/**
 * System / browser dark mode (Chrome “Dark” appearance, macOS dark, etc.)
 * Loaded after styles.css — overrides tokens and a few hard-coded light surfaces.
 */

@media (prefers-color-scheme: dark) {
  html {
    color-scheme: dark;
  }

  :root {
    --bg: #0c0f14;
    --surface: #141a24;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --muted-soft: #7c8c9f;
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --primary-dark: #93c5fd;
    --primary-soft: rgba(96, 165, 250, 0.14);
    --card: #161d28;
    --line: #2a3444;
    --line-strong: #3d4b5f;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55);
  }

  /* —— Landing —— */
  .landing-header {
    background: rgba(12, 15, 20, 0.88);
  }

  .landing-hero-bg {
    background:
      radial-gradient(ellipse 80% 60% at 70% -10%, rgba(96, 165, 250, 0.14), transparent 55%),
      radial-gradient(ellipse 50% 40% at 10% 40%, rgba(129, 140, 248, 0.1), transparent 50%);
  }

  .landing-panel-badge {
    background: rgba(6, 78, 59, 0.45);
    color: #6ee7b7;
    border-color: rgba(52, 211, 153, 0.35);
  }

  .landing-metric-bar--good::after {
    background: #34d399;
  }

  .landing-cta-band {
    background: linear-gradient(160deg, #020617 0%, #0f172a 100%);
    color: #f8fafc;
  }

  .landing-cta-copy {
    color: #94a3b8;
  }

  /* Legacy marketing shell */
  .header {
    background: rgba(12, 15, 20, 0.9);
  }

  .btn-secondary:hover {
    background: #1e293b;
    border-color: var(--line-strong);
  }

  .btn-ghost:hover {
    background: rgba(241, 245, 249, 0.06);
  }

  .btn-light:hover,
  .btn-outline:hover {
    border-color: rgba(96, 165, 250, 0.45);
  }

  .btn-outline {
    border-color: rgba(96, 165, 250, 0.45);
  }

  .note {
    color: var(--muted-soft);
  }

  .hero-card {
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  }

  .alt {
    background: linear-gradient(180deg, #121a28 0%, #151d2e 100%);
    border-top-color: var(--line);
    border-bottom-color: var(--line);
  }

  .footer-wrap {
    color: var(--muted);
  }

  .auth-error {
    color: #fca5a5;
  }

  .auth-success {
    color: #6ee7b7;
  }

  /* Auth inputs */
  .auth-card input,
  .auth-card select,
  .auth-card textarea {
    background: var(--bg);
    color: var(--text);
  }

  .auth-card input:focus,
  .auth-card select:focus,
  .auth-card textarea:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22);
  }

  /* —— Dashboard: first (legacy) block —— */
  .dash-body {
    background-color: #0a0d12;
    background-image:
      radial-gradient(ellipse 120% 90% at 100% 0%, rgba(59, 130, 246, 0.12), transparent 55%),
      radial-gradient(ellipse 90% 70% at 0% 100%, rgba(99, 102, 241, 0.08), transparent 50%),
      linear-gradient(180deg, #0f172a 0%, #0c1017 45%, #0a0d12 100%);
  }

  .dash-header {
    background: linear-gradient(180deg, #161d28 0%, var(--surface) 100%);
  }

  .btn-dash-signout {
    background: #1a2230;
    color: var(--muted);
    border-color: var(--line-strong);
  }

  .btn-dash-signout:hover {
    background: #243044;
    color: var(--text);
    border-color: var(--muted-soft);
  }

  .btn-dash-home {
    border-color: rgba(96, 165, 250, 0.45);
  }

  .dash-sidebar {
    background: linear-gradient(180deg, #0f1419 0%, #151b24 100%);
  }

  .btn-dash-nav {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }

  .btn-dash-nav:hover {
    background: rgba(96, 165, 250, 0.12);
    border-color: rgba(96, 165, 250, 0.35);
    color: var(--primary);
  }

  .btn-dash-nav:focus-visible {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px rgba(96, 165, 250, 0.45);
  }

  .admin-badge {
    color: #6ee7b7;
    background: linear-gradient(180deg, rgba(6, 78, 59, 0.5), rgba(4, 120, 87, 0.25));
    border-color: rgba(52, 211, 153, 0.35);
  }

  .dash-main {
    background: #0e1218;
  }

  .dash-panel .dash-panel-error {
    color: #fca5a5;
  }

  .dash-panel .dash-textarea:focus,
  .dash-panel .manage-form-grid input:focus,
  .dash-panel .manage-form-grid select:focus,
  .dash-panel .manage-form-grid textarea:focus {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22);
  }

  .dash-panel .btn-light,
  .dash-panel .btn.btn-light {
    background: #1a2230;
    border-color: var(--line-strong);
    color: var(--text);
  }

  .dash-panel .btn-light:hover,
  .dash-panel .btn.btn-light:hover {
    background: #243044;
    border-color: var(--muted-soft);
  }

  .dash-panel .btn-danger,
  .dash-panel .btn.btn-danger {
    border-color: rgba(251, 113, 133, 0.35);
    color: #fda4af;
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.35), rgba(136, 19, 55, 0.25));
  }

  .dash-panel .btn-danger:hover,
  .dash-panel .btn.btn-danger:hover {
    background: rgba(190, 18, 60, 0.35);
    border-color: rgba(251, 113, 133, 0.5);
    color: #fecdd3;
  }

  .dash-info {
    background: rgba(15, 23, 42, 0.65);
  }

  .dash-panel .stat-card {
    background: linear-gradient(180deg, #1a2230 0%, var(--surface) 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  }

  .dash-panel .filter-row button[data-filter] {
    background: #1a2230;
    color: var(--muted);
  }

  .dash-panel .filter-row button[data-filter]:hover {
    background: #243044;
    color: var(--text);
  }

  .dash-panel .filter-row button[data-filter].active {
    color: #f8fafc;
  }

  .dash-panel .status-pending {
    background: rgba(113, 63, 18, 0.35);
    color: #fde047;
    border-color: rgba(250, 204, 21, 0.35);
  }

  .dash-panel .status-approved {
    background: rgba(20, 83, 45, 0.35);
    color: #86efac;
    border-color: rgba(74, 222, 128, 0.35);
  }

  .dash-panel .status-rejected {
    background: rgba(127, 29, 29, 0.35);
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.35);
  }

  .dash-panel .status-cancelled {
    background: #1a2230;
    color: var(--muted);
    border-color: var(--line-strong);
  }

  /* —— Dashboard: “SaaS refresh” overrides (same file, later rules) —— */
  .dash-sidebar {
    background: linear-gradient(180deg, #070b14 0%, #0c1220 100%);
    color: #cbd5e1;
    box-shadow: inset -1px 0 0 rgba(148, 163, 184, 0.1);
  }

  .dash-brand {
    color: #f8fafc;
  }

  .dash-user-card {
    background: rgba(2, 6, 23, 0.45);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
  }

  .dash-avatar {
    color: #0f172a;
    background: linear-gradient(180deg, #bfdbfe 0%, #93c5fd 100%);
  }

  .dashboard-email {
    color: #e2e8f0;
  }

  .dashboard-meta {
    color: #94a3b8;
  }

  .btn-dash-nav {
    color: #cbd5e1;
  }

  .btn-dash-nav:hover {
    color: #f1f5f9;
    background: rgba(148, 163, 184, 0.12);
  }

  .btn-dash-nav.is-active {
    background: rgba(59, 130, 246, 0.28);
    color: #eff6ff;
  }

  .nav-section-label {
    color: #94a3b8;
  }

  .hr-only-nav hr {
    border-top-color: rgba(148, 163, 184, 0.18);
  }

  .dash-main {
    background: #0a0e15;
  }

  .dash-header {
    border-bottom-color: var(--line);
    background: rgba(20, 26, 36, 0.92);
    backdrop-filter: blur(10px);
  }

  .btn-dash-icon {
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--muted);
  }

  .btn-dash-icon:hover {
    background: #1e293b;
    color: var(--text);
  }

  .btn-dash-home {
    background: var(--primary);
    color: #0f172a;
  }

  .btn-dash-home:hover {
    background: var(--primary-hover);
    color: #0f172a;
  }

  .dash-panel {
    background: var(--surface);
    border: none;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  }

  .dash-panel .stat-card {
    border: 1px solid var(--line);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  }

  .dash-panel .stat-card-casual {
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.18), var(--surface));
  }

  .dash-panel .stat-card-sick {
    background: linear-gradient(180deg, rgba(22, 163, 74, 0.16), var(--surface));
  }

  .dash-panel .stat-card-earned {
    background: linear-gradient(180deg, rgba(147, 51, 234, 0.16), var(--surface));
  }

  .dash-panel .stat-card-pending {
    background: linear-gradient(180deg, rgba(234, 88, 12, 0.14), var(--surface));
  }

  .dash-panel .stat-head i {
    color: var(--muted);
  }

  .next-leave-card,
  .holiday-list-card {
    background: #121a24;
  }

  .next-leave-row i {
    color: var(--primary);
  }

  .holiday-left i {
    color: #a5b4fc;
  }

  .holiday-right {
    color: var(--text);
  }

  .dash-info {
    background: linear-gradient(180deg, rgba(14, 116, 144, 0.2), rgba(30, 58, 138, 0.18));
    border: 1px solid var(--line);
  }

  .dash-info i {
    color: #7dd3fc;
  }

  .dash-panel .manage-form-grid input,
  .dash-panel .manage-form-grid select,
  .dash-panel .manage-form-grid textarea {
    background: var(--bg);
    color: var(--text);
  }

  .dash-panel .dash-textarea {
    background: var(--bg);
    color: var(--text);
  }
}
