/*! @tools-ict/design-system v0.3.0 | https://gitlab.fdmci.hva.nl/tools-ict/design-system */
/* Inter (variable, SIL OFL 1.1), bundled so apps with a strict CSP or no
   network still get it. Copied from @fontsource-variable/inter by build.js. */

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('./fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('./fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   tools-ict design system: tokens
   Neutral greys, one accent per app. Every colour is a token on :root and is
   redefined for dark mode: chosen with <html data-theme="dark|light">, or the
   system's preference when data-theme is absent. An app picks its accent with
   <html data-accent="teal"> (see the presets below) or sets --accent itself.
   ========================================================================== */

:root {
  /* Surfaces and ink */
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --border: #dde1e6;
  --border-strong: #c3c9d1;
  --fg: #1f2329;
  --fg-muted: #5c6470;
  --placeholder: #8b929c;

  /* Status */
  --danger: #c92a2a;
  --danger-soft: #fff5f5;
  --danger-line: #ffc9c9;
  --warn-bg: #fff4d6;
  --warn-fg: #8a5a00;
  --ok: #2b7a37;
  --ok-soft: #ebfbee;

  /* Inverted surfaces: tooltips, toasts */
  --tip-bg: #1f2329;
  --tip-fg: #ffffff;
  --backdrop: rgb(20 24 30 / .45);
  --code-bg: #eef0f3;

  /* Accent (default: blue; overridden by data-accent presets) */
  --accent: #3b5bdb;
  --accent-soft: #edf2ff;
  --on-accent: #ffffff;
  --ring: 3px solid color-mix(in srgb, var(--accent) 45%, transparent);

  /* Shape and depth */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --shadow: 0 2px 10px rgb(0 0 0 / .07), 0 1px 2px rgb(0 0 0 / .05);
  --shadow-lift: 0 8px 24px rgb(0 0 0 / .16);
  --shadow-dialog: 0 20px 60px rgb(0 0 0 / .25);

  /* Type */
  --font-sans: 'Inter Variable', Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --leading: 1.45;
  --leading-tight: 1.25;

  /* Space (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Sizes */
  --control-h: 40px;
  --control-h-sm: 32px;
  --topbar-h: 56px;
  --content-w: 1100px;

  color-scheme: light;
}

/* Dark: the same values twice, once for an explicit choice, once for the system. */
:root[data-theme='dark'] {
  --bg: #15181d;
  --surface: #1e2228;
  --surface-2: #262a31;
  --border: #343a43;
  --border-strong: #4a515c;
  --fg: #e4e7eb;
  --fg-muted: #9aa3ae;
  --placeholder: #6b7380;
  --danger: #ff6b6b;
  --danger-soft: #3a1f22;
  --danger-line: #6b2f33;
  --warn-bg: #3d3216;
  --warn-fg: #ffd166;
  --ok: #69db7c;
  --ok-soft: #1c3322;
  --tip-bg: #e4e7eb;
  --tip-fg: #15181d;
  --backdrop: rgb(0 0 0 / .6);
  --code-bg: #2c313a;
  --accent: #7c96ff;
  --accent-soft: #252d4a;
  --on-accent: #0f1320;
  --shadow: 0 2px 10px rgb(0 0 0 / .4), 0 1px 2px rgb(0 0 0 / .3);
  --shadow-lift: 0 8px 24px rgb(0 0 0 / .5);
  --shadow-dialog: 0 20px 60px rgb(0 0 0 / .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #15181d;
    --surface: #1e2228;
    --surface-2: #262a31;
    --border: #343a43;
    --border-strong: #4a515c;
    --fg: #e4e7eb;
    --fg-muted: #9aa3ae;
    --placeholder: #6b7380;
    --danger: #ff6b6b;
    --danger-soft: #3a1f22;
    --danger-line: #6b2f33;
    --warn-bg: #3d3216;
    --warn-fg: #ffd166;
    --ok: #69db7c;
    --ok-soft: #1c3322;
    --tip-bg: #e4e7eb;
    --tip-fg: #15181d;
    --backdrop: rgb(0 0 0 / .6);
    --code-bg: #2c313a;
    --accent: #7c96ff;
    --accent-soft: #252d4a;
    --on-accent: #0f1320;
    --shadow: 0 2px 10px rgb(0 0 0 / .4), 0 1px 2px rgb(0 0 0 / .3);
    --shadow-lift: 0 8px 24px rgb(0 0 0 / .5);
    --shadow-dialog: 0 20px 60px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

/* ── Accent presets ───────────────────────────────────────────────────────────
   Each preset is three light values and three dark values. Every light accent
   reaches 4.5:1 against --surface with white text on it; test/contrast.test.js
   checks that, so keep the two in step when adding one. */

:root[data-accent='blue']   { --accent: #3b5bdb; --accent-soft: #edf2ff; --on-accent: #ffffff; }
:root[data-accent='teal']   { --accent: #087f5b; --accent-soft: #e6fcf5; --on-accent: #ffffff; }
:root[data-accent='orange'] { --accent: #c2410c; --accent-soft: #fff1e6; --on-accent: #ffffff; }
:root[data-accent='violet'] { --accent: #6741d9; --accent-soft: #f3f0ff; --on-accent: #ffffff; }
:root[data-accent='pink']   { --accent: #c2255c; --accent-soft: #fff0f6; --on-accent: #ffffff; }
:root[data-accent='cyan']   { --accent: #0b7285; --accent-soft: #e3fafc; --on-accent: #ffffff; }
:root[data-accent='green']  { --accent: #2b7a37; --accent-soft: #ebfbee; --on-accent: #ffffff; }
:root[data-accent='slate']  { --accent: #1f2a44; --accent-soft: #e9ecf5; --on-accent: #ffffff; }

:root[data-theme='dark'][data-accent='blue']   { --accent: #7c96ff; --accent-soft: #252d4a; --on-accent: #0f1320; }
:root[data-theme='dark'][data-accent='teal']   { --accent: #38d9a9; --accent-soft: #173a31; --on-accent: #0f1a17; }
:root[data-theme='dark'][data-accent='orange'] { --accent: #ff922b; --accent-soft: #3d2614; --on-accent: #1f1206; }
:root[data-theme='dark'][data-accent='violet'] { --accent: #b197fc; --accent-soft: #2e2650; --on-accent: #160f2b; }
:root[data-theme='dark'][data-accent='pink']   { --accent: #f783ac; --accent-soft: #3d1f2c; --on-accent: #250b16; }
:root[data-theme='dark'][data-accent='cyan']   { --accent: #3bc9db; --accent-soft: #123338; --on-accent: #06191c; }
:root[data-theme='dark'][data-accent='green']  { --accent: #69db7c; --accent-soft: #1c3322; --on-accent: #0a1a0d; }
:root[data-theme='dark'][data-accent='slate']  { --accent: #c9d4f0; --accent-soft: #2a3142; --on-accent: #11161f; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light'])[data-accent='blue']   { --accent: #7c96ff; --accent-soft: #252d4a; --on-accent: #0f1320; }
  :root:not([data-theme='light'])[data-accent='teal']   { --accent: #38d9a9; --accent-soft: #173a31; --on-accent: #0f1a17; }
  :root:not([data-theme='light'])[data-accent='orange'] { --accent: #ff922b; --accent-soft: #3d2614; --on-accent: #1f1206; }
  :root:not([data-theme='light'])[data-accent='violet'] { --accent: #b197fc; --accent-soft: #2e2650; --on-accent: #160f2b; }
  :root:not([data-theme='light'])[data-accent='pink']   { --accent: #f783ac; --accent-soft: #3d1f2c; --on-accent: #250b16; }
  :root:not([data-theme='light'])[data-accent='cyan']   { --accent: #3bc9db; --accent-soft: #123338; --on-accent: #06191c; }
  :root:not([data-theme='light'])[data-accent='green']  { --accent: #69db7c; --accent-soft: #1c3322; --on-accent: #0a1a0d; }
  :root:not([data-theme='light'])[data-accent='slate']  { --accent: #c9d4f0; --accent-soft: #2a3142; --on-accent: #11161f; }
}

/* ==========================================================================
   tools-ict design system: base
   Reset, typography, form elements and a few utilities. Element selectors
   only, plus the utility classes at the bottom.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
/* Components set display; the hidden attribute must still win. */
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text);
  line-height: var(--leading);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: var(--leading-tight); font-weight: 700; }
h1 { font-size: var(--text-2xl); margin: 0 0 var(--space-4); }
h2 { font-size: var(--text-lg); margin: var(--space-5) 0 var(--space-2); }
h3 { font-size: var(--text); margin: var(--space-4) 0 6px; }
h4 { font-size: var(--text-sm); margin: var(--space-3) 0 var(--space-1); text-transform: uppercase; letter-spacing: .04em; color: var(--fg-muted); }
p { margin: 0 0 var(--space-3); }
a { color: var(--accent); text-underline-offset: 2px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }
img, svg, video { max-width: 100%; }

code, kbd, pre, samp { font-family: var(--font-mono); font-size: .92em; }
code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg); }
pre { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--code-bg); overflow-x: auto; }
pre code { padding: 0; background: none; }
kbd {
  padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 4px; background: var(--surface); font-size: var(--text-xs);
}

:focus-visible { outline: var(--ring); outline-offset: 1px; }

/* Form elements: 40px controls, the same border as .btn. */
button, input, textarea, select { font: inherit; color: inherit; }
/* :where() keeps these at zero specificity, so any component class overrides them. */
:where(input:not([type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file']), select, textarea) {
  min-height: var(--control-h);
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  max-width: 100%;
}
:where(textarea) { min-height: 80px; resize: vertical; line-height: var(--leading); }
:where(input, textarea)::placeholder { color: var(--placeholder); }
:where(input, select, textarea):focus-visible { border-color: var(--accent); }
:where(input, select, textarea):disabled { opacity: .55; cursor: not-allowed; }
input[type='checkbox'], input[type='radio'], input[type='range'] { accent-color: var(--accent); }
:where(input[type='checkbox'], input[type='radio']) { width: 18px; height: 18px; margin: 0; vertical-align: -3px; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { padding: 0; font-weight: 600; }
label { cursor: default; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: var(--text-sm); font-weight: 600; color: var(--fg-muted); }

/* Motion: the system's preference, or <html data-motion="reduced">. */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion='full']) *, :root:not([data-motion='full']) *::before, :root:not([data-motion='full']) *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important;
  }
}
:root[data-motion='reduced'] *, :root[data-motion='reduced'] *::before, :root[data-motion='reduced'] *::after {
  animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important;
}

/* ── Utilities ─────────────────────────────────────────────────────────── */

.muted { color: var(--fg-muted); }
.small { font-size: var(--text-sm); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 100; padding: 8px 14px;
  border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); font-weight: 600;
}
.skip-link:focus { left: 8px; }

/* ==========================================================================
   tools-ict design system: components
   The class names are the ones Noted, Cohort and Flowslate already used, so
   those apps adopt this file by deleting their own copies. Modifiers are
   plain extra classes (.btn.primary), not BEM.
   ========================================================================== */

/* ── App shell ───────────────────────────────────────────────────────────
   <header class="topbar">
     <a class="brand" href="./"><span class="logo">…icon…</span>Noted</a>
     <span class="topbar-title">…</span>
     <span class="spacer"></span>
     …actions…
     <a class="suite-mark" href="{overview}">tools-ict</a>
   </header> */

.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-1);
  min-width: 0; font-weight: 800; font-size: var(--text-lg); color: var(--fg); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.logo {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 7px; background: var(--accent); color: var(--on-accent); font-size: 15px;
}
.logo svg { width: 16px; height: 16px; }
.topbar-title { flex: 1; min-width: 0; font-size: var(--text-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: var(--space-1); }

/* The suite mark: a quiet link back to the overview in every app's top bar. */
.suite-mark {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-h-sm); padding: 0 10px;
  border-radius: var(--radius-pill); color: var(--fg-muted); font-size: var(--text-sm); font-weight: 600;
  text-decoration: none; white-space: nowrap;
}
.suite-mark::before {
  content: ''; width: 10px; height: 10px; border-radius: 3px;
  background: conic-gradient(var(--fg-muted) 0 25%, transparent 0 50%, var(--fg-muted) 0 75%, transparent 0);
  box-shadow: inset 0 0 0 1.5px var(--fg-muted);
}
.suite-mark:hover { background: var(--surface-2); color: var(--fg); }
@media (max-width: 560px) { .suite-mark { font-size: 0; gap: 0; padding: 0 9px; } }

.page { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-7); }
.page-head { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.page-head h1 { flex: 1; margin: 0; }

.suite-footer {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); justify-content: center;
  padding: var(--space-4); color: var(--fg-muted); font-size: var(--text-sm); border-top: 1px solid var(--border);
}
.suite-footer a { color: inherit; }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control-h); padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  font-weight: 600; color: var(--fg); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--fg-muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { min-height: var(--control-h-sm); padding: 0 10px; font-size: var(--text-sm); }
.btn.block { display: flex; width: 100%; }
.btn.on, .btn[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .45; cursor: default; filter: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: var(--control-h); height: var(--control-h); flex: none;
  padding: 0; border: 0; border-radius: 8px; background: none; color: var(--fg); text-decoration: none; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.on, .icon-btn[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent); }
.icon-btn.small { width: var(--control-h-sm); height: var(--control-h-sm); }
.icon-btn:disabled { opacity: .3; cursor: default; }

.link-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px;
  border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.btn-group { display: inline-flex; gap: var(--space-2); flex-wrap: wrap; }

/* Segmented control: <div class="segmented" role="group"><button class="on">…</button>…</div> */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
}
.segmented button {
  min-height: var(--control-h-sm); padding: 0 10px; border: 0; border-radius: var(--radius-sm);
  background: none; font-size: var(--text-sm); font-weight: 600; cursor: pointer;
}
.segmented button:hover { background: var(--surface-2); }
.segmented button.on, .segmented button[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); }

/* Switch: <label class="switch"><input type="checkbox"><span>Label</span></label> */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input {
  appearance: none; position: relative; width: 36px; height: 20px; margin: 0; flex: none;
  border-radius: 10px; background: var(--border-strong); cursor: pointer; transition: background .15s;
}
.switch input::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .3); transition: transform .15s;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-3); }
.field > label, .field > .label { font-weight: 600; font-size: var(--text-sm); }
.field .hint { color: var(--fg-muted); font-size: var(--text-sm); }
.field .error { color: var(--danger); font-size: var(--text-sm); }
.field input, .field select, .field textarea { width: 100%; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }

.search { position: relative; display: flex; align-items: center; }
.search input { width: 100%; padding-left: 34px; }
.search > svg, .search > .icon { position: absolute; left: 11px; color: var(--fg-muted); pointer-events: none; }

/* ── Surfaces ──────────────────────────────────────────────────────────── */

.card {
  padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
a.card, button.card { display: block; color: inherit; text-decoration: none; text-align: left; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
a.card:hover, button.card:hover { border-color: var(--accent); box-shadow: var(--shadow-lift); }
.card-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius); background: var(--accent-soft); color: var(--fg);
}
.notice.warn { background: var(--warn-bg); color: var(--warn-fg); }
.notice.danger { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-line); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice > :last-child { margin-bottom: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 0 8px;
  border-radius: var(--radius-pill); background: var(--surface-2); color: var(--fg-muted);
  font-size: var(--text-xs); font-weight: 700; white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-h-sm); padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface);
  font-size: 14px; color: var(--fg); cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on, .chip[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button, .tabs a {
  min-height: var(--control-h); padding: 0 var(--space-3); margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--fg-muted); font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.tabs button:hover, .tabs a:hover { color: var(--fg); }
.tabs .on, .tabs [aria-selected='true'], .tabs [aria-current='page'] { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Dialog (native <dialog>) ───────────────────────────────────────────
   <dialog class="dialog"><div class="dialog-head"><h2>…</h2><button class="icon-btn">×</button></div>
   <div class="dialog-body">…</div><div class="dialog-actions">…</div></dialog> */

.dialog {
  width: min(480px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0;
  border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-dialog);
  color: var(--fg); background: var(--surface);
}
.dialog.wide { width: min(640px, calc(100vw - 24px)); }
.dialog.full { width: min(960px, calc(100vw - 24px)); }
.dialog::backdrop { background: var(--backdrop); }
.dialog-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-1) 20px; }
.dialog-head h2 { flex: 1; margin: 0; font-size: 18px; }
.dialog-body { padding: var(--space-2) 20px 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); padding: 0 20px 20px; }

/* ── Menu (popover list) ────────────────────────────────────────────── */

.menu {
  min-width: 200px; padding: var(--space-1); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-lift);
}
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--fg);
  text-align: left; text-decoration: none; cursor: pointer;
}
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu .danger { color: var(--danger); }
.menu hr { margin: var(--space-1) 0; }

/* ── Toast ─────────────────────────────────────────────────────────────
   <div class="toast-region" role="status" aria-live="polite"><div class="toast">…</div></div> */

.toast-region {
  position: fixed; left: 50%; bottom: 20px; z-index: 60; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--space-2); align-items: center;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 6px 6px 6px 16px;
  border-radius: var(--radius); background: var(--tip-bg); color: var(--tip-fg);
  box-shadow: var(--shadow-lift); font-size: 14px;
}
.toast:not(:has(button)) { padding-right: 16px; }
.toast .btn { min-height: 32px; background: none; color: var(--tip-fg); border-color: color-mix(in srgb, var(--tip-fg) 40%, transparent); }
.toast .icon-btn { color: var(--tip-fg); }
.toast .icon-btn:hover { background: color-mix(in srgb, var(--tip-fg) 12%, transparent); }

/* ── Tooltip ───────────────────────────────────────────────────────────
   <span class="tip" tabindex="0">?<span class="tip-text" role="tooltip">…</span></span> */

.tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none; border-radius: 50%; color: var(--fg-muted); cursor: help;
}
.tip:hover, .tip:focus-visible { color: var(--accent); }
.tip-text {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 30;
  width: max-content; max-width: min(340px, 80vw); padding: 10px 12px; border-radius: 8px;
  background: var(--tip-bg); color: var(--tip-fg); box-shadow: var(--shadow);
  font-size: var(--text-sm); font-weight: 400; line-height: var(--leading); text-align: left; white-space: pre-line;
  display: none; pointer-events: none;
}
.tip:hover .tip-text, .tip:focus-visible .tip-text, .tip:focus-within .tip-text { display: block; }
/* Near a screen edge, align the bubble to the tip's start or end instead of centring it. */
.tip.start .tip-text { left: -4px; transform: none; }
.tip.end .tip-text { left: auto; right: -4px; transform: none; }

/* ── Misc ──────────────────────────────────────────────────────────────── */

.meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-7) var(--space-4);
  text-align: center; color: var(--fg-muted);
}
.empty h2 { margin: 0; color: var(--fg); }

.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent);
  border-radius: 50%; animation: tools-ict-spin .8s linear infinite;
}
@keyframes tools-ict-spin { to { transform: rotate(360deg); } }
