/*
 * Kontrastudio UI · shared foundation for Kontrastudio Core and Kontrastudio Mail.
 *
 * Adapted from Souffleur's design system (Kontrastudio/Souffleur, relay/public/souffleur.css at commit
 * b1e0e4f5935ba52231612ca60a467a4e69430722), Kontrastudio's own work. This is a vendored copy:
 * products never load assets from Souffleur and have no runtime dependency on it.
 * Souffleur-specific page modules are omitted. The family layer at the end adds the product accent system.
 * System font stacks only; no third-party font files.
 */
/* ── 1. Tokens ─────────────────────────────────────────────────────────── */
:root {
  color-scheme: light dark;

  --paper: #f5f5f2;
  --surface: #ffffff;
  --chrome: #eeeeea;
  --sunken: #f0f0ec;
  --ink: #161715;
  --ink-2: #474844;
  --ink-3: #5f615c;
  --line: #e1e1dc;
  --line-2: #cdcec8;
  --control: #8b8d87;
  --selected: rgba(22, 23, 21, 0.075);
  --on-ink: #f6f6f2;
  --stage: #0e0f0d;
  --on-stage: #ededea;
  --on-stage-2: #bebfb8;
  --on-stage-3: #a1a39c;
  --on-stage-ok: #74c18b;
  --on-stage-warn: #e3ab52;
  --stage-line: #3b3c38;
  --stage-btn: #f5f5f2;
  --stage-btn-ink: #161715;
  --stage-gutter: max(20px, 7.8vw);

  --ok: #1d6a39;
  --ok-tint: #e6f0e8;
  --warn: #855000;
  --warn-tint: #f8eedb;
  --bad: #a4241d;
  --bad-tint: #f9e7e5;
  --off: #6d6f6a;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-display: clamp(34px, 4.4vw, 54px);
  --fs-display-2: clamp(25px, 2.6vw, 34px);
  --lh: 1.5;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;
  --s12: 48px;
  --s16: 64px;
  --s20: 80px;

  --r1: 3px;
  --r2: 5px;
  --r3: 7px;

  --h-control: 34px;
  --h-control-sm: 28px;
  --h-control-lg: 40px;
  --sidebar: 232px;
  --content: 1080px;
  --prose: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121311;
    --surface: #1a1b19;
    --chrome: #161715;
    --sunken: #0e0f0d;
    --ink: #ededea;
    --ink-2: #bebfb8;
    --ink-3: #a1a39c;
    --line: #2b2c29;
    --line-2: #3b3c38;
    --control: #72746e;
    --selected: rgba(237, 237, 234, 0.09);
    --on-ink: #121311;

    --ok: #74c18b;
    --ok-tint: rgba(116, 193, 139, 0.12);
    --warn: #e3ab52;
    --warn-tint: rgba(227, 171, 82, 0.12);
    --bad: #f08c82;
    --bad-tint: rgba(240, 140, 130, 0.12);
    --off: #8e908a;
  }
}

/* ── 2. Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--fs-base)/var(--lh) var(--font-ui);
  font-feature-settings: "kern", "tnum";
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
:is(h1, h2, h3, h4) { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0 0 var(--s3); padding-left: 1.25em; }
strong, b { font-weight: 600; }
em { font-style: italic; }
small { font-size: var(--fs-sm); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s6) 0; }
img, svg { max-width: 100%; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
a:hover { text-decoration-color: currentColor; }
:is(code, kbd, samp, pre, .mono) { font-family: var(--font-mono); font-size: 0.9em; font-feature-settings: normal; }
code { overflow-wrap: anywhere; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r1); }
::selection { background: color-mix(in srgb, var(--ink) 18%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .btn, button, a, summary, input, select, textarea { transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.skip-link { position: absolute; left: var(--s3); top: -48px; z-index: 10; background: var(--ink); color: var(--on-ink); padding: var(--s2) var(--s3); border-radius: var(--r2); text-decoration: none; }
.skip-link:focus { top: var(--s3); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Brand: the official mark file, and the product name set in the wordmark's typeface. */
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 32px; text-decoration: none; color: var(--ink); }
.brand-mark { display: block; width: 26px; height: 26px; border-radius: 6px; flex: none; }
.brand-name { font-family: var(--font-display); font-size: 21px; letter-spacing: -0.02em; line-height: 1; }
.brand-tag { font-size: var(--fs-xs); color: var(--ink-3); letter-spacing: 0.01em; border-left: 1px solid var(--line-2); padding-left: 10px; margin-left: 2px; white-space: nowrap; }
.maker { display: inline-flex; align-items: center; min-height: 24px; gap: var(--s2); color: var(--ink-3); font-size: var(--fs-xs); text-decoration: none; }
.maker img { display: block; height: 11px; width: auto; opacity: 0.82; }

/* ── 3. Layouts ────────────────────────────────────────────────────────── */

/* 3a. Signed-in workspace: sidebar + content. */
.l-app { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: var(--s6); padding: var(--s5) var(--s3) var(--s4); background: var(--chrome); border-right: 1px solid var(--line); overflow-y: auto; }
.sidebar .brand { padding: 0 var(--s2); }
.sidebar-context { margin: calc(var(--s4) * -1) 0 0; padding: 0 var(--s2); font-size: var(--fs-xs); color: var(--ink-3); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 32px; padding: 0 var(--s2) 0 var(--s3); border-radius: var(--r2); color: var(--ink-2); text-decoration: none; font-size: var(--fs-base); white-space: nowrap; }
.nav a:hover { background: var(--selected); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.nav .count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--warn); color: var(--surface); font-size: var(--fs-xs); font-weight: 600; line-height: 18px; text-align: center; }
.nav-group { margin: var(--s2) 0 var(--s1); padding: 0 var(--s3); font-size: var(--fs-xs); color: var(--ink-3); }
.sidebar-foot { margin-top: auto; display: grid; gap: var(--s3); padding: var(--s3) var(--s2) 0; border-top: 1px solid var(--line); }
.identity { display: grid; gap: 1px; min-width: 0; padding: var(--s2); margin: 0 calc(var(--s2) * -1); border-radius: var(--r2); color: var(--ink); text-decoration: none; }
.identity:hover { background: var(--selected); }
.identity-name { font-size: var(--fs-sm); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-detail { font-size: var(--fs-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-content { width: 100%; max-width: var(--content); margin: 0 auto; padding: var(--s8) var(--s10) var(--s12); flex: 1; }
.app-foot { width: 100%; max-width: var(--content); margin: 0 auto; padding: var(--s5) var(--s10) var(--s8); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); border-top: 1px solid var(--line); color: var(--ink-3); font-size: var(--fs-xs); }
.app-foot nav { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.app-foot a { color: var(--ink-3); text-decoration: none; display: inline-flex; align-items: center; min-height: 24px; }
.app-foot a:hover { color: var(--ink); text-decoration: underline; }
.operator-mark { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.operator-mark::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

@media (max-width: 999px) {
  .l-app { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding: var(--s3) var(--s4) 0; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .sidebar .brand { padding: 0; }
  .sidebar-context { margin: 0; padding: 0; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; }
  .sidebar-foot .maker { display: none; }
  .identity { margin: 0; padding: var(--s1) var(--s2); max-width: 46vw; text-align: right; }
  .nav { order: 10; flex: 1 0 100%; flex-direction: row; gap: 2px; margin: 0 calc(var(--s4) * -1); padding: var(--s1) var(--s4) var(--s2); overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; min-height: 34px; padding: 0 var(--s3); }
  .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--ink); background: transparent; border-radius: 0; }
  .nav-group { display: none; }
  .app-content { padding: var(--s6) var(--s5) var(--s10); }
  .app-foot { padding: var(--s5) var(--s5) var(--s6); }
}
@media (max-width: 480px) {
  .identity-detail { display: none; }
  .app-content { padding: var(--s5) var(--s4) var(--s8); }
  .app-foot { padding: var(--s4); }
}

/* 3b. Public site. */
.l-site { min-height: 100vh; display: flex; flex-direction: column; }
.site-head { width: 100%; max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: var(--s6); padding: var(--s5) var(--s8); }
.site-head .brand { margin-right: auto; }
.site-nav { display: flex; align-items: center; gap: var(--s6); }
.site-nav a { font-size: var(--fs-sm); color: var(--ink-2); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-account { display: flex; align-items: center; gap: var(--s2); }
.site-main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--s8) var(--s16); flex: 1; }
.site-foot { border-top: 1px solid var(--line); }
.site-main > .page-head:first-child, .pricing-page { padding-top: var(--s10); }
.site-foot-inner { max-width: 1200px; margin: 0 auto; padding: var(--s8); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s6); align-items: start; color: var(--ink-3); font-size: var(--fs-sm); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); }
.site-foot a { color: var(--ink-2); text-decoration: none; min-height: 24px; display: inline-flex; align-items: center; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }
.site-foot .legal-line { grid-column: 1 / -1; font-size: var(--fs-xs); }
@media (max-width: 860px) {
  .site-head { padding: var(--s4) var(--s5); gap: var(--s3); }
  .site-nav { display: none; }
  .site-main { padding: 0 var(--s5) var(--s12); }
  .site-foot-inner { grid-template-columns: 1fr; padding: var(--s6) var(--s5); }
}
@media (max-width: 420px) {
  .site-head .brand-tag { display: none; }
  .site-account { gap: var(--s1); }
}

/* 3c. Single-task pages (owner sign-in, consent, expired links). */
.l-plain { min-height: 100vh; display: flex; flex-direction: column; }
.plain-head { width: 100%; max-width: 1080px; margin: 0 auto; padding: var(--s5) var(--s8); display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.plain-main { width: 100%; max-width: 1080px; margin: 0 auto; padding: var(--s6) var(--s8) var(--s16); flex: 1; }
.plain-foot { width: 100%; max-width: 1080px; margin: 0 auto; padding: var(--s5) var(--s8) var(--s8); color: var(--ink-3); font-size: var(--fs-xs); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); }
.plain-foot a { color: var(--ink-3); text-decoration: none; min-height: 24px; display: inline-flex; align-items: center; }
.plain-foot nav { display: flex; gap: var(--s4); }
@media (max-width: 640px) {
  .plain-head, .plain-main, .plain-foot { padding-left: var(--s4); padding-right: var(--s4); }
}

/* Content widths shared by every layout. */
.narrow { max-width: 560px; margin: var(--s10) auto 0; }
.measure { max-width: 720px; }

/* ── 4. Components ─────────────────────────────────────────────────────── */

/* 4a. Page header: title, one-line purpose, actions on the right. */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s6); margin: 0 0 var(--s6); }
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-head h1 { margin: 0; }
.page-head .lede { margin: var(--s1) 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.crumbs { margin: 0 0 var(--s2); font-size: var(--fs-sm); color: var(--ink-3); }
.crumbs a { display: inline-flex; align-items: center; min-height: 24px; color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.lede { color: var(--ink-2); font-size: var(--fs-base); max-width: var(--prose); margin: 0 0 var(--s6); }
h1 + .lede { margin-top: var(--s2); }
.eyebrow { margin: 0 0 var(--s2); font-size: var(--fs-sm); color: var(--ink-3); }

/* 4b. Sections: whitespace and hairlines, not stacked cards. */
.section { margin: 0 0 var(--s10); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s4); margin: 0 0 var(--s3); }
.section-head h2 { font-size: var(--fs-md); }
.section-head .muted { font-size: var(--fs-sm); }
.section-head a { display: inline-flex; align-items: center; min-height: 24px; font-size: var(--fs-sm); }
.section-head summary { display: inline-flex; align-items: center; min-height: 24px; }
.section-note { margin: calc(var(--s2) * -1) 0 var(--s3); color: var(--ink-2); font-size: var(--fs-sm); max-width: var(--prose); }

/* 4c. Panel: a bordered surface for tables, forms and grouped records. */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); margin: 0 0 var(--s6); min-width: 0; }
.panel > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); min-height: 48px; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); }
.panel > header h2 { font-size: var(--fs-md); }
.panel > header .actions { margin: 0; }
.panel > .body { padding: var(--s5); }
.panel > .body > h2 { font-size: var(--fs-md); margin: 0 0 var(--s2); }
.panel > .body > h2:not(:first-child) { margin-top: var(--s5); }
.panel > .empty, .panel .empty { padding: var(--s5); color: var(--ink-2); }
.panel > header + .empty { border-top: 0; }
.panel-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--ink-2); display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; justify-content: space-between; }

/* 4d. Buttons. One size family; danger is for destructive or high-risk actions only. */
.btn, button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--h-control); padding: 0 var(--s4);
  border: 1px solid var(--line-2); border-radius: var(--r2);
  background: var(--surface); color: var(--ink);
  font: 500 var(--fs-sm)/1.2 var(--font-ui); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn:hover, button:hover, .button:hover { border-color: var(--control); background: var(--paper); }
.btn.primary, button.primary, .button.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover, button.primary:hover, .button.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--paper)); }
.btn.danger, button.danger, .button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line-2)); }
.btn.danger:hover, button.danger:hover, .button.danger:hover { border-color: var(--bad); background: var(--bad-tint); }
.btn.danger-solid, button.danger-solid { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn.danger-solid:hover, button.danger-solid:hover { background: color-mix(in srgb, var(--bad) 85%, var(--ink)); }
.btn.quiet, button.quiet, .btn-quiet { background: transparent; border-color: transparent; }
.btn.quiet:hover, button.quiet:hover, .btn-quiet:hover { background: var(--selected); border-color: transparent; }
.btn.sm, button.sm { min-height: var(--h-control-sm); padding: 0 var(--s3); font-size: var(--fs-xs); }
.btn.lg, button.lg { min-height: var(--h-control-lg); padding: 0 var(--s5); font-size: var(--fs-base); }
.btn.block, button.block { width: 100%; }
.btn .arrow, button .arrow { color: currentColor; opacity: 0.7; }
button:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
form.inline { display: inline-flex; margin: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: var(--s4) 0 0; }
.actions:first-child { margin-top: 0; }

/* 4e. Fields. Labels sit above inputs; hints are quiet; errors are announced. */
label { display: grid; gap: 6px; margin: 0 0 var(--s4); font-size: var(--fs-sm); font-weight: 500; color: var(--ink); }
label .hint, .field-hint { font-weight: 400; color: var(--ink-3); font-size: var(--fs-xs); }
:is(input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea) {
  display: block; width: 100%; min-height: 38px; padding: 0 var(--s3);
  border: 1px solid var(--control); border-radius: var(--r2);
  background: var(--surface); color: var(--ink);
  font: 400 var(--fs-base)/1.4 var(--font-ui);
}
textarea { padding: var(--s2) var(--s3); min-height: 96px; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 var(--s4); align-items: end; }
.form-grid .actions { margin: 0 0 var(--s4); }
.form-narrow { max-width: 560px; }

/* 4f. Notices. One sentence of state, optionally one action. */
.notice { display: block; margin: 0 0 var(--s5); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-left: 3px solid var(--ink-3); border-radius: var(--r2); background: var(--surface); font-size: var(--fs-sm); color: var(--ink); }
.notice.ok { border-left-color: var(--ok); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-tint); }
.notice.bad { border-left-color: var(--bad); background: var(--bad-tint); color: var(--ink); }
.notice strong:first-child { margin-right: 4px; }
.notice p { margin: 0; }

/* 4g. Status: a dot and a plain label. Colour carries meaning, the label carries it too. */
.st { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; }
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--off); flex: none; }
.st.ok::before { background: var(--ok); }
.st.warn::before { background: var(--warn); }
.st.bad::before { background: var(--bad); }
.st.ok { color: var(--ok); }
.st.warn { color: var(--warn); }
.st.bad { color: var(--bad); }
.st.quiet { color: var(--ink-3); }
.st.quiet::before { background: transparent; box-shadow: inset 0 0 0 1px var(--off); }
/* Legacy status vocabularies emitted by insights and telemetry renderers. */
.status, .state { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.state::before, .status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--off); }
.state.ok, .status.on { color: var(--ok); }
.state.ok::before, .status.on::before { background: var(--ok); }
.state.warn { color: var(--warn); }
.state.warn::before { background: var(--warn); }
.state.bad { color: var(--bad); }
.state.bad::before { background: var(--bad); }
.state.quiet { color: var(--ink-3); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; background: var(--off); vertical-align: 1px; }
.dot.on { background: var(--ok); }
/* Tag: a small, quiet, bordered label for a property (never decoration). */
.tag { display: inline-flex; align-items: center; min-height: 20px; padding: 0 6px; border: 1px solid var(--line-2); border-radius: var(--r1); font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; vertical-align: 1px; }
.tag.warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); color: var(--warn); }
.tag.bad { border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); }
.tag.ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); }

/* 4h. Readouts: a single instrument strip, not a row of cards. */
.readouts, .overview { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 1px; margin: 0 0 var(--s8); background: var(--line); border: 1px solid var(--line); border-radius: var(--r3); overflow: hidden; }
.overview.compact { --cols: 3; }
.overview.six { --cols: 6; }
.overview.operator-overview { --cols: 4; }
.readouts.meter-readouts { --cols: 3; margin-bottom: var(--s3); }
.readout, .overview-tile { background: var(--surface); padding: var(--s4) var(--s5); min-width: 0; }
.readout .value, .overview-tile .figure, .funnel .figure, .pulse .figure { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.readout .label, .overview-tile .caption, .funnel .caption, .pulse .caption { margin-top: 2px; font-size: var(--fs-sm); color: var(--ink-2); }
.readout .detail, .overview-tile .sub, .funnel .sub, .pulse .sub { margin-top: var(--s1); font-size: var(--fs-xs); color: var(--ink-3); min-height: 1.4em; }
.readout.alert .value, .overview-tile.tile-alert .figure, .figure.bad { color: var(--bad); }
.overview-tile .figure.accent { color: var(--ok); }
.figure .of, .value .of { font-size: var(--fs-base); font-weight: 400; color: var(--ink-3); }
@media (max-width: 999px) { .overview.six { --cols: 3; } }
@media (max-width: 640px) { .readouts, .overview, .overview.compact, .overview.six, .overview.operator-overview { --cols: 2; } }

/* 4i. Tables and record lists. */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th { text-align: left; font-weight: 500; font-size: var(--fs-xs); color: var(--ink-3); padding: var(--s2) var(--s5); border-bottom: 1px solid var(--line); background: var(--chrome); white-space: nowrap; }
td { padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s3) var(--s5); align-items: start; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .name { font-weight: 600; }
.row .meta { color: var(--ink-3); font-size: var(--fs-sm); margin-top: 2px; }
.row .actions { margin: 0; justify-content: flex-end; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } .row .actions { justify-content: flex-start; } }

/* 4j. Facts: label/value pairs for exact technical detail. */
dl.facts { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: var(--s2) var(--s6); margin: 0 0 var(--s5); font-size: var(--fs-sm); }
dl.facts dt { color: var(--ink-3); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
dl.facts dd pre { margin-top: 0; }
pre + dl.facts { margin-top: var(--s5); }
.panel > .body > dl.facts:last-child { margin-bottom: 0; }
@media (max-width: 560px) { dl.facts { grid-template-columns: 1fr; gap: 2px; } dl.facts dd { margin-bottom: var(--s2); } }

/* 4k. Code and exact strings. */
pre { margin: var(--s2) 0 0; padding: var(--s3) var(--s4); background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r2); font-size: 12.5px; line-height: 1.55; overflow-x: auto; white-space: pre; }
pre.wrap, .approval pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.code-box { display: inline-block; margin: var(--s2) 0 var(--s3); padding: var(--s3) var(--s5); border: 1px solid var(--line-2); border-radius: var(--r2); background: var(--surface); font: 600 28px/1.2 var(--font-mono); letter-spacing: 0.12em; }
.copyable { position: relative; }
.mono-id { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-3); overflow-wrap: anywhere; }

/* 4l. Disclosure: progressive detail. */
details > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 28px; color: var(--ink-2); font-size: var(--fs-sm); }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 0; height: 0; border-left: 4px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; flex: none; }
details[open] > summary::before { transform: rotate(90deg); }
details > summary:hover { color: var(--ink); }
.disclosure { border-top: 1px solid var(--line); padding: var(--s3) 0 0; margin: var(--s4) 0 0; }
.disclosure > *:not(summary) { margin-top: var(--s3); }
.device-details { margin: var(--s2) 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.device-details > *:not(summary) { margin-top: var(--s2); }

/* 4m. Meter. */
.meter-track { height: 6px; margin: var(--s3) 0 var(--s2); background: var(--line); border-radius: 3px; overflow: hidden; }
.meter-track > span { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.meter-track.warn > span { background: var(--warn); }
.meter-track.bad > span { background: var(--bad); }
.action-meter { padding: var(--s4) var(--s5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); }
.action-meter-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.action-meter strong { font-size: var(--fs-sm); font-weight: 600; }
.action-meter-total { margin: 2px 0 0; font-size: var(--fs-xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.action-meter-total span { font-size: var(--fs-sm); font-weight: 400; color: var(--ink-2); }
.action-meter a { font-size: var(--fs-sm); white-space: nowrap; display: inline-flex; align-items: center; min-height: 24px; }
.action-meter p.muted { margin: 0; }
.action-meter .notice { margin: var(--s3) 0 0; }

/* 4n. Steps: the first-use sequence. Each step states its condition and one next action. */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--s1) var(--s4); align-items: start; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.steps > li:last-child { border-bottom: 0; }
.steps > li::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-2); font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); background: var(--surface); }
.steps > li.done::before { content: "✓"; background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.steps > li.current { background: color-mix(in srgb, var(--paper) 55%, var(--surface)); }
.steps > li.current::before { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 3px var(--selected); }
.steps .step-title { font-weight: 600; }
.steps .step-body { grid-column: 2; color: var(--ink-2); font-size: var(--fs-sm); }
.steps .step-body p { margin: 2px 0 0; }
.steps .step-action { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.steps > li.done .step-title { color: var(--ink-2); font-weight: 500; }
@media (max-width: 640px) {
  .steps > li { grid-template-columns: 28px minmax(0, 1fr); }
  .steps .step-action { grid-column: 2; grid-row: auto; justify-self: start; margin-top: var(--s2); }
}

/* Spacing after a step sequence. */
.steps + .muted { margin-top: var(--s4); }
.steps + .section, .steps + .muted + .section { margin-top: var(--s8); }

/* 4o. Segmented control (period switcher). */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 0 0 var(--s6); padding: 2px; background: var(--chrome); border: 1px solid var(--line); border-radius: var(--r2); max-width: 100%; }
.seg a { display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--s3); border-radius: var(--r1); color: var(--ink-2); font-size: var(--fs-sm); text-decoration: none; white-space: nowrap; }
.seg a:hover { color: var(--ink); background: var(--selected); }
.seg a[aria-current] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }

/* 4p. Pager. */
.pager { display: flex; justify-content: space-between; gap: var(--s3); margin: calc(var(--s3) * -1) 0 var(--s6); }

/* 4q. Columns. */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 var(--s6); align-items: start; }
.grid2.tight { gap: 0 var(--s5); }
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--s8); align-items: start; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; gap: 0; } }


/* ── 5. Shared modules (from Souffleur 5: approval banner, approval, authentication, consent) ── */
/* Pending approvals banner (every signed-in page). */
.approval-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin: 0 0 var(--s6); padding: var(--s3) var(--s4); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); border-left: 3px solid var(--warn); border-radius: var(--r2); background: var(--warn-tint); font-size: var(--fs-sm); }
.approval-bar strong { margin-right: var(--s2); }
.approval-bar ul { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); list-style: none; margin: 0; padding: 0; }
.approval-bar a { display: inline-flex; align-items: center; min-height: 24px; font-weight: 500; }
.approval { margin: 0 0 var(--s5); padding: var(--s3) var(--s4); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); border-left: 3px solid var(--warn); border-radius: var(--r2); background: var(--warn-tint); font-size: var(--fs-sm); }

/* 5g. Authentication. */
.p-auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); gap: clamp(32px, 7vw, 96px); align-items: start; max-width: 1000px; margin: 0 auto; padding: var(--s12) 0 var(--s16); }
.p-auth .auth-intro h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 var(--s4); max-width: 13em; }
.p-auth .auth-intro > p { color: var(--ink-2); font-size: var(--fs-md); max-width: 30em; }
.auth-points { list-style: none; margin: var(--s6) 0 0; padding: 0; border-top: 1px solid var(--line); }
.auth-points li { padding: var(--s3) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); color: var(--ink-2); }
.auth-points strong { display: block; color: var(--ink); }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s6); }
.auth-card h2 { font-size: var(--fs-xl); margin: 0 0 var(--s4); }
.auth-card h2 + .auth-sub { margin-top: calc(var(--s3) * -1); }
.auth-card .auth-sub { margin: 0 0 var(--s5); color: var(--ink-2); font-size: var(--fs-sm); }
.auth-card label { margin-bottom: var(--s4); }
.auth-social { display: grid; gap: var(--s2); }
.auth-provider-form { margin: 0; }
.auth-provider { width: 100%; min-height: var(--h-control-lg); justify-content: flex-start; gap: var(--s3); padding: 0 var(--s4); font-size: var(--fs-base); }
.auth-provider-icon { width: 18px; height: 18px; display: block; flex: none; }
.auth-provider .auth-provider-arrow { margin-left: auto; color: var(--ink-3); }
.auth-divider { display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0; color: var(--ink-3); font-size: var(--fs-xs); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-email-form { margin: 0; }
.auth-help { margin: calc(var(--s2) * -1) 0 var(--s4); text-align: right; font-size: var(--fs-sm); }
.auth-submit { width: 100%; min-height: var(--h-control-lg); font-size: var(--fs-base); }
.auth-switch { margin: var(--s5) 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.auth-legal { margin: var(--s3) 0 0; font-size: var(--fs-xs); color: var(--ink-3); }
.auth-explainer { margin: 0 0 var(--s5); color: var(--ink-2); font-size: var(--fs-sm); }
.auth-return { margin: var(--s5) 0 0; padding-top: var(--s4); border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.auth-return a { text-decoration: none; color: var(--ink-2); display: inline-flex; align-items: center; min-height: 24px; }
.auth-return a:hover { color: var(--ink); text-decoration: underline; }
.p-signin { max-width: 400px; margin: var(--s12) auto 0; }
.p-signin .auth-card { margin-top: var(--s5); }
.p-signin h1 { font-size: var(--fs-xl); }
.p-signin .lede { margin: var(--s2) 0 0; }
@media (max-width: 860px) {
  .p-auth { grid-template-columns: 1fr; gap: var(--s6); padding: var(--s6) 0 var(--s12); }
  .auth-points { display: none; }
  .auth-card { max-width: 480px; }
}
@media (max-width: 420px) { .auth-card { padding: var(--s5) var(--s4); } }

/* 5k. Consent. */
.p-consent { max-width: 620px; margin: var(--s8) auto 0; }
.p-consent h1 { font-size: var(--fs-xl); margin-bottom: var(--s2); }
.p-consent form { margin-top: var(--s5); }

/* ── 6. Utilities ──────────────────────────────────────────────────────── */
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: var(--s3); }
.right { text-align: right; }

/* Progressive command copying: manual selection is the no-JavaScript fallback. */
.copy-block { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: var(--s2) 0; }
.copy-block [data-copy-value] { flex: 1 1 270px; min-width: 0; margin: 0; user-select: text; overflow-wrap: anywhere; }
.copy-block .copy-trigger { display: none; }
.copy-block.copy-ready .copy-trigger { display: inline-flex; }
.copy-block .copy-feedback { flex-basis: 100%; }
@media (max-width: 550px) { .copy-block [data-copy-value] { flex-basis: 100%; } }

/* ── 7. Media ──────────────────────────────────────────────────────────── */
@media (forced-colors: active) {
  .st::before, .state::before, .status::before, .dot { forced-color-adjust: none; border: 1px solid CanvasText; }
  .nav a[aria-current="page"] { outline: 2px solid CanvasText; }
  .btn.primary, button.primary, .button.primary { border: 2px solid ButtonText; }
}
@media print {
  .sidebar, .site-head, .site-foot, .app-foot, .plain-foot, .skip-link, .approval-bar, form { display: none !important; }
  .l-app { display: block; }
  body { background: #fff; color: #000; }
  .panel, .steps, .attention, .readouts, .overview { break-inside: avoid; border-color: #bbb; }
}

/* ── 8. Kontrastudio family layer ────────────────────────────────────────
 * Each product sets --accent, --accent-strong and --accent-tint (light and dark) in its own stylesheet.
 * Accent identifies the product: brand mark, current navigation, product eyebrow, selected states.
 * Primary actions stay in ink, as in Souffleur. Accent never carries status meaning (ok/warn/bad do).
 */
:root { --accent: var(--ink); --accent-strong: var(--ink); --accent-tint: var(--selected); --on-accent: var(--on-ink); }
.brand-mark { background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; display: block; }
.brand-family { font-size: var(--fs-xs); color: var(--ink-3); letter-spacing: 0.02em; display: block; line-height: 1.1; margin-bottom: 2px; }
.brand-lockup { display: grid; }
.nav a[aria-current="page"] { box-shadow: inset 2px 0 0 var(--accent), inset 0 0 0 1px var(--line); }
.eyebrow.product { color: var(--accent-strong); font-weight: 600; letter-spacing: 0.02em; }
.sidebar-context { color: var(--accent-strong); }
.readout .value.accent { color: var(--accent-strong); }
.tag.accent { border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent-strong); }
.notice.accent { border-left-color: var(--accent); background: var(--accent-tint); }
:is(input[type=checkbox], input[type=radio]) { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
label.check { display: flex; align-items: center; gap: var(--s2); font-weight: 400; margin: 0 0 var(--s2); }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }
legend { padding: 0; margin: 0 0 var(--s2); font-size: var(--fs-sm); font-weight: 500; }
.signout { margin: 0; }
.signout button { width: 100%; justify-content: flex-start; }
@media (max-width: 999px) {
  .nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
  .signout button { width: auto; }
}
