/* Render Relay v50 - the Expel "family" look (dash.expel.gg tokens).
   Shared by every page. Page CSS files (queue.css, channels.css, alerts.css, automation.css)
   only add page-specific rules. Light tokens live on :root, dark on html[data-theme="dark"].
   No inline styles are needed anywhere (CSP): use these classes, or el.style from JS. */

:root {
  --plane: #f3f4f1; --surface: #fcfcfb; --ink: #101512; --ink-2: #4d5550; --muted: #6b736d;
  --grid: #e3e5e0; --axis: #c4c8c1; --hair: rgba(16, 21, 18, .10); --wash: rgba(16, 21, 18, .045);
  --s1: #2a78d6; --s2: #eb6834; --s4: #eda100; --good: #006300; --bad: #c23434;
  --chip: #101512; --chip-ink: #fcfcfb; --note: #fff7e6; --note-edge: #e9c46a; --brand: #ff3535;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --sans: "Barlow", system-ui, "Segoe UI", sans-serif;
  color-scheme: light;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0f0e; --surface: #171a18; --ink: #f2f4f1; --ink-2: #bec4be; --muted: #8a918b;
  --grid: #282c29; --axis: #3a3f3b; --hair: rgba(255, 255, 255, .10); --wash: rgba(255, 255, 255, .06);
  --s1: #3987e5; --s2: #d95926; --s4: #c98500; --good: #2fb52f; --bad: #ec7070;
  --chip: #f2f4f1; --chip-ink: #101512; --note: #241f12; --note-edge: #7a6428;
}
/* Before the script sets data-theme, follow the browser/WebView2 colour scheme (the host sets it). */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
    --plane: #0d0f0e; --surface: #171a18; --ink: #f2f4f1; --ink-2: #bec4be; --muted: #8a918b;
    --grid: #282c29; --axis: #3a3f3b; --hair: rgba(255, 255, 255, .10); --wash: rgba(255, 255, 255, .06);
    --s1: #3987e5; --s2: #d95926; --s4: #c98500; --good: #2fb52f; --bad: #ec7070;
    --chip: #f2f4f1; --chip-ink: #101512; --note: #241f12; --note-edge: #7a6428;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--plane); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
body { min-height: 100vh; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: .01em; text-transform: uppercase; }
h1 { font-size: clamp(34px, 5vw, 52px); font-weight: 700; line-height: 1; }
h2 { font-size: 24px; font-weight: 700; letter-spacing: .03em; line-height: 1.1; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: .05em; color: var(--ink-2); line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }

/* Thin scrollbars, like dash (no overlay-scrollbar flag). */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--axis); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* Shell: header, tabs, tools */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 48px; display: grid; gap: 28px; align-content: start; min-height: 100vh; }
.page { display: grid; gap: 28px; min-width: 0; outline: none; }
.shell { display: flex; flex-wrap: wrap-reverse; align-items: stretch; justify-content: space-between; gap: 2px 16px; border-bottom: 1px solid var(--grid); }
.nav { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0 24px; }
.nav-item { display: inline-flex; align-items: center; white-space: nowrap; font: 600 15px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: 10px 0 11px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; cursor: pointer; }
.nav-item:hover { color: var(--ink); }
.nav-item.is-current, .nav-item[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.appmark { align-self: center; flex: none; margin-right: -6px; }
.tools { position: relative; display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-left: auto; padding: 6px 0; }
.fresh { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.tools .fresh { margin-right: 6px; }
.fresh i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.fresh.off i { background: var(--axis); }
.fresh.warn i { background: var(--s4); }
.fresh.bad i { background: var(--bad); }

/* Buttons */
.ctl { font: 600 13px/1 var(--sans); color: var(--ink); background: var(--wash); border: 0; border-radius: 8px; height: 35px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; text-decoration: none; }
.ctl:hover { background: var(--hair); }
.ctl.primary { background: var(--chip); color: var(--chip-ink); }
.ctl.primary:hover { opacity: .88; background: var(--chip); }
.ctl.danger { background: var(--bad); color: var(--chip-ink); }
.ctl.danger:hover { opacity: .88; background: var(--bad); }
.ctl svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ctl:disabled, .toggle:disabled, .link:disabled, .icon-btn:disabled { opacity: .5; cursor: default; }
.ctl[aria-busy="true"], .toggle[aria-busy="true"] { opacity: .7; cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 35px; height: 35px; border: 0; border-radius: 8px; background: var(--wash); color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { color: var(--ink); background: var(--hair); }
.icon-btn svg { width: 16px; height: 16px; }
svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ctl svg.icon { width: 15px; height: 15px; }
.link { font: 600 13px/1.3 var(--sans); color: var(--ink-2); text-decoration: none; border: 0; border-bottom: 1px solid var(--axis); background: none; padding: 0; cursor: pointer; white-space: nowrap; }
.link:hover { color: var(--ink); border-bottom-color: var(--ink-2); }
.link.danger { color: var(--bad); border-bottom-color: color-mix(in srgb, var(--bad) 45%, transparent); }

/* Menu (the three-dot menu, any dropdown made by ui.menu) */
.menu { position: absolute; right: 0; top: 46px; z-index: 20; min-width: 240px; background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .28); padding: 6px; display: grid; gap: 2px; }
.menu-heading { font: 600 12px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.menu-item { display: flex; align-items: center; gap: 8px; font: 500 14px var(--sans); text-align: left; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); cursor: pointer; width: 100%; }
.menu-item:hover, .menu-item:focus-visible { background: var(--wash); }
.menu-item:focus-visible { outline-offset: -2px; }
.menu-item.danger { color: var(--bad); }
.menu-item:disabled { opacity: .5; cursor: default; }
.menu-check { width: 16px; height: 16px; flex: none; visibility: hidden; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu-item.is-checked .menu-check { visibility: visible; }
.menu-item.is-checked { font-weight: 600; }
.menu-sep { height: 1px; background: var(--grid); margin: 4px 2px; }

/* Text, cards, sections */
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 14px; }
.sub { color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.small { font-size: 13px; color: var(--muted); }
.r { text-align: right; font-variant-numeric: tabular-nums; }
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 20px; }
.section { display: grid; gap: 14px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 10px 16px; }
.section-title { display: grid; gap: 4px; min-width: 0; }
/* A page title block (h1 + meta line) uses the canvas's 10px, like Queue's .qtitle; h2 heads keep 4px. */
.section-title:has(> h1) { gap: 10px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Segmented control and toggle */
.seg { display: inline-flex; flex-wrap: wrap; background: var(--wash); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { font: 600 13px/1 var(--sans); color: var(--ink-2); background: transparent; border: 0; border-radius: 6px; padding: 8px 11px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--chip); color: var(--chip-ink); }
.seg .n { font-weight: 500; opacity: .7; font-variant-numeric: tabular-nums; }
.toggle { display: inline-flex; align-items: center; gap: 10px; font: 600 13px/1.2 var(--sans); color: var(--ink); background: var(--wash); border: 0; border-radius: 8px; min-height: 35px; padding: 0 12px; cursor: pointer; text-align: left; }
.toggle:hover { background: var(--hair); }
.toggle.bare { background: none; min-height: 44px; padding: 0 10px; }
.toggle.bare:hover { background: var(--wash); }
.sw { position: relative; flex: none; width: 26px; height: 16px; border-radius: 8px; background: var(--axis); transition: background .15s ease; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s ease; }
.toggle[aria-pressed="true"] .sw { background: var(--chip); }
.toggle[aria-pressed="true"] .sw::after { transform: translateX(10px); background: var(--chip-ink); }

/* Note, pill, tones, dots, keys */
.note { background: var(--note); border: 1px solid var(--note-edge); border-radius: 10px; padding: 14px 16px; display: grid; gap: 4px; font-size: 14px; }
.pill { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: 999px; font: 600 12.5px/1 var(--sans); white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; max-width: 100%; --tone: var(--muted); background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--ink); }
.pill i { position: relative; width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--tone); }
.pill .bar { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--tone) 32%, transparent); }
.pill span { position: relative; }
.pill .bar { position: absolute; }
.pill > span:last-child { overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.t-work { --tone: var(--s4); }
.t-good { --tone: var(--good); }
.t-bad { --tone: var(--bad); }
.t-wait { --tone: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone, var(--muted)); flex: none; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.k1 { background: var(--s1); }
.k2 { background: var(--s2); }
.k0 { background: var(--muted); }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--wash); font: 600 12px/1 var(--sans); color: var(--ink-2); letter-spacing: .02em; white-space: nowrap; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 14px 16px; display: grid; gap: 8px; }
.kpi .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.kpi .row { display: grid; grid-template-columns: 12px 1fr auto; align-items: baseline; gap: 8px; font-size: 14px; color: var(--ink-2); }
.kpi .row .key { align-self: center; }
.kpi .val { font-size: 22px; font-weight: 600; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi .val.bad { color: var(--bad); }

/* Form fields */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input { font: 500 14px/1.3 var(--sans); color: var(--ink); background: var(--wash); border: 1px solid transparent; border-radius: 8px; min-height: 38px; padding: 9px 12px; width: 100%; }
.input:hover { border-color: var(--hair); }
.input::placeholder { color: var(--muted); font-weight: 400; }
.input:disabled { opacity: .6; }
.input.num { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
textarea.input { resize: vertical; line-height: 1.45; }
.select { position: relative; display: block; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; }
.select::after { content: ""; box-sizing: content-box; position: absolute; right: 14px; top: 50%; width: 6px; height: 6px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select option { background: var(--surface); color: var(--ink); }
.hint { font-size: 13px; font-weight: 400; color: var(--muted); }
.field-error { font-size: 13px; font-weight: 500; color: var(--bad); }

/* Banner (settings could not load / backup used). Sits above everything on every page. */
.banner { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; border: 1px solid var(--note-edge); background: var(--note); border-radius: 10px; padding: 12px 16px; font-size: 14px; }
.banner .dot { margin-top: 7px; --tone: var(--s4); }
.banner.error { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.banner.error .dot { --tone: var(--bad); }
.banner strong { font-weight: 700; }
/* A long path or URL in the text wraps instead of pushing the page sideways. */
.banner > :last-child { min-width: 0; overflow-wrap: anywhere; }

/* Modal and toast */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .5); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); color: var(--ink); border: 1px solid var(--hair); border-radius: 12px; box-shadow: 0 24px 64px rgba(0, 0, 0, .4); width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 8px 24px; }
.modal-head h2 { font-size: 22px; min-width: 0; overflow-wrap: anywhere; }
.modal-body { padding: 4px 24px 16px; overflow-y: auto; display: grid; gap: 14px; font-size: 14px; color: var(--ink-2); min-height: 0; }
.modal-body strong { color: var(--ink); }
.modal-body-inner { display: grid; gap: 10px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 24px 20px; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; justify-items: center; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; background: var(--surface); color: var(--ink); border: 1px solid var(--hair); border-left: 4px solid var(--tone, var(--muted)); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .28); padding: 11px 14px; font-size: 14px; max-width: 100%; overflow-wrap: anywhere; }
.toast .dot { margin-top: 7px; }

@media (max-width: 760px) {
  .nav { gap: 0 14px; }
  .nav-item { font-size: 13px; letter-spacing: .04em; }
  .tools .fresh span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sw, .sw::after { transition: none; }
}

/* Barlow and Barlow Condensed, stored locally (latin subset from Google Fonts, SIL OFL 1.1: /static/fonts/OFL.txt).
   Same families and weights as dash.expel.gg; nothing loads from the internet. */
@font-face{font-family:"Barlow";font-style:normal;font-weight:400;font-display:swap;src:url(/static/fonts/barlow-400.woff2) format("woff2")}
@font-face{font-family:"Barlow";font-style:normal;font-weight:500;font-display:swap;src:url(/static/fonts/barlow-500.woff2) format("woff2")}
@font-face{font-family:"Barlow";font-style:normal;font-weight:600;font-display:swap;src:url(/static/fonts/barlow-600.woff2) format("woff2")}
@font-face{font-family:"Barlow";font-style:normal;font-weight:700;font-display:swap;src:url(/static/fonts/barlow-700.woff2) format("woff2")}
@font-face{font-family:"Barlow Condensed";font-style:normal;font-weight:600;font-display:swap;src:url(/static/fonts/barlow-condensed-600.woff2) format("woff2")}
@font-face{font-family:"Barlow Condensed";font-style:normal;font-weight:700;font-display:swap;src:url(/static/fonts/barlow-condensed-700.woff2) format("woff2")}
