/* ============================================================================
   themes.css — LIGHT THEME
   ----------------------------------------------------------------------------
   A COLOR-ONLY override layer, active only when <html data-theme="light">.
   HARD RULE: this file changes ONLY colors — background, color, border-COLOR,
   box-shadow, gradient stops, fill/stroke. It NEVER sets font-*, padding,
   margin, width, height, line-height, border-WIDTH, gap, or any box metric, so
   every dimension stays byte-identical to the dark default. Dark = the app's
   untouched baseline; this file adds ZERO rules to it.

   Because the app has no color-variable system (every color is a literal
   rgba/hex spread across the component CSS + Tailwind utility classes), this
   layer targets concrete selectors. Two gotchas it deliberately handles:
     • "Glass" raised surfaces are WHITE-alpha overlays (rgba(255,255,255,.0x))
       on a dark page — invisible white-on-white in light mode, so they flip to
       BLACK-alpha rgba(0,0,0,.0x).
     • Tailwind utility classes (bg-gray-900, text-white…) are NOT overridden
       globally — text-white is correct on colored buttons — only on the named
       structural containers.
   Loaded LAST in index.html so it wins the cascade; html[data-theme="light"]
   also raises specificity so component rules are reliably beaten.
   ============================================================================ */

/* ---- Page + structural chrome (targeted by id, so Tailwind bg-gray-* on
   colored buttons elsewhere is untouched) --------------------------------- */
/* Palette = ChatGPT light (neutral greys + near-black text), NOT slate/blue.
   Main canvas #fff, sidebar off-white #f9f9f9, text #0d0d0d, muted #676767. */
html[data-theme="light"] body {
    background-color: #ffffff;
    color: #0d0d0d;
}
html[data-theme="light"] #sidebar {
    background-color: #f9f9f9;   /* off-white sidebar */
    color: #0d0d0d;
    /* box-shadow, not border — #sidebar has no border in dark, so a real border
       would add 1px and shift the layout. inset shadow is layout-neutral. */
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] #main-content,
html[data-theme="light"] #chat-history {
    /* !important REQUIRED: chat.css sets #main-content to rgba(10,15,30,0.95)
       !important — without matching it the whole canvas silently stays dark. */
    background-color: #ffffff !important;
}
html[data-theme="light"] #logo-bar {
    background-color: #ffffff;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);   /* layout-neutral divider */
}
html[data-theme="light"] #input-bar {
    /* #input-bar HAS a border-top in dark, so overriding only the COLOR keeps the
       1px width unchanged (no re-declared border shorthand). */
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.10) !important;
}
/* Sidebar white text → dark (scoped to the sidebar so colored controls elsewhere
   keep their own utility colors). */
html[data-theme="light"] #sidebar .text-white { color: #0d0d0d; }
html[data-theme="light"] #sidebar .text-gray-400,
html[data-theme="light"] #sidebar .text-gray-300 { color: #676767; }

/* ---- Chat bubbles — ChatGPT-style neutral grey user bubble --------------- */
html[data-theme="light"] .user-message {
    background: #ececec;
    border: 1px solid rgba(0, 0, 0, 0.10);
    color: #0d0d0d;
    box-shadow: none;
}
html[data-theme="light"] .user-message:hover {
    background: #e5e5e5;
    box-shadow: none;
}
html[data-theme="light"] .assistant-message {
    color: #0d0d0d;
}
html[data-theme="light"] .assistant-message:hover {
    background: rgba(0, 0, 0, 0.02);
}
html[data-theme="light"] .message-content { color: #0d0d0d; }
html[data-theme="light"] .message-content .text-xs,
html[data-theme="light"] .message-content .text-gray-300,
html[data-theme="light"] .message-content .text-gray-400 { color: #676767; }
/* Code blocks — LIGHT like ChatGPT (light grey box, dark text + a light syntax
   palette). highlight.js paints .hljs dark, so we flip the block bg AND remap the
   monokai token colors to dark-on-light (github-light-ish) equivalents. */
html[data-theme="light"] .chat-message pre,
html[data-theme="light"] .chat-message pre code.hljs,
html[data-theme="light"] .hljs {
    background: #f6f8fa !important;
    color: #1f2328 !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .chat-message :not(pre) > code { background: rgba(0, 0, 0, 0.05); color: #1f2328; }
html[data-theme="light"] .hljs-comment, html[data-theme="light"] .hljs-quote { color: #6e7781 !important; }
html[data-theme="light"] .hljs-keyword, html[data-theme="light"] .hljs-selector-tag,
html[data-theme="light"] .hljs-literal, html[data-theme="light"] .hljs-type { color: #cf222e !important; }
html[data-theme="light"] .hljs-string, html[data-theme="light"] .hljs-meta .hljs-string { color: #0a3069 !important; }
html[data-theme="light"] .hljs-number, html[data-theme="light"] .hljs-symbol,
html[data-theme="light"] .hljs-bullet, html[data-theme="light"] .hljs-attr { color: #0550ae !important; }
html[data-theme="light"] .hljs-title, html[data-theme="light"] .hljs-title.function_,
html[data-theme="light"] .hljs-section, html[data-theme="light"] .hljs-name { color: #8250df !important; }
html[data-theme="light"] .hljs-attribute, html[data-theme="light"] .hljs-variable,
html[data-theme="light"] .hljs-template-variable { color: #953800 !important; }
html[data-theme="light"] .hljs-built_in, html[data-theme="light"] .hljs-class .hljs-title { color: #0550ae !important; }
/* A user request that is MOSTLY CODE must still read as one grey unit: the generic
   code flip above (#f6f8fa, near-white) covered the #f4f4f4 bubble almost entirely,
   so a code-heavy request blended into the white answer canvas and the request/answer
   boundary vanished (user report 2026-07-10). Inside the user bubble, code surfaces go
   a step darker than the bubble — the whole request reads as one grey card, the
   answer's code blocks stay near-white. Same selector shapes as the generic flip,
   placed later → wins the tie. */
html[data-theme="light"] .user-message pre,
html[data-theme="light"] .user-message pre code.hljs,
html[data-theme="light"] .user-message .hljs {
    background: #d8d8d8 !important;
    border-color: rgba(0, 0, 0, 0.15);
}
html[data-theme="light"] .user-message :not(pre) > code { background: rgba(0, 0, 0, 0.11); }

/* ---- Composer — ChatGPT neutral grey pill -------------------------------- */
html[data-theme="light"] .message-input-container {
    background: #f4f4f4;
    border: 1px solid rgba(0, 0, 0, 0.10);
}
html[data-theme="light"] .message-input-container:focus-within {
    background: #f4f4f4;
    border-color: rgba(0, 0, 0, 0.18);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
html[data-theme="light"] .message-input-container textarea,
html[data-theme="light"] .message-input-container input { color: #0d0d0d; }
html[data-theme="light"] #input-bar .text-white { color: #0d0d0d; }

/* ---- Panels / modals / settings (dark gradient shells → light) ----------- */
html[data-theme="light"] .app-settings-panel,
html[data-theme="light"] .settings-panel {
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    border: 1px solid rgba(99, 102, 241, 0.20);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18), 0 0 40px rgba(99, 102, 241, 0.06);
}
html[data-theme="light"] .app-settings-title { color: #0d0d0d; }
html[data-theme="light"] .app-settings-label { color: #0d0d0d; }
html[data-theme="light"] .app-settings-hint { color: #676767; }
html[data-theme="light"] .app-settings-select {
    /* background-COLOR, not the `background` shorthand — the shorthand wipes the
       custom SVG dropdown-arrow background-image (it vanished in light). Re-provide
       a dark arrow so it's crisp on white. */
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    /* Lock no-repeat + position: the :hover rule uses a `background:` SHORTHAND
       which resets background-repeat to `repeat`; my arrow image wins on
       specificity but would then TILE into a grid without these. */
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    color: #0d0d0d;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

/* ---- Generic glass surfaces (raised cards, hovers): white-alpha → black-alpha.
   Scoped inside the chat/message surface so it doesn't touch colored widgets. */
html[data-theme="light"] .message-content [style*="rgba(255, 255, 255, 0.04)"],
html[data-theme="light"] .message-content [style*="rgba(255,255,255,0.04)"] {
    background: rgba(0, 0, 0, 0.03) !important;
}

/* ---- Reasoning panel scroll-fades (FUNCTIONAL: the opaque stop is matched to
   the page bg — must re-match the light canvas or a dark smudge shows). ----- */
html[data-theme="light"] .reasoning-bottom-fade {
    background: linear-gradient(to top,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.5) 30%,
        rgba(255, 255, 255, 0.15) 60%,
        transparent 100%);
}
html[data-theme="light"] .reasoning-header {
    background: linear-gradient(to bottom,
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 255, 255, 0.95) 30%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0.15) 80%,
        transparent 100%);
    color: #6d28d9 !important;   /* violet-700, readable on light */
}

/* ---- Top bar (model selector row) — own CSS bg, not a Tailwind class ------ */
html[data-theme="light"] #top-bar {
    background-color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);   /* dark #top-bar already has a 1px border-bottom → same width */
}

/* ---- Sidebar footer (credits / manage / upgrade / settings) --------------- */
html[data-theme="light"] #sidebar-footer {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(241, 245, 249, 0.97) 30%);
    border-top: 1px solid rgba(99, 102, 241, 0.18);   /* dark already has a 1px border-top → same width */
}
html[data-theme="light"] .credit-widget-bar-bg { background: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .credit-widget-info span { color: #5d5d5d; }
html[data-theme="light"] .credit-widget-reset { color: #676767; }
html[data-theme="light"] .sidebar-footer-manage-btn {
    background: rgba(0, 0, 0, 0.04);
    color: #5d5d5d;
    border-color: rgba(0, 0, 0, 0.10);
}
html[data-theme="light"] .sidebar-footer-manage-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #0d0d0d;
    border-color: rgba(0, 0, 0, 0.15);
}
html[data-theme="light"] .sidebar-footer-links a { color: #676767; }
html[data-theme="light"] .sidebar-footer-links a:hover { color: #0d0d0d; }

/* ---- Sidebar action buttons (New Chat / Folder / Search) — the weak-contrast
   pale-blue-on-pale the user flagged. Darken the text + firm up the fills. --- */
html[data-theme="light"] .sidebar-action-primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.14) 0%, rgba(139, 92, 246, 0.12) 100%);
    color: #1d4ed8;                                   /* blue-700 — strong on light */
    border-color: rgba(59, 130, 246, 0.35);
}
html[data-theme="light"] .sidebar-action-secondary {
    background: rgba(0, 0, 0, 0.04);
    color: #5d5d5d;
    border-color: rgba(0, 0, 0, 0.10);
}

/* ---- Tailwind gray SURFACES → light (modals/panels built with utilities:
   folder-lock, system-prompt, bulk-delete, model settings…). Structural ids
   above win by specificity, so #main-content/#sidebar/#input-bar are unaffected. */
html[data-theme="light"] .bg-gray-900 { background-color: #f1f5f9 !important; }
html[data-theme="light"] .bg-gray-800 { background-color: #ffffff !important; }
html[data-theme="light"] .bg-gray-700 { background-color: #f1f5f9 !important; }
html[data-theme="light"] .bg-gray-600 { background-color: #e2e8f0 !important; }
html[data-theme="light"] .border-gray-600 { border-color: rgba(0, 0, 0, 0.12) !important; }
html[data-theme="light"] .border-gray-700 { border-color: rgba(0, 0, 0, 0.10) !important; }

/* Utility text: white/light-gray → dark. Then RE-ASSERT white on COLORED accent
   fills (buttons like bg-blue-600/bg-red-600 keep white text). Order matters:
   the colored-fill rule comes AFTER so it wins at equal specificity. */
html[data-theme="light"] .text-white { color: #0d0d0d !important; }
html[data-theme="light"] .text-gray-300 { color: #5d5d5d !important; }
html[data-theme="light"] .text-gray-400 { color: #676767 !important; }
/* :not([class*="bg-gray-"]) excludes buttons that are gray by DEFAULT and only
   turn colored on hover (e.g. `bg-gray-700 hover:bg-blue-600 text-white`): those
   keep the dark text from the flip above, so they stay readable in their light
   default state instead of showing invisible white text. */
html[data-theme="light"] [class*="bg-blue-"]:not([class*="bg-gray-"]),
html[data-theme="light"] [class*="bg-indigo-"]:not([class*="bg-gray-"]),
html[data-theme="light"] [class*="bg-green-"]:not([class*="bg-gray-"]),
html[data-theme="light"] [class*="bg-red-"]:not([class*="bg-gray-"]),
html[data-theme="light"] [class*="bg-gradient"]:not([class*="bg-gray-"]) {
    color: #ffffff !important;   /* white text stays on saturated button fills */
}

/* ---- Composer input row: the always-visible surface ----------------------
   #prompt has NO explicit color (inherits) → force dark so typed text is
   readable; .input-row-btn is pale indigo #c7d2fe → near-invisible on light
   (the "unsichtbares Mikro"), darken it. */
html[data-theme="light"] #prompt { color: #0d0d0d !important; }
html[data-theme="light"] #prompt::placeholder { color: rgba(100, 116, 139, 0.65); }
html[data-theme="light"] .input-row-btn { color: #4f46e5; }        /* indigo-600 — visible on light */
html[data-theme="light"] .input-row-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
}

/* ---- Plans / Usage modal (rateLimitBanner.js .rlb-* — class-based) -------- */
html[data-theme="light"] .rlb-modal {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(0, 0, 0, 0.04);
}
html[data-theme="light"] .rlb-title { color: #0d0d0d; }
html[data-theme="light"] .rlb-subtitle,
html[data-theme="light"] .rlb-feat,
html[data-theme="light"] .rlb-beta { color: #676767; }
html[data-theme="light"] .rlb-usage,
html[data-theme="light"] .rlb-usage-container { background: rgba(0, 0, 0, 0.04); border: 1px solid rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .rlb-countdown { color: #676767; }
html[data-theme="light"] .rlb-usage-header,
html[data-theme="light"] .rlb-plan-name,
html[data-theme="light"] .rlb-feat-highlight { color: #0d0d0d !important; }
html[data-theme="light"] .rlb-bar-bg { background: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .rlb-plan-price { color: #0d0d0d; }
html[data-theme="light"] .rlb-card { background: #f8fafc; }
html[data-theme="light"] .rlb-card-free .rlb-btn { background: #e2e8f0; }
html[data-theme="light"] .rlb-btn { background: rgba(0, 0, 0, 0.04); color: #0d0d0d; border: 1px solid rgba(0, 0, 0, 0.12); }
html[data-theme="light"] .rlb-btn:hover:not(:disabled) { background: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .rlb-close { background: rgba(0, 0, 0, 0.04); color: #5d5d5d; border-color: rgba(0, 0, 0, 0.10); }
html[data-theme="light"] .rlb-close:hover { background: rgba(0, 0, 0, 0.08); color: #0d0d0d; }
/* keep the green "Current Plan"/ACTIVE and the white PLUS button as-is (readable). */

/* ---- Model picker (topbar.css .ms-* + inline #ms-search) ------------------ */
html[data-theme="light"] #ms-search {
    background: rgba(0, 0, 0, 0.04) !important;    /* !important beats the element's inline style */
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    color: #0d0d0d !important;
}
html[data-theme="light"] .ms-model-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.10);
}
html[data-theme="light"] .ms-model-name { color: #0d0d0d; }
html[data-theme="light"] .ms-model-provider,
html[data-theme="light"] .ms-model-meta { color: #676767; }
html[data-theme="light"] .ms-tier-title { color: #5d5d5d; }

/* ---- Header: logo + model/effort selector pills (select2) ----------------
   #app-logo is a white PNG that vanishes on light — stopgap filter darkens it
   (a proper light-logo asset can be swapped in later, then drop this rule). */
/* transform:translateY nudges the logo 5px UP visually WITHOUT changing the box it
   occupies (transforms don't affect layout flow) — so no reflow, same height. */
html[data-theme="light"] #app-logo { filter: brightness(0.35) saturate(1.15); transform: translateY(-5px); }
/* Model + Effort pills (select2 --classic). Dark rules use !important, so match it. */
html[data-theme="light"] .select2-container--classic .select2-selection--single {
    background-color: rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
    color: #0d0d0d !important;
}
html[data-theme="light"] .select2-container--classic .select2-selection--single:hover {
    background-color: rgba(0, 0, 0, 0.07) !important;
    border-color: rgba(0, 0, 0, 0.25) !important;
}
html[data-theme="light"] .select2-container--classic .select2-selection--single .select2-selection__rendered {
    color: #0d0d0d !important;
}
html[data-theme="light"] .select2-container--classic .select2-selection__arrow b {
    border-color: #5d5d5d transparent transparent transparent !important;   /* the dropdown triangle (color = the shape) */
}
/* select2 dropdown list */
html[data-theme="light"] .select2-container--classic .select2-results,
html[data-theme="light"] .select2-container--classic .select2-results__option,
html[data-theme="light"] .select2-container--classic .select2-results__group {
    background-color: #ffffff !important;
    color: #0d0d0d !important;
}
html[data-theme="light"] .select2-container--classic .select2-results__option--highlighted,
html[data-theme="light"] .select2-container--classic .select2-results__option--highlighted[aria-selected] {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #0d0d0d !important;
}

/* ============================================================================
   COMPREHENSIVE MODAL/OVERLAY PASS (from the full dark-surface inventory)
   Every surface below is either a class selector or an inline style reached via
   a stable id/class hook + !important. Backdrops (rgba(0,0,0,x) dim layers) are
   left dark on purpose. Still colors only.
   ============================================================================ */

/* --- select2 dropdown panel + search (beyond the pills above) ------------- */
html[data-theme="light"] .select2-dropdown {
    background-color: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}
html[data-theme="light"] .select2-container--classic .select2-results__group { color: #676767 !important; }
html[data-theme="light"] .select2-container--classic .select2-search--dropdown .select2-search__field {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #0d0d0d !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}
html[data-theme="light"] .select2-container--classic .select2-selection__clear { color: #676767 !important; }

/* --- Reasoning EFFORT pill + native option list --------------------------- */
html[data-theme="light"] #reasoning-effort {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(139, 92, 246, 0.06));
    color: #4338ca;
    border-color: rgba(99, 102, 241, 0.30);
}
html[data-theme="light"] #reasoning-effort option { background: #ffffff; color: #0d0d0d; }
html[data-theme="light"] .model-info-btn { background: rgba(0, 0, 0, 0.04); color: #676767; }
html[data-theme="light"] .model-info-btn:hover { background: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .model-info-btn.active { background: rgba(59, 130, 246, 0.18); color: #2563eb; }

/* --- Files Explorer (inside the now-white sidebar) ------------------------- */
html[data-theme="light"] .fe-title {
    background: none; -webkit-background-clip: initial; background-clip: initial;
    -webkit-text-fill-color: #0d0d0d; color: #0d0d0d;   /* gradient text → solid dark */
}
html[data-theme="light"] .fe-back,
html[data-theme="light"] .fe-grid-back,
html[data-theme="light"] .fe-tile,
html[data-theme="light"] .fe-tile-ico { color: #5d5d5d; }
html[data-theme="light"] .fe-tile-meta,
html[data-theme="light"] .fe-leaf-meta { color: #676767; }
html[data-theme="light"] .fe-sort-btn { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .fe-row:hover { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .fe-zone-action:hover,
html[data-theme="light"] .fe-row-action:hover { background: rgba(0, 0, 0, 0.06); color: #0d0d0d; }
html[data-theme="light"] .fe-chip-count { background: #e2e8f0; color: #0d0d0d; }
html[data-theme="light"] .fe-tile { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .fe-tile-thumb { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .fe-tile-favicon,
html[data-theme="light"] .fe-thumb-favicon { background: rgba(0, 0, 0, 0.05); }
/* Files-explorer modals */
html[data-theme="light"] .fe-modal-panel {
    background: linear-gradient(135deg, #ffffff, #f1f5f9);
    border-color: rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .fe-modal-title { color: #0d0d0d; }
html[data-theme="light"] .fe-modal-message { color: #5d5d5d; }
html[data-theme="light"] .fe-modal-input { background: #ffffff; color: #0d0d0d; border-color: rgba(0, 0, 0, 0.15); }
html[data-theme="light"] .fe-modal-btn { background: rgba(0, 0, 0, 0.05); color: #5d5d5d; }

/* --- Image lightbox -------------------------------------------------------- */
html[data-theme="light"] .lightbox-container {
    background: linear-gradient(145deg, #ffffff, #f1f5f9);
    border-color: rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .lightbox-caption { background: rgba(0, 0, 0, 0.04); color: #5d5d5d; }
html[data-theme="light"] .lightbox-close,
html[data-theme="light"] .lightbox-btn { background: rgba(0, 0, 0, 0.05); color: #5d5d5d; }
html[data-theme="light"] .lightbox-toolbar { background: rgba(0, 0, 0, 0.04); }

/* --- File viewer (attachment/PDF/CSV/text) -------------------------------- */
html[data-theme="light"] .file-viewer-panel {
    background: linear-gradient(145deg, #ffffff, #f1f5f9);
    border-color: rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .file-viewer-title { color: #0d0d0d; }
html[data-theme="light"] .file-viewer-close { background: rgba(0, 0, 0, 0.05); color: #5d5d5d; }
html[data-theme="light"] .file-viewer-download-name { color: #5d5d5d; }
html[data-theme="light"] .file-viewer-loading { color: #676767; }
html[data-theme="light"] .file-viewer-meta { color: #676767; }
html[data-theme="light"] .file-viewer-text,
html[data-theme="light"] .file-viewer-csvwrap { background: rgba(0, 0, 0, 0.04); color: #0d0d0d; }
html[data-theme="light"] .file-viewer-csv th { background: rgba(0, 0, 0, 0.05); color: #4338ca; }
html[data-theme="light"] .file-viewer-tab { background: rgba(0, 0, 0, 0.05); color: #5d5d5d; }
html[data-theme="light"] .file-viewer-tab.active { background: rgba(99, 102, 241, 0.15); color: #4338ca; }

/* --- Tooltip + legacy code-in-modal + html-preview frame ------------------ */
html[data-theme="light"] .tooltip .tooltiptext { background: #0d0d0d; color: #f8fafc; }   /* dark tooltip on light = readable, keep dark */
html[data-theme="light"] .html-preview-iframe { border-color: rgba(0, 0, 0, 0.15); }

/* --- System-Prompt modal (inline GLASS_PANEL via id hooks) -----------------
   > div[style] (1,1,1) MUST out-specify the navy catch-all below (1,1,0) — the
   panel's own gradient contains rgba(15,23,42,…), so without this the catch-all
   paints the whole panel near-transparent and the dark backdrop shows through
   ("schwarz auf dunkel"). Solid #fff so nothing bleeds through. */
html[data-theme="light"] #system-prompt-modal > div[style] {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
}
/* Every inline dark-navy surface inside the modal (textareas, cards, search
   bars across the System-Prompt/Deep-Context/Hyper-Context/Temporal tabs). */
html[data-theme="light"] #system-prompt-modal [style*="rgba(15,23,42"],
html[data-theme="light"] #system-prompt-modal [style*="rgba(15, 23, 42"] {
    background: rgba(0, 0, 0, 0.03) !important;
    color: #0d0d0d !important;
}
html[data-theme="light"] #system-prompt-modal textarea,
html[data-theme="light"] #system-prompt-modal select {
    background: #ffffff !important;
    color: #0d0d0d !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}
/* Inputs: the collapsible TITLE inputs are transparent (background:none) — forcing
   them white made stark "Windows 95" bars. Keep them transparent so they blend into
   the light collapsible; only give the real SEARCH fields (in the hyper/temporal
   bodies, 2-id specificity wins) a subtle field bg. */
html[data-theme="light"] #system-prompt-modal input { background: transparent !important; color: #0d0d0d !important; }
html[data-theme="light"] #system-prompt-modal #syshyper-body input,
html[data-theme="light"] #system-prompt-modal #systmp-body input { background: rgba(0, 0, 0, 0.04) !important; }
html[data-theme="light"] .sysmodal-tab { color: #676767; }
/* sysctx-rich content (injected class rules) */
html[data-theme="light"] .sysctx-rich h1,
html[data-theme="light"] .sysctx-rich h2,
html[data-theme="light"] .sysctx-rich h3,
html[data-theme="light"] .sysctx-rich h4 { color: #1f2328; }
html[data-theme="light"] .sysctx-rich strong { color: #0d0d0d; }
html[data-theme="light"] .sysctx-rich blockquote { color: #676767; }
html[data-theme="light"] .sysctx-rich a { color: #2563eb; }
html[data-theme="light"] .sysctx-rich th { background: rgba(99, 102, 241, 0.12); color: #4338ca; }
html[data-theme="light"] .sysctx-rich hr { border-color: rgba(0, 0, 0, 0.10); }
/* Save button (+ any inline indigo-gradient button): text.-white flip turned it black
   on the colored fill → re-assert white. */
html[data-theme="light"] #sysprompt-save,
html[data-theme="light"] button[style*="linear-gradient(135deg,#6366f1"],
html[data-theme="light"] button[style*="linear-gradient(135deg, #6366f1"] { color: #ffffff !important; }
html[data-theme="light"] .sysctx-rich h1, html[data-theme="light"] .sysctx-rich h2,
html[data-theme="light"] .sysctx-rich h3, html[data-theme="light"] .sysctx-rich strong { color: #0d0d0d; }
html[data-theme="light"] .sysctx-rich blockquote { color: #676767; }
html[data-theme="light"] .sysctx-rich a { color: #4338ca; }

/* --- Provider-consent modal (inline via id hooks) ------------------------- */
html[data-theme="light"] #consentModal > div {
    background: #ffffff !important;
    color: #0d0d0d !important;
}
html[data-theme="light"] #consentModal h2 { color: #0d0d0d !important; }
html[data-theme="light"] #consentMessage { color: #676767 !important; }
html[data-theme="light"] #declineConsent { background: rgba(0, 0, 0, 0.05) !important; color: #5d5d5d !important; }

/* --- Bulk-delete controls bar (inline via id hook) ------------------------ */
html[data-theme="light"] #bulk-delete-controls {
    background: linear-gradient(135deg, #ffffff, #f1f5f9) !important;
    border-color: rgba(0, 0, 0, 0.10) !important;
}
html[data-theme="light"] #bulk-delete-controls #selected-count { color: #676767 !important; }
html[data-theme="light"] #bulk-delete-controls button[style*="rgba(255,255,255"] { background: rgba(0, 0, 0, 0.05) !important; color: #5d5d5d !important; }

/* --- Cookie banner (injected class) --------------------------------------- */
html[data-theme="light"] .cb-card { background: #ffffff; color: #0d0d0d; }
html[data-theme="light"] .cb-title { color: #0d0d0d; }
html[data-theme="light"] .cb-text { color: #676767; }
html[data-theme="light"] .cb-btn-decline { background: rgba(0, 0, 0, 0.05); color: #5d5d5d; }

/* --- Memory-tool card (injected class) ------------------------------------ */
html[data-theme="light"] .memtool-card,
html[data-theme="light"] .memtool-think { background: rgba(0, 0, 0, 0.03); }
html[data-theme="light"] .memtool-diff { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .memtool-label,
html[data-theme="light"] .memtool-detail { color: #5d5d5d; }

/* --- Music player card (inline base #2d3748 via class hook) ---------------- */
/* Music player card: album-art background + a dark veil for caption legibility.
   Like a photo/media surface, it stays DARK in light mode (flipping the base to
   white left the veil + white text as a broken half-state). Intentionally not
   overridden — see the code-block/lightbox-mat precedent. */

/* --- Plans modal residual: the featured PLUS card inner (#09090b) --------- */
html[data-theme="light"] .rlb-card-plus { background: #f8fafc; }

/* ============================================================================
   v6 — surfaces still dark after the neutral retune (all light-text-on-light
   or a missed shell). Same rules: color only.
   ============================================================================ */

/* --- Model-picker SHELL (the modal bg itself was never overridden) --------- */
html[data-theme="light"] #model-selector-modal {
    background: linear-gradient(135deg, #ffffff, #f9f9f9) !important;
    border-color: rgba(0, 0, 0, 0.10) !important;
}
html[data-theme="light"] .ms-model-card {
    background: #f4f4f4 !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}
html[data-theme="light"] .ms-model-card .ms-model-name { color: #0d0d0d !important; }
html[data-theme="light"] .ms-model-card .ms-model-provider,
html[data-theme="light"] .ms-model-card .ms-model-meta { color: #676767 !important; }
/* Tensor ASI/AGI/AI hero cards: pale indigo fill would hide their white text. */
html[data-theme="light"] .ms-agi-card,
html[data-theme="light"] .ms-agi-card strong,
html[data-theme="light"] .ms-agi-card b { color: #0d0d0d !important; }
html[data-theme="light"] .ms-agi-card div,
html[data-theme="light"] .ms-agi-card span,
html[data-theme="light"] .ms-agi-card p { color: #5d5d5d !important; }

/* --- Audio message label + transcript (inline light text) ------------------ */
html[data-theme="light"] .audio-label { color: #0d0d0d; }
html[data-theme="light"] .audio-label strong { color: #0d0d0d; }
html[data-theme="light"] .audio-label-meta { color: #676767; }
html[data-theme="light"] .audio-transcript-body { background: rgba(0, 0, 0, 0.04) !important; }
html[data-theme="light"] .audio-transcript-body [style*="226,232,240"],
html[data-theme="light"] .audio-transcript-body [style*="226, 232, 240"] { color: #0d0d0d !important; }
html[data-theme="light"] .audio-transcript-body [style*="148,163,184"],
html[data-theme="light"] .audio-transcript-body [style*="148, 163, 184"] { color: #676767 !important; }
html[data-theme="light"] .audio-transcript-toggle { color: #676767 !important; }

/* --- Memory-tool card THOUGHTS + steps (light text on the light card) ------ */
/* Thinking box: dark bg rgba(15,23,42,0.45) + light text/head → light box, dark
   text, readable indigo head. The running "Thinking…" shimmer gradient has a
   near-white middle stop (#f1f5f9) invisible on white → dark-indigo shimmer. */
html[data-theme="light"] .memtool-think-text { background: rgba(0, 0, 0, 0.05) !important; color: #1f2328 !important; }
html[data-theme="light"] .memtool-think { border-top-color: rgba(0, 0, 0, 0.10); }
html[data-theme="light"] .memtool-think-head { color: #4338ca; }
html[data-theme="light"] .memtool-think.running .memtool-think-head span {
    background: linear-gradient(90deg, #4338ca 25%, #a5b4fc 50%, #4338ca 75%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
/* Tool-tile glyphs were #e2e8f0 (near-white) → invisible on the pale colored
   tints. Dark slate base reads on any tile; the 4 categoried ones get a
   hue-matched dark tint. */
html[data-theme="light"] .memtool-icon,
html[data-theme="light"] .memtool-head-icon { color: #334155 !important; }
html[data-theme="light"] .memtool-icon.grep { color: #0369a1 !important; }
html[data-theme="light"] .memtool-icon.glob { color: #15803d !important; }
html[data-theme="light"] .memtool-icon.sql { color: #b45309 !important; }
html[data-theme="light"] .memtool-icon.embedding { color: #7e22ce !important; }
html[data-theme="light"] .memtool-label,
html[data-theme="light"] .memtool-head-text { color: #0d0d0d; }
html[data-theme="light"] .memtool-detail { color: #676767; }

/* --- Hyper-Context / Deep-Context / Temporal tabs: the table + card inline
   navies. Broaden the inline catch to every dark-navy signature they use, and
   force dark text on the whole tab body so table cells are readable. --------- */
html[data-theme="light"] #syshyper-body,
html[data-theme="light"] #systmp-body { color: #0d0d0d; }
html[data-theme="light"] #system-prompt-modal [style*="rgba(30,41,59"],
html[data-theme="light"] #system-prompt-modal [style*="rgba(30, 41, 59"],
html[data-theme="light"] #system-prompt-modal [style*="rgba(51,65,85"],
html[data-theme="light"] #system-prompt-modal [style*="rgba(2,6,23"] {
    background: rgba(0, 0, 0, 0.03) !important;
}
html[data-theme="light"] #system-prompt-modal table th,
html[data-theme="light"] #syshyper-body th { background: rgba(0, 0, 0, 0.05) !important; color: #0d0d0d !important; }
html[data-theme="light"] #system-prompt-modal table td,
html[data-theme="light"] #syshyper-body td { color: #0d0d0d !important; border-color: rgba(0, 0, 0, 0.08) !important; }
html[data-theme="light"] #syshyper-body [style*="226,232,240"],
html[data-theme="light"] #syshyper-body [style*="226, 232, 240"],
html[data-theme="light"] #systmp-body [style*="226,232,240"],
html[data-theme="light"] #systmp-body [style*="226, 232, 240"] { color: #0d0d0d !important; }

/* ============================================================================
   v7 — EXHAUSTIVE pass (from the full JS-inline + CSS catalogs). Two mechanisms:
   (1) container-scoped catch-alls that flip EVERY dark-navy inline bg + light
       inline text inside a modal, matching BOTH the authored `rgba(15,23,42,`
       and the browser-normalized `rgba(15, 23, 42,` form (elements built via
       .style.cssText get re-serialized with spaces + hex→rgb);
   (2) direct class/id overrides for the remaining CSS + injected-<style> surfaces.
   Scoped to known containers so backdrops (rgba(0,0,0,x)) and media stay dark.
   ============================================================================ */

/* (1) Inline-styled modal containers — navy bg → light raised surface --------- */
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgba(15, 23, 42"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgba(15,23,42"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgba(30, 41, 59"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgba(30,41,59"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgba(15, 18, 35"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgba(30, 30, 50"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgba(45, 55, 72"] {
    background: rgba(0, 0, 0, 0.03) !important;
}
/* primary light text → near-black */
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="#e2e8f0"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgb(226, 232, 240"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="#f1f5f9"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="#cbd5e1"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgb(203, 213, 225"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="#cbd5e0"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="#e0e7ff"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="#c7d2fe"] {
    color: #0d0d0d !important;
}
/* muted/accent light text → readable grey */
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="#94a3b8"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgb(148, 163, 184"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="#a5b4fc"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="rgb(165, 180, 252"],
html[data-theme="light"] :is(#system-prompt-modal, #attachment-modal, #model-settings-panel, #bulk-delete-controls, #avatar-menu) [style*="#c7d2fe"] {
    color: #676767 !important;
}

/* (2a) chat.css surfaces --------------------------------------------------- */
html[data-theme="light"] .chat-message th { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .chat-message th,
html[data-theme="light"] .chat-message td { border-color: rgba(0, 0, 0, 0.12); }
html[data-theme="light"] .message-content hr { border-top-color: rgba(0, 0, 0, 0.12); }
html[data-theme="light"] .copy-button,
html[data-theme="light"] .play-button:not([style*="rgb(56"]) { background: rgba(0, 0, 0, 0.05); color: #5d5d5d; }
html[data-theme="light"] .language-label { background: rgba(0, 0, 0, 0.05) !important; color: #5d5d5d !important; border-color: rgba(0, 0, 0, 0.10) !important; }
html[data-theme="light"] .audio-player-modern { background: rgba(0, 0, 0, 0.04); border-color: rgba(0, 0, 0, 0.10); }
html[data-theme="light"] .audio-player-progress { background: rgba(0, 0, 0, 0.10); }
html[data-theme="light"] .audio-player-time { color: #676767; }
html[data-theme="light"] .ghost-text { color: #0d0d0d; }
html[data-theme="light"] .ghost-queue-header { color: #4338ca; }
html[data-theme="light"] .ghost-remove { background: rgba(0, 0, 0, 0.06); color: #5d5d5d; }
html[data-theme="light"] .compression-progress { color: #6d28d9; }
html[data-theme="light"] .compression-message-expanded { color: #0d0d0d; }
html[data-theme="light"] .reasoning-header span { color: #6d28d9 !important; }
html[data-theme="light"] .reasoning-content { color: #454545; }

/* (2b) topbar.css: model chip, TTS player, param controls, in-chat search --- */
html[data-theme="light"] #model-chip {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(139, 92, 246, 0.06));
    color: #4338ca;
}
html[data-theme="light"] #model-chip i { color: #6366f1; }
html[data-theme="light"] #tts-player { background: linear-gradient(135deg, #ffffff, #f9f9f9); }
html[data-theme="light"] .tts-player-btn { background: rgba(0, 0, 0, 0.05); color: #5d5d5d; }
html[data-theme="light"] .tts-player-seek,
html[data-theme="light"] .tts-player-speed { background: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .tts-player-speed-btn { background: rgba(99, 102, 241, 0.12); color: #4338ca; }
html[data-theme="light"] .param-mode-toggle,
html[data-theme="light"] .param-number,
html[data-theme="light"] .param-range-input,
html[data-theme="light"] .param-slider,
html[data-theme="light"] .param-range-track { background: rgba(0, 0, 0, 0.05); color: #0d0d0d; }
html[data-theme="light"] .param-name { color: #4338ca; }
html[data-theme="light"] .model-info-value { color: #0d0d0d; }
html[data-theme="light"] .in-chat-search-overlay,
html[data-theme="light"] .in-chat-search-count,
html[data-theme="light"] .in-chat-search-fab { background: #ffffff; color: #0d0d0d; }
html[data-theme="light"] .in-chat-search-fab:hover { background: #f1f5f9; }
html[data-theme="light"] .in-chat-search-input { background: rgba(0, 0, 0, 0.04); color: #0d0d0d; }
html[data-theme="light"] .ms-model-meta span { background: rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .ms-caps span { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .ms-close { background: rgba(0, 0, 0, 0.05); color: #5d5d5d; }

/* (2c) sidebar.css: chat-actions dropdown, list hover/active, misc ---------- */
html[data-theme="light"] .chat-actions-dropdown { background: #ffffff !important; border-color: rgba(0, 0, 0, 0.10) !important; }
/* Container-level dark bg lives ON the element itself (inline in markup), not a
   child — the [style*=] catch-alls use a DESCENDANT combinator and skipped it.
   Flip the panels directly. */
html[data-theme="light"] #avatar-menu { background: #ffffff !important; border-color: rgba(0, 0, 0, 0.10) !important; }
/* The [style] attribute bumps specificity (1,1,1) ABOVE the navy catch-all (1,1,0)
   — needed because these panels carry rgba(15,23,42,…) in their gradient, so the
   catch-all otherwise wins and paints them near-transparent (dark showing through).
   Solid #fff (not a gradient/alpha) so nothing dark bleeds through. */
html[data-theme="light"] #attachment-modal > div[style] { background: #ffffff !important; }
html[data-theme="light"] .chat-actions-dropdown button { color: #0d0d0d; }
html[data-theme="light"] .chat-actions-dropdown button:hover { background: #f1f5f9; }
html[data-theme="light"] .folder:hover,
html[data-theme="light"] .chat-item:hover { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .active-chat,
html[data-theme="light"] .active-chat:hover { color: #0d0d0d; }
html[data-theme="light"] .sidebar-footer-btn { background: rgba(0, 0, 0, 0.04); color: #5d5d5d; }
html[data-theme="light"] .sidebar-footer-btn:hover { background: rgba(0, 0, 0, 0.08); }
html[data-theme="light"] .chat-sort-btn:hover { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .chat-sort-btn.active { color: #2563eb; }
html[data-theme="light"] .search-highlight,
html[data-theme="light"] .search-highlight-msg,
html[data-theme="light"] .msg-preview .search-highlight { background: rgba(250, 204, 21, 0.45); color: #0d0d0d; }
html[data-theme="light"] #resize-handle { background: rgba(0, 0, 0, 0.10); }
html[data-theme="light"] #resize-handle:hover { background: rgba(0, 0, 0, 0.20); }
html[data-theme="light"] .folder-content { border-left-color: rgba(0, 0, 0, 0.08); }

/* (2d) input.css: scroll FAB, upload progress, attachment filename ---------- */
html[data-theme="light"] #scroll-to-bottom { background: rgba(99, 102, 241, 0.12) !important; color: #4338ca !important; }
html[data-theme="light"] .queue-upload-progress { background: #f1f5f9; }
html[data-theme="light"] .attachment-message span.filename { background: rgba(0, 0, 0, 0.05); color: #0d0d0d; }
html[data-theme="light"] .audio-record-timer { color: #4338ca; }

/* (2e) overlays.css: settings option list, legacy code-in-modal, close ------ */
html[data-theme="light"] .app-settings-select option,
html[data-theme="light"] .app-settings-select optgroup { background: #ffffff; color: #0d0d0d; }
html[data-theme="light"] .bg-gray-800 pre { background: #f6f8fa !important; color: #1f2328; }
html[data-theme="light"] .app-settings-close { background: rgba(0, 0, 0, 0.05); color: #5d5d5d; }

/* (2f) filesExplorer.css: dark icon plates the earlier pass left as text-only  */
html[data-theme="light"] .fe-tile-ico { background: rgba(0, 0, 0, 0.06) !important; }
html[data-theme="light"] .fe-filter-row { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .fe-thumb { background: rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .fe-chip-icon { background: rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .fe-back:hover { background: rgba(0, 0, 0, 0.06); }

/* (2g) base.css: generic dark utility + body link color -------------------- */
html[data-theme="light"] .bg-dark { background-color: #f1f5f9; }
html[data-theme="light"] .message-content a { color: #2563eb; }
html[data-theme="light"] .message-content a:hover { color: #1d4ed8; }

/* (2h) injected-<style> clusters (override by class) ------------------------ */
html[data-theme="light"] .memtool-write-head,
html[data-theme="light"] .memtool-head { color: #4338ca; }
html[data-theme="light"] .memtool-diff-body { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .memtool-file-open,
html[data-theme="light"] .memtool-diff-toggle { color: #4338ca; }
/* Diff rows: light text #e2e8f0 on the pale add/del tints = unreadable → dark
   text, and deepen the row tints so add/del still read on the light card. */
html[data-theme="light"] .memtool-diff-code { color: #1f2328 !important; }
html[data-theme="light"] .memtool-diff-row.add { background: rgba(34, 197, 94, 0.16) !important; }
html[data-theme="light"] .memtool-diff-row.del { background: rgba(239, 68, 68, 0.14) !important; }
html[data-theme="light"] .memtool-diff-row.add .memtool-diff-gutter { color: #15803d !important; }
html[data-theme="light"] .memtool-diff-row.del .memtool-diff-gutter { color: #b91c1c !important; }
html[data-theme="light"] .memtool-diff-lno,
html[data-theme="light"] .memtool-diff-row.add .memtool-diff-lno,
html[data-theme="light"] .memtool-diff-row.del .memtool-diff-lno { color: #676767 !important; }
html[data-theme="light"] .memtool-diff-toggle:hover { color: #0d0d0d; background: rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .loading-dot-waiting { background: rgba(99, 102, 241, 0.15); color: #4338ca; }
html[data-theme="light"] .no-response-pill { background: rgba(0, 0, 0, 0.04); color: #5d5d5d; border-color: rgba(0, 0, 0, 0.12); }

/* (2i) upload chips (template inline, class hooks) ------------------------- */
html[data-theme="light"] .upload-status-text { color: #4338ca; }
html[data-theme="light"] .img-upload-cancel-btn,
html[data-theme="light"] .doc-upload-cancel-btn,
html[data-theme="light"] .audio-upload-cancel-btn,
html[data-theme="light"] .video-upload-cancel-btn { color: #5d5d5d !important; }

/* (2j) generation placeholders (#2d3748 tile — both DOM forms) -------------- */
html[data-theme="light"] .gen-image-placeholder,
html[data-theme="light"] .gen-image-processing,
html[data-theme="light"] .gen-music-placeholder,
html[data-theme="light"] .gen-music-processing,
html[data-theme="light"] .gen-video-processing,
html[data-theme="light"] .gen-video-item { background: #f1f5f9 !important; }
html[data-theme="light"] :is(.gen-image-processing, .gen-music-processing, .gen-video-processing) [style*="rgba(255, 255, 255"] { color: #5d5d5d !important; }

/* ============================================================================
   v10 — Files-Explorer OVERHAUL + settings param controls + Tailwind hover
   variants. The explorer was washed out: its content text (file/folder names,
   counts) is light (#e2e8f0/#cbd5e1/#7c8aa0) built for dark, so on the light
   sidebar it nearly vanished. Give PRIMARY content crisp near-black, meta a
   readable grey, keep colored icons.
   ============================================================================ */
/* primary content — folder/file names, tree rows, grid tiles → near-black */
html[data-theme="light"] .fe-row,
html[data-theme="light"] .fe-back,
html[data-theme="light"] .fe-tile,
html[data-theme="light"] .fe-tile-name,
html[data-theme="light"] .fe-leaf,
html[data-theme="light"] .fe-leaf-name { color: #1f2328; }
/* secondary / meta / counts → readable muted grey */
html[data-theme="light"] .fe-count,
html[data-theme="light"] .fe-cardinality,
html[data-theme="light"] .fe-zone-label,
html[data-theme="light"] .fe-chevron,
html[data-theme="light"] .fe-sort,
html[data-theme="light"] .fe-empty,
html[data-theme="light"] .fe-message,
html[data-theme="light"] .fe-filter-ico,
html[data-theme="light"] .fe-tile-meta,
html[data-theme="light"] .fe-leaf-meta,
html[data-theme="light"] .fe-zone-action,
html[data-theme="light"] .fe-row-action { color: #676767; }
/* icons — indigo (stronger than the dark-theme #818cf8), file icons muted */
html[data-theme="light"] .fe-ico,
html[data-theme="light"] .fe-zone-label i,
html[data-theme="light"] .fe-filter-ico { color: #6366f1; }
html[data-theme="light"] .fe-row[data-kind="file"] .fe-ico { color: #94a3b8; }
html[data-theme="light"] .fe-ico-tile { color: #475569; }   /* was white → invisible */
/* surfaces + hovers (white-alpha → black-alpha; hover text #fff → dark) */
html[data-theme="light"] .fe-sort-btn { background: rgba(0, 0, 0, 0.05); color: #475569; }
html[data-theme="light"] .fe-sort-btn:hover { background: rgba(0, 0, 0, 0.10); }
html[data-theme="light"] .fe-sort-btn.active { color: #2563eb; }
html[data-theme="light"] .fe-filter-row { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .fe-thumb { background: rgba(0, 0, 0, 0.06); }
/* Category chips: label faint + per-bucket icon glyphs are light pastels on pale
   tints (invisible on white) → dark label + hue-matched dark icon glyphs. */
html[data-theme="light"] .fe-chip-label { color: #475569; }
html[data-theme="light"] .fe-chip.active .fe-chip-label { color: #4338ca; }
html[data-theme="light"] .fe-chip-icon { color: #475569; }
html[data-theme="light"] .fe-chip[data-bucket="Images"] .fe-chip-icon { color: #db2777 !important; }
html[data-theme="light"] .fe-chip[data-bucket="Audios"] .fe-chip-icon { color: #4f46e5 !important; }
html[data-theme="light"] .fe-chip[data-bucket="Videos"] .fe-chip-icon { color: #7c3aed !important; }
html[data-theme="light"] .fe-chip[data-bucket="Documents"] .fe-chip-icon { color: #ea580c !important; }
html[data-theme="light"] .fe-chip[data-bucket="Generated"] .fe-chip-icon { color: #059669 !important; }
html[data-theme="light"] .fe-chip[data-bucket="Links"] .fe-chip-icon { color: #0284c7 !important; }
html[data-theme="light"] .fe-row:hover { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .fe-zone-action:hover,
html[data-theme="light"] .fe-row-action:hover { background: rgba(0, 0, 0, 0.06); color: #1f2328; }
html[data-theme="light"] .fe-row-action.fe-danger:hover { background: rgba(239, 68, 68, 0.14); color: #b91c1c; }
/* explorer scrollbar */
html[data-theme="light"] .fe-tree { scrollbar-color: rgba(0, 0, 0, 0.25) transparent; }
html[data-theme="light"] .fe-tree::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.22); }
/* explorer modals (title/message/input/btn) */
html[data-theme="light"] .fe-modal-title { color: #0d0d0d; }
html[data-theme="light"] .fe-modal-message { color: #475569; }
html[data-theme="light"] .fe-modal-input { background: #ffffff; color: #0d0d0d; }
html[data-theme="light"] .fe-modal-btn { background: rgba(0, 0, 0, 0.05); color: #475569; }

/* settings param mode toggle (Default/Fixed/Random): #a5b4fc light-blue-on-blue */
html[data-theme="light"] .param-mode-toggle { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .param-mode-btn { color: #676767; }
html[data-theme="light"] .param-mode-btn.active { background: rgba(99, 102, 241, 0.18); color: #4338ca; }
html[data-theme="light"] .param-mode-btn:hover:not(.active) { color: #0d0d0d; }

/* Tailwind HOVER variants of bg-gray — the plain-class flip missed these, so the
   chat-list ⋯ button (hover:bg-gray-700) still went dark on hover. */
html[data-theme="light"] .hover\:bg-gray-700:hover { background-color: #f1f5f9 !important; }
html[data-theme="light"] .hover\:bg-gray-800:hover { background-color: #ececec !important; }
html[data-theme="light"] .hover\:bg-gray-600:hover { background-color: #f1f5f9 !important; }

/* Upgrade button (#credit-widget-btn): #fbbf24 light-amber text on a pale-amber
   fill = yellow-on-yellow → amber-700 text + a touch more fill. */
html[data-theme="light"] #credit-widget-btn {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.20), rgba(245, 158, 11, 0.14));
    color: #b45309;
    border-color: rgba(217, 119, 6, 0.35);
}
html[data-theme="light"] #credit-widget-btn:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.30), rgba(245, 158, 11, 0.22));
    color: #92400e;
}

/* ============================================================================
   v12 — systemic fixes (über den Tellerrand): the recurring classes, not
   one-offs. (1) native <select> dropdowns render dark (arrow + option list);
   (2) light-indigo/lavender TEXT tokens (#c7d2fe/#a5b4fc/#e0e7ff) — applied via
   .style.cssText so they're rgb() in the DOM and my hex catch-alls missed them —
   appear as headings EVERYWHERE and vanish on white.
   ============================================================================ */

/* (1) Native selects: force the LIGHT rendering so the dropdown arrow is a dark
   glyph and the opened option list is light (color-scheme drives native chrome). */
html[data-theme="light"] select,
html[data-theme="light"] input,
html[data-theme="light"] textarea { color-scheme: light; }
/* DARK too (user-reported: the native select ARROW was invisible in dark). The
   app never set color-scheme, so the native chrome rendered unpredictably. This
   is the ONE rule here that touches dark on purpose — color-scheme only, no
   layout, so the byte-stable guarantee holds. */
html:not([data-theme="light"]) select { color-scheme: dark; }
html[data-theme="light"] select option,
html[data-theme="light"] select optgroup,
html[data-theme="light"] .app-settings-select option,
html[data-theme="light"] .app-settings-select optgroup {
    background-color: #ffffff;
    color: #0d0d0d;
}

/* (2) Light-indigo/lavender inline TEXT → readable indigo, in BOTH the authored
   hex form and the browser-normalized rgb() form. Global (color-only, so it can
   only affect text) — this kills the faint-heading class app-wide in one shot. */
html[data-theme="light"] [style*="#c7d2fe"],
html[data-theme="light"] [style*="rgb(199, 210, 254)"],
html[data-theme="light"] [style*="#a5b4fc"],
html[data-theme="light"] [style*="rgb(165, 180, 252)"],
html[data-theme="light"] [style*="#e0e7ff"],
html[data-theme="light"] [style*="rgb(224, 231, 255)"],
html[data-theme="light"] [style*="#c7d2fe"] i {
    color: #4338ca !important;
}

/* (3) White-text pill on a pale-indigo fill (the in-chat "reconnect/load" button)
   → solid indigo so the white text reads. Match the BACKGROUND declaration only
   (`background:rgba(99,102,241,0.3)`) — matching the bare value wrongly caught the
   template "+" button, which merely has 0.3 in its BORDER, and glared it blue. */
html[data-theme="light"] button[style*="background:rgba(99,102,241,0.3)"],
html[data-theme="light"] button[style*="background:rgba(99, 102, 241, 0.3)"],
html[data-theme="light"] button[style*="background: rgba(99, 102, 241, 0.3)"] {
    background: #4f46e5 !important;
    border-color: #4338ca !important;
}
/* The template "+" (#sysprompt-tpl-add): keep it a subtle indigo, not glaring. */
html[data-theme="light"] #sysprompt-tpl-add {
    background: rgba(99, 102, 241, 0.12) !important;
    color: #4338ca !important;
    border-color: rgba(99, 102, 241, 0.30) !important;
}
/* Section numbers ("1." "2." …) are wrapped in span opacity:0.45 → a washed-out
   indigo. Bump the opacity so the number reads as indigo like its title (visual
   only, no layout). */
html[data-theme="light"] #system-prompt-modal span[style*="opacity:0.45"] { opacity: 0.72 !important; }

/* Citation count ("5 citations") — rgba(148,163,184,0.7) too pale on white. */
html[data-theme="light"] .citation-count { color: #676767 !important; }

/* Select hover feedback via background-COLOR (not the shorthand) so it keeps the
   arrow image + no-repeat instead of tiling. */
html[data-theme="light"] .app-settings-select:hover { background-color: #f4f4f4 !important; }

/* Temporal-Memory period badges use pastel colors built for dark (day #86efac,
   week #7dd3fc, year #f0abfc) that glare on white — darken to -600/-700. Both
   the authored hex and the .style.cssText-normalized rgb() form. (month #a5b4fc
   is already handled by the global lavender remap.) */
html[data-theme="light"] #system-prompt-modal [style*="#86efac"],
html[data-theme="light"] #system-prompt-modal [style*="rgb(134, 239, 172)"] { color: #16a34a !important; }
html[data-theme="light"] #system-prompt-modal [style*="#7dd3fc"],
html[data-theme="light"] #system-prompt-modal [style*="rgb(125, 211, 252)"] { color: #0284c7 !important; }
html[data-theme="light"] #system-prompt-modal [style*="#f0abfc"],
html[data-theme="light"] #system-prompt-modal [style*="rgb(240, 171, 252)"] { color: #a21caf !important; }

/* ---- Polish (beyond the surfaces): scrollbars, selection, native controls -
   Custom scrollbars are white-alpha thumbs (invisible on light) → black-alpha.
   A themed text selection + native color-scheme round it off. Color only. */
html[data-theme="light"] * { scrollbar-color: rgba(0, 0, 0, 0.25) transparent; }
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.22) !important; }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.35) !important; }
html[data-theme="light"] ::-webkit-scrollbar-track { background: transparent !important; }
html[data-theme="light"] ::selection { background: rgba(99, 102, 241, 0.22); color: #0d0d0d; }

html[data-theme="light"] { color-scheme: light; }
