/* ============================================================
   OUTCARE DASHBOARD — COMPLETE STYLESHEET
   Variables → Reset → Layout → Sidebar → Topbar →
   Pages → Cards → Tables → Forms → Badges → Utilities
   ============================================================ */

/* ---- DESIGN TOKENS ---------------------------------------- */
:root {
  /* Primary Accent — Vivid Indigo/Violet */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-bg: rgba(99, 102, 241, 0.10);

  /* Sidebar — Rich Deep Indigo */
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #a5b4fc;
  --sidebar-active: #ffffff;
  --sidebar-hover: rgba(129, 140, 248, 0.15);
  --sidebar-border: rgba(129, 140, 248, 0.10);

  /* Layout & Content — Clean, Bright */
  --content-bg: #f0f2ff;        /* Very light indigo-tinted background */
  --card-bg: #ffffff;
  --topbar-bg: #ffffff;
  --text-primary: #0f0e2a;      /* Near-black with a blue tint — rich contrast */
  --text-secondary: #4b5180;    /* Medium indigo-slate for secondary text */
  --text-muted: #8b8fbe;
  --border: #dde0f8;            /* Soft indigo-tinted border */
  --border-light: #eef0ff;

  /* Status Colors */
  --success: #059669;
  --success-bg: #d1fae5;

  --danger: #dc2626;
  --danger-bg: #fee2e2;

  --warning: #d97706;
  --warning-bg: #fef3c7;

  --info: #2563eb;
  --info-bg: rgba(37, 99, 235, 0.10);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(99, 102, 241, 0.08);
  --shadow-md: 0 4px 16px rgba(99, 102, 241, 0.12);
  --shadow-lg: 0 10px 30px rgba(99, 102, 241, 0.15);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --sidebar-w: 256px;
  --topbar-h: 70px;
  --transition: 0.2s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Dark Theme — Deep Slate with Electric Blue Accents */
[data-theme="dark"] {
  /* Primary Accent — Vivid Electric Blue/Cyan */
  --primary: #38bdf8;
  --primary-light: #7dd3fc;
  --primary-dark: #0ea5e9;
  --primary-bg: rgba(56, 189, 248, 0.12);

  /* Layout — Rich, Deep, Not Pitch-Black */
  --content-bg: #0d1117;        /* Deep GitHub-dark background */
  --card-bg: #161b22;           /* Card surface — noticeably lighter than bg */
  --topbar-bg: #161b22;
  --text-primary: #e6edf3;      /* Bright, highly readable off-white */
  --text-secondary: #8b949e;    /* Medium gray for secondary — not washed out */
  --text-muted: #4a5568;
  --border: #30363d;            /* Defined, visible border */
  --border-light: #21262d;

  /* Shadows for dark mode */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.6);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.7);

  /* Status Colors — More Vivid for Dark */
  --success: #3fb950;
  --success-bg: rgba(63, 185, 80, 0.15);
  --danger: #f85149;
  --danger-bg: rgba(248, 81, 73, 0.15);
  --warning: #d29922;
  --warning-bg: rgba(210, 153, 34, 0.15);
  --info: #58a6ff;
  --info-bg: rgba(88, 166, 255, 0.12);

  /* Sidebar — Bold Electric Blue */
  --sidebar-bg: #0d1117;
  --sidebar-text: #8b949e;
  --sidebar-active: #e6edf3;
  --sidebar-hover: rgba(56, 189, 248, 0.12);
  --sidebar-border: rgba(48, 54, 61, 0.8);
}

/* ---- RESET & BASE ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.5;
    height: 100vh; height: 100dvh;
    overflow: hidden;
    transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font); }
ul, ol { list-style: none; }
svg { display: block; }
img { max-width: 100%; }

/* ---- APP SHELL -------------------------------------------- */
.app-shell {
    display: flex;
    height: 100vh; height: 100dvh;
    overflow: hidden;
}

/* ---- SIDEBAR ---------------------------------------------- */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh; height: 100dvh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition);
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Brand */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.brand-logo {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex-shrink: 0;
    letter-spacing: 0.5px;
    overflow: hidden;
}
.brand-name {
    display: block;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.brand-tag {
    display: block;
    color: rgba(255,255,255,0.6);
    font-size: 11px;
    font-weight: 400;
    margin-top: 1px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-label {
    color: rgba(255,255,255,0.45);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 12px 8px 6px;
    margin-top: 4px;
}

/* Nav Item (dropdown) */
.nav-item { border-radius: var(--radius-sm); overflow: hidden; }

.nav-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    user-select: none;
}
.nav-item-header:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.nav-item.open .nav-item-header {
    background: var(--sidebar-hover);
    color: #fff;
}
.nav-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
    opacity: 0.85;
}
.nav-icon svg { width: 100%; height: 100%; }
.nav-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}
.nav-chevron {
    width: 16px; height: 16px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
    opacity: 0.7;
}
.nav-chevron svg { width: 100%; height: 100%; }
.nav-item.open .nav-chevron { transform: rotate(180deg); }

/* Sub-items */
.nav-item-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 20px;
}
.nav-item.open .nav-item-body { max-height: 200px; }

.sub-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.sub-item::before {
    content: '';
    width: 5px; height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    flex-shrink: 0;
    transition: background var(--transition);
}
.sub-item:hover, .sub-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.sub-item:hover::before, .sub-item.active::before {
    background: #fff;
}

/* Sidebar Footer — Theme Toggle */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.theme-toggle-row {
    display: flex;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 3px;
    gap: 3px;
}
.theme-btn {
    flex: 1;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    transition: all var(--transition);
}
.theme-btn.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.theme-btn:hover { color: #fff; }

/* ---- MAIN WRAPPER ----------------------------------------- */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh; height: 100dvh;
    overflow: hidden;
    background: var(--content-bg);
    transition: background var(--transition);
}

/* ---- TOP BAR ---------------------------------------------- */
.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 20px;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition);
}
.topbar-left { flex: 1; min-width: 0; }
.greeting-line { display: block; font-size: 12px; color: var(--text-muted); font-weight: 400; }
.greeting-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.topbar-center { flex: 1; max-width: 100%; max-width: 420px; }
.search-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--content-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 16px;
    transition: border-color var(--transition), background var(--transition);
}
.search-wrapper:focus-within { border-color: var(--primary); }
.search-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
}
.search-input::placeholder { color: var(--text-muted); }
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.topbar-icon-btn {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    background: var(--content-bg);
    border: 1px solid var(--border);
    transition: all var(--transition);
    position: relative;
}
.topbar-icon-btn svg { width: 18px; height: 18px; }
.topbar-icon-btn:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.notif-dot {
    position: absolute; top: 7px; right: 7px;
    width: 7px; height: 7px;
    background: var(--danger); border-radius: 50%;
    border: 1.5px solid var(--topbar-bg);
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--content-bg);
    cursor: pointer;
    transition: all var(--transition);
    margin-left: 4px;
}
.user-chip:hover { border-color: var(--primary); background: var(--primary-bg); }
.user-avatar-sm {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    flex-shrink: 0;
}
.user-fullname { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-role-label { display: block; font-size: 11px; color: var(--text-muted); }
.chevron-down { width: 14px; height: 14px; color: var(--text-muted); }

/* ---- PAGE CONTENT ----------------------------------------- */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ---- PAGE HEADER ------------------------------------------ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; align-items: center; }

/* ---- STAT CARDS ------------------------------------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
    width: 50px; height: 50px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.purple { background: var(--primary-bg); color: var(--primary); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.red    { background: var(--danger-bg);  color: var(--danger); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.blue   { background: var(--info-bg);    color: var(--info); }
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.stat-change { font-size: 12px; margin-top: 4px; font-weight: 500; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ---- DATA CARD (wrapper for table/content) ---------------- */
.data-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}
.data-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.data-card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.data-card-body { padding: 0; }

/* ---- TABLE ------------------------------------------------ */
.oc-table { width: 100%; border-collapse: collapse; }
.oc-table thead th {
    text-align: left;
    padding: 13px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .oc-table thead th { background: var(--border-light); }
.oc-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.oc-table tbody tr:last-child { border-bottom: none; }
.oc-table tbody tr:hover { background: var(--border-light); }
.oc-table td {
    padding: 13px 16px;
    font-size: 13.5px;
    color: var(--text-secondary);
    vertical-align: middle;
}
.oc-table td:first-child { color: var(--text-primary); font-weight: 500; }

/* Employee row with avatar */
.emp-cell { display: flex; align-items: center; gap: 10px; }
.emp-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 600;
    flex-shrink: 0;
}
.emp-avatar.green  { background: var(--success); }
.emp-avatar.orange { background: var(--warning); }
.emp-avatar.blue   { background: var(--info); }
.emp-avatar.red    { background: var(--danger); }
.emp-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.emp-role { font-size: 12px; color: var(--text-muted); }

/* ---- BADGES ----------------------------------------------- */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success  { background: var(--success-bg); color: var(--success); }
.badge-danger   { background: var(--danger-bg);  color: var(--danger); }
.badge-warning  { background: var(--warning-bg); color: var(--warning); }
.badge-info     { background: var(--info-bg);    color: var(--info); }
.badge-primary  { background: var(--primary-bg); color: var(--primary); }
.badge-neutral  { background: var(--border-light); color: var(--text-muted); }

/* ---- BUTTONS ---------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(124,92,252,0.35); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #dc2626; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ---- FORMS ------------------------------------------------ */
.form-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 28px;
    margin-bottom: 20px;
}
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-control {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--content-bg);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,92,252,0.1); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* ---- FILTER BAR ------------------------------------------- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.filter-bar select, .filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--content-bg);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--primary); }

/* ---- DEPARTMENT CARDS GRID -------------------------------- */
.dept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}
.dept-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    position: relative;
    overflow: hidden;
}
.dept-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dept-card-accent {
    position: absolute; top: 0; left: 0; right: 0; height: 4px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.dept-card-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.dept-card-icon svg { width: 22px; height: 22px; }
.dept-card-name { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.dept-card-head { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.dept-card-stats { display: flex; gap: 20px; }
.dept-stat-item { text-align: center; }
.dept-stat-val { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.dept-stat-lbl { font-size: 11px; color: var(--text-muted); }

/* ---- PROFILE LAYOUT --------------------------------------- */
.profile-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
.profile-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 32px 24px;
    text-align: center;
}
.profile-avatar-lg {
    width: 88px; height: 88px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 700;
    margin: 0 auto 16px;
}
.profile-name { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.profile-role { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.profile-dept { margin-top: 12px; }

/* ---- TOGGLE SWITCH ---------------------------------------- */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.toggle-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.toggle-switch { position: relative; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0;
    background: var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ---- CHARTS (CSS) ----------------------------------------- */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding: 0 8px; }
.bar-group { display: flex; align-items: flex-end; gap: 4px; flex: 1; }
.bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    transition: opacity var(--transition);
    min-width: 12px;
    cursor: pointer;
}
.bar:hover { opacity: 0.8; }
.bar.purple { background: var(--primary); }
.bar.green  { background: var(--success); }
.bar.orange { background: var(--warning); }

.chart-labels { display: flex; gap: 10px; padding: 0 8px; margin-top: 8px; }
.chart-label { flex: 1; text-align: center; font-size: 11px; color: var(--text-muted); }

/* Donut chart (decorative CSS) */
.donut-wrapper { position: relative; width: 130px; height: 130px; margin: 0 auto; }
.donut-ring { width: 130px; height: 130px; border-radius: 50%; }
.donut-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.donut-value { font-size: 26px; font-weight: 700; color: var(--text-primary); }
.donut-sub { font-size: 11px; color: var(--text-muted); }

/* ---- UTILITIES -------------------------------------------- */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }

/* Loading State */
.loading-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    height: 300px; gap: 16px;
    color: var(--text-muted);
}
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty State */
.empty-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 60px 20px; gap: 12px;
    color: var(--text-muted);
}
.empty-icon { font-size: 40px; opacity: 0.4; }
.empty-text { font-size: 15px; font-weight: 500; }
.empty-sub { font-size: 13px; }

/* Success / Alert Toast */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 12px;
    font-size: 14px; font-weight: 500;
    z-index: 999;
    animation: slideUp 0.3s ease;
}
.toast.success { border-left: 4px solid var(--success); color: var(--success); }
.toast.error   { border-left: 4px solid var(--danger);  color: var(--danger); }
@keyframes slideUp { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }

/* Responsive */
@media screen and (max-width: 900px) {
    :root { --sidebar-w: 220px; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .profile-layout { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   LOGIN SCREEN LAYOUT & STYLES (Split-Screen, 3D Spiral Graphic)
   ============================================================ */
/* ============================================================
   GLASSMORPHISM LOGIN SCREEN (NEW)
   ============================================================ */
.login-screen-wrapper {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #004fb0; /* Deep blue background */
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
    overflow: hidden;
}

/* Background floating shapes */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, #0088ff, #004fb0);
    filter: blur(40px);
    opacity: 0.6;
    animation: floatShape 20s infinite alternate ease-in-out;
}
.shape-1 { width: 100%; max-width: 400px; height: 400px; top: -100px; left: -100px; animation-delay: 0s; }
.shape-2 { width: 100%; max-width: 500px; height: 500px; bottom: -150px; right: -100px; animation-delay: -5s; background: linear-gradient(135deg, #00c3ff, #004fb0); }
.shape-3 { width: 100%; max-width: 300px; height: 300px; top: 30%; left: 60%; animation-delay: -10s; background: linear-gradient(135deg, #0051ff, #002b80); }

@keyframes floatShape {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Glass Card */
.login-glass-card {
    position: relative;
    z-index: 10;
    width: 100%; max-width: 400px;
    padding: 28px 32px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.login-header-group {
    text-align: center;
    margin-bottom: 18px;
}
.login-glass-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    margin-bottom: 8px;
}
.login-title {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.25;
}

/* Glass Inputs */
.login-field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}
.login-input-label {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}
.glass-input {
    width: 100%;
    height: 42px;
    background: rgba(255, 255, 255, 0.9) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0 14px;
    font-size: 13px;
    color: #333 !important;
    outline: none;
    transition: all var(--transition);
}
.glass-input::placeholder {
    color: #999;
}
.glass-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.password-input-wrapper {
    position: relative;
}
.password-toggle-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.forgot-link {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}
.forgot-link:hover {
    color: #fff;
    text-decoration: underline;
}

.quick-login-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed rgba(255,255,255,0.3);
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

.login-submit-btn {
    margin-top: 8px;
    width: 100%;
    height: 46px;
    background: #002b5e;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 8px 16px -8px rgba(0, 0, 0, 0.5);
}
.login-submit-btn:hover {
    background: #001a3d;
    transform: translateY(-1px);
}
.login-submit-btn:active {
    transform: translateY(1px);
}
.password-toggle-btn svg {
    width: 100%;
    height: 100%;
}

/* Checkbox option */
.login-options {
    margin-bottom: 24px;
}
.login-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    color: #475569;
    cursor: pointer;
    user-select: none;
}
[data-theme="dark"] .login-checkbox-label {
    color: #cbd5e1;
}
.login-checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0; width: 0;
}
.custom-checkbox {
    width: 20px;
    height: 20px;
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    display: inline-block;
    position: relative;
    transition: all var(--transition);
}
[data-theme="dark"] .custom-checkbox {
    background: #1c1c38;
    border-color: #475569;
}
.login-checkbox-label input:checked ~ .custom-checkbox {
    background: #e25c5c;
    border-color: #e25c5c;
}
.custom-checkbox::after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 3px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.login-checkbox-label input:checked ~ .custom-checkbox::after {
    display: block;
}

/* Submit Button */
.login-submit-btn {
    width: 100%;
    height: 52px;
    background: #e25c5c;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 14px;
    transition: all var(--transition);
    box-shadow: 0 4px 12px rgba(226, 92, 92, 0.2);
    border: none;
    cursor: pointer;
}
.login-submit-btn:hover {
    background: #d14d4d;
    box-shadow: 0 6px 16px rgba(226, 92, 92, 0.35);
    transform: translateY(-1px);
}
.login-submit-btn:active {
    transform: translateY(0);
}

/* Footer info */
.login-footer {
    margin-top: 24px;
    text-align: center;
}
.unable-link {
    font-size: 13px;
    color: #e25c5c;
    text-decoration: underline;
    font-weight: 500;
}
.unable-link:hover {
    color: #d14d4d;
}

/* Helper Credential Modal */
.credentials-modal {
    display: none;
    position: absolute;
    inset: 20px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 10;
    padding: 24px;
    flex-direction: column;
}
[data-theme="dark"] .credentials-modal {
    background: #111124;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.credentials-modal.open {
    display: flex;
}
.credentials-modal h3 {
    font-size: 16px;
    margin-bottom: 8px;
}
.credentials-modal p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.modal-list-wrapper {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 8px;
}
.cred-item-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 12.5px;
    cursor: pointer;
    border-radius: 6px;
    align-items: center;
}
.cred-item-row:hover {
    background: var(--border-light);
}
.cred-item-name {
    font-weight: 600;
    color: var(--text-primary);
}
.cred-item-email {
    color: var(--text-secondary);
}

.hidden {
    display: none !important;
}

@media screen and (max-width: 820px) {
    .login-graphic {
        display: none;
    }
    .login-form-side {
        width: 100%;
        padding: 40px 32px;
    }
}

/* ============================================================
   ZOHO-STYLE CALENDAR
   ============================================================ */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 16px;
}
.calendar-header-cell {
    background: var(--card-bg);
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}
.calendar-cell {
    background: var(--card-bg);
    min-height: 120px;
    padding: 12px;
    position: relative;
    transition: background 0.2s;
}
.calendar-cell:not(.empty):hover {
    background: var(--border-light);
}
.calendar-date {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.calendar-edit-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
}
.calendar-edit-btn svg {
    width: 14px;
    height: 14px;
}
.calendar-cell:hover .calendar-edit-btn {
    opacity: 1;
}
.calendar-edit-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
}
.calendar-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    display: inline-block;
}
.calendar-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: auto;
}
/* Calendar Status Colors */
.calendar-present .calendar-status { background: var(--success-bg); color: var(--success); }
.calendar-absent .calendar-status { background: var(--danger-bg); color: var(--danger); }
.calendar-late .calendar-status { background: var(--warning-bg); color: var(--warning); }
.calendar-leave .calendar-status { background: rgba(59,130,246,0.1); color: #3b82f6; }
.calendar-holiday .calendar-status { background: var(--primary-bg); color: var(--primary); }

.calendar-weekend {
    background: var(--border-light);
}
.calendar-holiday {
    background: var(--primary-bg);
}

.quick-login-box select { width: 100%; box-sizing: border-box; }


.quick-login-box select { width: 100%; box-sizing: border-box; padding: 12px; font-size: 14px; font-weight: 500; border-radius: 8px; border: 1px solid var(--border); background: var(--content-bg); color: var(--text-primary); margin-top: 4px; cursor: pointer; appearance: auto; }


/* ============================================================
   DARK MODE — COMPREHENSIVE VISIBILITY OVERRIDES
   Ensures every element is crystal clear even when the laptop
   screen is tilted at an angle (low viewing angle contrast).
   ============================================================ */

/* ---- Core Body & Layout ---- */
[data-theme="dark"] body {
    background: #0d1117;
    color: #e6edf3;
}

/* ---- Topbar ---- */
[data-theme="dark"] .topbar {
    background: #161b22;
    border-bottom: 1px solid #30363d;
}
[data-theme="dark"] .greeting-name {
    color: #e6edf3;
    font-weight: 700;
}
[data-theme="dark"] .greeting-line {
    color: #8b949e;
}
[data-theme="dark"] .search-wrapper {
    background: #21262d;
    border: 1px solid #30363d;
}
[data-theme="dark"] .search-input {
    color: #e6edf3;
}
[data-theme="dark"] .search-input::placeholder {
    color: #6e7681;
}
[data-theme="dark"] .topbar-icon-btn {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
}
[data-theme="dark"] .topbar-icon-btn:hover {
    background: rgba(56,189,248,0.15);
    border-color: #38bdf8;
    color: #38bdf8;
}
[data-theme="dark"] .user-chip {
    background: #21262d;
    border: 1px solid #30363d;
}
[data-theme="dark"] .user-chip:hover {
    border-color: #38bdf8;
    background: rgba(56,189,248,0.10);
}
[data-theme="dark"] .user-fullname {
    color: #e6edf3;
}
[data-theme="dark"] .user-role-label {
    color: #8b949e;
}

/* ---- Sidebar ---- */
[data-theme="dark"] .sidebar {
    background: #161b22;
    border-right: 1px solid #30363d;
}
[data-theme="dark"] .nav-item-header {
    color: #c9d1d9;
}
[data-theme="dark"] .nav-item-header:hover,
[data-theme="dark"] .nav-item.open .nav-item-header {
    background: rgba(56,189,248,0.12);
    color: #38bdf8;
}
[data-theme="dark"] .nav-section-label {
    color: #6e7681;
}
[data-theme="dark"] .sub-item {
    color: #8b949e;
}
[data-theme="dark"] .sub-item:hover,
[data-theme="dark"] .sub-item.active {
    background: rgba(56,189,248,0.12);
    color: #38bdf8;
}
[data-theme="dark"] .sub-item::before {
    background: #30363d;
}
[data-theme="dark"] .sub-item:hover::before,
[data-theme="dark"] .sub-item.active::before {
    background: #38bdf8;
}
[data-theme="dark"] .brand-name,
[data-theme="dark"] .brand-tag { color: #e6edf3; }
[data-theme="dark"] .sidebar-footer {
    border-top: 1px solid #30363d;
}
[data-theme="dark"] .theme-toggle-row {
    background: rgba(0,0,0,0.3);
}
[data-theme="dark"] .theme-btn {
    color: #8b949e;
}
[data-theme="dark"] .theme-btn.active {
    background: rgba(56,189,248,0.18);
    color: #38bdf8;
}

/* ---- Page headers & text ---- */
[data-theme="dark"] .page-title {
    color: #e6edf3;
    font-weight: 700;
}
[data-theme="dark"] .page-subtitle {
    color: #8b949e;
}

/* ---- Cards & Containers ---- */
[data-theme="dark"] .card,
[data-theme="dark"] .data-card,
[data-theme="dark"] .form-card,
[data-theme="dark"] .dept-card,
[data-theme="dark"] .profile-card,
[data-theme="dark"] .stat-card {
    background: #161b22;
    border: 1px solid #30363d;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
[data-theme="dark"] .data-card-header {
    border-bottom: 1px solid #30363d;
}
[data-theme="dark"] .data-card-title {
    color: #e6edf3;
}
[data-theme="dark"] .stat-value {
    color: #e6edf3;
}
[data-theme="dark"] .stat-label {
    color: #8b949e;
}
[data-theme="dark"] .dept-card-name {
    color: #e6edf3;
}
[data-theme="dark"] .dept-card-head,
[data-theme="dark"] .dept-stat-lbl {
    color: #8b949e;
}
[data-theme="dark"] .dept-stat-val {
    color: #e6edf3;
}

/* ---- Tables ---- */
[data-theme="dark"] .oc-table thead th {
    background: #21262d;
    color: #8b949e;
    border-bottom: 1px solid #30363d;
    letter-spacing: 0.8px;
}
[data-theme="dark"] .oc-table tbody tr {
    border-bottom: 1px solid #21262d;
}
[data-theme="dark"] .oc-table tbody tr:hover {
    background: #1c2128;
}
[data-theme="dark"] .oc-table td {
    color: #c9d1d9;
}
[data-theme="dark"] .oc-table td:first-child {
    color: #e6edf3;
    font-weight: 600;
}
[data-theme="dark"] .emp-name {
    color: #e6edf3;
    font-weight: 600;
}
[data-theme="dark"] .emp-role {
    color: #8b949e;
}

/* ---- Forms & Inputs ---- */
[data-theme="dark"] .form-control,
[data-theme="dark"] .filter-bar select,
[data-theme="dark"] .filter-bar input {
    background: #21262d;
    border: 1px solid #30363d;
    color: #e6edf3;
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .filter-bar select:focus,
[data-theme="dark"] .filter-bar input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56,189,248,0.15);
}
[data-theme="dark"] .form-control::placeholder {
    color: #6e7681;
}
[data-theme="dark"] .form-label {
    color: #c9d1d9;
    font-weight: 600;
}

/* ---- Buttons ---- */
[data-theme="dark"] .btn-outline {
    background: transparent;
    border: 1px solid #30363d;
    color: #c9d1d9;
}
[data-theme="dark"] .btn-outline:hover {
    border-color: #38bdf8;
    color: #38bdf8;
    background: rgba(56,189,248,0.10);
}
[data-theme="dark"] .btn-primary {
    background: #38bdf8;
    color: #0d1117;
    font-weight: 700;
}
[data-theme="dark"] .btn-primary:hover {
    background: #7dd3fc;
}

/* ---- Badges ---- */
[data-theme="dark"] .badge-success {
    background: rgba(63,185,80,0.18);
    color: #3fb950;
    font-weight: 700;
}
[data-theme="dark"] .badge-danger {
    background: rgba(248,81,73,0.18);
    color: #f85149;
    font-weight: 700;
}
[data-theme="dark"] .badge-warning {
    background: rgba(210,153,34,0.18);
    color: #e3b341;
    font-weight: 700;
}
[data-theme="dark"] .badge-info {
    background: rgba(88,166,255,0.15);
    color: #58a6ff;
    font-weight: 700;
}
[data-theme="dark"] .badge-primary {
    background: rgba(56,189,248,0.15);
    color: #38bdf8;
    font-weight: 700;
}
[data-theme="dark"] .badge-neutral {
    background: #21262d;
    color: #8b949e;
}

/* ---- Calendar ---- */
[data-theme="dark"] .calendar-grid {
    background: #30363d;
    border: 1px solid #30363d;
}
[data-theme="dark"] .calendar-header-cell {
    background: #161b22;
    color: #8b949e;
    font-weight: 700;
}
[data-theme="dark"] .calendar-cell {
    background: #161b22;
}
[data-theme="dark"] .calendar-cell:not(.empty):hover {
    background: #1c2128;
}
[data-theme="dark"] .calendar-date {
    color: #c9d1d9;
    font-weight: 700;
}
[data-theme="dark"] .calendar-time {
    color: #6e7681;
}
[data-theme="dark"] .calendar-weekend {
    background: #1c2128;
}
[data-theme="dark"] .calendar-holiday {
    background: rgba(56,189,248,0.08);
}
[data-theme="dark"] .calendar-present .calendar-status {
    background: rgba(63,185,80,0.20);
    color: #3fb950;
    font-weight: 700;
}
[data-theme="dark"] .calendar-absent .calendar-status {
    background: rgba(248,81,73,0.20);
    color: #f85149;
    font-weight: 700;
}
[data-theme="dark"] .calendar-late .calendar-status {
    background: rgba(210,153,34,0.20);
    color: #e3b341;
    font-weight: 700;
}
[data-theme="dark"] .calendar-leave .calendar-status {
    background: rgba(88,166,255,0.20);
    color: #58a6ff;
    font-weight: 700;
}
[data-theme="dark"] .calendar-holiday .calendar-status {
    background: rgba(56,189,248,0.20);
    color: #38bdf8;
    font-weight: 700;
}

/* ---- Toggle rows & misc ---- */
[data-theme="dark"] .toggle-row {
    border-bottom: 1px solid #30363d;
}
[data-theme="dark"] .toggle-label {
    color: #e6edf3;
}
[data-theme="dark"] .toggle-desc {
    color: #8b949e;
}
[data-theme="dark"] .toggle-slider {
    background: #30363d;
}

/* ---- Toast ---- */
[data-theme="dark"] .toast {
    background: #1c2128;
    border: 1px solid #30363d;
    color: #e6edf3;
}

/* ---- Profile ---- */
[data-theme="dark"] .profile-name {
    color: #e6edf3;
}
[data-theme="dark"] .profile-role {
    color: #8b949e;
}

/* ---- Filter bar labels ---- */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: #e6edf3;
}
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] label,
[data-theme="dark"] td,
[data-theme="dark"] li {
    color: #c9d1d9;
}
[data-theme="dark"] strong {
    color: #e6edf3;
}

/* ============================================================
   RESPONSIVE DESIGN (Tablets, Mobiles, Laptops)
   ============================================================ */

/* Mobile overlay for sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Laptops & Small Desktops (max-width: 1024px) */
@media screen and (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .department-grid { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .page-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .page-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }
}

/* Tablets & Mobiles (max-width: 768px) */
@media screen and (max-width: 768px) {
    /* Layout & Sidebar */
    .sidebar {
        position: fixed;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0 !important;
        width: 100%;
    }
    
    /* Topbar adjustments */
    .topbar {
        padding: 0 16px;
        min-width: 0;
    }
    .topbar-left {
        min-width: 0;
        flex: 1;
    }
    .page-breadcrumb {
        min-width: 0;
    }
    .greeting-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 18px;
    }
    .mobile-menu-toggle {
        display: block !important;
        margin-right: 12px;
        background: none;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
        flex-shrink: 0;
    }
    .topbar-center {
        display: none; /* Hide global search on small screens to save space */
    }
    .topbar-right {
        gap: 8px;
        flex-shrink: 0;
    }
    .user-text {
        display: none; /* Hide name/role on small screens */
    }
    
    /* Grids */
    .stat-grid { grid-template-columns: 1fr; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .profile-layout { grid-template-columns: 1fr; }
    
    /* Senior Mobile Card Pattern for Tables (No Scrolling) */
    .oc-table, .data-card table, .data-table {
        display: block;
        width: 100%;
        overflow: hidden;
        border: none;
    }
    .oc-table thead, .data-card table thead, .data-table thead {
        display: none;
    }
    .oc-table tbody, .data-card table tbody, .data-table tbody {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .oc-table tr, .data-card table tr, .data-table tr {
        display: flex;
        flex-direction: column;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    }
    .oc-table td, .data-card table td, .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0 !important;
        border: none !important;
        border-bottom: 1px solid #f0f0f0 !important;
        white-space: normal !important;
        text-align: right;
        font-size: 14px;
    }
    .oc-table tr:last-child, .data-card table tr:last-child, .data-table tr:last-child {
        margin-bottom: 0;
    }
    .oc-table td:last-child, .data-card table td:last-child, .data-table td:last-child {
        border-bottom: none !important;
    }
    /* Highlight the first cell as the Card Title */
    .oc-table td:first-child, .data-card table td:first-child, .data-table td:first-child {
        font-weight: 700;
        font-size: 16px;
        color: var(--primary);
        border-bottom: 2px solid #eaeaea !important;
        justify-content: center;
        padding-bottom: 12px !important;
        margin-bottom: 8px;
    }

    /* ── Holiday Calendar Mobile Card View (Applies to Tablet & Mobile) ── */
    /* Hide the desktop table header */
    .holiday-table thead {
        display: none;
    }
    /* Stack tbody as a vertical card list */
    .holiday-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 12px;
    }
    /* Each row becomes a beautiful calendar-style card */
    .holiday-table .holiday-row {
        display: grid;
        grid-template-columns: 48px 1fr;
        grid-template-rows: auto auto auto;
        background: var(--card-bg) !important;
        border: 1px solid var(--border) !important;
        border-radius: 12px !important;
        padding: 0 !important;
        margin-bottom: 10px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        overflow: hidden;
    }
    /* Sl.No cell — becomes a left accent column */
    .holiday-table .holiday-row td[data-label="#"] {
        grid-column: 1;
        grid-row: 1 / span 3;
        background: linear-gradient(180deg, var(--primary) 0%, #3b82f6 100%);
        color: #fff !important;
        font-size: 18px;
        font-weight: 800;
        display: flex;
        align-items: center;
        justify-content: center;
        border-right: none;
        border-radius: 0;
        padding: 0 !important;
    }
    /* Festival name — main title of the card */
    .holiday-table .holiday-row td[data-label="Festival / Occasion"] {
        grid-column: 2;
        grid-row: 1;
        padding: 12px 14px 4px 14px !important;
        font-size: 14px;
        font-weight: 700;
        color: var(--text-main) !important;
        display: block;
        border: none;
    }
    .holiday-table .holiday-row td[data-label="Festival / Occasion"]::before {
        display: none;
    }
    /* Date — shows as colored subtitle */
    .holiday-table .holiday-row td[data-label="Date"] {
        grid-column: 2;
        grid-row: 2;
        padding: 2px 14px 4px 14px !important;
        font-size: 13px;
        font-weight: 600;
        display: block;
        border: none;
        color: var(--primary) !important;
    }
    .holiday-table .holiday-row td[data-label="Date"]::before {
        content: attr(data-label) ": ";
        font-weight: 400;
        color: var(--text-muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: 4px;
    }
    /* Day — shows inline with location */
    .holiday-table .holiday-row td[data-label="Day"] {
        grid-column: 2;
        grid-row: 3;
        padding: 2px 14px 10px 14px !important;
        font-size: 12px;
        display: flex;
        align-items: center;
        gap: 8px;
        border: none;
        color: var(--text-secondary) !important;
    }
    .holiday-table .holiday-row td[data-label="Day"]::before {
        content: "📅";
        font-size: 13px;
    }
    /* Location — hidden, merged into Day row on tiny screens */
    .holiday-table .holiday-row td[data-label="Location"] {
        display: none;
    }
    /* Actions — HR only, full width below card */
    .holiday-table .holiday-row td:last-child:not([data-label]) {
        grid-column: 1 / -1;
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        padding: 8px 12px !important;
        border-top: 1px solid var(--border);
    }
    /* Holiday banner responsive */
    .holiday-banner {
        padding: 18px 16px !important;
    }
    .holiday-banner h2 {
        font-size: 18px !important;
    }
    .holiday-banner p {
        font-size: 12px !important;
    }
    #payslip-wrapper .ps-header, #payslip-wrapper .ps-grid {
        padding: 16px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    #payslip-wrapper hr, #payslip-wrapper .ps-divider {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    #payslip-wrapper .ps-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 16px !important;
    }
    #payslip-wrapper .ps-grid {
        flex-direction: column !important;
        gap: 16px !important;
    }
    #payslip-wrapper .ps-grid > div {
        width: 100% !important;
    }
    #payslip-wrapper table {
        display: block;
    }
    #payslip-wrapper tbody {
        display: block;
    }
    #payslip-wrapper tr {
        display: flex;
        flex-direction: column;
        border-bottom: 1px solid #eee;
        padding: 8px 0;
    }
    #payslip-wrapper td {
        display: flex;
        justify-content: space-between;
        width: 100% !important;
        padding: 4px 0 !important;
        border: none !important;
    }
    #payslip-wrapper .ps-label {
        font-weight: 600;
        color: #555;
    }
    
    /* Calendar fixes for tablets (horizontal scroll) */
    .calendar-grid {
        gap: 4px;
        min-width: 100%; max-width: 600px;
    }
    .calendar-cell {
        padding: 4px;
        min-height: 50px;
        font-size: 10px;
    }
    .calendar-header-cell {
        font-size: 9px;
    }
    .calendar-date {
        font-size: 12px;
    }
    .calendar-status {
        font-size: 9px;
        padding: 2px 4px;
        text-align: center;
    }
    
    /* Spacing adjustments */
    .page-content {
        padding: 16px;
    }
    
    /* Login Screen */
    .login-glass-card {
        width: 90%;
        padding: 30px 20px;
    }
    
    /* Cards */
    .data-card {
        padding: 16px;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Small Mobiles (max-width: 480px) */
@media screen and (max-width: 480px) {
    .page-title { font-size: 20px; }
    .stat-value { font-size: 24px; }
    .btn { width: 100%; justify-content: center; margin-bottom: 8px; }
    .page-actions { flex-direction: column; width: 100%; }
    .page-actions .btn { margin-bottom: 0; }
    .topbar-right .user-chip { padding: 4px; }
    .topbar-right .chevron-down { display: none; }
    .page-content { padding: 12px; }
    .data-card { padding: 12px; }

    /* Calendar List View for Mobiles */
    .calendar-scroll-wrapper {
        overflow-x: hidden;
    }
    .calendar-grid {
        display: flex;
        flex-direction: column;
        min-width: 0;
        gap: 8px;
        background: transparent;
        border: none;
    }
    .calendar-header-cell {
        display: none;
    }
    .calendar-cell {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        min-height: auto;
        padding: 12px 16px;
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: var(--radius);
    }
    .calendar-cell.empty {
        display: none;
    }
    .calendar-date {
        font-size: 16px;
        display: flex;
        flex-direction: row-reverse;
        align-items: center;
        gap: 8px;
    }
    .calendar-date::before {
        content: attr(data-day);
        font-size: 11px;
        font-weight: 500;
        color: var(--text-muted);
        text-transform: uppercase;
    }
    .calendar-time {
        font-size: 10px;
    }


}

/* ============================================================
   PHONE VIEWPORT FIX — Prevents ALL horizontal overflow
   on screens ≤ 768px (especially 320px – 480px phones)
   ============================================================ */
@media screen and (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100%;
    }
    .app-shell {
        overflow-x: hidden;
        max-width: 100vw;
    }
    .main-wrapper {
        overflow-x: hidden;
        max-width: 100%;
    }
    .page-content {
        overflow-x: hidden;
        max-width: 100%;
    }
    /* Wrap any inline-style divs that might overflow */
    .page-content > * {
        max-width: 100%;
        box-sizing: border-box;
    }
    /* Allow horizontal scroll ONLY inside payslip on tablets (not holiday — it's card-based) */
    #payslip-wrapper,
    .calendar-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
}

/* ============================================================
   VERY SMALL PHONES — 320px × 608px (e.g. Galaxy Fold, iPhone SE)
   ============================================================ */
@media screen and (max-width: 360px) {
    /* Topbar: shrink everything aggressively */
    .topbar {
        padding: 0 10px;
        gap: 8px;
        height: 56px;
    }
    .mobile-menu-toggle svg {
        width: 20px;
        height: 20px;
    }
    .user-avatar-sm {
        width: 30px !important;
        height: 30px !important;
        font-size: 11px !important;
    }
    .topbar-icon-btn svg {
        width: 18px;
        height: 18px;
    }
    .greeting-name {
        font-size: 15px;
    }

    /* Page content: minimal padding */
    .page-content {
        padding: 10px 8px;
    }
    .data-card {
        padding: 10px 8px;
    }

    /* Stat cards: 2 per row even on tiny screens */
    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .stat-card {
        padding: 12px 10px;
    }
    .stat-value {
        font-size: 20px;
    }
    .stat-label {
        font-size: 10px;
    }
    .stat-icon {
        width: 36px;
        height: 36px;
        margin-bottom: 8px;
    }

    /* Page title */
    .page-title {
        font-size: 17px;
    }
    .page-subtitle {
        font-size: 11px;
    }

    /* Buttons: full width on tiny screens */
    .btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Sidebar: ensure it doesn't bleed */
    .sidebar {
        width: min(256px, 85vw);
    }

    /* Department card grid: single column on 320px */
    .department-grid {
        grid-template-columns: 1fr;
    }

    /* Login card */
    .login-glass-card {
        width: 96%;
        padding: 24px 16px;
    }
}

/* Dropdown hover effects */
.dropdown-action:hover { background: var(--content-bg) !important; }

/* ---- Attendance Report & inline selects - dark mode fix ---- */
[data-theme="dark"] #rpt-month,
[data-theme="dark"] #rpt-year {
    background: #21262d !important;
    color: #e6edf3 !important;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 4px 8px;
}

/* Global safety net: any bare <select> inside a dark card/page */
[data-theme="dark"] select {
    background: #21262d;
    color: #e6edf3;
    border-color: #30363d;
}
[data-theme="dark"] select option {
    background: #21262d;
    color: #e6edf3;
}




