/* ============================================================
   TaskFlow Pro — Main Stylesheet
   Design: Industrial Precision — Dark accents on light base
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
    --bg: #f4f3ef;
    --bg-2: #eceae4;
    --surface: #ffffff;
    --surface-2: #f8f7f4;
    --border: #e2e0d8;
    --border-strong: #c8c5b8;
    --text: #1a1916;
    --text-2: #4a4840;
    --text-3: #7a776e;
    --text-inv: #ffffff;

    --accent: #1a1916;
    --accent-hover: #2d2b26;
    --accent-light: #f0ede6;

    --primary: #6366f1;
    --primary-light: #ede9fe;
    --primary-dark: #4f46e5;

    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    --red: #ef4444;
    --orange: #f97316;
    --yellow: #eab308;
    --green: #22c55e;

    --sidebar-w: 260px;
    --topbar-h: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 2px 8px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font-heading: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
}

[data-theme="dark"] {
    --bg: #111110;
    --bg-2: #1a1916;
    --surface: #1e1d1a;
    --surface-2: #252420;
    --border: #2e2c28;
    --border-strong: #3d3b35;
    --text: #f4f3ef;
    --text-2: #c8c5b8;
    --text-3: #7a776e;
    --text-inv: #111110;
    --accent: #f4f3ef;
    --accent-hover: #e0ddd4;
    --accent-light: #252420;
    --primary-light: #1e1b4b;
    --success-light: #052e16;
    --warning-light: #451a03;
    --danger-light: #450a0a;
    --info-light: #082f49;
    --shadow: 0 2px 8px rgba(0,0,0,0.3), 0 0 1px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.4);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed { width: 72px; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    min-height: var(--topbar-h);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: var(--text-inv);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 16px;
    flex-shrink: 0;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    transition: var(--transition);
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-details,
.sidebar.collapsed .badge {
    opacity: 0;
    width: 0;
    pointer-events: none;
    overflow: hidden;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 16px;
    transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-2); color: var(--text); }

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.nav-section { display: flex; flex-direction: column; gap: 2px; }

.nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 0 8px;
    margin-bottom: 4px;
    white-space: nowrap;
    transition: var(--transition);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.nav-item i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 15px;
}

.nav-item:hover { background: var(--bg-2); color: var(--text); }

.nav-item.active {
    background: var(--accent);
    color: var(--text-inv);
}

.nav-item.active:hover { background: var(--accent-hover); }

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    overflow: hidden;
    transition: var(--transition);
}

.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.user-role {
    display: block;
    font-size: 11px;
    color: var(--text-3);
    white-space: nowrap;
}

.logout-btn {
    color: var(--text-3);
    text-decoration: none;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 15px;
}
.logout-btn:hover { color: var(--danger); background: var(--danger-light); }

/* ─── Main Wrapper ──────────────────────────────────────── */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s;
}

.sidebar.collapsed ~ .main-wrapper { margin-left: 72px; }

/* ─── Topbar ────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-2);
    font-size: 18px;
    padding: 6px;
    border-radius: 6px;
}
.mobile-toggle:hover { background: var(--bg-2); }

.page-title h1 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-3);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.alert-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--danger-light);
    color: var(--danger);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: grid;
    place-items: center;
}
.theme-toggle:hover { background: var(--bg-2); color: var(--text); }

.topbar-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-3);
}

/* ─── Content Area ──────────────────────────────────────── */
.content-area {
    flex: 1;
    padding: 24px;
    max-width: 1600px;
    width: 100%;
}

/* ─── Badges ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.badge-red { background: var(--danger); color: white; }
.badge-orange { background: var(--orange); color: white; }
.badge-green { background: var(--green); color: white; }
.badge-yellow { background: var(--yellow); color: white; }
.badge-blue { background: var(--info); color: white; }
.badge-gray { background: var(--border-strong); color: var(--text-2); }
.badge-purple { background: var(--primary); color: white; }

/* ─── Stat Cards ────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    cursor: default;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.blue { background: var(--info-light); color: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.stat-delta {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
}
.stat-delta.up { background: var(--success-light); color: var(--success); }
.stat-delta.down { background: var(--danger-light); color: var(--danger); }

/* ─── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.card-title {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.card-body { padding: 20px; }

/* ─── Tables ────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr.overdue td { background: rgba(239,68,68,0.04); }
.table tbody tr.overdue td:first-child { border-left: 3px solid var(--danger); }

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-dark {
    background: var(--accent);
    color: var(--text-inv);
    border-color: var(--accent);
}
.btn-dark:hover:not(:disabled) { background: var(--accent-hover); }

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}
.btn-success:hover:not(:disabled) { background: #16a34a; }

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-warning {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}
.btn-warning:hover:not(:disabled) { background: #d97706; }

.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-2); border-color: var(--border-strong); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover:not(:disabled) { background: var(--primary-light); }

.btn-sm { padding: 5px 10px; font-size: 12px; gap: 5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 4px; }

/* ─── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
}
.form-label span { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.form-control::placeholder { color: var(--text-3); }
.form-control.error { border-color: var(--danger); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.form-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-check-label { font-size: 13.5px; color: var(--text-2); cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ─── Search & Filters ──────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.search-wrap i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    font-size: 13px;
}
.search-wrap .form-control { padding-left: 32px; }

.filter-select {
    min-width: 140px;
}

/* ─── Progress Bar ──────────────────────────────────────── */
.progress {
    height: 8px;
    background: var(--bg-2);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}
.progress-bar {
    height: 100%;
    border-radius: 100px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-bar.red { background: var(--red); }
.progress-bar.orange { background: var(--orange); }
.progress-bar.yellow { background: var(--yellow); }
.progress-bar.green { background: var(--green); }

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.progress-label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.progress-pct {
    font-size: 13px;
    font-weight: 700;
}
.progress-pct.red { color: var(--red); }
.progress-pct.orange { color: var(--orange); }
.progress-pct.yellow { color: var(--yellow); }
.progress-pct.green { color: var(--green); }

/* ─── Category Cards ────────────────────────────────────── */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.category-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--cat-color, var(--primary));
}

.category-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.category-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 18px;
}

.category-actions { display: flex; gap: 6px; }

.category-name {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.category-desc { font-size: 12px; color: var(--text-3); margin-bottom: 16px; }

.category-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.cat-stat { text-align: center; }
.cat-stat-val {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
    display: block;
}
.cat-stat-label { font-size: 11px; color: var(--text-3); }

/* ─── Task Cards ────────────────────────────────────────── */
.task-list { display: flex; flex-direction: column; gap: 10px; }

.task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: var(--transition);
    position: relative;
}
.task-card:hover { box-shadow: var(--shadow); }
.task-card.completed { opacity: 0.65; }
.task-card.overdue { border-left: 3px solid var(--danger); }

.task-check {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border-strong);
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    transition: var(--transition);
    margin-top: 2px;
}
.task-check:hover { border-color: var(--success); background: var(--success-light); }
.task-check.checked { background: var(--success); border-color: var(--success); color: white; }
.task-check.checked i { display: block; font-size: 11px; }
.task-check i { display: none; }

.task-body { flex: 1; min-width: 0; }

.task-title-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.task-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
}
.task-card.completed .task-title { text-decoration: line-through; color: var(--text-3); }

.task-desc { font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.task-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: var(--text-3);
}
.task-meta-item i { font-size: 10px; }
.task-meta-item.overdue { color: var(--danger); font-weight: 600; }

.task-actions { display: flex; gap: 6px; align-items: flex-start; }

/* Priority Badges */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
}
.priority-low { background: var(--success-light); color: var(--success); }
.priority-medium { background: var(--warning-light); color: var(--warning); }
.priority-high { background: var(--danger-light); color: var(--danger); }
.priority-urgent { background: var(--danger); color: white; }

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}
.status-not_completed { background: var(--bg-2); color: var(--text-3); }
.status-in_progress { background: var(--info-light); color: var(--info); }
.status-completed { background: var(--success-light); color: var(--success); }
.status-cancelled { background: var(--danger-light); color: var(--danger); }

/* ─── Modal ─────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}
.modal-backdrop.open { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal.modal-sm { max-width: 400px; }
.modal.modal-lg { max-width: 800px; }

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

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-2);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-2);
    display: grid;
    place-items: center;
    transition: var(--transition);
    font-size: 14px;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ─── Toast ─────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 260px;
    max-width: 360px;
    animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13.5px;
    font-weight: 500;
}
.toast.hiding { animation: toastOut 0.3s ease forwards; }

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }
.toast-msg { flex: 1; color: var(--text); }
.toast-close { color: var(--text-3); cursor: pointer; font-size: 12px; padding: 2px; }

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

/* ─── Dashboard Grid ────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-3);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-family: var(--font-heading); font-size: 18px; color: var(--text-2); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* ─── Color Dot ─────────────────────────────────────────── */
.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ─── Assignee Avatars ──────────────────────────────────── */
.avatar-stack { display: flex; }
.avatar-stack .avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: grid;
    place-items: center;
    border: 2px solid var(--surface);
    margin-left: -8px;
}
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .avatar-more {
    background: var(--bg-2);
    color: var(--text-3);
    font-size: 9px;
}

/* ─── Member Card ───────────────────────────────────────── */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.member-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    position: relative;
    transition: var(--transition);
}
.member-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.member-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 22px;
    font-weight: 700;
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
}
.member-name { font-family: var(--font-heading); font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.member-email { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.member-dept { display: inline-block; padding: 3px 10px; border-radius: 100px; background: var(--primary-light); color: var(--primary); font-size: 11px; font-weight: 600; margin-bottom: 14px; }
.member-actions { display: flex; gap: 8px; justify-content: center; }

/* ─── Checkboxes for Bulk Select ────────────────────────── */
.bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    display: none;
}
.bulk-actions.visible { display: flex; }
.bulk-count { font-size: 13px; font-weight: 600; color: var(--primary); }

/* ─── Login Page ────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 16px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo .logo-icon {
    width: 52px;
    height: 52px;
    font-size: 22px;
    border-radius: 14px;
    margin: 0 auto 14px;
}
.login-logo h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 800;
}
.login-logo p { font-size: 13px; color: var(--text-3); }

/* ─── Overlay ───────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ─── Loader ────────────────────────────────────────────── */
.loader {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Chart wrapper ─────────────────────────────────────── */
.chart-wrap { position: relative; height: 240px; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .col-span-2 { grid-column: span 2; }
    .col-span-3 { grid-column: span 2; }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-wrapper { margin-left: 0 !important; }
    .mobile-toggle { display: grid !important; place-items: center; }
    .sidebar-overlay.visible { display: block; }
    .topbar { padding: 0 16px; }
    .content-area { padding: 16px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .col-span-2, .col-span-3 { grid-column: span 1; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .topbar-date { display: none; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 24px; }
}

/* ─── Misc Utilities ────────────────────────────────────── */
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-3); }
.text-small { font-size: 12px; }
.fw-bold { font-weight: 700; }
.w-100 { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Strikethrough for completed task titles */
.line-through { text-decoration: line-through; }

/* Color Swatch */
.color-swatch {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.color-swatch-item {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: var(--transition);
}
.color-swatch-item.selected,
.color-swatch-item:hover { border-color: var(--text); transform: scale(1.15); }

/* Dark Mode subtle adjustments */
[data-theme="dark"] .task-card:hover { background: var(--surface-2); }
[data-theme="dark"] .table tbody tr:hover { background: var(--surface-2); }
[data-theme="dark"] .stat-card:hover { background: var(--surface-2); }
