/* SBUSH Studiology 2.4 — Orbit Design System
   Visual-only layer: preserves the existing HTML structure and app behaviour. */
:root {
  color-scheme: dark;
  --bg: #080d19;
  --paper: rgba(17, 24, 42, .88);
  --paper-2: #111a2c;
  --ink: #edf2ff;
  --muted: #98a5bd;
  --line: rgba(143, 164, 207, .16);
  --navy: #0b1121;
  --navy-2: #141d34;
  --cyan: #46d7e8;
  --cyan-soft: rgba(70, 215, 232, .12);
  --mint: rgba(64, 214, 164, .14);
  --violet: rgba(139, 111, 255, .16);
  --amber: rgba(255, 190, 92, .14);
  --shadow: 0 18px 55px rgba(0, 0, 0, .24);
  --radius: 20px;
  --accent: #8b6fff;
  --accent-2: #39d5e7;
  --focus-ring: 0 0 0 3px rgba(70, 215, 232, .2);
}

html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 78% 2%, rgba(83, 66, 180, .17), transparent 34rem),
    radial-gradient(ellipse at 7% 42%, rgba(26, 158, 187, .10), transparent 32rem),
    linear-gradient(145deg, #080d19 0%, #0b1020 48%, #080d19 100%);
  background-attachment: fixed;
  font-family: 'DM Sans', 'Noto Sans Bengali', sans-serif;
  line-height: 1.58;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .22;
  background-image: linear-gradient(rgba(130, 151, 201, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(130, 151, 201, .045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
}
::selection { color: #07111d; background: #70e4ed; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(5, 10, 20, .42); }
::-webkit-scrollbar-thumb { background: rgba(126, 145, 189, .32); border: 2px solid transparent; background-clip: padding-box; border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: rgba(119, 132, 223, .58); background-clip: padding-box; }
button, input, select, textarea { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { color: var(--ink); }
.muted, .fine-print { color: var(--muted) !important; }
.eyebrow { color: #80d9e5; letter-spacing: .16em; }
.hidden { display: none !important; }

/* Auth: the first impression */
.auth-screen {
  min-height: 100svh;
  background: transparent;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
  gap: 0;
}
.auth-art {
  min-height: 100svh;
  isolation: isolate;
  padding: clamp(30px, 5vw, 76px);
  background:
    radial-gradient(circle at 72% 73%, rgba(69, 210, 230, .16), transparent 20rem),
    radial-gradient(circle at 22% 24%, rgba(132, 103, 255, .24), transparent 27rem),
    linear-gradient(145deg, #0c1429 0%, #101b34 56%, #0a1427 100%);
  border-right: 1px solid rgba(143, 164, 207, .12);
}
.auth-art::before, .auth-art::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; z-index: -1; }
.auth-art::before { width: 520px; height: 520px; right: -190px; top: 11%; border: 1px solid rgba(96, 220, 236, .16); box-shadow: 0 0 0 36px rgba(96, 220, 236, .025), 0 0 0 82px rgba(139, 111, 255, .025); }
.auth-art::after { width: 330px; height: 330px; right: -92px; top: 26%; border: 1px solid rgba(139, 111, 255, .22); }
.brand-mark {
  background: linear-gradient(145deg, rgba(132, 103, 255, .24), rgba(70, 215, 232, .11));
  border: 1px solid rgba(116, 200, 255, .48);
  color: #8eeaf1;
  border-radius: 16px;
  box-shadow: 0 0 30px rgba(95, 106, 255, .18), inset 0 1px rgba(255,255,255,.1);
}
.brand-name { color: #f2f5ff; letter-spacing: .2em; }
.brand-sub { color: #8ba9c5; }
.auth-copy { margin-top: clamp(90px, 16vh, 190px); max-width: 600px; }
.auth-copy h1 { color: #f5f7ff; font-size: clamp(42px, 5.2vw, 72px); line-height: 1.06; letter-spacing: -.055em; }
.auth-copy h1 em { background: linear-gradient(90deg, #a18aff 0%, #55d8e8 70%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-copy p { color: #aebbd3; font-size: 16px; max-width: 440px; line-height: 1.8; }
.auth-copy .eyebrow { color: #7cdef0; }
.auth-orbit { border-color: rgba(100, 210, 235, .18); box-shadow: 0 0 70px rgba(62, 149, 224, .09); }
.auth-orbit:before, .auth-orbit:after { border-color: rgba(132, 119, 255, .18); }
.orbit-core { background: linear-gradient(145deg, #18264a, #143c4b); border-color: rgba(104, 229, 240, .52); color: #9aeeef; box-shadow: 0 0 55px rgba(64, 211, 232, .22), inset 0 0 30px rgba(128, 104, 255, .12); }
.orbit-chip { background: rgba(16, 30, 55, .88); border-color: rgba(104, 220, 236, .32); color: #c1eaf1; backdrop-filter: blur(10px); }
.auth-foot { color: #8496b4; }
.auth-panel {
  padding: clamp(38px, 6vw, 86px);
  background: linear-gradient(145deg, rgba(12, 17, 31, .86), rgba(11, 17, 31, .96));
  color: var(--ink);
}
.auth-panel-top { left: clamp(38px, 6vw, 86px); right: clamp(38px, 6vw, 86px); color: var(--muted); }
.auth-card h2 { font-size: clamp(28px, 3vw, 36px); letter-spacing: -.045em; }
.auth-card > p { color: var(--muted); line-height: 1.7; }
.auth-note { color: #8998b1; }
.mini-pill { color: #a8b8d3; background: rgba(132, 151, 196, .09); border-color: var(--line); }
.form-stack label, .form-grid label, .inline-form label, .sleep-field { color: #c0cbe0; }
.form-stack input, .form-stack select, .form-stack textarea,
.form-grid input, .form-grid select, .form-grid textarea,
.inline-form input, .inline-form select, .inline-form textarea,
.date-field, .filter-select, .resource-tools input, .resource-tools select,
.exam-config-grid select, .board-archive-filters select, .exam-source-mode-row select,
.exam-chapter-search, .chapter-row select, .date-switch input {
  color: #ecf2ff;
  background: rgba(12, 19, 35, .86);
  border: 1px solid rgba(142, 162, 205, .2);
  border-radius: 12px;
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
input::placeholder, textarea::placeholder { color: #697995; opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(76, 214, 233, .75) !important; box-shadow: var(--focus-ring) !important; }
select option, select optgroup { background: #121b30; color: #edf2ff; }

/* Workspace frame */
.app-shell { min-height: 100vh; }
.sidebar {
  width: 266px;
  padding: 25px 16px 17px;
  color: #eaf1ff;
  background: linear-gradient(180deg, rgba(13, 20, 39, .98), rgba(9, 15, 29, .99));
  border-right: 1px solid rgba(139, 160, 208, .15);
  box-shadow: 18px 0 55px rgba(0, 0, 0, .16);
  backdrop-filter: blur(18px);
}
.side-brand { padding: 0 9px 31px; }
.brand-mark.small { box-shadow: 0 0 24px rgba(117, 100, 255, .2); }
.sidebar .brand-name { color: #f3f5ff; }
.sidebar .brand-sub { color: #8296b9; }
.side-label { color: #6e80a5; }
.main-nav { gap: 6px; }
.nav-item {
  color: #9baac6;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 12px;
  transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}
.nav-item:hover { color: #f2f6ff; background: rgba(88, 111, 174, .13); border-color: rgba(126, 150, 207, .13); transform: translateX(2px); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(100deg, rgba(129, 100, 255, .22), rgba(56, 196, 224, .10));
  border-color: rgba(130, 139, 255, .25);
  box-shadow: inset 3px 0 #8b78ff, 0 7px 24px rgba(64, 72, 170, .12);
}
.nav-icon { color: #7edce9; }
.side-quote { background: linear-gradient(145deg, rgba(91, 109, 175, .17), rgba(42, 147, 165, .10)); border: 1px solid rgba(139, 161, 213, .13); }
.side-quote p { color: #9eacc7; }
.profile-mini { border-color: rgba(139, 160, 208, .16); }
.profile-text span { color: #8394b5; }
.avatar, .top-avatar { background: linear-gradient(135deg, #8d78ff, #45cde0); color: #091326; box-shadow: 0 5px 18px rgba(79, 154, 236, .18); }
.profile-mini .icon-btn { color: #b5c2da; border-color: rgba(139, 160, 208, .2); }
.main-area { margin-left: 266px; min-width: 0; }
.topbar {
  height: 70px;
  padding: 0 clamp(18px, 3vw, 42px);
  background: rgba(10, 16, 30, .78);
  border-bottom: 1px solid rgba(139, 160, 208, .15);
  backdrop-filter: blur(22px) saturate(140%);
}
.breadcrumb { color: #7f8eab; }
.breadcrumb strong { color: #e7edff; }
.breadcrumb b { color: #566887; }
.top-actions { gap: 11px; }
.date-chip { color: #aab8d2; background: rgba(121, 141, 190, .10); border: 1px solid rgba(139, 160, 208, .13); }
.language-btn, .icon-btn { color: #dce6fb; background: rgba(24, 34, 58, .84); border: 1px solid rgba(139, 160, 208, .2); transition: .2s ease; }
.language-btn:hover, .icon-btn:hover { border-color: rgba(94, 215, 231, .5); color: #8fe8ef; transform: translateY(-1px); }
.content-wrap { width: 100%; max-width: 1600px; padding: clamp(22px, 3vw, 42px) clamp(17px, 3vw, 42px) 52px; }
.page-heading { margin-bottom: 25px; }
.page-heading h1 { font-size: clamp(27px, 2.7vw, 38px); letter-spacing: -.05em; }
.page-heading p { color: #9eacc6; font-size: 13px; line-height: 1.65; }
.view { animation: orbitReveal .32s cubic-bezier(.2,.75,.25,1); }
@keyframes orbitReveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Page personalities: each area receives its own restrained ambient glow */
#view-dashboard { --view-glow: rgba(93, 115, 255, .12); }
#view-planner { --view-glow: rgba(58, 202, 208, .10); }
#view-focus { --view-glow: rgba(66, 216, 177, .11); }
#view-chapters { --view-glow: rgba(155, 112, 255, .12); }
#view-exams { --view-glow: rgba(72, 160, 255, .12); }
#view-groups { --view-glow: rgba(230, 143, 255, .10); }
#view-resources { --view-glow: rgba(73, 200, 173, .10); }
#view-study-ai { --view-glow: rgba(123, 105, 255, .15); }
#view-settings { --view-glow: rgba(80, 177, 227, .10); }
#view-habits { --view-glow: rgba(236, 178, 92, .10); }
.view.active { position: relative; }
.view.active::before {
  content: ''; position: absolute; width: min(620px, 80vw); height: 380px; top: -95px; right: -90px;
  background: radial-gradient(ellipse, var(--view-glow, rgba(80,130,220,.08)), transparent 68%);
  pointer-events: none; z-index: -1;
}

/* Core surfaces */
.panel, .stat-card {
  position: relative;
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(145deg, rgba(19, 27, 47, .92), rgba(14, 22, 39, .92));
  border: 1px solid rgba(143, 164, 207, .15);
  border-radius: 19px;
  box-shadow: 0 14px 42px rgba(0, 0, 0, .16), inset 0 1px rgba(255,255,255,.025);
}
.panel { padding: clamp(16px, 1.8vw, 23px); }
.panel::before, .stat-card::before {
  content: ''; position: absolute; inset: 0 12% auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(141, 161, 255, .25), rgba(80, 220, 235, .2), transparent);
  pointer-events: none;
}
.panel-head { gap: 14px; margin-bottom: 18px; }
.panel-head h3 { color: #eef3ff; letter-spacing: -.025em; }
.panel-head p { color: #91a1bd; font-size: 11px; }
.stat-card { min-height: 116px; padding: 18px 19px; transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease; }
.stat-card:hover { transform: translateY(-3px); border-color: rgba(109, 177, 235, .3); box-shadow: 0 18px 45px rgba(0,0,0,.22), 0 0 25px rgba(92, 112, 231, .06); }
.stat-head { color: #8d9bb8; }
.stat-value { color: #f1f5ff; font-size: 28px; letter-spacing: -.055em; }
.stat-foot { color: #8d9bb8; }
.stat-icon { border: 1px solid rgba(145, 166, 219, .14); }
.stat-icon.cyan { color: #6be1ef; background: rgba(55, 205, 224, .12); }
.stat-icon.mint { color: #6ce3b8; background: rgba(55, 211, 155, .12); }
.stat-icon.violet { color: #b29bff; background: rgba(147, 112, 255, .14); }
.stat-icon.amber { color: #ffc978; background: rgba(255, 190, 92, .12); }
.hero-banner, .exam-arena-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: #f6f8ff;
  background: linear-gradient(112deg, #171b3b 0%, #172750 48%, #103a4b 100%);
  border: 1px solid rgba(142, 145, 255, .34);
  border-radius: 23px;
  box-shadow: 0 18px 48px rgba(25, 35, 105, .19), inset 0 1px rgba(255,255,255,.07);
}
.hero-banner { min-height: 182px; padding: clamp(23px, 3vw, 34px); margin-bottom: 19px; }
.hero-banner::before, .exam-arena-hero::before {
  content: ''; position: absolute; z-index: -1; inset: 0;
  background: radial-gradient(circle at 82% 30%, rgba(89, 218, 235, .22), transparent 19rem), radial-gradient(circle at 58% 120%, rgba(148, 105, 255, .26), transparent 24rem);
}
.hero-banner::after { content: ''; position: absolute; width: 340px; height: 340px; right: 8%; top: -200px; border: 1px solid rgba(147, 205, 255, .16); border-radius: 50%; box-shadow: 0 0 0 34px rgba(143, 164, 255, .035), 0 0 0 72px rgba(143, 164, 255, .025); z-index: -1; }
.banner-tag, .exam-arena-hero .eyebrow { color: #93edf2; }
.hero-banner h2 { color: #fbfcff; font-size: clamp(26px, 2.8vw, 36px); }
.hero-banner p, .exam-arena-hero p { color: #c2cce4; }
.banner-graphic { filter: drop-shadow(0 0 26px rgba(85, 222, 234, .17)); }
.banner-ring { border-color: rgba(134, 211, 241, .32); }
.banner-stamp { background: linear-gradient(145deg, #a693ff, #56dce8); color: #111b36; box-shadow: 0 0 0 10px rgba(120, 174, 255, .10), 0 0 38px rgba(76, 210, 232, .24); }
.quick-actions { gap: 12px; }
.quick-action {
  color: #eaf0ff; background: linear-gradient(145deg, rgba(22, 32, 55, .92), rgba(15, 23, 42, .95));
  border: 1px solid rgba(141, 160, 206, .16); border-radius: 16px; box-shadow: 0 10px 28px rgba(0,0,0,.13);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.quick-action:hover { transform: translateY(-3px); border-color: rgba(92, 212, 230, .42); box-shadow: 0 15px 35px rgba(0,0,0,.2), 0 0 22px rgba(62, 198, 224, .07); }
.quick-action strong { color: #eaf0ff; }
.quick-action small { color: #93a2bf; }
.quick-action-icon { background: linear-gradient(145deg, rgba(131, 105, 255, .2), rgba(52, 197, 222, .14)); border: 1px solid rgba(125, 160, 255, .16); color: #8ce9f1; }

/* Buttons and links */
.btn {
  border-radius: 12px;
  padding: 11px 17px;
  font-weight: 800;
  letter-spacing: -.01em;
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn:active { transform: translateY(0); }
.btn-primary {
  color: #09152a;
  background: linear-gradient(105deg, #9a7bff 0%, #6b9dff 46%, #4bd7e6 100%);
  box-shadow: 0 9px 25px rgba(107, 123, 255, .24), inset 0 1px rgba(255,255,255,.34);
}
.btn-primary:hover { background: linear-gradient(105deg, #a58aff 0%, #78a8ff 46%, #5ce2ed 100%); box-shadow: 0 12px 32px rgba(107, 123, 255, .3); }
.btn-primary span { color: #0c1b32; }
.btn-soft { color: #a6edf0; background: rgba(49, 187, 202, .12); border: 1px solid rgba(75, 210, 223, .2); }
.btn-ghost { color: #aab8d2; background: rgba(126, 145, 188, .06); border: 1px solid rgba(139, 160, 208, .2); }
.text-btn, .link-btn { color: #80dfe9; }
.text-btn:hover, .link-btn:hover { color: #b5f3f4; }

/* Tasks, progress and planner */
.task-item, .exam-row, .week-day, .chapter-row, .quiz-card, .group-card, .resource-card,
.submission-item, .mini-session, .summary-chip, .builder-question, .attempt-question,
.privacy-note, .gentle-note, .today-focus, .habit-row, .prayer-grid label,
.board-archive-summary, .exam-bank-summary, .exam-source-notice, .exam-blueprint-note {
  color: #e7eefc;
  background: rgba(11, 18, 34, .72);
  border: 1px solid rgba(136, 158, 207, .15);
  border-radius: 13px;
}
.task-item { padding: 12px 13px; }
.task-content strong, .exam-info strong, .chapter-row strong, .quiz-card strong, .group-card-info strong, .resource-card strong { color: #ecf2ff; }
.task-content small, .exam-info small, .chapter-row small, .quiz-card small, .group-card-info small, .resource-card small { color: #93a2bf; }
.task-time, .exam-score { color: #aebbd4; }
.task-check { border-color: #607596; }
.task-check:checked { background: #3ecda9; border-color: #3ecda9; }
.progress-bar { background: rgba(114, 135, 179, .16); }
.progress-bar span { background: linear-gradient(90deg, #8870ff, #50dbe5); box-shadow: 0 0 12px rgba(81, 216, 229, .24); }
.progress-percent { color: #a8b5ce; }
.planner-layout { gap: 17px; }
.planner-form-panel, .planner-list-panel { min-height: 0; }
.step-dot { background: rgba(135, 111, 255, .17); color: #b4a3ff; border: 1px solid rgba(139, 111, 255, .2); }
.date-switch input { color: #eaf0ff; background: rgba(12, 19, 35, .86); }
.week-day { background: rgba(11, 18, 34, .76); color: #91a2bf; }
.week-day.selected { background: linear-gradient(145deg, rgba(133, 109, 255, .28), rgba(50, 191, 217, .16)); border-color: rgba(128, 145, 255, .4); color: #fff; }
.week-day.selected span { color: #c7dfff; }

/* Focus room */
.timer-panel { background: radial-gradient(circle at 50% 48%, rgba(41, 172, 185, .11), transparent 19rem), linear-gradient(145deg, rgba(18, 30, 49, .96), rgba(12, 20, 36, .96)); }
.timer-mode { color: #80e4e7; background: rgba(55, 196, 194, .1); border: 1px solid rgba(70, 210, 207, .18); }
.timer-ring { border-color: rgba(77, 212, 226, .2); box-shadow: inset 0 0 0 1px rgba(66, 207, 217, .12), 0 0 0 10px rgba(74, 188, 209, .045), 0 0 55px rgba(56, 195, 213, .08); }
.timer-ring::before { border-top-color: #51dce7; filter: drop-shadow(0 0 8px rgba(81, 220, 231, .55)); }
.timer-inner { background: radial-gradient(circle, rgba(50, 189, 205, .11), rgba(12, 20, 37, .94) 68%); }
.timer-inner span { color: #effaff; }
.timer-inner small, .timer-hint { color: #94a5bf; }
.timer-controls { gap: 9px; }
.focus-side { background: linear-gradient(145deg, rgba(17, 30, 48, .95), rgba(12, 20, 36, .95)); }
.today-focus { padding: 14px; }

/* Chapter mastery */
.chapter-summary { gap: 12px; }
.summary-chip { background: linear-gradient(145deg, rgba(26, 35, 65, .85), rgba(15, 23, 42, .92)); }
.chapter-row { padding: 13px 14px; }
.chapter-row select { color: #eaf0ff; background: rgba(13, 21, 38, .94); }
.confidence { color: #9faeca; }
.delete-mini { color: #97a7c5; }

/* Exam Arena — preserve all source/provenance signals */
.exam-arena-hero { padding: 25px 28px; }
.exam-hero-mark { background: rgba(255,255,255,.06); border-color: rgba(180, 193, 255, .2); }
.exam-hero-mark strong { color: #9aebf3; }
.exam-hero-mark span { color: #c6d1eb; }
.exam-builder-panel { background: linear-gradient(145deg, rgba(19, 27, 48, .96), rgba(13, 21, 38, .96)); }
.exam-config-grid label, .exam-source-mode-row label { color: #b8c5dd; }
.exam-config-grid select, .exam-source-mode-row select { color: #eaf1ff; background: #111a2e; }
.chapter-picker-head strong { color: #edf2ff; }
.chapter-picker-head small, .exam-source-mode-row small { color: #93a2bf; }
.exam-chapter-search { color: #edf2ff; background: #111a2e; }
.exam-chapter-options { gap: 8px; }
.chapter-pick { color: #dfe9ff; background: rgba(12, 20, 37, .8); border: 1px solid rgba(134, 155, 203, .17); border-radius: 12px; transition: .18s ease; }
.chapter-pick:hover { border-color: rgba(91, 214, 230, .42); background: rgba(21, 38, 62, .9); }
.chapter-pick:has(input:checked) { background: linear-gradient(110deg, rgba(130, 102, 255, .19), rgba(53, 191, 214, .11)); border-color: rgba(132, 137, 255, .56); box-shadow: inset 0 0 0 1px rgba(129, 116, 255, .12); }
.chapter-pick-name { color: #e9efff; }
.chapter-pick-count.has-questions { color: #67dfbc; }
.chapter-pick-count.no-questions { color: #ffbb85; }
.exam-bank-summary { background: linear-gradient(105deg, rgba(42, 60, 111, .25), rgba(24, 98, 111, .17)); border-color: rgba(116, 157, 226, .19); }
.exam-bank-summary #exam-available-count { color: #dceaff; }
.exam-availability-subtext { color: #99abc9; }
.exam-bank-note, .exam-honesty-note { color: #94a3bf; }
.exam-blueprint-note { background: rgba(66, 122, 171, .1); color: #a8c5e3; border-color: rgba(78, 162, 218, .18); }
.exam-blueprint-note.is-active { background: rgba(76, 164, 193, .12); color: #aee7eb; }
.exam-source-legend { background: rgba(9, 15, 30, .55); border: 1px solid rgba(139, 158, 203, .12); border-radius: 13px; }
.question-source-badge { border-radius: 999px; }
.source-board, .source-type-chip-board { background: rgba(45, 132, 191, .17); color: #9ed9ff; border-color: rgba(65, 162, 223, .28); }
.source-important { background: rgba(37, 159, 120, .16); color: #8ae8c4; border-color: rgba(54, 199, 148, .25); }
.source-pattern { background: rgba(170, 122, 53, .16); color: #f2cd8c; border-color: rgba(211, 163, 91, .25); }
.source-original, .source-type-chip { background: rgba(133, 115, 183, .16); color: #c6b5ff; border-color: rgba(159, 135, 224, .25); }
.question-source-note { color: #91a2bf; }
.question-source-link { color: #83dce8; }
.quiz-card { background: linear-gradient(145deg, rgba(19, 29, 51, .92), rgba(12, 20, 37, .92)); }
.quiz-card .btn { margin-top: 6px; }
.board-source-card, .board-reference-card, .board-archive-summary { background: rgba(11, 19, 36, .76); border-color: rgba(130, 152, 203, .16); border-radius: 13px; }
.board-source-card strong, .board-reference-card strong, .archive-library-card strong { color: #edf3ff; }
.board-source-card small, .board-reference-card small, .archive-library-card small { color: #9aaac6; }
.board-archive-count { background: rgba(67, 198, 217, .15); color: #8ee8ef; }
.board-archive-filters label { color: #aab8d2; }
.exam-mistakes-panel { border-color: rgba(240, 174, 82, .2); }
.quiz-modal-card { max-height: min(90svh, 920px); overflow: auto; }
.quiz-countdown { color: #9cebf0; background: rgba(44, 172, 190, .12); border: 1px solid rgba(71, 211, 221, .22); }
.quiz-countdown.time-warning { color: #ffd18d; background: rgba(209, 127, 58, .16); }
.quiz-nav-dot { background: rgba(117, 138, 183, .13); color: #afbdd7; border: 1px solid rgba(139, 158, 203, .15); }
.quiz-nav-dot.is-answered { background: rgba(53, 193, 160, .19); color: #8ce8c7; border-color: rgba(53, 193, 160, .3); }
.attempt-option { border-color: rgba(139, 158, 203, .17); background: rgba(17, 26, 46, .82); color: #dfe8fa; }
.attempt-option:hover { background: rgba(44, 66, 104, .55); }

/* Study Circle and resource cards */
.group-card { background: linear-gradient(145deg, rgba(20, 30, 52, .92), rgba(12, 20, 37, .92)); }
.group-symbol { background: linear-gradient(145deg, rgba(134, 108, 255, .2), rgba(54, 194, 219, .14)); color: #9beaf0; }
.group-code { background: rgba(133, 111, 255, .14); color: #c3b3ff; border: 1px dashed rgba(145, 124, 255, .34); }
.privacy-note { padding: 13px; color: #a7b7d2; background: rgba(72, 144, 186, .1); }
.resource-intro { background: linear-gradient(120deg, rgba(23, 38, 62, .97), rgba(15, 47, 58, .92)); }
.resource-intro h2 { color: #eff7ff; }
.resource-intro p { color: #aebed7; }
.resource-count { color: #9ceaf0; background: rgba(57, 190, 204, .13); border: 1px solid rgba(66, 205, 217, .18); border-radius: 15px; }
.resource-count strong { color: #d9fbff; }
.resource-tools input { min-width: 0; padding: 11px 13px; }
.resource-card { background: linear-gradient(145deg, rgba(20, 30, 52, .96), rgba(12, 20, 37, .96)); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.resource-card:hover { transform: translateY(-3px); border-color: rgba(85, 207, 225, .36); box-shadow: 0 16px 35px rgba(0,0,0,.19); }
.resource-card .resource-type { color: #9cafff; background: rgba(131, 111, 255, .14); }
.resource-card p { color: #a7b5cf; }
.resource-card a.resource-open { color: #85e3ec; }
.resource-access { color: #8ce9c2; background: rgba(49, 173, 125, .14); }
.resource-access.caution { color: #f1cb8d; background: rgba(198, 145, 69, .14); }
.resource-tags span { color: #a8b7d1; background: rgba(112, 133, 177, .11); }

/* SBUSH AI */
.ai-welcome { background: linear-gradient(115deg, rgba(31, 29, 72, .97), rgba(16, 44, 65, .96)); border-color: rgba(133, 126, 255, .25); }
.ai-welcome h2 { color: #f1f2ff; }
.ai-welcome p { color: #bac7e0; }
.ai-welcome .eyebrow { color: #9ce8ee; }
.ai-avatar { color: #101a35; background: linear-gradient(140deg, #a58cff, #53dce7); box-shadow: 0 0 30px rgba(116, 117, 255, .2); }
.ai-chat-log { background: rgba(7, 13, 26, .56); border: 1px solid rgba(139, 160, 208, .13); border-radius: 14px; }
.ai-message { color: #e2eaff; }
.ai-message.assistant { background: rgba(56, 91, 128, .2); border: 1px solid rgba(106, 158, 202, .15); }
.ai-message.user { color: #e2faff; background: rgba(48, 110, 128, .34); border: 1px solid rgba(72, 195, 210, .18); }
.ai-prompt { color: #dce7fa; background: rgba(15, 24, 43, .82); border-color: rgba(139, 160, 208, .16); border-radius: 12px; }
.ai-prompt:hover { background: rgba(35, 47, 81, .9); border-color: rgba(91, 211, 228, .4); }
.ai-note, .ai-setup-note { color: #bddbe4; background: rgba(50, 148, 162, .12); border: 1px solid rgba(76, 196, 204, .16); }
.ai-note p, .ai-setup-note p { color: #9db6c9; }
.ai-form textarea { color: #eaf1ff; background: rgba(10, 18, 34, .92); border: 1px solid rgba(139, 160, 208, .18); border-radius: 12px; }

/* Habits and settings */
.habit-row { background: rgba(10, 18, 33, .62); }
.habit-row strong { color: #ebf1ff; }
.habit-row small { color: #97a7c3; }
.habit-row input, .prayer-grid input { accent-color: #58d6df; }
.prayer-grid label { background: rgba(10, 18, 33, .7); color: #dfe9fc; }
.gentle-note { color: #a8b8d2; background: rgba(61, 135, 117, .1); }
.profile-account-id { background: rgba(11, 18, 34, .68); border-color: rgba(139, 160, 208, .16); }
.profile-account-id span, .profile-account-id small { color: #94a5c0; }
.profile-account-id strong { color: #e8efff; }
.settings-tip { color: #a8b8d2; background: rgba(65, 151, 170, .1); border: 1px solid rgba(73, 188, 204, .15); border-radius: 12px; padding: 13px; }
.private-tag { color: #8fe9d0; background: rgba(50, 195, 150, .12); border: 1px solid rgba(50, 195, 150, .2); }

/* Modal, footer, feedback */
.modal-backdrop { background: rgba(3, 7, 17, .78); backdrop-filter: blur(12px); }
.modal-card { color: #edf2ff; background: linear-gradient(145deg, #18213a, #10192c); border: 1px solid rgba(143, 164, 207, .2); border-radius: 21px; box-shadow: 0 30px 100px rgba(0,0,0,.48), 0 0 45px rgba(96, 94, 224, .1); }
.modal-card h2 { color: #f1f5ff; }
.modal-card > p { color: #a7b5ce; }
.modal-icon { color: #9aeaf0; background: rgba(65, 197, 214, .14); }
.recovery-code { color: #a9eff1; background: rgba(9, 16, 31, .8); border-color: rgba(81, 201, 215, .34); }
.toast { color: #f5f7ff; background: #182442; border: 1px solid rgba(142, 162, 211, .2); box-shadow: 0 16px 40px rgba(0,0,0,.28); }
.app-footer { color: #7888a6; border-color: rgba(139, 160, 208, .14); }

/* Small touches: accessible focus, subtle motion, responsive layout */
:focus-visible { outline: 2px solid #62dbe7; outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .panel { transition: border-color .2s ease, box-shadow .2s ease; }
  .panel:hover { border-color: rgba(125, 157, 225, .23); }
}
@media (max-width: 1150px) {
  .sidebar { width: 250px; }
  .main-area { margin-left: 250px; }
  .content-wrap { padding: 25px 24px 42px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .sidebar { width: min(290px, 86vw); transform: translateX(-105%); box-shadow: 24px 0 70px rgba(0,0,0,.42); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .mobile-menu { display: inline-grid; }
  .topbar { height: 62px; padding: 0 18px; }
  .content-wrap { padding: 23px 19px 38px; }
  .planner-layout, .focus-layout, .dashboard-grid, .exam-tools-grid, .group-create-grid, .habits-grid { grid-template-columns: 1fr; }
  .ai-layout { grid-template-columns: 1fr; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-art { min-height: 390px; padding: 30px 7vw; }
  .auth-copy { margin-top: 62px; }
  .auth-orbit { width: 190px; height: 190px; right: 5vw; bottom: 7%; opacity: .52; }
  .auth-orbit:before { inset: 20px; }
  .auth-orbit:after { inset: 43px; }
  .orbit-core { width: 72px; height: 72px; font-size: 30px; }
  .auth-panel { min-height: 500px; padding: 68px 8vw 54px; }
  .auth-panel-top { top: 22px; left: 8vw; right: 8vw; }
  .banner-graphic { opacity: .6; }
}
@media (max-width: 560px) {
  body { font-size: 14px; }
  .content-wrap { padding: 18px 13px 28px; }
  .topbar { height: 58px; padding: 0 12px; }
  .breadcrumb { font-size: 10px; gap: 7px; }
  .top-actions { gap: 6px; }
  .language-btn { padding: 7px 8px; font-size: 11px; }
  .top-avatar { display: none; }
  .date-chip { display: none; }
  .page-heading { align-items: flex-start; gap: 10px; }
  .page-heading h1 { font-size: 25px; }
  .page-heading p { font-size: 12px; }
  .page-heading > .btn { font-size: 10px; padding: 9px 11px; }
  .hero-banner { min-height: 156px; padding: 21px 19px; }
  .hero-banner h2 { font-size: 24px; max-width: 290px; }
  .hero-banner p { font-size: 11px; max-width: 260px; }
  .banner-graphic { position: absolute; right: -55px; opacity: .25; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .quick-action { min-height: 68px; padding: 10px; gap: 8px; }
  .quick-action-icon { width: 32px; height: 32px; flex-basis: 32px; }
  .quick-action strong { font-size: 11px; }
  .quick-action small { font-size: 9px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { padding: 12px; min-height: 100px; }
  .stat-value { font-size: 21px; }
  .stat-head { font-size: 8px; }
  .panel { padding: 14px; border-radius: 15px; }
  .panel-head { gap: 8px; }
  .panel-head h3 { font-size: 15px; }
  .panel-head p { font-size: 10px; }
  .form-grid { gap: 10px; }
  .form-grid .span-2 { grid-column: span 2; }
  .inline-form { grid-template-columns: 1fr; }
  .chapter-row { grid-template-columns: 1fr auto; gap: 8px; }
  .chapter-row > div:nth-child(2) { grid-column: span 2; grid-row: 2; }
  .chapter-row select { grid-column: 1; }
  .delete-mini { grid-column: 2; grid-row: 1; }
  .quiz-list, .group-list, .resource-grid { grid-template-columns: 1fr; }
  .resource-form { grid-template-columns: 1fr; }
  .resource-intro { align-items: flex-start; padding: 17px; }
  .resource-count { min-width: 72px; padding: 9px; }
  .resource-count strong { font-size: 21px; }
  .timer-ring { width: 220px; height: 220px; margin: 28px 0 22px; }
  .timer-inner span { font-size: 27px; }
  .timer-controls { flex-wrap: wrap; justify-content: center; gap: 7px; }
  .timer-controls .btn { padding: 9px 11px; font-size: 11px; }
  .prayer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .prayer-grid button { grid-column: span 3; }
  .board-archive-filters { grid-template-columns: 1fr; }
  .board-archive-grid { grid-template-columns: 1fr; }
  .exam-config-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-arena-hero { padding: 18px; }
  .exam-hero-mark { flex-basis: 78px; min-height: 76px; }
  .exam-hero-mark strong { font-size: 24px; }
  .app-footer { padding: 13px; font-size: 8px; }
  .auth-art { min-height: 320px; }
  .auth-copy { margin-top: 42px; }
  .auth-copy h1 { font-size: 36px; }
  .auth-copy p { font-size: 13px; max-width: 300px; }
  .auth-orbit { width: 140px; height: 140px; right: -16px; bottom: 7%; }
  .auth-orbit:before { inset: 15px; }
  .auth-orbit:after { inset: 32px; }
  .orbit-core { width: 55px; height: 55px; font-size: 24px; }
  .auth-panel { padding: 60px 7vw 46px; }
  .auth-links { flex-wrap: wrap; }
}

/* Light theme remains a full first-class option when the theme control is used. */
body:not(.dark) {
  color-scheme: light;
  --bg: #f1f4fb;
  --paper: rgba(255, 255, 255, .94);
  --paper-2: #f7f9fd;
  --ink: #172239;
  --muted: #68768d;
  --line: rgba(48, 67, 104, .13);
  --shadow: 0 14px 38px rgba(31, 49, 82, .08);
  background: radial-gradient(ellipse at 78% 2%, rgba(132, 115, 255, .12), transparent 34rem), radial-gradient(ellipse at 7% 42%, rgba(26, 158, 187, .07), transparent 32rem), linear-gradient(145deg, #f5f7fc, #eef2fa);
}
body:not(.dark)::before { opacity: .36; background-image: linear-gradient(rgba(91, 111, 160, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(91, 111, 160, .055) 1px, transparent 1px); }
body:not(.dark) .auth-screen { background: #fbfcff; }
body:not(.dark) .auth-panel { background: linear-gradient(145deg, #fff, #f6f8fd); }
body:not(.dark) .auth-card h2, body:not(.dark) .auth-panel { color: #172239; }
body:not(.dark) .auth-card > p, body:not(.dark) .auth-note { color: #6d7a91; }
body:not(.dark) .auth-panel-top { color: #72809a; }
body:not(.dark) .form-stack label, body:not(.dark) .form-grid label, body:not(.dark) .inline-form label, body:not(.dark) .sleep-field { color: #53627d; }
body:not(.dark) .form-stack input, body:not(.dark) .form-stack select, body:not(.dark) .form-stack textarea,
body:not(.dark) .form-grid input, body:not(.dark) .form-grid select, body:not(.dark) .form-grid textarea,
body:not(.dark) .inline-form input, body:not(.dark) .inline-form select, body:not(.dark) .inline-form textarea,
body:not(.dark) .date-field, body:not(.dark) .filter-select, body:not(.dark) .resource-tools input, body:not(.dark) .resource-tools select,
body:not(.dark) .exam-config-grid select, body:not(.dark) .board-archive-filters select, body:not(.dark) .exam-source-mode-row select,
body:not(.dark) .exam-chapter-search, body:not(.dark) .chapter-row select, body:not(.dark) .date-switch input {
  color: #1b2944; background: #fff; border-color: rgba(49, 68, 105, .16);
}
body:not(.dark) input::placeholder, body:not(.dark) textarea::placeholder { color: #9aa6b8; }
body:not(.dark) select option, body:not(.dark) select optgroup { background: #fff; color: #1b2944; }
body:not(.dark) .topbar { background: rgba(255, 255, 255, .82); border-color: rgba(49, 68, 105, .12); }
body:not(.dark) .breadcrumb strong { color: #1b2944; }
body:not(.dark) .date-chip { color: #68768d; background: rgba(84, 103, 150, .07); }
body:not(.dark) .language-btn, body:not(.dark) .icon-btn { color: #263653; background: #fff; }
body:not(.dark) .panel, body:not(.dark) .stat-card { color: #172239; background: linear-gradient(145deg, rgba(255,255,255,.97), rgba(247,249,254,.97)); border-color: rgba(49, 68, 105, .12); }
body:not(.dark) .panel-head h3, body:not(.dark) .stat-value { color: #1b2944; }
body:not(.dark) .panel-head p, body:not(.dark) .stat-foot { color: #74819a; }
body:not(.dark) .stat-head { color: #6c7a93; }
body:not(.dark) .quick-action { color: #1b2944; background: linear-gradient(145deg, #fff, #f7f9fd); border-color: rgba(49, 68, 105, .13); }
body:not(.dark) .quick-action strong { color: #1b2944; }
body:not(.dark) .quick-action small { color: #71809a; }
body:not(.dark) .task-item, body:not(.dark) .exam-row, body:not(.dark) .week-day, body:not(.dark) .chapter-row, body:not(.dark) .quiz-card, body:not(.dark) .group-card, body:not(.dark) .resource-card,
body:not(.dark) .submission-item, body:not(.dark) .mini-session, body:not(.dark) .summary-chip, body:not(.dark) .builder-question, body:not(.dark) .attempt-question,
body:not(.dark) .privacy-note, body:not(.dark) .gentle-note, body:not(.dark) .today-focus, body:not(.dark) .habit-row, body:not(.dark) .prayer-grid label,
body:not(.dark) .board-archive-summary, body:not(.dark) .exam-bank-summary, body:not(.dark) .exam-source-notice, body:not(.dark) .exam-blueprint-note {
  color: #263653; background: rgba(247, 249, 253, .96); border-color: rgba(49, 68, 105, .12);
}
body:not(.dark) .task-content strong, body:not(.dark) .exam-info strong, body:not(.dark) .chapter-row strong, body:not(.dark) .quiz-card strong, body:not(.dark) .group-card-info strong, body:not(.dark) .resource-card strong { color: #202f4b; }
body:not(.dark) .task-content small, body:not(.dark) .exam-info small, body:not(.dark) .chapter-row small, body:not(.dark) .quiz-card small, body:not(.dark) .group-card-info small, body:not(.dark) .resource-card small { color: #75829a; }
body:not(.dark) .chapter-row select, body:not(.dark) .attempt-option { color: #263653; background: #fff; }
body:not(.dark) .chapter-picker-head strong, body:not(.dark) .chapter-pick-name { color: #263653; }
body:not(.dark) .chapter-picker-head small, body:not(.dark) .exam-source-mode-row small { color: #687993; }
body:not(.dark) .chapter-pick { color: #263653; background: #f8faff; border-color: rgba(49, 68, 105, .13); }
body:not(.dark) .chapter-pick:has(input:checked) { background: linear-gradient(110deg, rgba(130, 102, 255, .11), rgba(53, 191, 214, .08)); }
body:not(.dark) .quiz-modal-card, body:not(.dark) .modal-card { color: #1b2944; background: linear-gradient(145deg, #fff, #f5f7fc); border-color: rgba(49, 68, 105, .15); }
body:not(.dark) .modal-card h2 { color: #1b2944; }
body:not(.dark) .modal-card > p { color: #68768d; }
body:not(.dark) .ai-welcome h2 { color: #fff; }
body:not(.dark) .ai-message { color: #263653; }
body:not(.dark) .ai-message.assistant { background: #f0f4fc; }
body:not(.dark) .ai-message.user { color: #18404b; background: #ddf5f6; }
body:not(.dark) .ai-prompt { color: #263653; background: #f8faff; }
body:not(.dark) .profile-account-id { background: #f7f9fd; }
body:not(.dark) .profile-account-id strong { color: #263653; }
body:not(.dark) .resource-card p { color: #687993; }
body:not(.dark) .resource-card .resource-type { color: #6351b8; }
body:not(.dark) .resource-tags span { color: #62718a; background: #edf1f8; }
body:not(.dark) .group-code { color: #6351b8; }
body:not(.dark) .app-footer { color: #8490a4; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Reassert Orbit tokens after the legacy dark-theme variables. */
body.dark {
  color-scheme: dark;
  --bg: #080d19;
  --paper: rgba(17, 24, 42, .9);
  --paper-2: #111a2c;
  --ink: #edf2ff;
  --muted: #98a5bd;
  --line: rgba(143, 164, 207, .16);
  --navy: #0b1121;
  --navy-2: #141d34;
  --cyan: #46d7e8;
  --cyan-soft: rgba(70, 215, 232, .12);
  --mint: rgba(64, 214, 164, .14);
  --violet: rgba(139, 111, 255, .16);
  --amber: rgba(255, 190, 92, .14);
  --shadow: 0 18px 55px rgba(0, 0, 0, .24);
}
