/* Design tokens (dark mode) */
[data-theme="dark"] {
  --bg-app: #0B1220;
  --surface-1: rgba(13,18,34,.9);
  --surface-2: rgba(13,18,34,.75);
  --surface-3: rgba(13,18,34,.6);
  --text-1: #e5eaf5;
  --text-2: #c9d4ea;
  --text-3: #99a7c2;
  --border: rgba(173,186,210,.16);
  --border-soft: rgba(173,186,210,.08);
  --glass: rgba(12,17,32,.7);
  --header-bg: rgba(12,17,32,.78);
  --sidebar-grad: linear-gradient(180deg,#0B1220,#0b1220f2);
}

[data-theme="dark"] body {
  background: #0B1220;
  color: var(--text-1);
}

[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-white\/50,
[data-theme="dark"] .bg-white\/60,
[data-theme="dark"] .bg-white\/70,
[data-theme="dark"] .bg-white\/80,
[data-theme="dark"] .bg-white\/90,
[data-theme="dark"] .bg-white\/95 { background-color: var(--surface-1) !important; }

[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-gray-50\/80 { background-color: var(--surface-2) !important; }

[data-theme="dark"] .border-gray-100,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-200\/50,
[data-theme="dark"] .border-gray-100\/50 { border-color: var(--border) !important; }

[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-lowify-dark { color: var(--text-1) !important; }
[data-theme="dark"] .text-lowify-primary { color: #3773ff !important; }
[data-theme="dark"] .text-gray-800,
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-600 { color: var(--text-1) !important; }
[data-theme="dark"] .text-gray-500,
[data-theme="dark"] .text-gray-400 { color: var(--text-3) !important; }

[data-theme="dark"] .bg-gray-50\/50 .text-gray-700 {
  color: var(--text-1) !important;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--surface-3) !important;
  color: var(--text-1) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--text-3) !important; }

[data-theme="dark"] table { color: var(--text-1); }
[data-theme="dark"] thead { background: var(--surface-2) !important; }
[data-theme="dark"] tbody tr { background: transparent; }
[data-theme="dark"] tbody tr:nth-child(odd) { background: rgba(255,255,255,.02); }
[data-theme="dark"] tbody tr:hover { background: rgba(255,255,255,.06) !important; }

[data-theme="dark"] span[class*="bg-green-100"]  { background: rgba(34,197,94,.18) !important;  color:#86efac !important; border-color: rgba(34,197,94,.25) !important; }
[data-theme="dark"] span[class*="bg-yellow-100"],
[data-theme="dark"] span[class*="bg-amber-100"]  { background: rgba(245,158,11,.18) !important;  color:#fbd38d !important; border-color: rgba(245,158,11,.25) !important; }
[data-theme="dark"] span[class*="bg-red-100"]     { background: rgba(239,68,68,.18) !important;   color:#fecaca !important; border-color: rgba(239,68,68,.25) !important; }
[data-theme="dark"] span[class*="bg-gray-100"]    { background: rgba(148,163,184,.18) !important; color:#d2dae6 !important; border-color: rgba(148,163,184,.25) !important; }
[data-theme="dark"] .badge, [data-theme="dark"] .chip { background: var(--surface-3) !important; color: var(--text-2) !important; border-color: var(--border) !important; }

[data-theme="dark"] .btn-ghost,
[data-theme="dark"] .btn-chip,
[data-theme="dark"] a.border,
[data-theme="dark"] button.border {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
[data-theme="dark"] .btn-ghost:hover,
[data-theme="dark"] .btn-chip:hover,
[data-theme="dark"] a.border:hover,
[data-theme="dark"] button.border:hover {
  background: rgba(255,255,255,.06);
  color: var(--text-1);
  border-color: var(--border);
}

[data-theme="dark"] .bg-green-50 { background-color: rgba(34,197,94,.08) !important; }
[data-theme="dark"] .bg-red-50   { background-color: rgba(239,68,68,.08) !important; }
[data-theme="dark"] .text-green-600 { color:#86efac !important; }
[data-theme="dark"] .text-red-600   { color:#fca5a5 !important; }
[data-theme="dark"] .bg-green-100 { background-color: rgba(34,197,94,.18) !important; }
[data-theme="dark"] .bg-red-100   { background-color: rgba(239,68,68,.18) !important; }

[data-theme="dark"] .stat-card { background: var(--surface-1) !important; border-color: var(--border) !important; }
[data-theme="dark"] .stat-chip { background: rgba(255,255,255,.06) !important; color: var(--text-2) !important; border-color: var(--border-soft) !important; }
[data-theme="dark"] .link-pill { background: rgba(255,255,255,.08)!important; color: var(--text-2)!important; border-color: var(--border-soft)!important; }

.theme-toggle {
  width: 44px; height: 24px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border);
  position: relative; cursor: pointer; transition: all .25s ease;
}
.theme-toggle::before {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-1); transition: transform .25s ease;
}
[data-theme="dark"] .theme-toggle { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .theme-toggle::before { transform: translateX(20px); }

/* Glass utility */
.glass {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  backdrop-filter: none;
}
[data-theme="dark"] .glass {
  background: var(--glass);
  border-color: var(--border);
  backdrop-filter: blur(12px);
}
