/* ==========================================================================
   css/theme.css — loaded AFTER style.css.
   1. Theme tokens (light / dark)   2. Light sidebar (claude.ai style)
   3. Hover-peek sidebar            4. Theme switcher in the account menu
   5. Dark-mode overrides (auto-generated from style.css + inline colours)
   ========================================================================== */

:root {
  --page-bg   : #f4f7f6;
  --sb-bg     : #e9edec;                 /* slightly darker than the page, like claude.ai */
  --sb-fg     : #2c3e50;
  --sb-muted  : #6b7a86;
  --sb-hover  : rgba(44, 62, 80, 0.07);
  --sb-active : rgba(52, 152, 219, 0.14);
  --sb-border : #d5dbd9;
  color-scheme: light;
}
html[data-theme="dark"] {
  --page-bg   : #12161b;
  --white     : #1c2229;                 /* every surface that used var(--white) */
  --dark      : #e4e8eb;                 /* every text that used var(--dark)     */
  --grey      : #9aa5ad;
  --light     : #2a323a;
  --shadow    : 0 4px 6px rgba(0, 0, 0, 0.35);
  --sb-bg     : #161b20;
  --sb-fg     : #dfe4e8;
  --sb-muted  : #8f9aa3;
  --sb-hover  : rgba(255, 255, 255, 0.06);
  --sb-active : rgba(52, 152, 219, 0.22);
  --sb-border : #262e36;
  color-scheme: dark;
}

body { background: var(--page-bg); color: var(--dark); }

/* ---------- 2. Light sidebar ---------- */
#sidebar {
  background   : var(--sb-bg);
  color        : var(--sb-fg);
  border-right : 1px solid var(--sb-border);
}
.sidebar-header { background: transparent; border-bottom: 1px solid var(--sb-border); }
.sidebar-brand  { border-bottom-color: var(--sb-border); }
.sidebar-brand-text, .profile-name { color: var(--sb-fg); }
.profile-meta, .profile-trade, .profile-iti { color: var(--sb-muted); }
.profile-pic-wrap { background: rgba(127, 127, 127, 0.15); border-color: var(--sb-border); }
.nav-item { color: var(--sb-fg); }
.nav-item:hover { background: var(--sb-hover); }
.nav-item.active { background: var(--sb-active); border-left-color: var(--blue); color: var(--blue-d); font-weight: 600; }
html[data-theme="dark"] .nav-item.active { color: #6cb8ec; }

/* Name/meta were centre vs left aligned (inherited text-align) → looked shifted */
.profile-info, .profile-name, .profile-meta { text-align: left; justify-content: flex-start; }

/* Coloured menu icons (mid-tone shades: readable on both light and dark sidebar) */
.nav-item i { transition: transform .15s ease; }
.nav-item:hover i { transform: scale(1.12); }
.nav-item i.fa-chart-line, .nav-item i.fa-house      { color: #3498db; }
.nav-item i.fa-users-gear                            { color: #9b59b6; }
.nav-item i.fa-database                              { color: #e67e22; }
.nav-item i.fa-file-signature, .nav-item i.fa-list-check { color: #16a085; }
.nav-item i.fa-plus-circle                           { color: #27ae60; }
.nav-item i.fa-book-open                             { color: #f39c12; }
.nav-item i.fa-flag                                  { color: #e74c3c; }
.nav-item i.fa-chart-pie                             { color: #e84393; }
.nav-item i.fa-box-archive                           { color: #b07a4f; }
.nav-item i.fa-bullhorn                              { color: #e6a817; }
.nav-item i.fa-comments                              { color: #00a8cc; }
.nav-item i.fa-globe                                 { color: #2980b9; }
.nav-item i.fa-laptop-code                           { color: #6c5ce7; }

/* ---------- 3. Hover-peek (desktop, mouse only) ---------- */
@media (min-width: 769px) {
  #sidebar.collapsed.peek {
    width      : 260px !important;
    top        : 60px;                  /* start under the top bar so ☰ stays reachable */
    box-shadow : 8px 0 28px rgba(0, 0, 0, 0.18);
    border-top : 1px solid var(--sb-border);
  }
  #sidebar.collapsed.peek .sidebar-header,
  #sidebar.collapsed.peek .sidebar-menu,
  #sidebar.collapsed.peek .nav-text { opacity: 1; pointer-events: auto; }
  #sidebar.collapsed.peek .sidebar-brand-text,
  #sidebar.collapsed.peek .profile-info { display: block; }
  #sidebar.collapsed.peek .profile-sep { display: inline; }
  #sidebar.collapsed.peek .profile-row { justify-content: flex-start; padding: 14px 16px; }
  #sidebar.collapsed.peek .profile-pic-wrap { width: 52px; height: 52px; }
}

/* ---------- 4. Theme switcher (inside the account menu) ---------- */
.um-theme { display: flex; gap: 4px; margin: 0 0 10px; padding: 3px; border-radius: 9px; background: var(--light); }
.um-theme button {
  flex: 1; border: 0; background: transparent; color: var(--grey); cursor: pointer;
  padding: 6px 4px; border-radius: 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.um-theme button i { margin-right: 3px; }
.um-theme button.on { background: var(--white); color: var(--blue); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }

/* ---------- 5. Dark mode ---------- */
html[data-theme="dark"] .toast-sync,
html[data-theme="dark"] .force-landscape::before { background: #2c3e50 !important; }
html[data-theme="dark"] .user-menu { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5); }
html[data-theme="dark"] img { filter: none; }

/* ---- Form controls, tables, pagination, charts (hand-tuned) ---- */
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background-color: #232b33 !important; color: var(--dark) !important; border-color: #36424d !important;
}
html[data-theme="dark"] ::placeholder { color: #7d8993 !important; }
html[data-theme="dark"] option { background: #232b33; color: var(--dark); }
html[data-theme="dark"] .btn:disabled, html[data-theme="dark"] .btn[disabled] { opacity: .45; }
/* d3 charts use SVG presentation attributes, not style="" */
html[data-theme="dark"] svg [stroke="#fff"], html[data-theme="dark"] svg [stroke="#ffffff"] { stroke: var(--white); }
html[data-theme="dark"] svg [fill="#2c3e50"] { fill: #e4e8eb; }
html[data-theme="dark"] svg [fill="#555"]    { fill: #c3ccd3; }
html[data-theme="dark"] svg [fill="#f0f0f0"] { fill: #2a323a; }
html[data-theme="dark"] svg [fill="#aaa"], html[data-theme="dark"] svg [fill="#7f8c8d"] { fill: #8f9aa3; }
html[data-theme="dark"] svg text { fill: #c3ccd3; }
html[data-theme="dark"] svg text[fill="#2c3e50"], html[data-theme="dark"] svg text[fill="#e4e8eb"] { fill: #e4e8eb; }
html[data-theme="dark"] .d3-tooltip, html[data-theme="dark"] [class*="tooltip"] { background: #0d1014 !important; color: #e4e8eb !important; }
/* ---- AUTO-GENERATED dark overrides: css/style.css rules ---- */
html[data-theme="dark"] body { background: #1f2a26 !important; color: #b6c6d7 !important; }
html[data-theme="dark"] .input-group label { color: #bbbbbb !important; }
html[data-theme="dark"] .input-group input,
html[data-theme="dark"] .input-group select { border: 1px solid #454545 !important; }
html[data-theme="dark"] .data-table th,
html[data-theme="dark"] .data-table td { border-bottom: 1px solid #303030 !important; }
html[data-theme="dark"] .data-table th { background: #1d2227 !important; }
html[data-theme="dark"] .data-table tr:hover { background: #202020 !important; }
html[data-theme="dark"] .data-table th.sortable:hover { background: #222a2d !important; }
html[data-theme="dark"] .search-result-row { border-bottom: 1px solid #303030 !important; }
html[data-theme="dark"] .search-result-row:hover { background: #1d2227 !important; }
html[data-theme="dark"] .multi-select-box { border: 1px solid #454545 !important; background: #1f1f1f !important; }
html[data-theme="dark"] .multi-select-box label { color: #cccccc !important; }
html[data-theme="dark"] .upload-zone { border: 2px dashed #454545 !important; background: #222222 !important; }
html[data-theme="dark"] .key-badge { background: #20222b !important; }
html[data-theme="dark"] .save-status-badge { color: var(--green-d, #58d98e) !important; }
html[data-theme="dark"] #s-quiz-area { background: #20252c !important; }
html[data-theme="dark"] .opt-label { border: 2px solid #303030 !important; }
html[data-theme="dark"] .opt-label:hover { background: #242b30 !important; }
html[data-theme="dark"] .opt-selected { background: #252d33 !important; }
html[data-theme="dark"] .opt-correct { background: #28322c !important; }
html[data-theme="dark"] .opt-wrong { background: #322524 !important; }
html[data-theme="dark"] .exp-box { background: #333025 !important; }
html[data-theme="dark"] .p-not-visited { color: #cccccc !important; }
html[data-theme="dark"] .quiz-right { border-left: 1px solid #3b3b3b !important; }
html[data-theme="dark"] .palette-bottom { border-top: 1px solid #303030 !important; }
html[data-theme="dark"] .palette-legend { border-top: 1px solid #303030 !important; background: #1d2227 !important; }
html[data-theme="dark"] .legend-item { color: #bbbbbb !important; }
html[data-theme="dark"] #quiz-timer-box.warning { background: #322524 !important !important; }
html[data-theme="dark"] .rev-card { border-left: 4px solid #454545 !important; }
html[data-theme="dark"] .rev-correct { background: #28322c !important; }
html[data-theme="dark"] .rev-wrong { background: #322524 !important; }
html[data-theme="dark"] .rev-skipped { background: #1d2227 !important; }
html[data-theme="dark"] .exp-text { color: #bbbbbb !important; }
html[data-theme="dark"] .modal-content { background: #1f1f1f !important; }
html[data-theme="dark"] .fab-item { border: 1px solid #303030 !important; }
html[data-theme="dark"] .fab-item:hover { background: #1d2227 !important; }
html[data-theme="dark"] .spinner { border: 5px solid #2d2d2d !important; }
html[data-theme="dark"] .quiz-right { border-top: 1px solid #3b3b3b !important; }
html[data-theme="dark"] #s-quiz-area { background: #20252c !important; }
html[data-theme="dark"] .quiz-right { border-left: 1px solid #3b3b3b !important; }
html[data-theme="dark"] .opt-label { border: 2px solid #303030 !important; }
html[data-theme="dark"] .quiz-right { border-top: 1px solid #3b3b3b !important; }
html[data-theme="dark"] .rev-card { border: 1px solid #454545 !important !important; }
html[data-theme="dark"] .palette-bottom { border-top: 1px solid #3b3b3b !important; background: #1f1f1f !important; }
html[data-theme="dark"] .palette-legend { background: #1d2227 !important; }
html[data-theme="dark"] .msg-layout { background: #1f1f1f !important; border: 1px solid #2c323a !important; }
html[data-theme="dark"] .msg-side { border-right: 1px solid #282d34 !important; background: #1f1f1f !important; }
html[data-theme="dark"] .msg-side-search { border-bottom: 1px solid #282d33 !important; }
html[data-theme="dark"] .msg-icon-btn { background: #292c2e !important; color: #a5afba !important; }
html[data-theme="dark"] .msg-icon-btn:hover { background: #2c3033 !important; }
html[data-theme="dark"] .msg-side-search input { border: 1px solid #2f343b !important; background: #272a2d !important; }
html[data-theme="dark"] .msg-side-search input:focus { background: #1f1f1f !important; }
html[data-theme="dark"] .msg-thread-list { background: #1f1f1f !important; }
html[data-theme="dark"] .msg-online-dot { border: 2px solid #262626 !important; }
html[data-theme="dark"] .msg-hdr-btn:hover { background: #292c2e !important; }
html[data-theme="dark"] .msg-searchbar { background: #1f1f1f !important; border-bottom: 1px solid #2b3137 !important; }
html[data-theme="dark"] .msg-searchbar input { border: 1px solid #30363d !important; background: #272a2d !important; }
html[data-theme="dark"] .msg-date-sep span { color: #a8a8b4 !important; }
html[data-theme="dark"] .msg-thread-item { border-bottom: 1px solid #262b32 !important; }
html[data-theme="dark"] .msg-thread-item:hover { background: #232930 !important; }
html[data-theme="dark"] .msg-thread-item.active { background: #252c33 !important; }
html[data-theme="dark"] .msg-panel { background: #292c2f !important; }
html[data-theme="dark"] .msg-panel-header { background: #1f1f1f !important; border-bottom: 1px solid #2b3137 !important; }
html[data-theme="dark"] .msg-bubbles { background: #0b141a !important; }
html[data-theme="dark"] .msg-bubble.theirs { background: #202c33 !important; }
html[data-theme="dark"] .msg-bubble.mine { background: #005c4b !important; color: #e9edef !important; }
html[data-theme="dark"] .msg-bubble.theirs.tail::before { background: #202c33 !important; }
html[data-theme="dark"] .msg-bubble.mine.tail::before { background: #005c4b !important; }
html[data-theme="dark"] .msg-context { background: #252c34 !important; border-top: 1px solid #243548 !important; }
html[data-theme="dark"] .msg-composer { background: #1f1f1f !important; border-top: 1px solid #2b3137 !important; }
html[data-theme="dark"] .msg-composer textarea { border: 1px solid #30363d !important; background: #272a2d !important; }
html[data-theme="dark"] .msg-composer textarea:focus { background: #1f1f1f !important; }
html[data-theme="dark"] .msg-contacts { background: #1f1f1f !important; }
html[data-theme="dark"] .msg-contact-item { border-bottom: 1px solid #262b32 !important; }
html[data-theme="dark"] .msg-contact-item:hover { background: #232930 !important; }
html[data-theme="dark"] .msg-role-badge { background: #23292f !important; color: #b0b0bd !important; }
html[data-theme="dark"] .msg-role-badge.role-admin { background: #332525 !important; }
html[data-theme="dark"] .msg-role-badge.role-instructor { background: #2e2733 !important; }
html[data-theme="dark"] .msg-role-badge.role-trainee { background: #28342d !important; }
html[data-theme="dark"] .msg-bc-body { background: #1f1f1f !important; }
html[data-theme="dark"] .msg-bc-filters { border-bottom: 1px solid #282d34 !important; }
html[data-theme="dark"] .msg-bc-filters select,
html[data-theme="dark"] .msg-bc-filters input { border: 1px solid #30363d !important; background: #272a2d !important; }
html[data-theme="dark"] .msg-bc-bar { background: #272a2d !important; border-bottom: 1px solid #282d34 !important; }
html[data-theme="dark"] .msg-bc-row { border-bottom: 1px solid #262b32 !important; }
html[data-theme="dark"] .msg-bc-row:hover { background: #232930 !important; }
html[data-theme="dark"] .msg-bc-compose { border-top: 1px solid #2b3137 !important; background: #272a2d !important; }
html[data-theme="dark"] .msg-bc-compose textarea { border: 1px solid #30363d !important; }
html[data-theme="dark"] .msg-bc-progress { background: #272a2d !important; }
html[data-theme="dark"] .ann-form { background: #1f1f1f !important; border: 1px solid #2c323a !important; }
html[data-theme="dark"] .ann-form input,
html[data-theme="dark"] .ann-form textarea,
html[data-theme="dark"] .ann-form select { border: 1px solid #30363d !important; background: #272a2d !important; }
html[data-theme="dark"] .ann-card { background: #1f1f1f !important; border: 1px solid #2c323a !important; border-left: 4px solid #353c45 !important; }
html[data-theme="dark"] .ann-card.ann-new { background: #232930 !important; }
html[data-theme="dark"] .ann-body { color: #afc1d3 !important; }
html[data-theme="dark"] .ann-chip { background: #252c33 !important; }
html[data-theme="dark"] .push-banner { background: #252c33 !important; border: 1px solid #24384a !important; }
html[data-theme="dark"] .push-no { background: #2c3034 !important; color: #b8b8c6 !important; }
html[data-theme="dark"] .user-chip { border: 2px solid #2c3640 !important; }
html[data-theme="dark"] .user-menu { background: #1f1f1f !important; border: 1px solid #2c323a !important; }
html[data-theme="dark"] .um-logout { background: #332625 !important; }
html[data-theme="dark"] .um-logout:hover { background: #372928 !important; }

/* ---- AUTO-GENERATED dark overrides: inline style="" colours in js/*.js + index.html ---- */
html[data-theme="dark"] [style*="color:#555"] { color: #bbbbbb !important; }
html[data-theme="dark"] [style*="color: rgb(85, 85, 85)"] { color: #bbbbbb !important; }
html[data-theme="dark"] [style*="color:#333"] { color: #cccccc !important; }
html[data-theme="dark"] [style*="color: rgb(51, 51, 51)"] { color: #cccccc !important; }
html[data-theme="dark"] [style*="color:#666"] { color: #b2b2b2 !important; }
html[data-theme="dark"] [style*="color: rgb(102, 102, 102)"] { color: #b2b2b2 !important; }
html[data-theme="dark"] [style*="color: #000"] { color: #e6e6e6 !important; }
html[data-theme="dark"] [style*="color: rgb(0, 0, 0)"] { color: #e6e6e6 !important; }
html[data-theme="dark"] [style*="color:#1a5276"] { color: #489fd7 !important; }
html[data-theme="dark"] [style*="color: rgb(26, 82, 118)"] { color: #489fd7 !important; }
html[data-theme="dark"] [style*="color:#856404"] { color: #f8c120 !important; }
html[data-theme="dark"] [style*="color: rgb(133, 100, 4)"] { color: #f8c120 !important; }
html[data-theme="dark"] [style*="color:#1a237e"] { color: #4d59da !important; }
html[data-theme="dark"] [style*="color: rgb(26, 35, 126)"] { color: #4d59da !important; }
html[data-theme="dark"] [style*="color:#2e7d32"] { color: #70ca74 !important; }
html[data-theme="dark"] [style*="color: rgb(46, 125, 50)"] { color: #70ca74 !important; }
html[data-theme="dark"] [style*="background:#eee"] { background: #292929 !important; }
html[data-theme="dark"] [style*="background: rgb(238, 238, 238)"] { background: #292929 !important; }
html[data-theme="dark"] [style*="background:#fff"] { background: #1f1f1f !important; }
html[data-theme="dark"] [style*="background: rgb(255, 255, 255)"] { background: #1f1f1f !important; }
html[data-theme="dark"] [style*="background: #fff"] { background: #1f1f1f !important; }
html[data-theme="dark"] [style*="background: rgb(255, 255, 255)"] { background: #1f1f1f !important; }
html[data-theme="dark"] [style*="background:#f9f9f9"] { background: #222222 !important; }
html[data-theme="dark"] [style*="background: rgb(249, 249, 249)"] { background: #222222 !important; }
html[data-theme="dark"] [style*="background:#e9f7ef"] { background: #28322c !important; }
html[data-theme="dark"] [style*="background: rgb(233, 247, 239)"] { background: #28322c !important; }
html[data-theme="dark"] [style*="background:#eaf2f8"] { background: #272d32 !important; }
html[data-theme="dark"] [style*="background: rgb(234, 242, 248)"] { background: #272d32 !important; }
html[data-theme="dark"] [style*="background:#fef5e7"] { background: #332d25 !important; }
html[data-theme="dark"] [style*="background: rgb(254, 245, 231)"] { background: #332d25 !important; }
html[data-theme="dark"] [style*="background:#f4ecf7"] { background: #2e2831 !important; }
html[data-theme="dark"] [style*="background: rgb(244, 236, 247)"] { background: #2e2831 !important; }
html[data-theme="dark"] [style*="background:#eafaf1"] { background: #25332b !important; }
html[data-theme="dark"] [style*="background: rgb(234, 250, 241)"] { background: #25332b !important; }
html[data-theme="dark"] [style*="background:#eaf6fb"] { background: #252f33 !important; }
html[data-theme="dark"] [style*="background: rgb(234, 246, 251)"] { background: #252f33 !important; }
html[data-theme="dark"] [style*="background:#fdecea"] { background: #332625 !important; }
html[data-theme="dark"] [style*="background: rgb(253, 236, 234)"] { background: #332625 !important; }
html[data-theme="dark"] [style*="background:#fffaf0"] { background: #312c23 !important; }
html[data-theme="dark"] [style*="background: rgb(255, 250, 240)"] { background: #312c23 !important; }
html[data-theme="dark"] [style*="background:#fffdf5"] { background: #302d23 !important; }
html[data-theme="dark"] [style*="background: rgb(255, 253, 245)"] { background: #302d23 !important; }
html[data-theme="dark"] [style*="background:#eaf4fb"] { background: #252d33 !important; }
html[data-theme="dark"] [style*="background: rgb(234, 244, 251)"] { background: #252d33 !important; }
html[data-theme="dark"] [style*="background:#fffef5"] { background: #302f23 !important; }
html[data-theme="dark"] [style*="background: rgb(255, 254, 245)"] { background: #302f23 !important; }
html[data-theme="dark"] [style*="background:#fff3cd"] { background: #383429 !important; }
html[data-theme="dark"] [style*="background: rgb(255, 243, 205)"] { background: #383429 !important; }
html[data-theme="dark"] [style*="background:#e8eaf6"] { background: #282a32 !important; }
html[data-theme="dark"] [style*="background: rgb(232, 234, 246)"] { background: #282a32 !important; }
html[data-theme="dark"] [style*="background:#e8f5e9"] { background: #29322a !important; }
html[data-theme="dark"] [style*="background: rgb(232, 245, 233)"] { background: #29322a !important; }
html[data-theme="dark"] [style*="background:#f0f9f0"] { background: #273027 !important; }
html[data-theme="dark"] [style*="background: rgb(240, 249, 240)"] { background: #273027 !important; }
html[data-theme="dark"] [style*="background:#fff8e1"] { background: #343126 !important; }
html[data-theme="dark"] [style*="background: rgb(255, 248, 225)"] { background: #343126 !important; }
html[data-theme="dark"] [style*="background:#f0e0a8"] { background: #433e30 !important; }
html[data-theme="dark"] [style*="background: rgb(240, 224, 168)"] { background: #433e30 !important; }
html[data-theme="dark"] [style*="background:#f8f9fa"] { background: #1d2227 !important; }
html[data-theme="dark"] [style*="background: rgb(248, 249, 250)"] { background: #1d2227 !important; }
html[data-theme="dark"] [style*="border:1px solid #ddd"] { border: 1px solid #3b3b3b !important; }
html[data-theme="dark"] [style*="border: 1px solid rgb(221, 221, 221)"] { border: 1px solid #3b3b3b !important; }
html[data-theme="dark"] [style*="border:1px solid #ccc"] { border: 1px solid #454545 !important; }
html[data-theme="dark"] [style*="border: 1px solid rgb(204, 204, 204)"] { border: 1px solid #454545 !important; }
html[data-theme="dark"] [style*="border:1px solid #eee"] { border: 1px solid #303030 !important; }
html[data-theme="dark"] [style*="border: 1px solid rgb(238, 238, 238)"] { border: 1px solid #303030 !important; }
html[data-theme="dark"] [style*="border: 1px solid #ddd"] { border: 1px solid #3b3b3b !important; }
html[data-theme="dark"] [style*="border: 1px solid rgb(221, 221, 221)"] { border: 1px solid #3b3b3b !important; }
html[data-theme="dark"] [style*="border:1px solid #bdc3c7"] { border: 1px solid #484b4e !important; }
html[data-theme="dark"] [style*="border: 1px solid rgb(189, 195, 199)"] { border: 1px solid #484b4e !important; }
html[data-theme="dark"] [style*="border:1px solid #dde3ea"] { border: 1px solid #30363d !important; }
html[data-theme="dark"] [style*="border: 1px solid rgb(221, 227, 234)"] { border: 1px solid #30363d !important; }
html[data-theme="dark"] [style*="border-top:1px solid #eee"] { border-top: 1px solid #303030 !important; }
html[data-theme="dark"] [style*="border-top: 1px solid rgb(238, 238, 238)"] { border-top: 1px solid #303030 !important; }
html[data-theme="dark"] [style*="border-top:1px dashed #ccc"] { border-top: 1px dashed #454545 !important; }
html[data-theme="dark"] [style*="border-top: 1px dashed rgb(204, 204, 204)"] { border-top: 1px dashed #454545 !important; }
html[data-theme="dark"] [style*="border-bottom:1px solid #eee"] { border-bottom: 1px solid #303030 !important; }
html[data-theme="dark"] [style*="border-bottom: 1px solid rgb(238, 238, 238)"] { border-bottom: 1px solid #303030 !important; }
html[data-theme="dark"] [style*="border-bottom:2px solid #eee"] { border-bottom: 2px solid #303030 !important; }
html[data-theme="dark"] [style*="border-bottom: 2px solid rgb(238, 238, 238)"] { border-bottom: 2px solid #303030 !important; }
html[data-theme="dark"] [style*="border-bottom:1px solid #f0f0f0"] { border-bottom: 1px solid #2f2f2f !important; }
html[data-theme="dark"] [style*="border-bottom: 1px solid rgb(240, 240, 240)"] { border-bottom: 1px solid #2f2f2f !important; }
html[data-theme="dark"] [style*="border-bottom:1px solid #f0e0a8"] { border-bottom: 1px solid #5d522d !important; }
html[data-theme="dark"] [style*="border-bottom: 1px solid rgb(240, 224, 168)"] { border-bottom: 1px solid #5d522d !important; }

/* keep tokens winning over the generated body/sidebar rules */
html[data-theme="dark"] body { background: var(--page-bg) !important; color: var(--dark) !important; }
html[data-theme="dark"] #sidebar { background: var(--sb-bg) !important; }
html[data-theme="dark"] .sidebar-header { background: transparent !important; }
html[data-theme="dark"] .um-logout { color: #ff8a7d !important; }

/* ==========================================================================
   Consent / privacy notice / printable consent form (js/consent.js)
   ========================================================================== */
.cs-doc h3 { margin: 0 0 2px; }
.cs-doc h4 { margin: 14px 0 4px; font-size: 14px; color: var(--blue); }
.cs-doc p, .cs-doc li { font-size: 13px; line-height: 1.65; margin: 4px 0; }
.cs-doc ul { padding-left: 18px; margin: 4px 0; }
.cs-sub { font-size: 11px !important; color: var(--grey); }
.cs-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; cursor: pointer; }
.cs-check input { margin-top: 3px; width: auto; flex: none; }
.um-links { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; }
.um-links button { border: 0; background: transparent; color: var(--dark); cursor: pointer; text-align: left; padding: 6px 8px; border-radius: 7px; font-size: 12.5px; }
.um-links button:hover { background: var(--light); }
.um-links i { width: 16px; margin-right: 6px; color: var(--blue); }

/* Accept gate (full-screen, cannot be dismissed except by accepting or logging out) */
#consent-gate { position: fixed; inset: 0; z-index: 20000; background: rgba(0, 0, 0, 0.65); display: flex; align-items: center; justify-content: center; padding: 12px; }
.cs-gate-card { background: var(--white); color: var(--dark); border-radius: 12px; width: min(680px, 100%); max-height: 92vh; display: flex; flex-direction: column; padding: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.cs-gate-scroll { overflow: auto; flex: 1; padding-right: 6px; margin-bottom: 10px; border-bottom: 1px solid var(--light); }
.cs-gate-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; justify-content: flex-end; }

/* Printable form overlay — always "paper": white, black text, in light AND dark theme */
#consent-overlay { position: fixed; inset: 0; z-index: 21000; background: #e9ecef !important; overflow: auto; }
#consent-overlay .cs-toolbar { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; background: #2c3e50 !important; }
#consent-overlay .cs-hint { color: #cfd8dc !important; font-size: 12px; }
#consent-overlay .cs-sheet { padding: 14px 0 30px; }
#consent-overlay .cs-page { background: #fff !important; color: #000 !important; width: min(794px, 96%); margin: 0 auto 16px; padding: 28px 32px; box-sizing: border-box; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
#consent-overlay .cs-page * { color: #000 !important; border-color: #000 !important; background: transparent !important; }
.cs-page h2 { text-align: center; margin: 0; font-size: 20px; }
.cs-page h3 { text-align: center; margin: 4px 0 14px; font-size: 16px; }
.cs-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.cs-table td { padding: 5px 6px; font-size: 13px; border: 1px solid #000; }
.cs-table td:first-child { width: 32%; font-weight: 600; }
.cs-blank { display: inline-block; border-bottom: 1px solid #000; height: 16px; vertical-align: bottom; }
.cs-fill { font-weight: 600; }
.cs-body p { font-size: 12.5px; line-height: 1.6; margin: 5px 0; }
.cs-decl { border: 1px solid #000; padding: 6px 8px; margin-top: 8px !important; }
.cs-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.cs-box { border: 1px solid #000; padding: 8px 10px; font-size: 12.5px; line-height: 2.1; }
.cs-box:last-child { grid-column: 1 / -1; }
.cs-foot { font-size: 10.5px; margin-top: 10px; text-align: center; }
@media (max-width: 600px) { .cs-sign { grid-template-columns: 1fr; } #consent-overlay .cs-page { padding: 18px 14px; } }

@media print {
  /* style.css has a global "body * { visibility:hidden }" print rule (for result printing) — opt the form back in */
  body.consent-print-mode, html:has(body.consent-print-mode) { background: #fff !important; }
  #consent-overlay, #consent-overlay * { visibility: visible !important; }
  body.consent-print-mode #common-modal { display: none !important; }
  body.consent-print-mode > *:not(#consent-overlay) { display: none !important; }
  #consent-overlay { position: static !important; overflow: visible !important; background: #fff !important; }
  #consent-overlay .cs-toolbar { display: none !important; }
  #consent-overlay .cs-sheet { padding: 0; }
  #consent-overlay .cs-page { width: 100%; margin: 0; padding: 0; box-shadow: none; page-break-after: always; break-after: page; }
  #consent-overlay .cs-page:last-child { page-break-after: auto; break-after: auto; }
}

/* ---- Reports & Flags cards (dark): tinted ભાગો — token થી ન થાય એવા રંગ ---- */
html[data-theme="dark"] .flag-q-link { color: #6cb8ec; }
html[data-theme="dark"] .flag-reply  { background: rgba(46, 204, 113, 0.16); color: #7ddc9b; }
html[data-theme="dark"] .flag-btn-danger { color: #ff7b6b; border-color: #ff7b6b; }
html[data-theme="dark"] .flag-btn-danger:hover { background: #e74c3c; border-color: #e74c3c; color: #fff; }
html[data-theme="dark"] .flag-fchip:not(.active):hover { background: #232b33; }

/* ── Question palette (exam screen) — dark theme ──
   Before: the "not visited" buttons kept the LIGHT-theme fill (#bdc3c7) while dark-theme text colour
   (#ccc) was forced on them → numbers 5-30 were nearly invisible. Now every state has its own dark-tuned
   colours, the current question gets a clear glowing ring, and the panel header/legend match. */
html[data-theme="dark"] .palette-title{ background:#1d2227 !important; border-bottom:1px solid #303030 !important; color:#cfd6dd !important; }
html[data-theme="dark"] .palette-submit-area{ border-bottom:1px solid #303030 !important; }
html[data-theme="dark"] .q-btn{ border:2px solid transparent; transition:transform .15s ease, box-shadow .15s ease, filter .15s ease; }
html[data-theme="dark"] .q-btn:hover{ filter:brightness(1.18); }
html[data-theme="dark"] .p-not-visited{ background:#2d353e !important; color:#b8c3cf !important; border-color:#3f4a56; }
html[data-theme="dark"] .p-unanswered { background:#cf4337 !important; color:#fff !important; }
html[data-theme="dark"] .p-answered   { background:#27ae60 !important; color:#fff !important; }
html[data-theme="dark"] .p-review     { background:#8e5bd0 !important; color:#fff !important; }
html[data-theme="dark"] .p-retry      { background:#e67e22 !important; color:#fff !important; }
html[data-theme="dark"] .p-current{
  border-color:#fff !important; transform:scale(1.08);
  box-shadow:0 0 0 3px rgba(106,90,249,.65), 0 0 16px rgba(106,90,249,.55) !important;
}
html[data-theme="dark"] .legend-dot[style*="bdc3c7"]{ background:#2d353e !important; box-shadow:0 0 0 1.5px #5a6672; }
