/* Per-user appearance: tone per theme mode, menu position and tone, style, density, text size.
   Attributes are rendered on <html> from the signed-in account's preferences. */

/* Light mode tones. The menu is white by default. */
:root[data-palette="light"] { --accent:#1f5fae; --accent-hover:#184c8c; --accent-soft:#e3ecf8; --accent-ink:#1d5aa3; --bg:#f3f6fa; --paper:#fff;
  --side-bg:#fff; --side-ink:#2b3943; --side-muted:#6a7a84; --side-hover:#edf2f8; --side-line:var(--line); --side-active-bg:var(--accent-soft); --side-active-ink:var(--accent); }
:root[data-palette="light"][data-light-tone="green"] { --accent:#176757; --accent-hover:#125345; --accent-soft:#e1efe9; --accent-ink:#176453; --bg:#f4f6f5; --side-hover:#eef2f1; }
:root[data-palette="light"][data-light-tone="slate"] { --accent:#36414b; --accent-hover:#252e36; --accent-soft:#e6e9ed; --accent-ink:#2f3a44; --bg:#f4f5f7; --side-hover:#eef0f3; }
:root[data-palette="light"][data-light-tone="sand"] { --accent:#8a5a1c; --accent-hover:#6f4813; --accent-soft:#f3e9da; --accent-ink:#7f5319; --bg:#f7f5f1; --side-hover:#f3efe8; }
:root[data-palette="light"][data-menu-tone="dark"] { --side-bg:#293742; --side-ink:#d9e1e6; --side-muted:#aebdc7; --side-hover:#384955; --side-line:#475662; --side-active-bg:#d6e7e2; --side-active-ink:#29463f; }

/* Dark mode tones. */
:root[data-palette="dark"] { --accent:#5c6773; --accent-hover:#6a7682; --accent-soft:#30343a; --accent-ink:#c9d1da; --bg:#1b1c1f; --paper:#25272b; --line:#3b3e44;
  --side-bg:#202226; --side-ink:#dcdfe3; --side-muted:#a3a8af; --side-hover:#2e3136; --side-line:#34373c; --side-active-bg:#43484f; --side-active-ink:#fff; }
:root[data-palette="dark"][data-dark-tone="blue"] { --accent:#3d6fb0; --accent-hover:#4a7dc0; --accent-soft:#2a3b55; --accent-ink:#a9c8f0; --bg:#151c27; --paper:#1f2836; --line:#36435a;
  --side-bg:#19212e; --side-ink:#d6dfeb; --side-muted:#9daabd; --side-hover:#263246; --side-line:#2f3b50; --side-active-bg:#33507a; --side-active-ink:#f2f6fc; }
:root[data-palette="dark"][data-dark-tone="green"] { --accent:#3f8b73; --accent-hover:#4a9a81; --accent-soft:#2f4a43; --accent-ink:#a8d3c4; --bg:#1a2321; --paper:#233029; --line:#3a4a45;
  --side-bg:#1f2a27; --side-ink:#d5e0dc; --side-muted:#9fb1ab; --side-hover:#2c3a36; --side-line:#34433f; --side-active-bg:#355a50; --side-active-ink:#f1f7f4; }
:root[data-palette="dark"][data-dark-tone="graphite"] { --accent:#5c6773; --accent-hover:#6a7682; --accent-soft:#30343a; --accent-ink:#c9d1da; --bg:#1b1c1f; --paper:#25272b; --line:#3b3e44;
  --side-bg:#202226; --side-ink:#dcdfe3; --side-muted:#a3a8af; --side-hover:#2e3136; --side-line:#34373c; --side-active-bg:#43484f; --side-active-ink:#fff; }
:root[data-palette="dark"][data-dark-tone="black"] { --accent:#2f6f5d; --accent-hover:#3a7f6c; --accent-soft:#16211e; --accent-ink:#9ad0bd; --bg:#000; --paper:#0e0f10; --line:#26292b;
  --side-bg:#000; --side-ink:#d8dddb; --side-muted:#8f9894; --side-hover:#141716; --side-line:#1f2321; --side-active-bg:#1d2c28; --side-active-ink:#e9f5f0; }

:root[data-palette] { background:var(--bg); }
:root[data-palette] header { background:var(--paper); }
:root[data-palette] .gate-main { background:var(--paper); }
:root[data-palette] .gate-main:has(.gate-panel) { background:var(--bg); }
:root[data-palette] :is(.panel,.metric,.session-dialog,.toast) { background:var(--paper); }
:root[data-palette] aside { background:var(--side-bg); color:var(--side-ink); border-right:1px solid var(--side-line); }
:root[data-palette] aside nav a, :root[data-palette] .local-chip, :root[data-palette] .side-bottom button { color:var(--side-ink); }
:root[data-palette] aside nav a:hover, :root[data-palette] .local-chip:hover, :root[data-palette] .side-bottom button:hover { background:var(--side-hover); }
:root[data-palette] aside nav a.active, :root[data-palette] .local-chip.active { background:var(--side-active-bg); color:var(--side-active-ink); }
:root[data-palette] :is(.navlabel,.brand-text span) { color:var(--side-muted); }
:root[data-palette] .shell .side-bottom { border-color:var(--side-line); }
:root[data-palette] aside .brand-text { color:var(--side-ink); }
:root[data-palette] .brand-icon { background:var(--accent-soft); color:var(--accent-ink); }
:root[data-palette] .btn { color:var(--accent-ink); }
:root[data-palette] .btn.primary { color:#fff; background:var(--accent); border-color:var(--accent); }
:root[data-palette] .btn.primary:hover { background:var(--accent-hover); }
:root[data-palette] :is(a,.eyebrow,.link-action,.choice > svg,.export-links button,.downloads button) { color:var(--accent-ink); }
:root[data-palette] :is(a.choice,.patient-link) { color:var(--ink); }
:root[data-palette] .bar { background:var(--accent); }
:root[data-palette] :is(input,select,textarea):focus { outline-color:var(--accent); }
:root[data-palette] .languages .selected { color:var(--accent-ink); }

.menu-resize { display:none; }
/* Menu position (wide screens; phones always use the drawer). */
@media (min-width: 801px) {
  /* Menu width: --menu-w is the account's dragged width (style on <html>), else the default below. */
  .shell { --menu-default:252px; position:relative; grid-template-columns:var(--menu-w, var(--menu-default)) minmax(0,1fr); }
  :root[data-menu="right"] .shell { grid-template-columns:minmax(0,1fr) var(--menu-w, var(--menu-default)); }
  .menu-resize { display:block; position:absolute; z-index:7; top:0; bottom:0; left:calc(var(--menu-w, var(--menu-default)) - 3px); width:6px; cursor:col-resize; touch-action:none; }
  :root[data-menu="right"] .menu-resize { left:auto; right:calc(var(--menu-w, var(--menu-default)) - 3px); }
  .menu-resize:is(:hover, :focus-visible, .dragging) { background:var(--accent); opacity:.45; outline:0; }
  :root[data-menu="top"] .menu-resize { display:none; }
  html:has(.menu-resize.dragging) { cursor:col-resize; user-select:none; }
  @media (max-width: 1100px) { .shell { --menu-default:220px; } }
  :root[data-menu="right"] .shell > aside { order:2; border-right:0; border-left:1px solid var(--side-line); }
  :root[data-menu="top"] .shell { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
  :root[data-menu="top"] .shell > aside { flex-direction:row; align-items:center; gap:18px; padding:8px 20px; overflow:auto hidden; border-right:0; border-bottom:1px solid var(--side-line); }
  :root[data-menu="top"] .shell .brand { padding:0; }
  :root[data-menu="top"] .brand-icon { width:36px; height:36px; }
  :root[data-menu="top"] .brand-text { font-size:21px; }
  :root[data-menu="top"] .brand-text span { display:none; }
  :root[data-menu="top"] .navlabel { display:none; }
  :root[data-menu="top"] aside nav { display:flex; gap:4px; }
  :root[data-menu="top"] aside nav a { padding:9px 11px; white-space:nowrap; }
  :root[data-menu="top"] .side-bottom { display:flex; align-items:center; gap:6px; margin:0 0 0 auto; padding:0; border:0; }
  :root[data-menu="top"] .side-bottom nav { margin:0; }
  :root[data-menu="top"] .local-chip span { max-width:140px; }
}

/* Interface style. */
:root[data-style="sharp"] :is(.panel,.metric,.btn,input,select,textarea,.badge,nav a,.local-chip,.session-dialog,.choice,.toast,.brand-icon,.languages,.theme-options,.tile-icon,.notice,.alert,.downloads button,.menu-toggle) { border-radius:2px; }
:root[data-style="soft"] :is(.panel,.metric,.session-dialog,.toast) { border-radius:20px; }
:root[data-style="soft"] :is(.btn,nav a,.local-chip,.badge,.languages,.theme-options,.languages button,.theme-options button) { border-radius:999px; }
:root[data-style="soft"] :is(input,select,textarea,.choice,.downloads button,.notice,.alert) { border-radius:14px; }
:root[data-style="soft"] .brand-icon { border-radius:50%; }
:root[data-style="flat"] :is(.panel,.metric) { border-color:transparent; border-radius:6px; }
:root[data-style="flat"] header { border-bottom-color:transparent; }
:root[data-style="flat"] aside { border-color:transparent; }
:root[data-style="flat"][data-palette="light"] { --bg:#eceff1; }
:root[data-style="flat"] th { background:transparent; }
/* Flat: the active language and theme options follow the rounded switch around them. */
:root[data-style="flat"] :is(.languages button,.theme-options button) { border-radius:calc(var(--control-r) - 3px); border-color:transparent; }

/* Density and text size. */
:root[data-density="compact"] .panel-head { padding:12px 16px; }
:root[data-density="compact"] :is(th,td) { padding-top:6px; padding-bottom:6px; }
:root[data-density="compact"] aside nav a { padding:8px 10px; }
:root[data-density="compact"] .content { padding-top:20px; }
:root[data-density="compact"] .metric { padding:12px 14px; }
:root[data-density="compact"] .page-head { margin-bottom:16px; }
:root { --zoom:.9; }
:root[data-zoom="75"] { --zoom:0.75; } :root[data-zoom="80"] { --zoom:0.8; } :root[data-zoom="85"] { --zoom:0.85; } :root[data-zoom="95"] { --zoom:0.95; } :root[data-zoom="100"] { --zoom:1; } :root[data-zoom="105"] { --zoom:1.05; } :root[data-zoom="110"] { --zoom:1.1; } :root[data-zoom="115"] { --zoom:1.15; } :root[data-zoom="125"] { --zoom:1.25; }
.shell, .gate, .toasts { zoom:var(--zoom); }
.shell, .gate { height:calc(100vh / var(--zoom)); height:calc(100dvh / var(--zoom)); }
@media (min-width: 801px) {
  :root[data-menu="top"] .side-bottom form button { font-size:0; gap:0; }
  :root[data-menu="top"] .side-bottom form button svg { width:18px; height:18px; }
}

/* Inter is bundled with the app, so every device renders the same type without an install. */
@font-face { font-family:"Inter"; font-style:normal; font-weight:100 900; font-display:block; src:url("/assets/fonts/InterVariable.woff2?v=4.1") format("woff2"); }
/* No italic file (370 KB in the exe): the browser slants Inter for the rare italic text. */
:root { font-family:"Inter","Segoe UI",Arial,sans-serif; }

/* Motion and page transitions (Settings → Performance). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .14s; }
/* The menu and the header stay still because they are identical on both pages of the one root crossfade.
   No separate snapshots for them: un-animated old and new snapshots blend additively, so the header line flashed,
   and a snapshot redrawn at the zoomed shell's fractional position blurs that 1px line. */
:root:not([data-motion="reduced"]) :is(.btn,aside nav a,.local-chip,.tile,.choice,.chip-link,.member-card,.downloads a,.downloads button,.settings-tabs a,.icon-btn,.row-link) {
  transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { transition: none !important; animation: none !important; }
/* Without motion, the refresh result still hides after a moment and the loading bar shows at once. */
:root[data-motion="reduced"] header .refresh-result { animation:refresh-result 1.8s steps(1,end) forwards !important; }
:root[data-motion="reduced"].is-loading::before { width:92%; }
@media (prefers-reduced-motion: reduce) {
  :root[data-motion="system"] *, :root[data-motion="system"] *::before, :root[data-motion="system"] *::after { transition: none !important; animation: none !important; }
  :root[data-motion="system"] header .refresh-result { animation:refresh-result 1.8s steps(1,end) forwards !important; }
  :root[data-motion="system"].is-loading::before { width:92%; }
}
:root[data-palette] .btn.danger { color:#b42318; }
:root[data-palette="dark"] .btn.danger { color:#ff9b91; }
:root[data-palette] .btn.danger:hover { background:color-mix(in srgb, #c0392b 10%, transparent); }
/* Scrollbars: thin, tinted from the selected theme colour (thumb) over a soft track. */
:root { --scroll-thumb: color-mix(in srgb, var(--accent, #176757) 24%, transparent); --scroll-track: transparent; }
:root[data-palette="dark"] { --scroll-thumb: color-mix(in srgb, var(--accent-ink, #a8d3c4) 20%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
/* The side menu and the guide contents show their thumb only while they scroll (app.js toggles .scrolling). */
aside, .guide-list { --scroll-thumb: transparent; }
aside.scrolling { --scroll-thumb: color-mix(in srgb, var(--side-ink, #d9e1e6) 22%, transparent); }
.guide-list.scrolling { --scroll-thumb: inherit; }
/* Chromium/WebView2: thinner than "thin" (the standard properties would override these, so unset them). */
@supports selector(::-webkit-scrollbar) {
  * { scrollbar-width: auto; scrollbar-color: auto; }
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: var(--scroll-track); }
  ::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 6px; }
  ::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--scroll-thumb), var(--muted, #57656f) 30%); }
}
/* The logo is the app icon itself (macros.html logo()): its own dark tile, whatever the palette or style. */
.brand-icon.app-icon, :root[data-palette] .brand-icon.app-icon, :root[data-style] .brand-icon.app-icon { background:none; border-radius:0; }
.brand-icon.app-icon .app-icon-art { width:100%; height:100%; display:block; }
