/* Dark theme remaps for Tailwind utility classes (screen only — print stays light). */
@media screen {
  html.dark {
    color-scheme: dark;
  }

  html.dark body {
    background-color: #0b1220;
    color: #e2e8f0;
  }

  /* Surfaces */
  html.dark .bg-white { background-color: #151d2e; }
  html.dark .bg-slate-50 { background-color: #0b1220; }
  html.dark .bg-slate-50\/50 { background-color: rgb(15 23 42 / 0.55); }
  html.dark .bg-slate-50\/40 { background-color: rgb(15 23 42 / 0.45); }
  html.dark .bg-slate-100 { background-color: #1a2438; }
  html.dark .bg-slate-200\/95 { background-color: rgb(30 41 59 / 0.95); }
  html.dark .hover\:bg-slate-50:hover { background-color: #1a2438; }
  html.dark .hover\:bg-slate-100:hover { background-color: #243044; }
  html.dark .hover\:bg-slate-200:hover { background-color: #334155; }
  html.dark .hover\:bg-slate-300\/90:hover { background-color: rgb(51 65 85 / 0.9); }
  html.dark .hover\:file\:bg-slate-200:hover::file-selector-button { background-color: #334155; }

  /* Darker slate buttons need lift in dark UI */
  html.dark .bg-slate-800 { background-color: #475569; }
  html.dark .hover\:bg-slate-700:hover { background-color: #64748b; }

  /* Borders & dividers */
  html.dark .border-slate-100,
  html.dark .border-slate-200 { border-color: #2a3548; }
  html.dark .border-slate-300 { border-color: #3d4b63; }
  html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color: #2a3548; }

  /* Text */
  html.dark .text-slate-900 { color: #f1f5f9; }
  html.dark .text-slate-800 { color: #e2e8f0; }
  html.dark .text-slate-700 { color: #cbd5e1; }
  html.dark .text-slate-600 { color: #94a3b8; }
  html.dark .text-slate-500 { color: #94a3b8; }
  html.dark .text-slate-400 { color: #64748b; }
  html.dark .hover\:text-slate-700:hover { color: #e2e8f0; }
  html.dark .hover\:text-slate-600:hover { color: #cbd5e1; }
  html.dark .hover\:text-indigo-900:hover { color: #c7d2fe; }

  /* Soft accent fills */
  html.dark .bg-indigo-50,
  html.dark .bg-indigo-50\/60,
  html.dark .bg-indigo-50\/40 { background-color: rgb(49 46 129 / 0.35); }
  html.dark .hover\:bg-indigo-50\/40:hover { background-color: rgb(49 46 129 / 0.45); }
  html.dark .hover\:bg-indigo-100:hover { background-color: rgb(67 56 202 / 0.45); }
  html.dark .text-indigo-700,
  html.dark .text-indigo-600 { color: #a5b4fc; }
  html.dark .border-indigo-200,
  html.dark .border-indigo-100 { border-color: #4338ca; }
  html.dark .ring-indigo-200,
  html.dark .ring-indigo-300 { --tw-ring-color: #6366f1; }

  html.dark .bg-emerald-50,
  html.dark .bg-emerald-50\/70 { background-color: rgb(6 78 59 / 0.35); }
  html.dark .bg-emerald-200\/90 { background-color: rgb(6 95 70 / 0.7); }
  html.dark .text-emerald-800,
  html.dark .text-emerald-700 { color: #6ee7b7; }
  html.dark .border-emerald-300,
  html.dark .border-emerald-200 { border-color: #059669; }

  html.dark .bg-amber-50,
  html.dark .bg-amber-50\/40 { background-color: rgb(120 53 15 / 0.35); }
  html.dark .bg-amber-200\/80 { background-color: rgb(146 64 14 / 0.55); }
  html.dark .text-amber-950,
  html.dark .text-amber-900,
  html.dark .text-amber-900\/90,
  html.dark .text-amber-800,
  html.dark .text-amber-700 { color: #fcd34d; }
  html.dark .border-amber-300,
  html.dark .border-amber-200,
  html.dark .border-amber-100 { border-color: #b45309; }
  html.dark .ring-amber-200,
  html.dark .ring-amber-300 { --tw-ring-color: #f59e0b; }

  html.dark .bg-rose-50 { background-color: rgb(136 19 55 / 0.3); }
  html.dark .text-rose-600 { color: #fb7185; }

  html.dark .bg-red-50 { background-color: rgb(127 29 29 / 0.4); }
  html.dark .border-red-300 { border-color: #f87171; }
  html.dark .text-red-800 { color: #fecaca; }
  html.dark .text-red-500 { color: #f87171; }
  html.dark .hover\:text-red-700:hover { color: #fca5a5; }

  /* Form controls */
  html.dark input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
  html.dark select,
  html.dark textarea {
    background-color: #0b1220;
    color: #e2e8f0;
    border-color: #3d4b63;
  }
  html.dark input[type="file"] {
    color: #94a3b8;
  }
  html.dark input[type="file"]::file-selector-button {
    background-color: #1a2438;
    color: #e2e8f0;
    border: 0;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    margin-right: 0.5rem;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
  }
  html.dark code.bg-slate-100,
  html.dark .bg-slate-100 { background-color: #1a2438; }
  html.dark code.bg-indigo-100\/80 { background-color: rgb(49 46 129 / 0.55); }

  /* Soft course palette chips / calendar blocks */
  html.dark .bg-blue-50 { background-color: rgb(30 58 138 / 0.45); }
  html.dark .border-blue-200 { border-color: #1d4ed8; }
  html.dark .text-blue-800 { color: #bfdbfe; }
  html.dark .hover\:bg-blue-100:hover { background-color: rgb(30 64 175 / 0.55); }

  html.dark .bg-emerald-50 { background-color: rgb(6 78 59 / 0.45); }
  html.dark .border-emerald-200 { border-color: #059669; }
  html.dark .hover\:bg-emerald-100:hover { background-color: rgb(6 95 70 / 0.55); }

  html.dark .bg-indigo-50 { background-color: rgb(49 46 129 / 0.45); }
  html.dark .hover\:bg-indigo-100:hover { background-color: rgb(67 56 202 / 0.5); }
  html.dark .text-indigo-800 { color: #c7d2fe; }

  html.dark .bg-amber-50 { background-color: rgb(120 53 15 / 0.45); }
  html.dark .border-amber-200 { border-color: #d97706; }
  html.dark .hover\:bg-amber-100:hover { background-color: rgb(146 64 14 / 0.55); }

  html.dark .bg-rose-50 { background-color: rgb(136 19 55 / 0.4); }
  html.dark .border-rose-200 { border-color: #e11d48; }
  html.dark .text-rose-800 { color: #fecdd3; }
  html.dark .hover\:bg-rose-100:hover { background-color: rgb(159 18 57 / 0.5); }

  html.dark .bg-purple-50 { background-color: rgb(88 28 135 / 0.4); }
  html.dark .border-purple-200 { border-color: #9333ea; }
  html.dark .text-purple-800 { color: #e9d5ff; }
  html.dark .hover\:bg-purple-100:hover { background-color: rgb(107 33 168 / 0.5); }

  html.dark .bg-cyan-50 { background-color: rgb(21 94 117 / 0.4); }
  html.dark .border-cyan-200 { border-color: #0891b2; }
  html.dark .text-cyan-800 { color: #a5f3fc; }
  html.dark .hover\:bg-cyan-100:hover { background-color: rgb(14 116 144 / 0.5); }

  /* Sticky unit headers */
  html.dark .unit-header {
    background-color: rgb(30 41 59 / 0.95);
    color: #94a3b8;
    border-color: #3d4b63;
  }

  /* Theme toggle */
  #theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(255 255 255 / 0.2);
    background: rgb(15 23 42 / 0.35);
    color: #e0e7ff;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  }
  #theme-toggle:hover {
    background: rgb(15 23 42 / 0.55);
    border-color: rgb(255 255 255 / 0.35);
  }
  #theme-toggle:active { transform: scale(0.96); }
  #theme-toggle svg { width: 1rem; height: 1rem; }
  #theme-toggle .icon-sun { display: none; }
  #theme-toggle .icon-moon { display: block; }
  html.dark #theme-toggle .icon-sun { display: block; }
  html.dark #theme-toggle .icon-moon { display: none; }
}
