/* ============================================================
   PROJECT MANAGER — Design System
   Primary: Orange (#FF6B35) | Black (#1A1A2E) | White (#FFF)
   ============================================================ */

:root {
    --primary:        #FF6B35;
    --primary-dark:   #E55520;
    --primary-light:  rgba(255,107,53,.12);
    --black:          #1A1A2E;

    /* Status */
    --upcoming:  #E55520;
    --ongoing:   #16A34A;
    --finished:  #6B7280;
    --pending-c: #F59E0B;
    --active-c:  #10B981;
    --rejected-c:#EF4444;

    /* Light theme */
    --bg:          #F0F2F5;
    --surface:     #FFFFFF;
    --surface2:    #F7F8FA;
    --text:        #1A1A2E;
    --text-sec:    #6B7280;
    --border:      #E5E7EB;
    --sidebar-bg:  #1A1A2E;
    --sidebar-txt: #C9D1D9;
    --sidebar-act: rgba(255,107,53,.15);
    --topbar-bg:   #FFFFFF;
    --shadow:      0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
    --shadow-lg:   0 8px 32px rgba(0,0,0,.12);
    --radius:      12px;
    --radius-sm:   8px;
}

[data-theme="dark"] {
    --bg:         #0D0D1A;
    --surface:    #1A1A2E;
    --surface2:   #141427;
    --text:       #F0F2F5;
    --text-sec:   #9CA3AF;
    --border:     #2D2D4A;
    --sidebar-bg: #0A0A15;
    --topbar-bg:  #1A1A2E;
    --shadow:     0 1px 4px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---- LAYOUT ---- */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* ---- SIDEBAR ---- */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    transition: width .25s ease, min-width .25s ease;
    overflow: hidden;
    z-index: 100;
}
.sidebar.collapsed { width: 64px; min-width: 64px; }
.sidebar.collapsed .nav-item span:not(.notif-badge),
.sidebar.collapsed .user-info > div,
.sidebar.collapsed .sidebar-footer .btn-logout span { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 14px; }
.sidebar.collapsed .nav-item svg { margin: 0; }

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo {
    max-width: 140px;
    max-height: 52px;
    width: 100%;
    object-fit: contain;
    display: block;
}
.sidebar.collapsed .sidebar-logo {
    max-width: 36px;
    max-height: 36px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--sidebar-txt);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
    position: relative;
}
.nav-item svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--sidebar-act); color: var(--primary); }
.nav-item.active svg { fill: var(--primary); }

.notif-badge {
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 700;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
    margin-left: auto;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.user-info { display: flex; align-items: center; gap: 10px; overflow: hidden; }
.user-avatar {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; color: #fff;
    flex-shrink: 0;
}
.user-name { font-size: .8rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .7rem; color: var(--sidebar-txt); }
.btn-logout {
    background: none; border: none; cursor: pointer;
    color: var(--sidebar-txt); padding: 6px; border-radius: 6px;
    display: flex; transition: color .15s;
}
.btn-logout:hover { color: var(--rejected-c); }
.btn-logout svg { width: 18px; height: 18px; fill: currentColor; }

/* ---- MAIN WRAPPER ---- */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ---- TOPBAR ---- */
.topbar {
    height: 58px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 14px;
    flex-shrink: 0;
    z-index: 50;
}
.sidebar-toggle {
    background: none; border: none; cursor: pointer;
    color: var(--text-sec); padding: 6px; border-radius: 6px;
    display: flex; transition: color .15s;
}
.sidebar-toggle:hover { color: var(--primary); }
.sidebar-toggle svg { width: 22px; height: 22px; fill: currentColor; }
.topbar-title { font-weight: 600; font-size: 1rem; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text-sec);
    display: flex; align-items: center; gap: 6px;
    transition: all .15s;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle svg { width: 18px; height: 18px; fill: currentColor; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

/* ---- CONTENT ---- */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    animation: slideDown .25s ease;
}
.alert-success { background: rgba(16,185,129,.12); color: #065f46; border: 1px solid rgba(16,185,129,.3); }
.alert-error   { background: rgba(239,68,68,.1);   color: #991b1b; border: 1px solid rgba(239,68,68,.3);  }
[data-theme="dark"] .alert-success { color: #34d399; }
[data-theme="dark"] .alert-error   { color: #f87171; }

/* ---- CARDS ---- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px;
}
.card-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ---- STATS GRID ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card-link { text-decoration: none !important; color: inherit; cursor: pointer; }
.stat-card-link * { text-decoration: none !important; }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; fill: #fff; }
.stat-orange { background: linear-gradient(135deg, #FF6B35, #E55520); }
.stat-green  { background: linear-gradient(135deg, #10B981, #059669); }
.stat-blue   { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.stat-yellow { background: linear-gradient(135deg, #F59E0B, #D97706); }
.stat-value  { font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label  { font-size: .8rem; color: var(--text-sec); margin-top: 4px; }

/* ---- VIEW CONTROLS ---- */
.view-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.view-tabs {
    display: flex;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}
.view-tab {
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: .825rem;
    font-weight: 500;
    color: var(--text-sec);
    background: none;
    transition: all .15s;
}
.view-tab.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ---- DASHBOARD VIEWS ---- */
.dashboard-views {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.dashboard-views.single-view { grid-template-columns: 1fr; }
.panel-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    min-height: 480px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}
#ganttContainer {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    display: flex;
    align-items: center;
}
.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
}
.panel-header h3 svg { width: 18px; height: 18px; fill: var(--primary); }

/* ---- CALENDAR ---- */
.calendar-wrapper { padding: 12px; flex: 1; }
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px 12px;
    gap: 8px;
}
.calendar-header h2 { font-size: .95rem; font-weight: 600; color: var(--text); }
.cal-nav-btn {
    width: 30px; height: 30px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-sec);
    font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
}
.cal-nav-btn:hover { border-color: var(--primary); color: var(--primary); }
.cal-view-toggle { display: flex; gap: 4px; }
.cal-view-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: none;
    cursor: pointer;
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-sec);
    transition: all .15s;
}
.cal-view-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-day-header {
    text-align: center;
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-sec);
    padding: 4px 0 8px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.cal-cell {
    min-height: 76px;
    border-radius: 6px;
    padding: 4px;
    background: var(--surface2);
    border: 1px solid transparent;
    transition: border-color .15s;
    cursor: default;
    overflow: hidden;
}
.cal-cell:hover { border-color: var(--border); }
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.today .day-number {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
}
.day-number { font-size: .72rem; font-weight: 600; color: var(--text-sec); margin-bottom: 2px; display: inline-block; width: 22px; height: 22px; text-align: center; line-height: 22px; }
.day-events { display: flex; flex-direction: column; gap: 1px; }
.event-pill {
    font-size: .65rem;
    font-weight: 500;
    padding: 2px 5px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: transform .1s, opacity .1s;
    background: #6B7280;
    color: #fff;
    user-select: none;
}
.event-pill:hover { transform: scaleX(.98); opacity: .9; }
.event-pill.selected { outline: 2px solid var(--text); outline-offset: 1px; }
.event-pill.upcoming    { background: var(--upcoming); }
.event-pill.ongoing     { background: var(--ongoing);  }
.event-pill.finished    { background: var(--finished); }
.event-pill.not_started { background: #3B82F6; }
.event-pill.in_progress { background: #F59E0B; }
.event-pill.completed   { background: #16A34A; }

/* Week view */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.week-cell {
    min-height: 200px;
    border-radius: 6px;
    padding: 6px;
    background: var(--surface2);
    border: 1px solid var(--border);
}
.week-cell.today { border-color: var(--primary); }
.week-cell-header { font-size: .72rem; font-weight: 600; color: var(--text-sec); margin-bottom: 6px; text-align: center; }
.week-event {
    font-size: .7rem;
    padding: 4px 6px;
    border-radius: 4px;
    background: #6B7280;
    color: #fff;
    margin-bottom: 3px;
    cursor: pointer;
}
.week-event.upcoming    { background: var(--upcoming); }
.week-event.ongoing     { background: var(--ongoing);  }
.week-event.finished    { background: var(--finished); }
.week-event.not_started { background: #3B82F6; }
.week-event.in_progress { background: #F59E0B; }
.week-event.completed   { background: #16A34A; }

/* ======================================================
   GANTT v2 — Table-style Gantt Chart
   ====================================================== */

/* Outer wrapper fills panel */
.gantt2-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ── Controls bar ── */
.gantt2-controls {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    flex-shrink: 0;
}
.gantt2-zoom-btn {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: transparent;
    cursor: pointer;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-sec);
    font-family: inherit;
    transition: all .15s;
}
.gantt2-zoom-btn:hover  { border-color: var(--primary); color: var(--primary); }
.gantt2-zoom-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Main row (left + right) ── */
.gantt2-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Left panel ── */
.gantt2-left {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 2px solid var(--primary);
    background: var(--surface);
    overflow: hidden;
}

/* Left header row 1 — dark brand bar */
.gantt2-left-head1 {
    background: var(--sidebar-bg);
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: .72rem;
    font-weight: 700;
    color: rgba(255,255,255,.7);
    text-transform: uppercase;
    letter-spacing: .07em;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

/* Left header row 2 — column labels */
.gantt2-left-head2 {
    background: var(--surface2);
    display: flex;
    align-items: center;
    border-bottom: 2px solid var(--border);
    flex-shrink: 0;
}
.gantt2-th {
    font-size: .68rem;
    font-weight: 700;
    color: var(--text-sec);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Left body — rows */
.gantt2-left-body {
    flex: 1;
    overflow: hidden; /* scrolled via JS in sync with right panel */
}
.gantt2-left-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .1s;
}
.gantt2-left-row:hover .gantt2-cell   { background: var(--primary-light); }
.gantt2-left-row-sel .gantt2-cell     { background: var(--primary-light); }
.gantt2-stripe .gantt2-cell           { background: var(--surface2); }
.gantt2-stripe.gantt2-left-row:hover .gantt2-cell { background: var(--primary-light); }

/* Cells shared by header + body */
.gantt2-cell {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 8px;
    font-size: .78rem;
    color: var(--text);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    border-right: 1px solid var(--border);
    box-sizing: border-box;
    flex-shrink: 0;
}
.gantt2-cell-num    { width: 36px; justify-content: center; color: var(--text-sec); font-size: .68rem; }
.gantt2-cell-center { width: 72px; justify-content: center; color: var(--text-sec); font-size: .72rem; }
/* Name cell width set via inline style */

/* ── Right / timeline panel ── */
.gantt2-right {
    flex: 1;
    overflow: auto;
    position: relative;
}
.gantt2-right-inner { position: relative; }

/* Timeline header — sticky */
.gantt2-tl-head {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface);
}
.gantt2-thead-r1 {
    display: flex;
    height: 32px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.gantt2-thead-r2 {
    display: flex;
    height: 32px;
    background: var(--surface2);
    border-bottom: 2px solid var(--border);
}

/* Group header cells (top row) */
.gantt2-th-grp {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    font-size: .7rem;
    font-weight: 700;
    color: rgba(255,255,255,.85);
    border-right: 1px solid rgba(255,255,255,.1);
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
}

/* Column header cells (bottom row) */
.gantt2-th-col {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    font-weight: 700;
    color: var(--text-sec);
    border-right: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
    transition: background .1s;
}
.gantt2-th-col.g2-today   { background: var(--primary-light); color: var(--primary); }
.gantt2-th-col.g2-weekend { opacity: .55; }

/* Timeline body */
.gantt2-tl-body { position: relative; overflow: hidden; }

/* Row background stripes */
.gantt2-row-bg {
    position: absolute;
    left: 0;
    border-bottom: 1px solid var(--border);
}
.g2-bar-stripe { background: var(--surface2); }

/* Background column shading */
.gantt2-bg-col {
    position: absolute;
    top: 0; bottom: 0;
    pointer-events: none;
}
.g2-bg-wknd  { background: rgba(0,0,0,.04); }
[data-theme="dark"] .g2-bg-wknd { background: rgba(255,255,255,.025); }
.g2-bg-today { background: rgba(255,107,53,.08); }

/* Today vertical line */
.gantt2-today-line {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: #3B82F6;
    z-index: 5;
    pointer-events: none;
}

/* Event bars */
.gantt2-bar {
    position: absolute;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    font-size: .7rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .01em;
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
    transition: filter .15s, transform .1s, box-shadow .15s;
    z-index: 3;
    min-width: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,.18);
    background: linear-gradient(90deg, #374151, #6B7280, #9CA3AF);
}
.gantt2-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt2-bar:hover { filter: brightness(1.12); transform: scaleY(1.06); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.g2-bar-sel { outline: 2px solid var(--text); outline-offset: 2px; }

.gantt2-bar.upcoming     { background: linear-gradient(90deg, #C94510, #FF6B35, #FF9A6C); }
.gantt2-bar.ongoing      { background: linear-gradient(90deg, #166534, #16A34A, #4ADE80); }
.gantt2-bar.finished     { background: linear-gradient(90deg, #374151, #6B7280, #9CA3AF); }
.gantt2-bar.not_started  { background: linear-gradient(90deg, #1E40AF, #3B82F6, #60A5FA); }
.gantt2-bar.in_progress  { background: linear-gradient(90deg, #92400E, #F59E0B, #FCD34D); }
.gantt2-bar.completed    { background: linear-gradient(90deg, #14532D, #16A34A, #4ADE80); }

/* Empty state */
.gantt2-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-sec);
    font-size: .875rem;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger  { background: var(--rejected-c); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-success { background: var(--active-c); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-ghost   { background: none; border: none; color: var(--text-sec); cursor: pointer; }
.btn-ghost:hover { color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: .78rem; border-radius: 6px; }
.btn-full { width: 100%; }

/* ---- FORMS ---- */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-group label { font-size: .82rem; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: .875rem;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-sec); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-check { flex-direction: row; align-items: center; gap: 8px; }
.form-check label { font-weight: 400; margin: 0; cursor: pointer; }
.form-check input { width: auto; }
.field-error { font-size: .75rem; color: var(--rejected-c); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-card { height: fit-content; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }

/* ---- STAFF SLOTS ---- */
.staff-slot {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 12px;
}
.staff-slot-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.staff-slot-num { font-size: .8rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; }
.custom-select { position: relative; }
.staff-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: .875rem;
    outline: none;
    cursor: pointer;
}
.staff-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.staff-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 200px;
    overflow-y: auto;
}
.staff-dropdown.open { display: block; }
.staff-option { padding: 10px 14px; cursor: pointer; transition: background .1s; }
.staff-option:hover { background: var(--primary-light); }
.staff-option-name { font-size: .85rem; font-weight: 600; color: var(--text); }
.staff-option-email { font-size: .75rem; color: var(--text-sec); }
.task-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.task-check { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: .82rem; color: var(--text); }
.task-check input { cursor: pointer; accent-color: var(--primary); }
.empty-hint { text-align: center; color: var(--text-sec); font-size: .82rem; padding: 20px; }

/* ---- TABLES ---- */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th { padding: 10px 14px; text-align: left; font-weight: 600; color: var(--text-sec); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.empty-state { text-align: center; color: var(--text-sec); padding: 32px !important; }
.text-muted { color: var(--text-sec); }
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-overdue { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: .68rem; font-weight: 700; background: #FEF2F2; color: #DC2626; margin-left: 6px; }
[data-theme="dark"] .badge-overdue { background: rgba(220,38,38,.15); }
.badge-daily-needed { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: .68rem; font-weight: 700; background: #FFF7ED; color: #C2410C; margin-left: 6px; }
[data-theme="dark"] .badge-daily-needed { background: rgba(194,65,12,.18); color: #FB923C; }
.badge-daily-done { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: .68rem; font-weight: 700; background: #F0FDF4; color: #16A34A; margin-left: 6px; }
[data-theme="dark"] .badge-daily-done { background: rgba(22,163,74,.15); }
.daily-reminder {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FFF7ED;
    border: 1px solid #FED7AA;
    border-left: 4px solid #F97316;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: .875rem;
    color: #9A3412;
}
.daily-reminder svg { width: 20px; height: 20px; fill: #F97316; flex-shrink: 0; }
[data-theme="dark"] .daily-reminder { background: rgba(249,115,22,.1); border-color: rgba(249,115,22,.3); border-left-color: #F97316; color: #FB923C; }
.staff-cell { display: flex; align-items: center; gap: 10px; }
.staff-avatar-sm { width: 30px; height: 30px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .75rem; color: #fff; flex-shrink: 0; }
.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: .78rem;
    font-weight: 600;
}

/* ---- STATUS BADGES ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.status-badge::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-upcoming { background: rgba(229,85,32,.12); color: var(--upcoming); }
.status-ongoing  { background: rgba(22,163,74,.12);  color: var(--ongoing);  }
.status-finished { background: rgba(107,114,128,.12); color: var(--finished); }
.status-badge-small { padding: 3px 8px; border-radius: 6px; font-size: .72rem; font-weight: 600; }
.status-badge-small.active   { background: rgba(16,185,129,.12); color: var(--active-c); }
.status-badge-small.pending  { background: rgba(245,158,11,.12); color: var(--pending-c); }
.status-badge-small.rejected { background: rgba(239,68,68,.12);  color: var(--rejected-c); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.pending  { background: var(--pending-c); }
.status-dot.active   { background: var(--active-c); }
.status-dot.rejected { background: var(--rejected-c); }

.task-status-badge { padding: 3px 8px; border-radius: 5px; font-size: .72rem; font-weight: 600; }
.task-not_started { background: rgba(107,114,128,.12); color: var(--finished); }
.task-in_progress { background: rgba(245,158,11,.12);  color: var(--pending-c); }
.task-completed   { background: rgba(16,185,129,.12);  color: var(--active-c); }

/* Role badge — one universal style, roles no longer have fixed colors */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
    background: rgba(255,107,53,.12);
    color: var(--primary);
}
/* Task input rows in create form */
.task-input-list { display: flex; flex-direction: column; gap: 6px; }
.task-input-row  { display: flex; gap: 6px; align-items: center; }
.task-text-input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: .85rem; font-family: inherit; outline: none; transition: border-color .15s; }
.task-text-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.btn-remove-task { width: 28px; height: 28px; border: none; border-radius: 6px; background: #FEE2E2; color: #DC2626; font-size: 1.1rem; line-height: 1; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.btn-remove-task:hover { background: #FECACA; }

/* ---- PROGRESS ---- */
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar-large {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 6px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 999px;
    transition: width .5s ease;
}
.progress-mini {
    height: 4px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.progress-mini-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width .4s ease;
}
.progress-label { display: flex; justify-content: space-between; font-size: .82rem; color: var(--text-sec); }

/* ---- EVENT DETAIL ---- */
.event-detail-header { padding: 24px; }
.event-detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.event-detail-title h2 { font-size: 1.4rem; font-weight: 700; }
.event-meta-grid { display: flex; flex-direction: column; gap: 8px; color: var(--text-sec); font-size: .875rem; }
.event-meta-item { display: flex; align-items: flex-start; gap: 8px; }
.event-meta-item svg { width: 16px; height: 16px; fill: var(--text-sec); flex-shrink: 0; margin-top: 3px; }
.overall-progress { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.section-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 12px; }

/* ---- STAFF DETAIL CARD ---- */
.staff-detail-card { margin-bottom: 12px; }
.staff-detail-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.staff-avatar { width: 40px; height: 40px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; color: #fff; flex-shrink: 0; }
.staff-detail-info { flex: 1; }
.staff-detail-info strong { display: block; font-size: .9rem; }
.staff-detail-info span { font-size: .78rem; color: var(--text-sec); }
.staff-progress-summary { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.staff-progress-summary span { font-size: .85rem; font-weight: 700; color: var(--primary); }
.staff-progress-summary .progress-mini { width: 80px; }

/* ---- TASKS ---- */
.tasks-list { display: flex; flex-direction: column; gap: 10px; }
.task-item { padding: 12px; background: var(--surface2); border-radius: 8px; border: 1px solid var(--border); }
.task-item-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.task-name { font-weight: 600; font-size: .875rem; flex: 1; }
.task-progress { font-size: .8rem; font-weight: 700; color: var(--primary); margin-left: auto; }
.task-description { font-size: .8rem; color: var(--text-sec); margin-top: 6px; }
.task-history { margin-top: 10px; }
.task-history summary { font-size: .78rem; color: var(--primary); cursor: pointer; font-weight: 500; }
.history-list { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.history-item { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
.history-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: .78rem; }
.history-meta strong { color: var(--text); }
.history-meta span { color: var(--text-sec); }
.history-detail { display: flex; align-items: center; gap: 8px; font-size: .78rem; }
.history-desc { font-size: .78rem; color: var(--text-sec); margin-top: 4px; }

/* ---- TASK UPDATE FORM ---- */
.task-card { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 12px; }
.task-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.task-card-header h4 { flex: 1; font-size: .9rem; font-weight: 600; }
.task-update-form { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.staff-assignment-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.progress-summary { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }

/* ---- PAGE HEADER ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-header h2 { font-size: 1.2rem; font-weight: 700; }

/* ---- SECTION CARD ---- */
.section-card { margin-bottom: 16px; }

/* ---- NOTIFICATIONS ---- */
.notifications-list { display: flex; flex-direction: column; gap: 8px; }
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s;
}
.notification-item.unread { border-left: 3px solid var(--primary); background: var(--primary-light); }
.notification-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--surface2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notification-icon.active { background: var(--primary); }
.notification-icon svg { width: 18px; height: 18px; fill: var(--text-sec); }
.notification-icon.active svg { fill: #fff; }
.notification-body { flex: 1; }
.notification-body strong { font-size: .875rem; color: var(--text); display: block; margin-bottom: 2px; }
.notification-body p { font-size: .82rem; color: var(--text-sec); margin-bottom: 6px; }
.notification-time { font-size: .72rem; color: var(--text-sec); }

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(.95);
    transition: transform .2s;
    border: 1px solid var(--border);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.5rem; color: var(--text-sec); line-height: 1; padding: 4px 8px; border-radius: 4px; }
.modal-close:hover { color: var(--rejected-c); }
.modal-body { overflow-y: auto; padding: 20px; }
.modal-event-info { display: flex; flex-direction: column; gap: 10px; }
.info-row { font-size: .875rem; color: var(--text); }
.info-row strong { color: var(--text-sec); }

/* ---- AUTH PAGES ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    background-image: radial-gradient(ellipse at 20% 50%, rgba(255,107,53,.07) 0%, transparent 60%),
                      radial-gradient(ellipse at 80% 20%, rgba(255,107,53,.05) 0%, transparent 50%);
}
.auth-container { width: 100%; max-width: 440px; padding: 20px; }
.auth-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.12);
    border: 1px solid var(--border);
    overflow: hidden;
}
.auth-header {
    text-align: center;
    padding: 36px 36px 28px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: #111111;
}
.auth-header p { color: rgba(255,255,255,.6); font-size: .875rem; margin: 0; }
.auth-logo-img {
    max-width: 200px;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto 16px;
    display: block;
}
.auth-logo-divider {
    width: 40px; height: 3px;
    background: var(--primary);
    border-radius: 2px;
    margin: 0 auto 12px;
}
.auth-form-body { padding: 28px 36px 8px; }
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-footer {
    text-align: center;
    padding: 16px 36px 28px;
    font-size: .82rem;
    color: var(--text-sec);
}
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
[data-theme="dark"] .auth-card { box-shadow: 0 8px 40px rgba(0,0,0,.4); }
.info-box { display: flex; align-items: flex-start; gap: 8px; background: var(--primary-light); border-radius: 8px; padding: 10px 12px; font-size: .8rem; color: var(--text); margin-bottom: 16px; }
.info-box svg { width: 16px; height: 16px; fill: var(--primary); flex-shrink: 0; margin-top: 1px; }

/* ---- NOT ASSIGNED ---- */
.not-assigned-card { text-align: center; padding: 48px 20px; }
.not-assigned-card svg { width: 48px; height: 48px; fill: var(--text-sec); margin-bottom: 12px; }
.not-assigned-card h3 { margin-bottom: 6px; }
.not-assigned-card p { color: var(--text-sec); font-size: .875rem; }

/* ---- SETTINGS ---- */
.settings-card { max-width: 700px; margin-bottom: 16px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; }
.settings-row p { font-size: .82rem; color: var(--text-sec); margin: 2px 0 0; }
.theme-toggle-large { padding: 8px 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--text); font-size: .85rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.theme-toggle-large:hover { border-color: var(--primary); color: var(--primary); }
.badge-self { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 4px; font-size: .68rem; font-weight: 700; background: var(--primary-light); color: var(--primary); margin-left: 6px; }
.gcal-status { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 8px; font-size: .88rem; font-weight: 500; width: fit-content; margin-top: 12px; }
.gcal-status svg { width: 18px; height: 18px; flex-shrink: 0; }
.gcal-status.connected { background: #e8f5e9; color: #2e7d32; }
.gcal-status.connected svg { fill: #2e7d32; }
.gcal-status.disconnected { background: #fce4ec; color: #c62828; }
.gcal-status.disconnected svg { fill: #c62828; }
[data-theme="dark"] .gcal-status.connected { background: rgba(46,125,50,.18); color: #81c784; }
[data-theme="dark"] .gcal-status.connected svg { fill: #81c784; }
[data-theme="dark"] .gcal-status.disconnected { background: rgba(198,40,40,.18); color: #ef9a9a; }
[data-theme="dark"] .gcal-status.disconnected svg { fill: #ef9a9a; }

/* ---- WELCOME BANNER ---- */
.welcome-banner { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border-radius: var(--radius); padding: 20px 24px; color: #fff; }
.welcome-banner h2 { font-size: 1.15rem; margin-bottom: 4px; }
.welcome-banner p { font-size: .875rem; opacity: .85; }

/* ---- LOADING ---- */
.loading-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
    .dashboard-views { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 640px) {
    .sidebar { position: fixed; height: 100%; z-index: 100; transition: transform .25s ease; }
    .sidebar:not(.open) { transform: translateX(-100%); }
    .main-wrapper { width: 100%; }
    .content { padding: 14px; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
