/* admin panel: the theme switch in the sidebar and the dark layer over admin.css, intel.css and the inline SVG charts
   (charts.py, admin.js, intel.js draw them with presentation attributes, which any CSS rule overrides). Goes after
   ui/tokens.css; rules are :where()-prefixed so they only beat the same selector in the files above */
.adm-side-foot .theme-seg{display:flex}
.adm-side-foot .theme-seg button{flex:1;justify-content:center;padding:6px 4px;font-size:var(--fs-xs)}
.adm-side-foot .theme-seg svg{display:none}
.adm-side-foot .theme-seg button[aria-pressed=true]{background:var(--card)}
body.adm:not(.adm-in) .top .theme-tg{margin-left:auto}

/* scrollbars (both themes): a thin pill on a clear track; the sidebar shows its own only under the pointer.
   scrollbar-color is inherited, scrollbar-width is not; Chrome 121+ and Firefox take these and skip ::-webkit-scrollbar,
   which stays for Safari. Lists that hide their bar (scrollbar-width:none) keep it hidden: * loses to any class */
html{--sb:rgba(16,16,20,.18);--sb-h:rgba(16,16,20,.34);scrollbar-color:var(--sb) transparent;scrollbar-gutter:stable}
html[data-theme=dark]{--sb:rgba(255,255,255,.16);--sb-h:rgba(255,255,255,.3)}
*{scrollbar-width:thin}
.adm-side{scrollbar-color:transparent transparent;transition:scrollbar-color .2s}
.adm-side:hover,.adm-side:focus-within{scrollbar-color:var(--sb) transparent}
@supports not (scrollbar-color:auto){
  ::-webkit-scrollbar{width:10px;height:10px}
  ::-webkit-scrollbar-track,::-webkit-scrollbar-corner{background:transparent}
  ::-webkit-scrollbar-thumb{min-height:32px;border:3px solid transparent;border-radius:var(--r-pill);background:var(--sb) padding-box}
  ::-webkit-scrollbar-thumb:hover{background-color:var(--sb-h)}
}

/* shell */
:where(html[data-theme=dark]) .adm-side-foot .theme-seg{background:var(--canvas)}
:where(html[data-theme=dark]) .adm-side-foot .theme-seg button[aria-pressed=true]{background:var(--press)}
@media (max-width:900px){
  :where(html[data-theme=dark]) .adm-side{box-shadow:0 24px 48px -20px rgba(0,0,0,.7)}
  :where(html[data-theme=dark]) .adm-side:target+.adm-scrim{background:rgba(0,0,0,.55)}
}
:where(html[data-theme=dark]) .adm-sug,:where(html[data-theme=dark]) .vk-switch-menu{background:var(--stage);box-shadow:0 12px 32px rgba(0,0,0,.5)}
:where(html[data-theme=dark]) .adm-sug a:hover,:where(html[data-theme=dark]) .adm-sug a.on,:where(html[data-theme=dark]) .vk-switch-menu a:hover,
:where(html[data-theme=dark]) .vk-switch-menu a.on{background:var(--press)}

/* picked tabs, chips and filters: light on dark instead of ink on light */

/* brand-ink blocks: the flat raised --panel-bg surface */
:where(html[data-theme=dark]) .adm-tip,:where(html[data-theme=dark]) .ic-tip{background:var(--stage);box-shadow:inset 0 0 0 1px var(--sep),0 12px 28px rgba(0,0,0,.5)}

/* status tints */
:where(html[data-theme=dark]) .vk-badge.bad{background:#B42318;color:#fff}
:where(html[data-theme=dark]) .ui-delta.up,:where(html[data-theme=dark]) .adm-calm,:where(html[data-theme=dark]) .pill.adm-st-sent,
:where(html[data-theme=dark]) .vk-chip.ok,:where(html[data-theme=dark]) .vk-badge.ok,:where(html[data-theme=dark]) .vk-did-fix,:where(html[data-theme=dark]) .sh-state.ok,:where(html[data-theme=dark]) body.adm .vk-funnel td.vk-best{background-color:var(--tint-g)}
:where(html[data-theme=dark]) .ui-delta.down,:where(html[data-theme=dark]) .adm-attn-bad,:where(html[data-theme=dark]) .vk-chip.bad,
:where(html[data-theme=dark]) .sh-state.bad{background:var(--tint-r)}
:where(html[data-theme=dark]) .adm-attn-warn,:where(html[data-theme=dark]) .pill.adm-st-stopped,:where(html[data-theme=dark]) .sh-state.warn{background:var(--tint-y)}
:where(html[data-theme=dark]) .adm-attn-info,:where(html[data-theme=dark]) .pill.adm-st-sending,:where(html[data-theme=dark]) .pill.adm-st-scheduled{background:var(--tint-i);color:var(--info)}

/* heat map: yellow washes, then a strong and a solid yellow for the top */

/* text, meters and fields that used the brand ink */
:where(html[data-theme=dark]) .adm-art a,:where(html[data-theme=dark]) .adm-news-form input,:where(html[data-theme=dark]) .adm-news-form textarea{background:rgba(255,255,255,.08)}

/* post in the bot: the editor and Telegram's night chat */
:where(html[data-theme=dark]) .pill.adm-ch-tg{background:rgba(42,171,238,.18);color:#7CC6F2}
:where(html[data-theme=dark]) .tg-chat{background:#0E1621 linear-gradient(160deg,#16222E 0%,#0E1621 60%,#101B26 100%)}
:where(html[data-theme=dark]) .tg-msg,:where(html[data-theme=dark]) .tg-album{background:#182533;color:#E9EEF2}
:where(html[data-theme=dark]) .tg-text a{color:#6AB3F3}
:where(html[data-theme=dark]) .tg-text code{color:#E8A3A3}
:where(html[data-theme=dark]) .tg-text pre{background:#101B26;color:#DDE5EC}
:where(html[data-theme=dark]) .tg-text blockquote{border-left-color:#6AB3F3;background:rgba(106,179,243,.1)}
:where(html[data-theme=dark]) .tg-sp{background:#5B6B7B}
:where(html[data-theme=dark]) .tg-btn{background:rgba(255,255,255,.12)}
:where(html[data-theme=dark]) .tg-btn:hover{background:rgba(255,255,255,.18)}

/* VK bot preview: a dark chat */
:where(html[data-theme=dark]) .vk-bubble-btn{color:#8AB4F8}

/* inline SVG charts */
:where(html[data-theme=dark]) .ic-svg circle[fill="#fff"]{fill:var(--card)}
:where(html[data-theme=dark]) .adm-chart circle[stroke="#fff"]{stroke:var(--card)}
:where(html[data-theme=dark]) .ic-cross{stroke:var(--fg)}
:where(html[data-theme=dark]) :is(.ic-key,.ic-tip,.adm-tip) [style*="rgb(6, 17, 31)"]{background:var(--fg)!important}

/* network map */
:where(html[data-theme=dark]) .nm-node.s-down rect{fill:#3A1F22}
:where(html[data-theme=dark]) .nm-node.r-infra rect{fill:var(--canvas)}
:where(html[data-theme=dark]) .nm-side{box-shadow:0 12px 40px rgba(0,0,0,.5)}
:where(html[data-theme=dark]) .fin-flag-warn{background:var(--tint-y)}
:where(html[data-theme=dark]) .fin-flag-info{background:var(--tint-i);color:var(--info)}
:where(html[data-theme=dark]) .fin-effect{background:var(--tint-g)}
:where(html[data-theme=dark]) .fin-levers .st-action.fin-p1{border-left-color:var(--fg)}
:where(html[data-theme=dark]) body.adm .mail-area a{color:#8AB4F8}

/* inline SVG charts (both themes): charts.py and intel.js draw with the old palette; CSS beats presentation attributes */
:is(.adm-chart,.adm-spark,.ic-svg) [fill="#06111F"]{fill:var(--chart-1)}
:is(.adm-chart,.adm-spark,.ic-svg) [stroke="#06111F"]{stroke:var(--chart-1)}
:is(.adm-chart,.adm-spark,.ic-svg) [fill="#F6CA2F"],:is(.adm-chart,.adm-spark,.ic-svg) [fill="#E0AE0B"]{fill:var(--chart-4)}
:is(.adm-chart,.adm-spark,.ic-svg) [stroke="#F6CA2F"],:is(.adm-chart,.adm-spark,.ic-svg) [stroke="#E0AE0B"]{stroke:var(--chart-4)}
:is(.adm-chart,.adm-spark,.ic-svg) [fill="#2F6FEB"]{fill:var(--chart-2)}
:is(.adm-chart,.adm-spark,.ic-svg) [stroke="#2F6FEB"]{stroke:var(--chart-2)}
:is(.adm-chart,.adm-spark,.ic-svg) [fill="#1F7A3D"]{fill:var(--chart-3)}
:is(.adm-chart,.adm-spark,.ic-svg) [stroke="#1F7A3D"]{stroke:var(--chart-3)}
:is(.adm-chart,.adm-spark) [fill="#E4E4EA"]{fill:var(--chart-muted)}
.adm-spark [stroke="#E4E4EA"]{stroke:var(--chart-muted)}
.adm-cellbar [fill="#EEF1F5"]{fill:var(--canvas)}
.adm-cellbar [fill="#F6CA2F"]{fill:var(--chart-1)}
.adm-cellbar [fill="#F9DC75"]{fill:color-mix(in srgb,var(--chart-1) 55%,transparent)}
.adm-chart [fill="#6B7080"]{fill:var(--mute)}
.adm-chart circle[stroke="#fff"]{stroke:var(--surface)}
.adm-chart [stroke="#0B1220"]{stroke:var(--fg)}
.adm-funnel .fn-bar [fill="#F6CA2F"]{fill:color-mix(in srgb,var(--accent) 24%,transparent)}
.adm-funnel .fn-bar [fill="#F9DC75"]{fill:color-mix(in srgb,var(--accent) 14%,transparent)}
