/* ============================================
   Personal Dashboard CRM — Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================
   Theme Variables
   ============================================ */
:root, [data-theme="dark"] {
    --bg-body: #0c0c14;
    --bg-sidebar: #0f0f1a;
    --bg-card: #13132a;
    --bg-card-hover: #1a1a35;
    --bg-input: #1a1a30;
    --bg-topbar: rgba(12, 12, 20, 0.85);
    --bg-modal: #13132a;

    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --border: rgba(99, 102, 241, 0.12);
    --border-hover: rgba(99, 102, 241, 0.3);
    --border-input: rgba(99, 102, 241, 0.15);

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-bg: rgba(99, 102, 241, 0.12);

    --purple: #8b5cf6;
    --blue: #3b82f6;
    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;
    --pink: #ec4899;

    --shadow-sm: 0 1px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --transition: 0.25s ease;
}

[data-theme="light"] {
    --bg-body: #f3f4f8;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f9fafb;
    --bg-input: #f3f4f8;
    --bg-topbar: rgba(243, 244, 248, 0.9);
    --bg-modal: #ffffff;

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(99, 102, 241, 0.3);
    --border-input: rgba(0, 0, 0, 0.12);

    --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.15rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.93rem;
    transition: all var(--transition);
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--accent-bg);
}

.sidebar-link.active {
    color: var(--accent);
    background: var(--accent-bg);
    font-weight: 600;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border);
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-icon-light, .theme-label-light { display: none; }
.theme-icon-dark, .theme-label-dark { display: inline; }
[data-theme="light"] .theme-icon-light, [data-theme="light"] .theme-label-light { display: inline; }
[data-theme="light"] .theme-icon-dark, [data-theme="light"] .theme-label-dark { display: none; }

/* ============================================
   Main Wrapper & Topbar
   ============================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-height);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-topbar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Search */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 360px;
    transition: border-color var(--transition);
}
.search-box:focus-within { border-color: var(--accent); }
.search-box i { color: var(--text-muted); font-size: 0.85rem; }
.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box kbd {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: inherit;
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    max-height: 400px;
    overflow-y: auto;
    z-index: 999;
}
.search-results.visible { display: block; }

.search-group-title {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.search-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background var(--transition);
    font-size: 0.9rem;
}
.search-item:hover { background: var(--bg-card-hover); }
.search-item i { color: var(--accent); width: 16px; text-align: center; }

/* Topbar Buttons */
.topbar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition);
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); }

.notif-badge {
    position: absolute;
    top: -2px; right: -2px;
    width: 8px; height: 8px;
    background: var(--red);
    border-radius: 50%;
}

/* ============================================
   Page Content
   ============================================ */
.page-content {
    padding: 1.5rem 1.75rem 3rem;
}

/* ============================================
   Stats Row
   ============================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all var(--transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.stat-card-purple .stat-icon { background: rgba(99,102,241,0.15); color: var(--accent); }
.stat-card-blue .stat-icon { background: rgba(59,130,246,0.15); color: var(--blue); }
.stat-card-amber .stat-icon { background: rgba(245,158,11,0.15); color: var(--amber); }
.stat-card-green .stat-icon { background: rgba(16,185,129,0.15); color: var(--green); }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* ============================================
   Cards
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.card-header h3 i { color: var(--accent); font-size: 0.9rem; }

.card-action {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: gap var(--transition);
}
.card-action:hover { gap: 0.5rem; }

.card-body { padding: 1rem 1.25rem; }

/* ============================================
   Project Items (Dashboard)
   ============================================ */
.project-list { display: flex; flex-direction: column; gap: 0.75rem; }

.project-item {
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all var(--transition);
}
.project-item:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }

.project-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.project-item-name { font-weight: 600; font-size: 0.9rem; }

.project-item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.project-item-meta i { margin-right: 0.25rem; }

/* ============================================
   Status & Priority Badges
   ============================================ */
.status-badge {
    display: inline-flex;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
}
.status-planning { background: rgba(59,130,246,0.15); color: var(--blue); }
.status-in_progress { background: rgba(245,158,11,0.15); color: var(--amber); }
.status-review { background: rgba(139,92,246,0.15); color: var(--purple); }
.status-completed { background: rgba(16,185,129,0.15); color: var(--green); }
.status-on_hold { background: rgba(107,114,128,0.15); color: var(--text-muted); }
.status-cancelled { background: rgba(239,68,68,0.15); color: var(--red); }
.status-active { background: rgba(16,185,129,0.15); color: var(--green); }
.status-inactive { background: rgba(107,114,128,0.15); color: var(--text-muted); }
.status-lead { background: rgba(245,158,11,0.15); color: var(--amber); }

.priority-badge {
    display: inline-flex;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
}
.priority-low { background: rgba(107,114,128,0.15); color: var(--text-muted); }
.priority-medium { background: rgba(59,130,246,0.15); color: var(--blue); }
.priority-high { background: rgba(245,158,11,0.15); color: var(--amber); }
.priority-urgent { background: rgba(239,68,68,0.15); color: var(--red); }

.priority-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.priority-dot.priority-low { background: var(--text-muted); }
.priority-dot.priority-medium { background: var(--blue); }
.priority-dot.priority-high { background: var(--amber); }
.priority-dot.priority-urgent { background: var(--red); }

/* ============================================
   Progress Bars
   ============================================ */
.progress-bar, .progress-bar-mini {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-mini { height: 4px; }

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

/* ============================================
   Deadline List
   ============================================ */
.deadline-list { display: flex; flex-direction: column; gap: 0.75rem; }

.deadline-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: background var(--transition);
}
.deadline-item:hover { background: var(--bg-card-hover); }

.deadline-urgent { border-color: rgba(239,68,68,0.3); }
.deadline-warning { border-color: rgba(245,158,11,0.3); }

.deadline-date {
    text-align: center;
    min-width: 44px;
}
.deadline-day { display: block; font-size: 1.25rem; font-weight: 800; color: var(--accent); }
.deadline-month { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

.deadline-name { display: block; font-weight: 600; font-size: 0.9rem; }
.deadline-remaining { display: block; font-size: 0.78rem; color: var(--text-muted); }
.deadline-urgent .deadline-remaining { color: var(--red); }

/* ============================================
   Task Items
   ============================================ */
.task-list { display: flex; flex-direction: column; gap: 0.5rem; }

.task-item, .task-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all var(--transition);
}
.task-item:hover, .task-row:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }

.task-check {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
    color: transparent;
    font-size: 0.65rem;
}
.task-check:hover { border-color: var(--accent); }
.task-check.checked {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.task-item-info, .task-row-info { flex: 1; min-width: 0; }
.task-item-title, .task-row-title { font-size: 0.88rem; font-weight: 500; }
.task-item-title.completed, .task-row-title.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-item-meta, .task-row-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

.task-project, .task-project-badge {
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 500;
}

.task-due, .task-due-badge {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.task-due.overdue, .task-due-badge.overdue { color: var(--red); }

/* Full task list page */
.tasks-list-full { display: flex; flex-direction: column; gap: 0.5rem; }

.task-row { padding: 0.85rem 1rem; }
.task-row-desc { display: block; font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.task-row-actions { display: flex; gap: 0.35rem; }
.task-done { opacity: 0.6; }

/* ============================================
   Notes (Dashboard mini + full page)
   ============================================ */
.notes-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }

.note-mini, .note-card {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all var(--transition);
}
.note-mini:hover, .note-card:hover { border-color: var(--border-hover); }

.note-mini h4 { font-size: 0.85rem; margin-bottom: 0.35rem; font-weight: 600; }
.note-mini p { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5; }

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}
.note-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }
.note-card-content { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; white-space: pre-line; }

.note-card-footer {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.note-category-badge {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
}

.note-card-actions { display: flex; gap: 0.25rem; }

/* Note Colors */
.note-color-blue { border-left: 3px solid var(--blue); }
.note-color-green { border-left: 3px solid var(--green); }
.note-color-yellow { border-left: 3px solid var(--amber); }
.note-color-red { border-left: 3px solid var(--red); }
.note-color-purple { border-left: 3px solid var(--purple); }
.note-color-default { border-left: 3px solid var(--border); }

.fa-thumbtack.pinned { color: var(--accent); transform: rotate(-45deg); }

/* ============================================
   Projects Grid (Full page)
   ============================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: all var(--transition);
}
.project-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.project-card-header > div { display: flex; gap: 0.5rem; align-items: center; }
.project-card-actions { display: flex; gap: 0.25rem; }

.project-card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.project-card-desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 1rem; }

.project-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.meta-item {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.project-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.tag {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 500;
}

.project-card-progress { margin-bottom: 0.75rem; }

.project-card-footer {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.task-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ============================================
   Kanban Board
   ============================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    min-height: calc(100vh - var(--topbar-height) - 4rem);
}

.kanban-column {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - var(--topbar-height) - 4rem);
}

.kanban-column-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.kanban-column-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kanban-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
}
.kanban-dot-planning { background: var(--blue); }
.kanban-dot-in_progress { background: var(--amber); }
.kanban-dot-review { background: var(--purple); }
.kanban-dot-completed { background: var(--green); }

.kanban-count {
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: var(--accent-bg);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-left: auto;
}

.kanban-cards {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    min-height: 100px;
}

.kanban-card {
    padding: 1rem;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all var(--transition);
}
.kanban-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); }
.kanban-card.dragging { opacity: 0.5; }

.kanban-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.kanban-card h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.35rem; }

.kanban-client {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.kanban-deadline { font-size: 0.72rem; color: var(--text-muted); }

.kanban-card-bottom {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.kanban-card-bottom .progress-bar-mini { flex: 1; }
.kanban-tasks { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }

/* ============================================
   Data Table (Clients)
   ============================================ */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-card-hover);
}
.data-table tr:hover td { background: var(--bg-card-hover); }
.data-table tr:last-child td { border-bottom: none; }

.client-name-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.avatar {
    width: 34px; height: 34px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}
.avatar-purple { background: var(--accent); }
.avatar-blue { background: var(--blue); }
.avatar-green { background: var(--green); }
.avatar-amber { background: var(--amber); }
.avatar-pink { background: var(--pink); }

.count-badge {
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
}

.table-actions { display: flex; gap: 0.35rem; }

/* ============================================
   Page Toolbar & Filters
   ============================================ */
.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.25rem;
}

.filter-tab {
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition);
}
.filter-tab:hover { color: var(--text-primary); }
.filter-tab.active {
    background: var(--accent);
    color: #fff;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: #fff;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(99,102,241,0.4); }

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }

.icon-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all var(--transition);
}
.icon-btn:hover { color: var(--accent); background: var(--accent-bg); }
.icon-btn-danger:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ============================================
   FAB (Floating Action Button)
   ============================================ */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    color: #fff;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 90;
}
.fab:hover { transform: scale(1.1); }

.fab-menu {
    position: fixed;
    bottom: 5.5rem;
    right: 2rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 89;
}
.fab-menu.visible { display: flex; }

.fab-item {
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}
.fab-item:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.fab-item i { color: var(--accent); width: 16px; text-align: center; }

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal-overlay.visible { display: flex; }

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.modal-close:hover { color: var(--red); background: rgba(239,68,68,0.1); }

.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid var(--border);
}

/* Form elements inside modal */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { appearance: none; cursor: pointer; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.form-colors {
    display: flex;
    gap: 0.5rem;
}
.color-option {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}
.color-option:hover, .color-option.selected { border-color: var(--text-primary); transform: scale(1.15); }
.color-option[data-color="default"] { background: var(--text-muted); }
.color-option[data-color="blue"] { background: var(--blue); }
.color-option[data-color="green"] { background: var(--green); }
.color-option[data-color="yellow"] { background: var(--amber); }
.color-option[data-color="red"] { background: var(--red); }
.color-option[data-color="purple"] { background: var(--purple); }

/* ============================================
   Toast
   ============================================ */
.toast-container {
    position: fixed;
    top: calc(var(--topbar-height) + 1rem);
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
}

.toast {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
    min-width: 260px;
}

.toast-success { background: rgba(16,185,129,0.95); }
.toast-error { background: rgba(239,68,68,0.95); }
.toast-info { background: rgba(99,102,241,0.95); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateX(50px); }
}

/* ============================================
   Empty States
   ============================================ */
.empty-state, .empty-state-mini {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 0.75rem; color: var(--border); display: block; }
.empty-state p { margin-bottom: 1rem; }

.empty-state-full {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
}
.empty-state-full i { font-size: 3.5rem; margin-bottom: 1rem; color: var(--border); display: block; }
.empty-state-full h3 { font-size: 1.25rem; color: var(--text-primary); margin-bottom: 0.5rem; }
.empty-state-full p { margin-bottom: 1.5rem; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .kanban-board { grid-template-columns: repeat(2, 1fr); }
    .search-box { width: 280px; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 200;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-toggle { display: block; }

    .main-wrapper { margin-left: 0; }

    .stats-row { grid-template-columns: 1fr 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .kanban-board { grid-template-columns: 1fr; }
    .projects-grid { grid-template-columns: 1fr; }

    .topbar { padding: 0 1rem; }
    .page-content { padding: 1rem; }
    .search-box { width: 200px; }
    .search-box kbd { display: none; }
    .page-toolbar { flex-direction: column; align-items: stretch; }
    .filter-tabs { overflow-x: auto; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr; }
    .search-box { display: none; }
}
