/* HDDeploy portal - design system (ADR-015).
   Hand-written, no build step, embedded in the binary and served under
   /static/. Everything visual is a token; pages never carry inline style=. */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  /* brand */
  --brand: #0e67a3;
  --brand-strong: #035794;
  --brand-deep: #1b4581;
  /* surfaces */
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --border: #d8dee7;
  --border-strong: #b9c2cf;
  /* text */
  --text: #18212e;
  --text-muted: #566273;
  --link: #0e67a3;
  /* actions */
  --accent: #0e67a3;
  --accent-hover: #035794;
  --accent-soft: #e3eff8;
  --on-accent: #ffffff;
  --danger: #b3261e;
  --danger-hover: #8f1d17;
  /* status: text colour + soft background + border, always with glyph + word */
  --ok: #17794a;      --ok-soft: #e2f4ea;   --ok-border: #9fd6b8;
  --warn: #8a5200;    --warn-soft: #fdf0d8; --warn-border: #e6b35a;
  --crit: #b3261e;    --crit-soft: #fbe8e6; --crit-border: #e8a29d;
  --info: #0e67a3;    --info-soft: #e3eff8; --info-border: #a5cbe6;
  --neutral: #566273; --neutral-soft: #eceff3; --neutral-border: #cfd6df;
  /* sidebar (brand navy in light mode) */
  --side-bg: #10263f;
  --side-text: #c9d6e6;
  --side-text-strong: #ffffff;
  --side-hover: rgba(255, 255, 255, .08);
  --side-active: #0e67a3;
  --side-border: rgba(255, 255, 255, .10);
  /* scale */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem;
  --radius: 6px; --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(16, 38, 63, .06), 0 1px 3px rgba(16, 38, 63, .08);
  --shadow-pop: 0 8px 28px rgba(16, 38, 63, .22);
  --focus: 0 0 0 3px rgba(14, 103, 163, .40);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  --side-w: 15rem; --side-w-collapsed: 3.75rem;
}

/* Dark tokens: follow the OS unless the viewer forced light; or forced dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #10151c; --surface: #18202a; --surface-2: #202a36;
    --border: #2d3846; --border-strong: #44515f;
    --text: #e5eaf0; --text-muted: #9ba8b8; --link: #6bb3e6;
    --accent: #0e67a3; --accent-hover: #1577b8; --accent-soft: #15324a;
    --danger: #c4372e; --danger-hover: #d9483e;
    --ok: #55c993; --ok-soft: #12301f; --ok-border: #215a3b;
    --warn: #f0b24a; --warn-soft: #36280d; --warn-border: #6d5217;
    --crit: #ff8d82; --crit-soft: #3a1815; --crit-border: #74302a;
    --info: #6bb3e6; --info-soft: #15324a; --info-border: #24557a;
    --neutral: #9ba8b8; --neutral-soft: #222c38; --neutral-border: #36424f;
    --side-bg: #0b1017; --side-border: rgba(255, 255, 255, .07);
    --shadow: none; --shadow-pop: 0 8px 28px rgba(0, 0, 0, .55);
    --focus: 0 0 0 3px rgba(107, 179, 230, .45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10151c; --surface: #18202a; --surface-2: #202a36;
  --border: #2d3846; --border-strong: #44515f;
  --text: #e5eaf0; --text-muted: #9ba8b8; --link: #6bb3e6;
  --accent: #0e67a3; --accent-hover: #1577b8; --accent-soft: #15324a;
  --danger: #c4372e; --danger-hover: #d9483e;
  --ok: #55c993; --ok-soft: #12301f; --ok-border: #215a3b;
  --warn: #f0b24a; --warn-soft: #36280d; --warn-border: #6d5217;
  --crit: #ff8d82; --crit-soft: #3a1815; --crit-border: #74302a;
  --info: #6bb3e6; --info-soft: #15324a; --info-border: #24557a;
  --neutral: #9ba8b8; --neutral-soft: #222c38; --neutral-border: #36424f;
  --side-bg: #0b1017; --side-border: rgba(255, 255, 255, .07);
  --shadow: none; --shadow-pop: 0 8px 28px rgba(0, 0, 0, .55);
  --focus: 0 0 0 3px rgba(107, 179, 230, .45);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 .9375rem/1.5 var(--font); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .875em; }
code { background: var(--surface-2); border-radius: 4px; padding: .05rem .3rem; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius); }
[hidden] { display: none !important; }
.muted { color: var(--text-muted); }
.ic { width: 1.125rem; height: 1.125rem; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-lg { width: 1.5rem; height: 1.5rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: var(--s2) var(--s4); z-index: 100; }
.skip:focus { left: var(--s2); top: var(--s2); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.nav-collapsed .shell { grid-template-columns: var(--side-w-collapsed) minmax(0, 1fr); }
.side { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow: hidden auto; border-right: 1px solid var(--side-border); }
.brand { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); color: var(--side-text-strong); text-decoration: none; min-height: 4rem; }
.brand img { width: 2.5rem; height: auto; flex: none; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 1rem; letter-spacing: .01em; }
.brand-text small { color: var(--side-text); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { list-style: none; margin: 0; padding: var(--s2); display: flex; flex-direction: column; gap: 2px; }
.nav a, .side-btn { display: flex; align-items: center; gap: var(--s3); width: 100%; padding: .55rem .75rem; border-radius: var(--radius); color: var(--side-text); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; text-align: left; white-space: nowrap; }
.nav a:hover, .side-btn:hover { background: var(--side-hover); color: var(--side-text-strong); }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; font-weight: 600; }
.nav-label { font-size: .6875rem; text-transform: uppercase; letter-spacing: .08em; color: var(--side-text); opacity: .7; padding: var(--s4) .75rem var(--s1); }
.nav-badge { margin-left: auto; background: #d9483e; color: #fff; font-size: .6875rem; font-weight: 700; border-radius: 999px; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; display: inline-flex; align-items: center; justify-content: center; }
.side-foot { margin-top: auto; padding: var(--s2); border-top: 1px solid var(--side-border); display: flex; flex-direction: column; gap: 2px; }
.side-foot form { margin: 0; }
.side-meta { font-size: .6875rem; opacity: .6; padding: var(--s2) .75rem; }
.nav-collapsed .brand-text, .nav-collapsed .nav a span, .nav-collapsed .side-btn span, .nav-collapsed .nav-label, .nav-collapsed .side-meta { display: none; }
.nav-collapsed .brand { padding: var(--s4) .6rem; justify-content: center; }
.nav-collapsed .nav a, .nav-collapsed .side-btn { justify-content: center; padding: .6rem 0; position: relative; }
.nav-collapsed .nav-badge { position: absolute; top: .15rem; right: .3rem; min-width: 1rem; height: 1rem; font-size: .625rem; }
.nav-collapsed .side-collapse .ic { transform: rotate(180deg); }
.topbar { display: none; }
.main { padding: var(--s5) var(--s6) var(--s6); max-width: 78rem; width: 100%; }
.page-head { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.page-head h1 { font-size: 1.375rem; font-weight: 650; letter-spacing: -.01em; }
.page-head .crumb { color: var(--text-muted); font-weight: 400; }
.page-actions { margin-left: auto; display: flex; gap: var(--s2); flex-wrap: wrap; }

/* narrow screens: sidebar becomes a drawer under a top bar */
@media (max-width: 56rem) {
  .shell, .nav-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 40; width: var(--side-w); transform: translateX(-100%); transition: transform .18s ease; }
  .drawer-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .drawer-open .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: var(--s3); background: var(--side-bg); color: #fff; padding: var(--s2) var(--s4); position: sticky; top: 0; z-index: 20; }
  .topbar img { width: 2rem; }
  .topbar .side-btn { width: auto; color: #fff; }
  .side-collapse { display: none; }
  .main { padding: var(--s4); }
  .nav-collapsed .brand-text, .nav-collapsed .nav a span, .nav-collapsed .side-btn span, .nav-collapsed .nav-label { display: initial; }
}

/* ---------- tabs (server-rendered links, ?tab=...) ---------- */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--border); margin-bottom: var(--s5); overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: var(--s2); padding: .6rem .9rem; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--link); border-bottom-color: var(--accent); font-weight: 600; }
.tab-flag { width: .5rem; height: .5rem; border-radius: 50%; background: var(--crit); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: var(--s5); }
.card-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: .9375rem; font-weight: 650; }
.card-head .page-actions { margin-left: auto; }
.card-body { padding: var(--s4); }
.card-body > * + * { margin-top: var(--s3); }
.card-foot { padding: var(--s3) var(--s4); border-top: 1px solid var(--border); display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
/* object pages: "Stacks / name" breadcrumb title + a quiet line of facts under it */
.page-head h1 a.crumb { color: var(--text-muted); text-decoration: none; font-weight: 400; }
.page-head h1 a.crumb:hover { color: var(--link); text-decoration: underline; }
.page-sub { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; color: var(--text-muted); margin: calc(-1 * var(--s2)) 0 var(--s4); font-size: .875rem; }
.page-sub a { display: inline-flex; align-items: center; gap: var(--s1); }
.page-sub .ic { width: .9rem; height: .9rem; }
.form-narrow { max-width: 40rem; }
.form-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-bottom: var(--s5); }
.textarea.code { font-size: .8125rem; line-height: 1.45; tab-size: 2; resize: vertical; min-height: 8rem; white-space: pre; overflow: auto; }
.logpane { margin: 0; height: min(34rem, 65vh); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: .8125rem; line-height: 1.45; padding: var(--s3) var(--s4); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.output { margin: 0; max-height: 24rem; overflow: auto; white-space: pre-wrap; font-family: var(--mono); font-size: .8125rem; }
.card-danger { border-color: var(--crit-border); }
.card-danger > .card-head { color: var(--crit); }
details.card-fold > summary { cursor: pointer; list-style: none; border-bottom: 0; }
details.card-fold > summary::-webkit-details-marker { display: none; }
details.card-fold[open] > summary { border-bottom: 1px solid var(--border); }
details.card-fold > summary::after { content: ""; margin-left: auto; width: .5rem; height: .5rem; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(-45deg); }
details.card-fold[open] > summary::after { transform: rotate(45deg); }
.steps { margin: 0; padding-left: 1.25rem; }
.steps li { margin: var(--s2) 0; }
.card-foot-form { align-items: flex-end; }
.card-foot-form .field { margin-bottom: 0; flex: 1; min-width: 12rem; }
.secret-row { margin-top: var(--s3); }
.kv dt { display: flex; align-items: center; gap: var(--s2); }
.kv dd.inline { gap: var(--s2); }
.kv dd form { margin: 0; display: inline-flex; }
.cell-line { display: block; }
.field-nested { margin-top: var(--s3); }
.field-nested .field-label + .input { margin-bottom: var(--s2); }
.field-narrow { max-width: 32rem; }
.subhead-gap { margin-top: var(--s4); }
.flash-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.is-neutral { color: var(--neutral); background: var(--neutral-soft); border-color: var(--neutral-border); }
.tab-flag.is-warn { background: var(--warn); }
.tab-flag.is-info { background: var(--info); }
a.row-toggle { text-decoration: none; }
a.row-toggle:hover { background: var(--surface-2); color: var(--text); }
.banner .mono { display: block; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.field-wide { grid-column: span 2; }
@media (max-width: 40rem) { .field-wide { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.grid > .field { margin-bottom: 0; }
.grid-tiles { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-bottom: var(--s5); } /* six tiles: 3 x 2 on a desktop, 2 x 3 on a tablet */

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); padding: .45rem .9rem; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-ghost { border-color: transparent; background: none; color: var(--link); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { padding: .25rem .6rem; font-size: .8125rem; }
.btn-icon { padding: .35rem; border-color: transparent; background: none; color: var(--text-muted); }
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-icon.is-danger:hover { color: var(--crit); background: var(--crit-soft); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; align-items: center; }
.row-actions form { margin: 0; display: inline-flex; }

/* ---------- status badges: glyph + word, never colour alone ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem .1rem .4rem; border-radius: 999px; border: 1px solid; font-size: .8125rem; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.badge .ic { width: .9rem; height: .9rem; }
.badge-ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.badge-crit { color: var(--crit); background: var(--crit-soft); border-color: var(--crit-border); }
.badge-info { color: var(--info); background: var(--info-soft); border-color: var(--info-border); }
.badge-neutral { color: var(--neutral); background: var(--neutral-soft); border-color: var(--neutral-border); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: .65rem var(--s4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child > td { border-bottom: 0; }
.table tbody tr.row:hover { background: var(--surface-2); }
.table .cell-main { font-weight: 600; }
.table .cell-sub { display: block; color: var(--text-muted); font-size: .8125rem; font-weight: 400; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.shrink, .table th.shrink { width: 1%; white-space: nowrap; }
.row-toggle { background: none; border: 0; padding: .25rem; cursor: pointer; color: var(--text-muted); border-radius: var(--radius); display: inline-flex; }
.row-toggle[aria-expanded="true"] .ic { transform: rotate(90deg); }
.row-detail > td { background: var(--surface-2); padding: var(--s4); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s1) var(--s4); margin: 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.detail-cols { display: grid; gap: var(--s5); grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.subhead { font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; margin-bottom: var(--s2); }
.filelist { list-style: none; margin: 0; padding: 0; }
.filelist li { display: flex; align-items: center; gap: var(--s3); padding: .3rem 0; border-bottom: 1px dashed var(--border); }
.filelist li:last-child { border-bottom: 0; }
.filelist .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---------- forms ---------- */
.field { margin-bottom: var(--s4); }
.field-label { display: flex; align-items: center; gap: var(--s2); font-weight: 600; margin-bottom: var(--s1); }
.field-label .opt { font-weight: 400; color: var(--text-muted); font-size: .8125rem; }
.req { color: var(--crit); }
.input, .select, .textarea { width: 100%; padding: .5rem .65rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
.input.mono, .textarea.mono { font-family: var(--mono); font-size: .875rem; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input-sm { width: 6rem; }
.field-hint { color: var(--text-muted); font-size: .8125rem; margin-top: var(--s1); }
.field-error { color: var(--crit); font-size: .8125rem; margin-top: var(--s1); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 500; cursor: pointer; }
.check input { width: 1rem; height: 1rem; accent-color: var(--accent); }
.inline { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0 var(--s3); font-size: .9375rem; font-weight: 650; }
.step:first-child { margin-top: 0; }
.step-n { width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .8125rem; }
details.more > summary { cursor: pointer; color: var(--link); font-weight: 550; list-style: none; display: inline-flex; align-items: center; gap: var(--s1); }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary .ic { transform: rotate(90deg); }
details.more > div { margin-top: var(--s3); }

/* ---------- help ("?") : a <details>, enhanced into a popover by app.js ---------- */
details.help { display: inline-block; position: relative; }
details.help > summary { list-style: none; width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--text-muted); font-size: .6875rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; }
details.help > summary::-webkit-details-marker { display: none; }
details.help > summary:hover, details.help[open] > summary { background: var(--accent); border-color: var(--accent); color: #fff; }
details.help > .help-body { position: absolute; z-index: 15; top: 1.6rem; left: -.5rem; width: min(24rem, 80vw); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: var(--s3) var(--s4); font-weight: 400; font-size: .875rem; color: var(--text); }
details.help > .help-body p + p { margin-top: var(--s2); }
details.help.help-right > .help-body { left: auto; right: -.5rem; }

/* ---------- messages: flash + persistent state banners ---------- */
.flash, .banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid; border-radius: var(--radius-lg); margin-bottom: var(--s4); }
.flash .ic, .banner .ic { margin-top: .15rem; }
.flash-body, .banner-body { flex: 1; min-width: 0; }
.banner-body strong { display: block; }
.is-ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.is-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }
.is-crit { color: var(--crit); background: var(--crit-soft); border-color: var(--crit-border); }
.is-info { color: var(--info); background: var(--info-soft); border-color: var(--info-border); }
.flash .flash-body, .banner .banner-body { color: var(--text); }
.flash-close { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; display: inline-flex; }
.flash pre { margin: 0; white-space: pre-wrap; font-family: var(--mono); font-size: .8125rem; }

/* ---------- "shown once" secret + copyable values ---------- */
.secret { border: 1px solid var(--warn-border); background: var(--warn-soft); border-radius: var(--radius-lg); padding: var(--s4); margin-bottom: var(--s4); }
.secret-title { display: flex; align-items: center; gap: var(--s2); font-weight: 650; color: var(--warn); margin-bottom: var(--s2); }
.copyable { display: flex; gap: var(--s2); align-items: stretch; }
.copyable pre, .copyable code { flex: 1; min-width: 0; margin: 0; padding: .5rem .65rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--mono); font-size: .8125rem; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; color: var(--text); }

/* ---------- empty state ---------- */
.empty { text-align: center; padding: var(--s6) var(--s4); color: var(--text-muted); }
.empty .ic { width: 2.25rem; height: 2.25rem; stroke-width: 1.5; margin-bottom: var(--s2); }
.empty p { margin-bottom: var(--s3); }

/* ---------- confirm dialog ---------- */
dialog.confirm { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); padding: 0; width: min(28rem, 92vw); box-shadow: var(--shadow-pop); }
dialog.confirm::backdrop { background: rgba(8, 16, 28, .55); }
.confirm-body { padding: var(--s5); }
.confirm-body h2 { font-size: 1.0625rem; margin-bottom: var(--s2); }
.confirm-foot { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s3) var(--s5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ---------- overview tiles ---------- */
.tile { display: flex; flex-direction: column; gap: var(--s1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--s4); text-decoration: none; color: var(--text); border-left-width: 4px; }
.tile:hover { border-color: var(--border-strong); }
.tile-top { display: flex; align-items: center; gap: var(--s2); color: var(--text-muted); font-size: .8125rem; font-weight: 600; }
.tile-value { font-size: 1.375rem; font-weight: 650; line-height: 1.25; }
.tile-sub { font-size: .8125rem; color: var(--text-muted); }
.tile.t-ok { border-left-color: var(--ok); } .tile.t-warn { border-left-color: var(--warn); }
.tile.t-crit { border-left-color: var(--crit); } .tile.t-info { border-left-color: var(--info); }
.headline { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); border-radius: var(--radius-lg); border: 1px solid; margin-bottom: var(--s5); }
.headline .ic { width: 1.75rem; height: 1.75rem; }
.headline strong { font-size: 1.0625rem; display: block; color: var(--text); }
.headline span { color: var(--text-muted); font-size: .875rem; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.todo li:last-child { border-bottom: 0; }
.todo .grow { flex: 1; min-width: 0; }
/* Usage bars are native <progress> elements: the value is data, so no inline
   style= is needed (keeps a strict CSP possible). */
progress.meter { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: .4rem; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: var(--s1); color: var(--ok); }
progress.meter::-webkit-progress-bar { background: var(--surface-2); }
progress.meter::-webkit-progress-value { background: currentColor; border-radius: 999px; }
progress.meter::-moz-progress-bar { background: currentColor; border-radius: 999px; }
progress.meter.m-warn { color: var(--warn); } progress.meter.m-crit { color: var(--crit); }

/* ---------- customer status page ---------- */
.app-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: var(--s4); }
.app-head { display: flex; align-items: center; gap: var(--s4); padding: var(--s4); flex-wrap: wrap; }
.app-state { width: 2.75rem; height: 2.75rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; border: 1px solid; }
.app-state .ic { width: 1.5rem; height: 1.5rem; }
.app-title { flex: 1; min-width: 12rem; }
.app-title h2 { font-size: 1.0625rem; font-weight: 650; }
.app-title p { color: var(--text-muted); font-size: .875rem; }
.app-links { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: .875rem; }
.app-links a { display: inline-flex; align-items: center; gap: var(--s1); }
.app-parts { border-top: 1px solid var(--border); }
.part { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.part:last-child { border-bottom: 0; }
.part-name { flex: 1; min-width: 10rem; }
.part-name small { display: block; color: var(--text-muted); }
details.app-more { border-top: 1px solid var(--border); }
details.app-more > summary { padding: var(--s3) var(--s4); display: flex; font-weight: 500; font-size: .875rem; }
details.app-more > div { margin-top: 0; }
.contact { display: flex; gap: var(--s5); flex-wrap: wrap; align-items: center; }
.contact a { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); background: linear-gradient(160deg, var(--side-bg) 0 45%, var(--bg) 45% 100%); }
.login-card { width: min(24rem, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: var(--s6); text-align: center; }
.login-card img { width: 9rem; height: auto; margin-bottom: var(--s3); }
.login-card h1 { font-size: 1.25rem; margin-bottom: var(--s1); }
.login-card form { text-align: left; margin-top: var(--s5); }
.login-card .btn { width: 100%; margin-top: var(--s2); }
.login-foot { margin-top: var(--s5); font-size: .8125rem; color: var(--text-muted); }

/* ---------- first-run wizard: centred, branded column ---------- */
.wizard { max-width: 46rem; margin: 0 auto; padding: var(--s5) var(--s4) var(--s6); }
.wizard-brand { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.wizard-brand img { width: 3.25rem; height: auto; }
.wizard-brand strong { display: block; font-size: 1.25rem; }
.wizard-brand span { color: var(--text-muted); font-size: .875rem; }
.wizard-steps { list-style: none; margin: 0 0 var(--s5); padding: 0; display: flex; gap: var(--s2); flex-wrap: wrap; font-size: .8125rem; color: var(--text-muted); }
.wizard-steps li { display: inline-flex; align-items: center; gap: var(--s2); padding-right: var(--s3); }
.wizard-steps li span { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.wizard-steps li[aria-current="step"] { color: var(--text); font-weight: 650; }
.wizard-steps li[aria-current="step"] span { background: var(--accent); border-color: var(--accent); color: #fff; }
.wizard-steps li.is-done span { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.copyable .input { flex: 1; min-width: 0; }
