/* Recon portal theme ("Signal"). One stylesheet for every view: tokens, shell, components, the
   stack topology. Rules for using it: docs/ui/THEME.md. Every class a view uses must be defined
   here (tests/Recon.Deployment.Tests/PortalThemeTests.cs). No inline styles: the CSP forbids them. */

/* ---- tokens ---------------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --surface-3: #e8edf3;
  --border: #dbe2ea;
  --border-strong: #c3cdd8;
  --text: #142030;
  --text-2: #475569;
  --text-3: #74818f;

  --brand: #0e7c74;
  --brand-strong: #0a5f59;
  --brand-soft: #e0f3f1;
  --on-brand: #ffffff;

  --shell: #0d1a2b;
  --shell-2: #152740;
  --shell-text: #e3ebf4;
  --shell-muted: #8ea1b8;
  --ops: #f0b429;

  --ok: #16803c;      --ok-soft: #e2f4e8;      --ok-line: #34a853;
  --warn: #a85b06;    --warn-soft: #fdf1df;    --warn-line: #e39b21;
  --bad: #c0281e;     --bad-soft: #fde7e5;     --bad-line: #e5483d;
  --info: #1f5fbf;    --info-soft: #e5eefc;
  --unknown: #6b7785; --unknown-soft: #edf0f4; --unknown-line: #a7b1bd;
  --off: #8a94a0;     --off-soft: #f0f2f5;     --off-line: #c9cfd6;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(16 32 48 / 0.06), 0 1px 1px rgb(16 32 48 / 0.04);
  --shadow-lg: 0 8px 24px rgb(16 32 48 / 0.08), 0 2px 6px rgb(16 32 48 / 0.05);
  --focus: 0 0 0 3px rgb(14 124 116 / 0.35);
  --page: 76rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0a111b;
    --surface: #101a27;
    --surface-2: #142132;
    --surface-3: #1a2a3f;
    --border: #22344b;
    --border-strong: #2f4563;
    --text: #e4ebf3;
    --text-2: #a7b4c4;
    --text-3: #7b899a;

    --brand: #2cc9b7;
    --brand-strong: #5fe0d0;
    --brand-soft: #0f3532;
    --on-brand: #04201d;

    --shell: #070d16;
    --shell-2: #0f1b2b;

    --ok: #4ccb75;      --ok-soft: #10301d;      --ok-line: #3dbb66;
    --warn: #f0b04a;    --warn-soft: #3a2a0f;    --warn-line: #e8a33a;
    --bad: #ff7b70;     --bad-soft: #3b1614;     --bad-line: #f0625a;
    --info: #7fb0ff;    --info-soft: #132a4a;
    --unknown: #93a0b0; --unknown-soft: #1a2635; --unknown-line: #4c5b6e;
    --off: #7d8896;     --off-soft: #161f2b;     --off-line: #364354;

    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 8px 24px rgb(0 0 0 / 0.35);
    --focus: 0 0 0 3px rgb(44 201 183 / 0.4);
  }
}

/* ---- base ------------------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 0.98rem; font-weight: 650; }
p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); text-decoration: underline; }
strong { font-weight: 650; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 0.05em 0.35em; }
code.wrap { word-break: break-all; }
ul { margin: 0 0 0.75rem; padding-left: 1.25rem; }
blockquote { margin: 0 0 1rem; padding: 0.75rem 1rem; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
[hidden] { display: none !important; }

.muted { color: var(--text-3); }
.small { font-size: 0.86rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- shell ----------------------------------------------------------------------------------- */
.shell {
  background: var(--shell);
  color: var(--shell-text);
  border-bottom: 1px solid var(--shell-2);
}
.shell-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 3.6rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--shell-text); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-mark .ring { fill: none; stroke: #2cc9b7; stroke-width: 2; }
.brand-mark .ring-2 { fill: none; stroke: #2cc9b7; stroke-width: 2; opacity: 0.45; }
.brand-mark .dot { fill: #2cc9b7; }
.brand-mark .sweep { fill: #2cc9b7; opacity: 0.25; }
.area { font-size: 0.72rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--shell-2); color: var(--shell-muted); }
.area-ops { background: rgb(240 180 41 / 0.15); color: var(--ops); }
.nav { display: flex; gap: 0.15rem; flex-wrap: wrap; }
.nav a { color: var(--shell-muted); padding: 0.45rem 0.7rem; border-radius: 8px; font-weight: 550; font-size: 0.92rem; }
.nav a:hover { color: var(--shell-text); background: var(--shell-2); text-decoration: none; }
.nav a[aria-current="page"] { color: #fff; background: var(--shell-2); box-shadow: inset 0 -2px 0 #2cc9b7; }
.who { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; font-size: 0.88rem; color: var(--shell-muted); }
.who-name { color: var(--shell-text); font-weight: 550; }
.who button { background: transparent; border-color: var(--shell-2); color: var(--shell-text); }
.who button:hover { background: var(--shell-2); border-color: var(--shell-muted); }

.page { width: 100%; max-width: var(--page); margin: 0 auto; padding: 1.75rem 1.25rem 3rem; flex: 1; }
.page-narrow { max-width: 30rem; padding-top: 3.5rem; }
.footer { color: var(--text-3); font-size: 0.8rem; text-align: center; padding: 1.25rem; }

/* Page header: eyebrow, title, lede, actions. */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { margin-bottom: 0.25rem; }
.eyebrow { font-size: 0.75rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); margin-bottom: 0.35rem; }
.lede { color: var(--text-2); max-width: 46rem; margin: 0; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ---- surfaces -------------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.35rem; margin-bottom: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-head h2, .card-head h3 { margin: 0 0 0.2rem; }
.card-head p { color: var(--text-2); margin: 0; font-size: 0.92rem; max-width: 44rem; }
.card-danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.card-danger h2 { color: var(--bad); }
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); margin-bottom: 1.25rem; }
.grid > .card { margin-bottom: 0; }
.stack-v > * + * { margin-top: 1rem; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* Key-value list. */
.kv { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: 0.5rem 1.5rem; margin: 0; }
.kv dt { color: var(--text-3); font-size: 0.88rem; }
.kv dd { margin: 0; }

/* Headline numbers. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); }
.stat-label { color: var(--text-3); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; margin-top: 0.2rem; }
.stat-sub { color: var(--text-2); font-size: 0.85rem; }
.stat-ok .stat-value { color: var(--ok); }
.stat-warn .stat-value { color: var(--warn); }
.stat-bad .stat-value { color: var(--bad); }

/* Nothing to show yet. */
.empty { text-align: center; padding: 2rem 1rem; color: var(--text-2); border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.empty h3 { color: var(--text); }

/* ---- messages -------------------------------------------------------------------------------- */
.flash, .callout { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 1.25rem; }
.flash::before, .callout::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 0.5rem; background: currentColor; }
.flash-ok, .callout-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.flash-bad, .callout-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.callout-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); color: var(--info); }
.flash > div, .callout > div { color: var(--text); }
.callout > div > strong:first-child { display: block; }

/* A value shown once: a token, an enrolment key, an invitation link. */
.secret { border: 1.5px dashed var(--brand); background: var(--brand-soft); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1.25rem; }
.secret-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--brand); margin-bottom: 0.35rem; }
.secret-value { display: block; font-family: var(--mono); font-size: 0.82rem; word-break: break-all; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.65rem 0.75rem; margin: 0.5rem 0; user-select: all; }

/* Numbered steps: a guided setup, one action per step. */
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 1.25rem 2.75rem; }
.steps > li:last-child { padding-bottom: 0; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.steps h3 { margin: 0.2rem 0 0.35rem; font-size: 1rem; }
.steps p { margin: 0 0 0.45rem; color: var(--text-2); }

/* A command to copy into a terminal. */
.command { display: block; font-family: var(--mono); font-size: 0.82rem; line-height: 1.5; white-space: pre-wrap; word-break: break-all; background: var(--shell); color: var(--shell-text); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem; margin: 0.4rem 0; user-select: all; }

/* ---- badges ---------------------------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; background: var(--unknown-soft); color: var(--unknown); border: 1px solid transparent; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge-plain::before { display: none; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-off { background: var(--off-soft); color: var(--off); }
.badge-unknown { background: var(--unknown-soft); color: var(--unknown); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-ok.badge-live::before { box-shadow: 0 0 0 0 currentColor; animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 80%, 100% { box-shadow: 0 0 0 6px transparent; } }

/* Status dot on its own (tables, compact rows). */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--unknown-line); flex: none; }
.dot-ok { background: var(--ok-line); }
.dot-warn { background: var(--warn-line); }
.dot-bad { background: var(--bad-line); }
.dot-off { background: var(--off-line); }
.dot-unknown { background: var(--unknown-line); }

/* ---- buttons --------------------------------------------------------------------------------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1.2;
  padding: 0.55rem 0.95rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
button:hover, .button:hover { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; color: var(--text); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.danger:hover { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.danger.solid:hover { filter: brightness(1.08); color: #fff; }
.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.ghost:hover { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); }
.sm { padding: 0.3rem 0.6rem; font-size: 0.82rem; border-radius: 7px; }
button.link { background: none; border: none; padding: 0; color: var(--brand); font-weight: 500; text-decoration: underline; }
.button-row { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
form.inline { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0; }

/* ---- forms ----------------------------------------------------------------------------------- */
.form { display: grid; gap: 1rem; max-width: 34rem; }
.form-wide { max-width: 48rem; }
.form-row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1 1 14rem; }
.field { display: grid; gap: 0.35rem; }
.field > span:first-child, .field-label { font-size: 0.86rem; font-weight: 600; color: var(--text-2); }
.hint { font-size: 0.82rem; color: var(--text-3); }
input, select, textarea {
  font: inherit; font-size: 0.93rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem; width: 100%; height: 2.5rem;
}
textarea { height: auto; min-height: 5rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input::placeholder { color: var(--text-3); }
select { width: auto; min-width: 10rem; }
.form select, .field select { width: 100%; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 0; display: grid; gap: 1rem; }
legend { font-weight: 650; padding: 0 0.4rem; }

/* A setting with its current value and the switch. */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }

/* ---- tables ---------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card .table-wrap { box-shadow: none; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); background: var(--surface-2); padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 0.7rem 0.85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 35%, transparent); }
.table td.actions-cell { text-align: right; white-space: nowrap; }
.table .sub { display: block; color: var(--text-3); font-size: 0.82rem; }
/* Report figures: numbers line up on the right; the foot holds totals. */
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border-strong); border-bottom: 0; }

.pager { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ---- the stack: topology -------------------------------------------------------------------- */
/* Recon control plane ══ tunnel ══ [ connector ── database ── ingest proxy ] ══ devices */
.card.stack-card { padding: 0; overflow: hidden; }
.stack-card > .stack-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.35rem; border-bottom: 1px solid var(--border); }
.stack-title { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.stack-title h3 { margin: 0; font-size: 1.05rem; }
.stack-body { padding: 1.35rem; display: grid; gap: 1.35rem; }
.stack-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.85rem 1.35rem; border-top: 1px solid var(--border); background: var(--surface-2); }

.topology { display: flex; align-items: stretch; gap: 0; min-width: 0; }
.zone { position: relative; border-radius: var(--radius); padding: 1.6rem 0.85rem 0.85rem; display: flex; align-items: stretch; }
.zone-label { position: absolute; top: 0.45rem; left: 0.85rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.zone-recon { background: color-mix(in srgb, var(--brand-soft) 60%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); }
.zone-client { flex: 1; border: 1.5px dashed var(--border-strong); background: var(--surface-2); gap: 0; }
.zone-devices { padding-left: 0; padding-right: 0; }

.node {
  position: relative; flex: 1 1 0; min-width: 8.5rem; max-width: 15rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.75rem 0.8rem; display: flex; flex-direction: column; gap: 0.3rem; box-shadow: var(--shadow);
}
.node::after { content: ""; position: absolute; left: 0; top: 0.65rem; bottom: 0.65rem; width: 3px; border-radius: 0 3px 3px 0; background: var(--unknown-line); }
.node-ok::after { background: var(--ok-line); }
.node-warn::after { background: var(--warn-line); }
.node-bad::after { background: var(--bad-line); }
.node-off::after { background: var(--off-line); }
.node-bad { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.node-head { display: flex; align-items: center; gap: 0.5rem; }
.node-name { font-weight: 650; font-size: 0.9rem; }
.node-summary { font-size: 0.84rem; font-weight: 550; }
.node-ok .node-summary { color: var(--ok); }
.node-warn .node-summary { color: var(--warn); }
.node-bad .node-summary { color: var(--bad); }
.node-unknown .node-summary, .node-off .node-summary { color: var(--text-3); }
.node-detail { margin: 0; padding: 0; list-style: none; font-size: 0.78rem; color: var(--text-3); line-height: 1.45; }
.node-plain { box-shadow: none; background: transparent; border-style: dashed; }
.node-plain::after { display: none; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--text-2); }
.node-ok .icon { color: var(--ok); }
.node-warn .icon { color: var(--warn); }
.node-bad .icon { color: var(--bad); }

/* A connection between two nodes: a line, coloured by state, with a label above and below. */
.link { flex: 0 0 6.5rem; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0.3rem; padding: 0 0.35rem; text-align: center; min-width: 4.5rem; }
.link-short { flex-basis: 3.5rem; min-width: 2.5rem; }
.link-line { width: 100%; height: 4px; border-radius: 4px; background: var(--unknown-line); position: relative; overflow: hidden; }
.link-label { font-size: 0.7rem; font-weight: 650; color: var(--text-2); line-height: 1.2; }
.link-meta { font-size: 0.68rem; color: var(--text-3); line-height: 1.2; }
.link-ok .link-line { background: var(--ok-line); }
.link-ok .link-line::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 10px, rgb(255 255 255 / 0.55) 10px 16px);
  animation: flow 1.2s linear infinite;
}
.link-warn .link-line { background: var(--warn-line); }
.link-bad .link-line { background: repeating-linear-gradient(90deg, var(--bad-line) 0 6px, transparent 6px 11px); }
.link-off .link-line, .link-unknown .link-line { background: repeating-linear-gradient(90deg, var(--off-line) 0 6px, transparent 6px 11px); }
.link-bad .link-label { color: var(--bad); }
@keyframes flow { from { transform: translateX(-16px); } to { transform: translateX(0); } }

/* The checks beside the diagram. */
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.75rem; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.7rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.check .dot { margin-top: 0.4rem; }
.check-name { font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.check-summary { font-size: 0.88rem; font-weight: 550; }
.check-detail { font-size: 0.78rem; color: var(--text-3); }

/* Fleet: one compact tile per stack (operator dashboard). */
.fleet { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; }
.tile { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.95rem 1.05rem; box-shadow: var(--shadow); color: var(--text); transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s; }
.tile:hover { border-color: var(--brand); box-shadow: var(--shadow-lg); text-decoration: none; color: var(--text); transform: translateY(-1px); }
.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.tile-org { font-weight: 650; }
.tile-meta { font-size: 0.8rem; color: var(--text-3); margin-bottom: 0.7rem; }
.tile-parts { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.part { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.72rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); border-radius: 999px; padding: 0.1rem 0.5rem 0.1rem 0.35rem; }
.part .dot { width: 7px; height: 7px; }

@media (max-width: 62rem) {
  .topology, .zone-client { flex-direction: column; }
  .zone { padding-top: 1.7rem; }
  .node { max-width: none; }
  .link { flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 0.75rem; padding: 0.35rem 0 0.35rem 1.4rem; text-align: left; min-width: 0; }
  .link-short { flex-basis: auto; }
  .link-line { width: 4px; height: 2.2rem; flex: none; }
  .link-ok .link-line::after { background: repeating-linear-gradient(180deg, transparent 0 10px, rgb(255 255 255 / 0.55) 10px 16px); animation: flow-v 1.2s linear infinite; }
  .link-bad .link-line { background: repeating-linear-gradient(180deg, var(--bad-line) 0 6px, transparent 6px 11px); }
  .link-off .link-line, .link-unknown .link-line { background: repeating-linear-gradient(180deg, var(--off-line) 0 6px, transparent 6px 11px); }
  .zone-devices { padding: 0; }
}
@keyframes flow-v { from { transform: translateY(-16px); } to { transform: translateY(0); } }

@media (max-width: 40rem) {
  .shell-inner { gap: 0.75rem; padding: 0.5rem 1rem; }
  .who { margin-left: 0; width: 100%; justify-content: space-between; }
  .page { padding: 1.25rem 1rem 2.5rem; }
  .kv { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .kv dd { margin-bottom: 0.5rem; }
  .card { padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
