/* Light / dark theme: the switch, and hand-made fixes on top of the generated dark CSS (/theme/dark-*.css).
   The generated file moves every colour of the light CSS to the dark side; put here only what it can't know
   (colours in views and scripts, things that should look different on purpose). */

/* ---- the switch (public site and back office) ---- */
.theme-switch{display:inline-flex;align-items:center;gap:2px;padding:2px;border:1px solid #e3e6ee;border-radius:999px;background:#fff}
.theme-switch button{display:inline-flex;align-items:center;justify-content:center;width:28px;height:26px;padding:0;border:0;border-radius:999px;background:transparent;color:#7a808c;cursor:pointer;transition:background .15s,color .15s}
.theme-switch button:hover{color:#171923}
.theme-switch button[aria-pressed="true"]{background:#fff0f1;color:#d92d3a}
.theme-switch button:focus-visible{outline:2px solid #d92d3a;outline-offset:1px}
.theme-sr{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.mobile-menu .theme-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 4px 0;color:var(--ink);font-weight:650}

/* ---- dark: general ---- */
html[data-theme="dark"]{color-scheme:dark}
html[data-theme="dark"] .theme-switch{background:#1b1e25;border-color:#323743}
html[data-theme="dark"] .theme-switch button{color:#9aa1ae}
html[data-theme="dark"] .theme-switch button:hover{color:#eef0f4}
html[data-theme="dark"] .theme-switch button[aria-pressed="true"]{background:#3a1f23;color:#ff8a93}
html[data-theme="dark"] img.brand-logo,html[data-theme="dark"] .header-brand-img{filter:drop-shadow(0 0 1px rgba(255,255,255,.25))}

/* ---- back office pages with their own <style> blocks ---- */
/* Owner → AI chat → Test (scoped: the inbox uses .ai-msg too) */
html[data-theme="dark"] .ai-test-log{background:#15181e}
html[data-theme="dark"] .ai-test-form{background:#1b1e25;border-top-color:rgba(255,255,255,.08)}
html[data-theme="dark"] .ai-test-log .ai-msg{background:#232731;border-color:#323743}
html[data-theme="dark"] .ai-test-log .ai-msg.me{background:#1d3150;border-color:#2b4670}
html[data-theme="dark"] .ai-test-log .ai-meta,html[data-theme="dark"] .ai-test-log .ai-typing{color:#9aa1ae}
html[data-theme="dark"] .ai-test-log .ai-note{color:#a7adb9}
html[data-theme="dark"] .ai-test-log .ai-note.err{color:#ff8a8a}
html[data-theme="dark"] .ai-test-log .ai-sugg button{background:#232731;border-color:#3a404d;color:#e6e8ee}
html[data-theme="dark"] .ai-test-log .ai-sugg button:hover{border-color:#6d9be0;color:#9cc0f5}

/* Inbox composer: a field of the theme's own colour, not the browser's grey */
html[data-theme="dark"] .ai-composer textarea{background:#13161d;color:inherit}

/* Tabler switches: the knob stays light */
html[data-theme="dark"] .custom-switch-indicator:before{background:#e6e8ee}

/* Public site: the dark call-to-action band keeps readable text */
html[data-theme="dark"] .cta-band p{color:#c0bfca}

/* Owner → Statistics: dark steps of the same chart palette, and a heatmap that grows brighter with more traffic */
html[data-theme="dark"] .viz-root{
  --viz-bot:#3987e5;--viz-ai:#d95926;--viz-live:#199e70;--viz-rating:#c98500;--viz-empty:#262a33;--viz-grid:#323743;--viz-muted:#a3a9b5;
  --heat-1:#104281;--heat-2:#184f95;--heat-3:#1c5cab;--heat-4:#256abf;--heat-5:#2a78d6;--heat-6:#3987e5;--heat-7:#6da7ec}
html[data-theme="dark"] .viz-bar .viz-tip{background:#eef0f4;color:#171923}

/* Email previews show the email as it is sent: keep their light frame. */
html[data-theme="dark"] iframe[title="Email preview"]{background:#f5f6fa!important}

/* Inline chat mock on the Live chat page */
html[data-theme="dark"] .bubble.visitor[style]{background:#262a33!important}

/* Clients: the initials keep the client's own colour */
html[data-theme="dark"] .client-mono{background:var(--client,#d92d3a);color:#fff}
/* Real logos are drawn for light backgrounds, so they keep a white tile */
html[data-theme="dark"] img.client-logo{background:#fff;border-color:transparent}
html[data-theme="dark"] .client-plus{background:#3a1f23;color:#ff8a93;border-color:#6a2f36}
