/* Dark theme for the whole portal (Nov 2026) – <html data-theme="dark">, set by theme.js before the first paint.
   Loaded after app.css + desk.css. The NOC, Live board and Zoho ticket table were already dark and stay as they are.
   Every rule is wrapped in :where() so it has exactly the specificity of the light rule it replaces (later file wins,
   more specific rules – Zoho table, NOC, Zoho Add Ticket form – keep their own look). Status colours keep their meaning (green ok / amber warning / red problem) – only lighter steps for the dark surface. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0e15; --card: #191823; --text: #e9e7f1; --muted: #9b99ab; --line: #2c2a38; --soft: #211f2c;
  --violet: #9b7bff; --violet-hi: #ae93ff; --ok: #2fbf7d; --warn: #f0a52a; --bad: #ff6b80; --info: #5b9dff;
}

/* buttons & inputs */
:where(html[data-theme="dark"]) .btn { background: #23212f; border-color: #363445; color: var(--text); }
:where(html[data-theme="dark"]) .btn:hover { border-color: #4b4860; }
:where(html[data-theme="dark"]) .btn.primary { background: #6a2cff; border-color: #6a2cff; color: #fff; }
:where(html[data-theme="dark"]) .btn.primary:hover { background: #8445ff; }
:where(html[data-theme="dark"]) .btn.ghost { background: transparent; }
:where(html[data-theme="dark"]) .btn.danger { color: var(--bad); }
:where(html[data-theme="dark"]) input, :where(html[data-theme="dark"]) select, :where(html[data-theme="dark"]) textarea { background: #14131c; border-color: #34323f; color: var(--text); }
:where(html[data-theme="dark"]) input::placeholder, :where(html[data-theme="dark"]) textarea::placeholder { color: #75738a; }
:where(html[data-theme="dark"]) input:focus, :where(html[data-theme="dark"]) select:focus, :where(html[data-theme="dark"]) textarea:focus { border-color: #9b7bff; box-shadow: 0 0 0 3px rgba(155, 123, 255, .22); }
:where(html[data-theme="dark"]) .seg button.on { background: #322f42; color: #fff; box-shadow: none; }
:where(html[data-theme="dark"]) .langsw { background: #191823; border-color: #34323f; }
:where(html[data-theme="dark"]) .langsw button.on { background: #2c2a3a; color: #fff; }

/* sign-in */
:where(html[data-theme="dark"]) .login-card { background: #191823; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .9); border: 1px solid #2c2a38; }

/* cards, tables, call list */
:where(html[data-theme="dark"]) .tbl th { background: #1d1c28; }
:where(html[data-theme="dark"]) .tbl tr.row:hover td { background: #201f2c; }
:where(html[data-theme="dark"]) .tbl tr.playing td { background: #2a2147; }
:where(html[data-theme="dark"]) .dir.in { background: rgba(91, 157, 255, .16); } :where(html[data-theme="dark"]) .dir.out { background: rgba(47, 191, 125, .16); }
:where(html[data-theme="dark"]) .dir.internal { background: rgba(155, 123, 255, .16); } :where(html[data-theme="dark"]) .dir.missed { background: rgba(255, 107, 128, .16); }
:where(html[data-theme="dark"]) .pill.answered { background: rgba(47, 191, 125, .16); } :where(html[data-theme="dark"]) .pill.missed { background: rgba(255, 107, 128, .16); }
:where(html[data-theme="dark"]) .pill.busy, :where(html[data-theme="dark"]) .pill.failed { background: rgba(240, 165, 42, .16); }
:where(html[data-theme="dark"]) .play { background: #23212f; border-color: #363445; color: #b49cff; }
:where(html[data-theme="dark"]) .play.on { background: #6a2cff; border-color: #6a2cff; color: #fff; }
:where(html[data-theme="dark"]) .play.dl { background: #23212f; color: var(--text); }
:where(html[data-theme="dark"]) .drawer { background: #191823; box-shadow: -20px 0 60px -20px rgba(0, 0, 0, .9); }
:where(html[data-theme="dark"]) .legs li::before { background: #191823; }
:where(html[data-theme="dark"]) .shade { background: rgba(0, 0, 0, .6); }
:where(html[data-theme="dark"]) .subtabs a.on { background: #191823; }
:where(html[data-theme="dark"]) .note { background: #241d3d; }
:where(html[data-theme="dark"]) .note.warn, :where(html[data-theme="dark"]) .secret { background: #2d2312; }
:where(html[data-theme="dark"]) .acc tr.grp td { background: #241d3d; color: #b49cff; }
:where(html[data-theme="dark"]) .cbdone:hover { background: rgba(255, 255, 255, .08); }
:where(html[data-theme="dark"]) .toast { background: #2c2a3a; border: 1px solid #3c3a4c; }
:where(html[data-theme="dark"]) .toast.err { background: #b3263b; }

/* header menus (admin) */
:where(html[data-theme="dark"]) .top .menu-pop { background: #1d1c28; border: 1px solid #2f2d3c; box-shadow: 0 18px 40px rgba(0, 0, 0, .6); }
:where(html[data-theme="dark"]) .top .menu-pop a.on { background: #2a2147; color: #c4b2ff; }
:where(html[data-theme="dark"]) .top .menu-pop a, :where(html[data-theme="dark"]) .top .menu-pop button { color: var(--text); }

/* service desk */
:where(html[data-theme="dark"]) .tag, :where(html[data-theme="dark"]) .dtabs b { background: #2a2147; color: #c4b2ff; }
:where(html[data-theme="dark"]) .pr-low { color: #8f8da0; }
:where(html[data-theme="dark"]) .dpill { background: #191823; border-color: #3a3848; color: var(--text); }
:where(html[data-theme="dark"]) .dpill.st-closed { background: rgba(47, 191, 125, .12); border-color: #2c6b4e; color: #4fd18a; }
:where(html[data-theme="dark"]) .dpill.st-on_hold { background: rgba(240, 165, 42, .12); border-color: #7a5520; color: #f3b04a; }
:where(html[data-theme="dark"]) .dpill.st-escalated { background: rgba(255, 107, 128, .12); border-color: #7d3442; color: #ff7d90; }
:where(html[data-theme="dark"]) .ddetail .dstatus { background: #191823; border-color: #3a3848; color: var(--text); }
:where(html[data-theme="dark"]) .ddetail .dstatus.st-closed { color: #4fd18a; } :where(html[data-theme="dark"]) .ddetail .dstatus.st-on_hold { color: #f3b04a; }
:where(html[data-theme="dark"]) .ddetail .dstatus.st-escalated { color: #ff7d90; }
:where(html[data-theme="dark"]) .dmsg { background: #191823; }
:where(html[data-theme="dark"]) .dmsg.k-note, :where(html[data-theme="dark"]) .dcomposer.note-mode textarea, :where(html[data-theme="dark"]) .dpin { background: #29240f; border-color: #574b1d; }
:where(html[data-theme="dark"]) .dmsg.k-note { border-left-color: #e2b93b; }
:where(html[data-theme="dark"]) .dpinned { background: #221f12; border-color: #574b1d; }
:where(html[data-theme="dark"]) .dlive { background: #11261c; border-color: #2c6b4e; } :where(html[data-theme="dark"]) .dnotlive { background: #2a2113; border-color: #7a5520; }
:where(html[data-theme="dark"]) dialog.dmodal { background: #191823; box-shadow: 0 24px 70px rgba(0, 0, 0, .7); }
:where(html[data-theme="dark"]) dialog.dmodal::backdrop { background: rgba(0, 0, 0, .6); }
:where(html[data-theme="dark"]) .dmodal-head, :where(html[data-theme="dark"]) .dmodal-foot { background: #191823; }
:where(html[data-theme="dark"]) .dkbitem { background: #1d1c28; }
:where(html[data-theme="dark"]) .dkbcard p { color: #bdbbcb; }
:where(html[data-theme="dark"]) .md pre, :where(html[data-theme="dark"]) .dcode, :where(html[data-theme="dark"]) .cmd, :where(html[data-theme="dark"]) .sshout { background: #08070d; border: 1px solid #2c2a38; }

/* live chat */
:where(html[data-theme="dark"]) .cmsg.me { background: #6a2cff; border-color: #6a2cff; }
:where(html[data-theme="dark"]) .chatlog { background: #13121a; }

/* call-flow designer */
:where(html[data-theme="dark"]) .fd-pi, :where(html[data-theme="dark"]) .fd-node { background: #1d1c28; }
:where(html[data-theme="dark"]) .fd-node { box-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
:where(html[data-theme="dark"]) .fd-scroll { background-color: #12111a; background-image: radial-gradient(circle, #2e2c3c 1px, transparent 1px); }
:where(html[data-theme="dark"]) .fd-line { stroke: #625d7c; } :where(html[data-theme="dark"]) .fd-arrow { fill: #625d7c; }
:where(html[data-theme="dark"]) .fd-port { background: #1d1c28; border-color: #625d7c; }
:where(html[data-theme="dark"]) .fd-port.out.on { background: #625d7c; }
:where(html[data-theme="dark"]) .fd-badge.open { background: rgba(47, 191, 125, .16); color: #4fd18a; }
:where(html[data-theme="dark"]) .fd-badge.closed { background: rgba(255, 107, 128, .16); color: #ff7d90; }
:where(html[data-theme="dark"]) .fd-exit.live { background: #2a2147; color: #c4b2ff; }
:where(html[data-theme="dark"]) .fd-exit.changed { background: #2a2113; }
:where(html[data-theme="dark"]) .fd-exit.open { color: #f3b04a; }
:where(html[data-theme="dark"]) .fd-tool:hover { color: #c4b2ff; }
:where(html[data-theme="dark"]) .t-num { --fdc: #6f5ad6; }
:where(html[data-theme="dark"]) .fd-modal { background: rgba(0, 0, 0, .6); }

/* framed in the (light) website admin: the page is see-through there – give it the dark background so text stays readable */
html.embed[data-theme="dark"] body { background: var(--bg); }

/* theme switch (header) */
.themesw { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: #fff; margin: 0 10px 6px; justify-self: start; }
.themesw button { border: 0; background: none; padding: 5px 9px; border-radius: 7px; cursor: pointer; font: 600 12.5px var(--sans); color: var(--muted); }
.themesw button.on { background: var(--soft); color: var(--text); }
:where(html[data-theme="dark"]) .themesw { background: #191823; border-color: #34323f; }
:where(html[data-theme="dark"]) .themesw button.on { background: #2c2a3a; color: #fff; }
.thbtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: #fff; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }
.thbtn:hover { background: rgba(255, 255, 255, .08); }
.login-top .thbtn { color: var(--text); border-color: var(--line); }
:where(html[data-theme="dark"]) .pill.nl-sending { background: rgba(47, 124, 246, .18); } :where(html[data-theme="dark"]) .pill.nl-paused { background: rgba(240, 165, 42, .16); } :where(html[data-theme="dark"]) .pill.nl-sent { background: rgba(47, 191, 125, .16); }
