/* Copyright 2026 The Goliash Authors */
/* SPDX-License-Identifier: AGPL-3.0-only */

/* Layout: a top bar, then one wide working column. The matrix is the hero; every other page is a table or a form. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #161b26;
  --muted: #5d6677;
  --faint: #687184; /* 4.5:1 on white and on --bg, for small text */
  --line: #e1e4ea;
  --accent: #3157d5;      /* links, primary actions */
  --accent-soft: #e8edfc;
  --ok: #1d7a4f;
  --ok-soft: #e3f3ea;
  --warn: #9a5b00;
  --warn-soft: #fbf0dd;
  --bad: #b42335;
  --bad-soft: #fbe6e9;
  --info: #5b4bc4;
  --info-soft: #eeebfb;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 8px;
  /* Chart series: vivid, distinct, readable on both themes. */
  --c0: #4e74f8; --c1: #9b5cf0; --c2: #22b3a2; --c3: #f29d1b; --c4: #ef4f6a; --c5: #2fb0e0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117; --surface: #161b24; --surface-2: #1b212c; --ink: #e6e9ef; --muted: #9aa3b4; --faint: #8b94a7;
    --line: #2a3140; --accent: #8aa4ff; --accent-soft: #1f2a4a; --ok: #6fcf9c; --ok-soft: #14291e;
    --warn: #f0b45e; --warn-soft: #2d2213; --bad: #f08a96; --bad-soft: #301920; --info: #b2a6ff; --info-soft: #241f42;
    --c0: #6f8dff; --c1: #b07dff; --c2: #34d1bd; --c3: #ffb444; --c4: #ff6b82; --c5: #4cc8f5;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.35rem; font-weight: 650; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0; }

/* Top bar */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-inner { max-width: 1400px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 22px; min-height: 52px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); letter-spacing: 0.01em; }
.brand:hover { text-decoration: none; }
.brand svg { color: var(--accent); }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.count { font: 600 11px/1 var(--sans); background: var(--warn-soft); color: var(--warn); padding: 3px 6px; border-radius: 999px; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.who form { margin: 0; }
.who-link { color: inherit; text-decoration: none; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-link:hover, .who-link.active { color: var(--ink); text-decoration: underline; }
.switcher select { font-weight: 600; padding: 6px 28px 6px 10px; }
.ws-name { font-weight: 600; color: var(--ink); }
@media (max-width: 720px) {
  .top-inner { padding: 8px 16px 0; gap: 8px 16px; }
  .who { margin-left: auto; }
  .who > span { display: none; }
  .who-link { max-width: 14ch; }
  .nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
  main { padding: 18px 16px 48px; }
}

/* Page */
main { max-width: 1400px; margin: 0 auto; padding: 24px 20px 64px; display: grid; gap: 22px; }
main > *, .grid-2 > * { min-width: 0; } /* wide tables scroll inside their panel, not the page */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head .sub { color: var(--muted); margin-top: 4px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel > .panel-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel > .panel-body { padding: 16px; display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 22px; align-items: start; }
.notice { padding: 10px 14px; border-radius: var(--radius); background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.notice.error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.secret { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: var(--radius); }
.secret code { background: var(--surface); padding: 4px 8px; border-radius: 5px; word-break: break-all; }
.empty { color: var(--muted); padding: 28px 16px; text-align: center; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.scroll { overflow-x: auto; position: relative; } /* absolute children (menus, screen reader text) stay inside */

/* Tables */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Matrix */
.matrix th.env { min-width: 190px; }
.matrix th.env small { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); }
.matrix td.svc { white-space: nowrap; }
.matrix td.svc a { font-weight: 600; color: var(--ink); }
.matrix td.svc .owner { display: block; font-size: 12px; color: var(--faint); }
.cell { display: grid; gap: 4px; }
.ver { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.tag { font: 600 13.5px/1.3 var(--mono); }
.reps { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.targets { font-size: 11.5px; color: var(--faint); }
.none { color: var(--faint); }
.latest .tag { color: var(--muted); }
.badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; font: 600 11px/1.2 var(--sans); padding: 3px 7px; border-radius: 999px; white-space: nowrap; }
.badge.env, .badge.declared { background: var(--warn-soft); color: var(--warn); }
.badge.upstream { background: var(--info-soft); color: var(--info); }
.badge.inconsistent, .badge.failing, .badge.stale, .badge.eol, .badge.revoked { background: var(--bad-soft); color: var(--bad); }
.badge.ok, .badge.online { background: var(--ok-soft); color: var(--ok); }
.badge.degraded, .badge.outdated { background: var(--warn-soft); color: var(--warn); }
.badge.neutral, .badge.never, .badge.declared-only { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.live.off::before { background: var(--faint); box-shadow: none; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ev { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.ev .what { font-weight: 500; }
.ev .where { color: var(--muted); font-size: 12.5px; }
.kind { font: 600 10.5px/1 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.kind.deployed, .kind.version_changed { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.kind.new_release { background: var(--info-soft); color: var(--info); border-color: transparent; }
.kind.drift_detected { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.kind.drift_resolved { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.kind.removed { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
@media (max-width: 640px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

/* Forms */
form.stack { display: grid; gap: 12px; }
form.inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin: 0; }
label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--ink); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.hint { font-size: 12px; font-weight: 400; color: var(--faint); }
button, .button { font: 600 13px/1 var(--sans); padding: 9px 14px; border-radius: 6px; border: 1px solid transparent; background: var(--accent); color: #fff; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
@media (prefers-color-scheme: dark) { button, .button { color: #0e1117; } }
button:hover, .button:hover { filter: brightness(1.07); text-decoration: none; }
button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
button.link { background: none; color: var(--accent); padding: 0; border: 0; font-weight: 500; }
button.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
details > summary { cursor: pointer; color: var(--accent); font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 12px; }

/* Facts list on the service page */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.fact { background: var(--surface); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.fact dt { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.fact dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* Sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 18px; }
.login .brand { font-size: 1.15rem; }
.login .passkey-button { justify-content: center; }
.login .forgot { font-size: 13px; justify-self: start; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (prefers-reduced-motion: no-preference) {
  .flash { animation: flash 1.2s ease-out; }
  @keyframes flash { from { background: var(--accent-soft); } }
}

.asof { margin-top: 10px; font-size: 13px; }
.asof input { width: auto; }

.report-nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.report-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; padding: 18px; }
.report-stats div { display: flex; flex-direction: column; gap: 2px; }
.report-stats strong { font-size: 26px; }
.report-stats span { color: var(--muted); font-size: 12.5px; }
@media print {
  header.top, .noprint, .flash { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; break-inside: avoid; border-color: #ddd; }
  a { color: inherit; text-decoration: none; }
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
h1 .badge { vertical-align: middle; margin-left: 6px; }
details.install { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
details.install[open] > summary { margin-bottom: 8px; }
details.install pre { margin: 0 0 8px; padding: 10px 12px; background: var(--surface-2); border-radius: 6px; white-space: pre-wrap; word-break: break-all; font-size: 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; padding: 14px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Header menus: Settings and the account. <details> works without JavaScript; app.js closes them on outside clicks. */
.menu { position: relative; }
.menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; cursor: pointer; user-select: none; margin: 0; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { background: var(--surface-2); color: var(--ink); }
.menu > summary.current { color: var(--ink); background: var(--accent-soft); }
.menu[open] > summary { margin-bottom: 0; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); padding: 6px; display: flex; flex-direction: column; z-index: 20; }
.menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--ink); font: inherit; background: none; border: 0; cursor: pointer; }
.menu-item:hover, .menu-item[aria-current="page"] { background: var(--surface-2); text-decoration: none; }
.menu-item[aria-current="page"] { font-weight: 600; }
.menu-list form { margin: 0; border-top: 1px solid var(--line); padding-top: 4px; margin-top: 4px; }
.menu-head { display: flex; flex-direction: column; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow: hidden; }
.menu-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--surface); font: 700 12px/1 var(--sans); }
.who-email { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) {
  .menu-label { display: none; }
  .menu > summary { padding: 6px 8px; }
}

/* Page toolbar (matrix): filter on the left, actions on the right. */
.toolbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin: 0 0 14px; }
.toolbar .spacer { flex: 1; }
.toolbar .search { width: min(340px, 100%); }
.toolbar-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: auto; margin: 0; }
.timetravel > summary { color: var(--accent); }
.timetravel .menu-list { min-width: 280px; padding: 12px; }
.button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
tr.filtered { display: none; }
.no-match td { text-align: center; color: var(--muted); padding: 28px; }

/* Wide tables: the first column stays put while the rest scrolls sideways, and names do not break. */
table.matrix th:first-child, table.matrix td.svc { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 1px 0 0 var(--line); }
table.matrix thead th:first-child { background: var(--surface-2); }
td.svc a, td > strong:first-child, td > a > strong { white-space: nowrap; }

.row-actions { display: inline-flex; gap: 12px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.row-actions form { margin: 0; }
button.danger-link, a.danger-link { color: var(--bad); }
tr.paused td { color: var(--muted); }
.env-edit { gap: 8px; flex-wrap: nowrap; }
.env-edit input[name="name"] { min-width: 0; width: 12ch; }
.env-edit input[name="position"] { width: 6ch; }
textarea.mono { font-family: var(--mono); font-size: 12.5px; }

/* First-run checklist on an empty matrix. */
.first-run { padding: 28px clamp(16px, 4vw, 40px); display: flex; flex-direction: column; gap: 10px; }
.steps { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 2px; counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li p { margin-top: 2px; }
.step-mark { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font: 600 12px/1 var(--sans); color: var(--muted); }
.step-mark::before { content: counter(step); }
.steps li.done .step-mark { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.steps li.done .step-mark::before { content: "✓"; }
.steps li.done strong { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 720px) { .steps li { grid-template-columns: 28px 1fr; } .steps li .button { grid-column: 2; justify-self: start; } }

/* Summary tiles that double as filters (hygiene). */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; margin-bottom: 14px; }
.tiles > * { min-width: 0; overflow-wrap: anywhere; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile strong { font-size: 22px; line-height: 1.1; }
.tile span { font-weight: 600; }
.tile small { color: var(--muted); font-size: 12px; }
.tile.warn strong { color: var(--warn); }
/* Empty tiles step back by colour, not opacity, so their text stays readable. */
.tile.zero { background: transparent; }
.tile.zero strong, .tile.zero span { color: var(--muted); }
.tile.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }

/* On phones the matrix becomes one card per service, environments listed inside it. */
@media (max-width: 720px) {
  table.matrix thead { display: none; }
  table.matrix, table.matrix tbody, table.matrix tr, table.matrix td { display: block; width: 100%; }
  table.matrix tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  table.matrix tr.filtered { display: none; }
  table.matrix td { border: 0; padding: 5px 0; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; align-items: start; }
  table.matrix td::before { content: attr(data-label); color: var(--muted); font: 600 11px/1.9 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }
  table.matrix td.svc { display: flex; align-items: baseline; gap: 8px; position: static; box-shadow: none; padding-bottom: 6px; }
  table.matrix td.svc::before { content: none; }
  table.matrix td.svc a { font-size: 15px; }
  table.matrix tr.no-match td { display: block; }
  table.matrix tr.no-match td::before { content: none; }
  .scroll:has(> table.matrix) { overflow: visible; }
}

/* Two-factor setup */
.setup-2fa { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.setup-2fa img { border-radius: 8px; background: #fff; padding: 8px; border: 1px solid var(--line); image-rendering: pixelated; }
.setup-2fa .key { font-size: 15px; letter-spacing: 0.04em; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; display: inline-block; word-break: break-all; }
pre.codes { columns: 2; margin: 0; padding: 14px 16px; background: var(--surface-2); border-radius: 8px; font-size: 15px; line-height: 1.9; white-space: pre; }

/* Charts (server-drawn SVG). Colours follow the theme; gradients take their stop
   colours from the st-c* classes. app.js adds the crosshair and the tooltip. */
.chart { margin: 0; padding: 16px 18px 14px; overflow-x: auto; position: relative; }
.chart svg { width: 100%; min-width: 520px; max-height: 270px; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; opacity: 0.9; }
.chart .baseline { stroke: var(--line); stroke-width: 1.2; }
.chart .axis { fill: var(--faint); font: 500 10.5px var(--sans); font-variant-numeric: tabular-nums; }
.chart .lane { fill: var(--muted); font: 600 11px var(--sans); }
.chart .seg-label { fill: #fff; font: 600 11px var(--mono); pointer-events: none; }
.chart .bar { transition: opacity 0.15s; }
.chart.hovering .bar { opacity: 0.45; }
.chart.hovering .bar.active { opacity: 1; }
.chart .seg { transition: filter 0.15s; }
.chart .seg:hover { filter: brightness(1.12); }
.chart .area { stroke: none; pointer-events: none; }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .halo { opacity: 0.18; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; pointer-events: none; }
.chart.hovering .cross { opacity: 0.7; }
.chart .cross-band { fill: var(--ink); opacity: 0; pointer-events: none; }
.chart.hovering .cross-band { opacity: 0.04; }
.chart .hover-dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
/* Lines and dots take their colour from the class; bars, areas and segments keep
   the gradient their fill attribute names (a CSS fill would override it). */
.chart .line.c0 { stroke: var(--c0); } .chart .line.c1 { stroke: var(--c1); } .chart .line.c2 { stroke: var(--c2); }
.chart .line.c3 { stroke: var(--c3); } .chart .line.c4 { stroke: var(--c4); } .chart .line.c5 { stroke: var(--c5); }
.chart :is(.dot, .halo, .hover-dot).c0 { fill: var(--c0); } .chart :is(.dot, .halo, .hover-dot).c1 { fill: var(--c1); }
.chart :is(.dot, .halo, .hover-dot).c2 { fill: var(--c2); } .chart :is(.dot, .halo, .hover-dot).c3 { fill: var(--c3); }
.chart :is(.dot, .halo, .hover-dot).c4 { fill: var(--c4); } .chart :is(.dot, .halo, .hover-dot).c5 { fill: var(--c5); }
.chart .halo { stroke: none; }
.st-c0 { stop-color: var(--c0); } .st-c1 { stop-color: var(--c1); } .st-c2 { stop-color: var(--c2); }
.st-c3 { stop-color: var(--c3); } .st-c4 { stop-color: var(--c4); } .st-c5 { stop-color: var(--c5); }
.legend-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; padding: 0 0 0 36px; font-size: 12.5px; color: var(--muted); }
.legend-list li { display: inline-flex; align-items: center; gap: 7px; }
.legend-value { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.swatch.c0 { background: var(--c0); } .swatch.c1 { background: var(--c1); } .swatch.c2 { background: var(--c2); }
.swatch.c3 { background: var(--c3); } .swatch.c4 { background: var(--c4); } .swatch.c5 { background: var(--c5); }
@media (prefers-color-scheme: dark) { .chart .seg-label { fill: #0e1117; } }
/* The tooltip, SigNoz-style: the period, then every series with its value. */
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 168px; padding: 9px 11px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 10px 30px rgba(15, 20, 30, 0.14), 0 2px 6px rgba(15, 20, 30, 0.08);
  font-size: 12.5px; transition: opacity 0.1s; opacity: 0;
}
.chart.hovering .chart-tip { opacity: 1; }
.chart-tip .tip-head { font-weight: 600; color: var(--muted); font-size: 11.5px; margin-bottom: 6px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; line-height: 1.75; }
.chart-tip .tip-row .swatch { flex: none; }
.chart-tip .tip-name { flex: 1; color: var(--muted); }
.chart-tip .tip-val { font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-tip .tip-total { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 4px; }

/* Connect */
.platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.platform { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.platform:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); text-decoration: none; }
.platform strong { font-size: 16px; }
.platform span { color: var(--muted); font-size: 13px; }
.connect-form { max-width: 860px; }
.connect-manual { max-width: 860px; margin-top: 18px; }
.connect-manual > summary { cursor: pointer; list-style: none; }
.connect-manual > summary h2 { display: inline; }
.connect-manual .connect-form .panel { box-shadow: none; }
.code-agent + .code-agent { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.connect-status .notice ul.tight { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.connect-status .notice pre { margin: 6px 0; }
.notes-list { margin: 0; padding-left: 34px; display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.code-agent h3 { margin: 4px 0 0; font-size: 15px; }
#install-code { margin: 6px 0; word-break: break-all; white-space: pre-wrap; }
.choice { align-items: flex-start; font-weight: 400; }
.choice input { margin-top: 3px; }
.inline-field { margin-left: 26px; max-width: 320px; }
.install-cmd { margin: 0; padding: 12px 14px; background: var(--surface-2); border-radius: 6px; white-space: pre-wrap; word-break: break-all; font-size: 12.5px; }
.connect-status { padding: 6px 18px; }
.connect-status .actions { padding: 0 0 14px 42px; }
.settings-record > summary { cursor: pointer; }
.error-text { color: var(--bad); }
details.advanced { margin-top: 4px; }
details.advanced > summary { color: var(--muted); font-weight: 500; padding: 6px 0; }
details.advanced[open] > summary { margin-bottom: 10px; }
.connect-status .steps li.done strong { text-decoration: none; color: var(--ink); }

/* Target page: health ring, tiles, sparkline, workload cards. */
.target-summary { display: grid; grid-template-columns: auto 1fr minmax(160px, 240px); gap: 24px; align-items: center; padding: 18px 22px; }
.ring { position: relative; width: 112px; height: 112px; }
.ring svg { width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 9; }
/* The ring's stroke is a gradient between two shades of its health colour. */
.ring-value { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring.good .ring-from { stop-color: var(--c2); } .ring.good .ring-to { stop-color: var(--ok); }
.ring.fair .ring-from { stop-color: var(--c3); } .ring.fair .ring-to { stop-color: var(--warn); }
.ring.poor .ring-from { stop-color: var(--c4); } .ring.poor .ring-to { stop-color: var(--c1); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label strong { font-size: 24px; line-height: 1; }
.ring-label span { font-size: 11px; color: var(--muted); }
.summary-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.summary-tiles > * { display: flex; flex-direction: column; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink); }
.summary-tiles strong { font-size: 22px; line-height: 1.1; }
.summary-tiles span { font-size: 12px; color: var(--muted); }
.summary-tiles .warn strong { color: var(--warn); }
.summary-tiles a:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--accent); }
.summary-tiles .muted-tile { background: transparent; }
.summary-tiles .muted-tile strong { color: var(--muted); }
.spark { display: flex; flex-direction: column; gap: 6px; }
.spark-label { font-size: 12px; color: var(--muted); }
.spark svg { width: 100%; height: 44px; }
.spark line { stroke: var(--line); }
.spark .spark-line { fill: none; stroke: var(--c0); stroke-width: 1.8; stroke-linejoin: round; }
.spark .spark-hit { fill: transparent; }
.spark .spark-hit:hover { fill: var(--c0); opacity: 0.12; }
.badge.env-tag { background: var(--accent-soft); color: var(--accent); }
.legend-dots { display: inline-flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: -6px; }
.dot.ok, .wl-card.ok { --health: var(--ok); }
.dot.warn, .wl-card.warn { --health: var(--warn); }
.dot.bad, .wl-card.bad { --health: var(--bad); }
.dot.unmapped, .wl-card.unmapped { --health: var(--faint); }
.dot { background: var(--health); }
.wl-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; align-items: start; margin-bottom: 18px; }
.wl-group { display: flex; flex-direction: column; gap: 10px; padding: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: calc(var(--radius) + 2px); }
.wl-group-name { display: flex; justify-content: space-between; align-items: center; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 2px 4px; }
.count-pill { font: 600 11px/1 var(--sans); padding: 3px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.wl-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px 14px 12px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.wl-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--health); }
.wl-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgb(0 0 0 / .08); }
.wl-card header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.wl-card header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; max-width: 70%; }
.wl-card header .muted { font-size: 11.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-version { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wl-version .tag { font-size: 20px; font-weight: 700; }
.wl-arrow { font: 600 12px var(--mono); color: var(--info); }
.wl-image { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-replicas { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; min-height: 10px; }
.rep { width: 9px; height: 9px; border-radius: 3px; background: var(--health); opacity: .85; }
.wl-card footer { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-top: auto; padding-top: 6px; border-top: 1px dashed var(--line); }
.wl-card.unmapped .wl-version .tag { color: var(--muted); }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .target-summary { grid-template-columns: 1fr; justify-items: center; }
  .summary-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .spark { width: 100%; }
}
.segmented { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.segmented .muted { padding: 0 8px 0 6px; font-size: 12.5px; white-space: nowrap; }
.segmented a { white-space: nowrap; }
.segmented a { padding: 5px 10px; border-radius: 6px; color: var(--muted); font-weight: 500; font-size: 13px; }
.segmented a:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }
.segmented a.on { background: var(--accent-soft); color: var(--accent); }
.wl-group-name small { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); font-size: 11px; margin-top: 2px; }

/* Matrix groups: each application (team, status) is a block of its own: a gap
   before it, a tinted heading with an avatar, and its rows indented on a guide line. */
table.matrix tbody.mgroup.filtered { display: none; }
table.matrix tbody.mgroup.named + tbody.mgroup.named tr.group-head th { border-top: 12px solid var(--bg); }
table.matrix tr.group-head th {
  position: static; padding: 11px 16px; text-align: left; text-transform: none; letter-spacing: 0; color: var(--ink);
  background: linear-gradient(90deg, var(--accent-soft), var(--surface-2) 55%); border-bottom: 1px solid var(--line);
}
table.matrix tbody.mgroup.named:first-of-type tr.group-head th { border-top: 0; }
.group-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; position: sticky; left: 16px; width: max-content; max-width: calc(100vw - 64px); }
.group-name { font-weight: 700; font-size: 15px; }
.group-line small { color: var(--faint); font-weight: 400; font-size: 12px; }
.app-avatar {
  width: 26px; height: 26px; border-radius: 8px; display: inline-grid; place-items: center; flex: none;
  color: #fff; font: 700 13px var(--sans); box-shadow: 0 1px 2px rgb(0 0 0 / 0.15);
}
.app-avatar.c0 { background: linear-gradient(135deg, var(--c0), var(--c1)); }
.app-avatar.c1 { background: linear-gradient(135deg, var(--c1), var(--c4)); }
.app-avatar.c2 { background: linear-gradient(135deg, var(--c2), var(--c5)); }
.app-avatar.c3 { background: linear-gradient(135deg, var(--c3), var(--c4)); }
.app-avatar.c4 { background: linear-gradient(135deg, var(--c4), var(--c1)); }
.app-avatar.c5 { background: linear-gradient(135deg, var(--c5), var(--c0)); }
/* Rows of a named group: indented, with a guide line from the heading down. */
table.matrix tbody.mgroup.named td.svc {
  padding-left: 44px;
  background-image: linear-gradient(var(--line), var(--line)); background-size: 2px 100%;
  background-position: 28px 0; background-repeat: no-repeat;
}
table.matrix tbody.mgroup.named tr:last-child td.svc { background-size: 2px 50%; }
.group-health { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.group-health svg { border-radius: 3px; overflow: hidden; display: block; }
.hb-bg { fill: var(--line); }
.hb-ok { fill: var(--ok); }
.hb-warn { fill: var(--warn); }
.hb-bad { fill: var(--bad); }
/* The service cell carries the row's health as an edge, like the workload cards. */
table.matrix tr[data-health="warn"] td.svc { box-shadow: inset 3px 0 0 var(--warn), 1px 0 0 var(--line); }
table.matrix tr[data-health="bad"] td.svc { box-shadow: inset 3px 0 0 var(--bad), 1px 0 0 var(--line); }
@media (max-width: 720px) {
  table.matrix tr.group-head { padding: 0; }
  table.matrix tr.group-head th { display: block; padding: 10px 16px; }
  .group-line { position: static; max-width: none; width: auto; row-gap: 6px; }
  .group-health { margin-left: 0; }
  .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  table.matrix tr[data-health="warn"] { box-shadow: inset 3px 0 0 var(--warn); }
  table.matrix tr[data-health="bad"] { box-shadow: inset 3px 0 0 var(--bad); }
  table.matrix tr[data-health] td.svc { box-shadow: none; }
}
.matrix td.svc .part, td.svc > .part { display: block; font-size: 12px; color: var(--info); font-weight: 500; }
.resolved { font: 500 12px var(--mono); color: var(--muted); margin-left: 4px; white-space: nowrap; }

/* Updates: a to-do list of upgrades, coloured by urgency. */
.tile.u-eol strong { color: var(--bad); }
.tile.u-inconsistent strong { color: var(--bad); }
.tile.u-upstream strong { color: var(--info); }
.tile.u-env strong { color: var(--warn); }
table.updates td.svc { white-space: nowrap; }
table.updates td.svc a { font-weight: 600; color: var(--ink); }
table.updates td.svc .part { display: block; font-size: 12px; color: var(--info); font-weight: 500; }
table.updates td.svc .owner { display: block; font-size: 12px; color: var(--faint); }
table.updates tr[data-level="eol"] td.svc { box-shadow: inset 3px 0 0 var(--bad); }
table.updates tr[data-level="inconsistent"] td.svc { box-shadow: inset 3px 0 0 var(--bad); }
table.updates tr[data-level="upstream"] td.svc { box-shadow: inset 3px 0 0 var(--info); }
table.updates tr[data-level="env"] td.svc { box-shadow: inset 3px 0 0 var(--warn); }
table.updates .upgrade { white-space: nowrap; }
table.updates .upgrade .arrow { color: var(--faint); margin: 0 6px; }
details.acked > summary { cursor: pointer; list-style: none; }
details.acked > summary::-webkit-details-marker { display: none; }
details.acked:not([open]) > summary { border-bottom: 0; }
details.acked table { opacity: 0.75; }
/* Put off, per update: a small menu; the table's scroll box lets it out while open. */
table.updates td.update-actions { width: 1%; white-space: nowrap; text-align: right; vertical-align: middle; }
.put-off > summary { font-size: 12.5px; padding: 4px 9px; border: 1px solid var(--line); }
.put-off .menu-list { min-width: 240px; }
.put-off .menu-list form:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.put-off .menu-item strong { display: block; font-weight: 600; }
.put-off .menu-item small { display: block; color: var(--muted); font-size: 12px; }
.scroll:has(details.put-off[open]) { overflow: visible; }
@media (max-width: 720px) {
  table.matrix tbody.mgroup.named td.svc { padding-left: 0; background-image: none; }
  table.matrix tbody.mgroup.named + tbody.mgroup.named tr.group-head th { border-top-width: 10px; }
}
.wl-group-title { display: inline-flex; align-items: center; gap: 8px; }
.app-avatar.small { width: 22px; height: 22px; border-radius: 7px; font-size: 11.5px; letter-spacing: 0; }

/* Tiles: each application drawn like the logo, a navy rounded square with a cell per
   service. Colours are the logo's: bright, dimmer and faint blue, and the warm cell. */
:root { --logo-bg: #1b2a6b; --logo-cell: #8aa4ff; --logo-warm: #ffb347; }
.tcell { display: block; border-radius: 22%; background: var(--logo-cell); min-width: 0; min-height: 0; }
.tcell.current { background: var(--logo-cell); }
.tcell.behind { background: color-mix(in srgb, var(--logo-cell) 55%, var(--logo-bg)); }
.tcell.unknown { background: color-mix(in srgb, var(--logo-cell) 30%, var(--logo-bg)); }
.tcell.attention { background: var(--logo-warm); box-shadow: 0 0 10px rgb(255 179 71 / 0.55); }
.tcell.void { background: rgb(255 255 255 / 0.05); }
.tile-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.tile-legend li { display: inline-flex; align-items: center; gap: 7px; }
.tile-legend .tcell { width: 13px; height: 13px; border-radius: 4px; box-shadow: none; }
.tile-legend .tcell.behind, .tile-legend .tcell.unknown { outline: 1px solid rgb(27 42 107 / 0.25); }
.tile-legend strong { color: var(--ink); font-variant-numeric: tabular-nums; }
/* The panel opens on :target, no script needed; the backdrop and × link back to "#". */
.tile-panel { display: none; position: fixed; inset: 0; z-index: 50; }
.tile-panel:target { display: block; }
.tile-panel-backdrop { position: absolute; inset: 0; background: rgb(10 14 30 / 0.35); }
.tile-panel-body {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); overflow-y: auto;
  background: var(--surface); box-shadow: -12px 0 40px rgb(10 14 30 / 0.25); padding: 22px 22px 28px;
  animation: tile-in 0.2s ease;
}
@keyframes tile-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.tile-panel header { display: flex; gap: 14px; align-items: flex-start; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.tile-panel header > div { flex: 1; min-width: 0; }
.tile-panel h2 { margin: 2px 0 0; font-size: 19px; }
.tile-panel header small { display: block; color: var(--faint); font-size: 12px; }
.tile-state { margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.tile-state.s-attention { color: var(--warn); }
.tile-close { font-size: 24px; line-height: 1; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.tile-close:hover { background: var(--surface-2); text-decoration: none; }
.tile-services { list-style: none; margin: 0; padding: 0; }
.tile-services li { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.tile-services li > .tcell { width: 18px; height: 18px; flex: none; margin-top: 2px; border-radius: 5px; }
.tile-services li > div { flex: 1; min-width: 0; }
.tile-services a strong { color: var(--ink); }
.tile-ver { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: 13px; }
.tile-ver .arrow { color: var(--faint); }
.tile-ver .latest { color: var(--accent); }
.tile-services .badges { margin-top: 6px; }
.tile-panel footer { display: flex; gap: 18px; padding-top: 16px; font-size: 13.5px; }
/* Board: the logo enlarged. One navy rounded square; each cell an application. */
.logo-board {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 20px);
  padding: clamp(18px, 3.2vw, 44px); border-radius: clamp(24px, 4vw, 52px); background: var(--logo-bg);
  width: 100%; max-width: calc(var(--cols) * 190px + 120px); margin: 0 auto; box-sizing: border-box;
  box-shadow: 0 24px 60px rgb(27 42 107 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.07);
}
.board-cell {
  position: relative; aspect-ratio: 1; border-radius: 22%; padding: 14%; display: flex; flex-direction: column;
  justify-content: space-between; text-decoration: none; overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.board-cell:hover, .board-cell:focus-visible { transform: translateY(-3px) scale(1.03); text-decoration: none; filter: brightness(1.06); }
.board-cell.s-current { background: var(--logo-cell); color: var(--logo-bg); }
.board-cell.s-behind { background: color-mix(in srgb, var(--logo-cell) 45%, var(--logo-bg)); color: #eef1ff; }
.board-cell.s-behind .board-sub, .board-cell.s-behind .board-headline { opacity: 1; }
.board-cell.s-unknown { background: color-mix(in srgb, var(--logo-cell) 30%, var(--logo-bg)); color: #c9d2ff; }
.board-cell.s-attention { background: var(--logo-warm); color: #3b2300; box-shadow: 0 0 34px rgb(255 179 71 / 0.45); }
.board-name { font-weight: 750; font-size: clamp(12px, 1.35vw, 17px); line-height: 1.15; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-sub { font-size: clamp(10px, 0.95vw, 12px); font-weight: 600; opacity: 0.8; }
.board-foot { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.board-headline { font: 600 11px/1.3 var(--mono); opacity: 0.9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .logo-board { grid-template-columns: repeat(min(var(--cols), 3), minmax(0, 1fr)); } }
/* Tiles, round two: breadcrumbs, env strips, big cells, boards side by side, TV mode. */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13.5px; margin-bottom: 2px; }
.crumbs span { color: var(--faint); }
.tiles-toolbar { flex-wrap: wrap; row-gap: 10px; }
.tiles-live > .tile-legend { margin: 0 0 14px; justify-content: flex-end; }
.logo-board { grid-auto-flow: dense; }
.board-cell.big { grid-column: span 2; grid-row: span 2; padding: 9%; }
.board-cell.big .board-name { font-size: clamp(15px, 1.9vw, 24px); }
.board-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; min-width: 0; }
.env-strip { display: inline-flex; gap: 3px; flex: none; padding: 4px; border-radius: 8px; background: var(--logo-bg); box-shadow: 0 2px 6px rgb(15 23 66 / 0.25); }
.env-sq { width: 9px; height: 9px; border-radius: 26%; background: var(--logo-cell); }
.env-sq.behind { background: color-mix(in srgb, var(--logo-cell) 55%, var(--logo-bg)); }
.env-sq.unknown { background: color-mix(in srgb, var(--logo-cell) 30%, var(--logo-bg)); }
.env-sq.attention { background: var(--logo-warm); }
.env-sq.none { background: transparent; box-shadow: inset 0 0 0 1px rgb(138 164 255 / 0.35); }
.board-cell.s-none { background: rgb(255 255 255 / 0.04); color: #9aa6d6; box-shadow: inset 0 0 0 1px rgb(138 164 255 / 0.12); }
/* Boards side by side: one small logo per environment. */
.env-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 26px; align-items: start; }
.env-board h2 { text-align: center; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; }
.env-board .tile-legend { justify-content: center; margin-top: 12px; font-size: 11.5px; gap: 4px 10px; }
.logo-board.compact { gap: 8px; padding: 18px; border-radius: 30px; max-width: none; }
.logo-board.compact .board-cell { padding: 10%; border-radius: 20%; justify-content: flex-end; }
.logo-board.compact .board-name { font-size: 11px; line-height: 1.1; }
/* A cell whose state changed since the last refresh pulses once. */
@keyframes cell-pulse {
  0% { box-shadow: 0 0 0 0 rgb(255 255 255 / 0.85); }
  70% { box-shadow: 0 0 0 16px rgb(255 255 255 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(255 255 255 / 0); }
}
.board-cell.changed { animation: cell-pulse 1.2s ease-out 2; }
.tcell.big { width: 44px; height: 44px; flex: none; border-radius: 12px; }
/* TV mode: no header, the board fills the screen. */
body.kiosk main { max-width: none; padding: 18px 28px; }
.tv-head { display: flex; align-items: center; gap: 12px; font-size: 18px; margin-bottom: 18px; }
.tv-head svg { width: 34px; height: 34px; }
.tv-title { font-size: inherit; font-weight: 700; margin: 0; }
.tv-exit { font-size: 13px; color: var(--muted); }
.tv-exit:hover { color: var(--accent); }
body.kiosk .logo-board:not(.compact) { max-width: min(100%, calc((100vh - 150px) * var(--cols) / var(--rows, 3))); }
body.kiosk .tiles-live > .tile-legend { justify-content: center; font-size: 15px; }
/* Tiles: focus, and small screens (names and env strips only). */
.board-cell:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-width: 720px) {
  .logo-board { gap: 8px; padding: 14px; border-radius: 26px; }
  .board-cell { padding: 11%; border-radius: 20%; }
  .board-cell .mini-logo, .board-cell .board-headline, .board-cell .board-sub { display: none; }
  .board-cell.big { grid-column: span 1; grid-row: span 1; }
  .board-top { flex-direction: column; gap: 6px; }
  .tiles-toolbar .segmented { overflow-x: auto; }
}
/* The services of a board cell, drawn as a small logo: a navy rounded square with a
   rounded cell per service in the logo's colours (the same on blue and warm cells). */
.mini-logo {
  --mini: 46px;
  display: grid; grid-template-columns: repeat(var(--side), 1fr); grid-template-rows: repeat(var(--side), 1fr);
  width: var(--mini); height: var(--mini); padding: calc(var(--mini) * 0.16); gap: calc(var(--mini) * 0.07);
  box-sizing: border-box; border-radius: 26%; background: var(--logo-bg);
  box-shadow: 0 3px 10px rgb(15 23 66 / 0.3), inset 0 1px 0 rgb(255 255 255 / 0.08);
}
.board-cell.big .mini-logo { --mini: 78px; }
.mcell { border-radius: 26%; background: var(--logo-cell); min-width: 0; min-height: 0; }
.mcell.behind { background: color-mix(in srgb, var(--logo-cell) 55%, var(--logo-bg)); }
.mcell.unknown { background: color-mix(in srgb, var(--logo-cell) 30%, var(--logo-bg)); }
.mcell.attention { background: var(--logo-warm); box-shadow: 0 0 5px rgb(255 179 71 / 0.6); }
.mcell.void { background: rgb(255 255 255 / 0.05); }
/* Drilled in: the application's board is a card laid over the global board, which
   stays behind, dimmed and clickable, as the way back and across. */
.tile-stack { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); align-items: start; }
.stack-back { position: relative; margin-top: 34px; padding: 14px 40px 14px 0; }
/* The board behind is dimmed, its label is not (it must stay readable). */
.stack-back > .logo-board { opacity: 0.78; transition: opacity 0.2s ease; filter: saturate(0.85); }
.stack-back:hover > .logo-board, .stack-back:focus-within > .logo-board { opacity: 1; filter: none; }
.stack-back-label { display: inline-block; margin: 0 0 8px 4px; font-weight: 600; font-size: 13px; }
.stack-back .logo-board.compact { transform: rotate(-1.5deg); transform-origin: top left; }
.stack-back .board-cell.current { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 7px rgb(255 255 255 / 0.25); z-index: 1; }
.stack-front {
  position: relative; z-index: 1; margin-left: -40px; padding: 18px 20px 16px; border-radius: 30px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 30px 70px rgb(15 23 66 / 0.28), 0 6px 18px rgb(15 23 66 / 0.12);
  animation: stack-in 0.28s cubic-bezier(.2,.8,.2,1);
}
@keyframes stack-in { from { transform: translate(-24px, 18px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.stack-front.s-attention { box-shadow: 0 30px 70px rgb(15 23 66 / 0.28), 0 0 0 3px rgb(255 179 71 / 0.55); }
.stack-head { display: flex; align-items: center; gap: 14px; margin: 0 4px 16px; }
.stack-head .mini-logo { --mini: 52px; }
.stack-title { flex: 1; min-width: 0; }
.stack-title h2 { margin: 0; font-size: 22px; }
.stack-title .muted { font-size: 13px; }
.stack-close { font-size: 26px; line-height: 1; color: var(--muted); padding: 2px 10px 6px; border-radius: 10px; }
.stack-close:hover { background: var(--surface-2); text-decoration: none; }
.stack-front .logo-board:not(.compact) { max-width: calc(var(--cols) * 235px + 90px); }
.stack-front > .tile-legend { justify-content: center; margin-top: 14px; }
::view-transition-group(*) { animation-duration: 0.32s; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
@media (prefers-color-scheme: dark) { .stack-front { background: #121827; border-color: #222b40; } }
@media (max-width: 900px) {
  .tile-stack { grid-template-columns: 1fr; }
  .stack-back { margin: 0 0 -18px; padding: 0 0 26px; opacity: 0.8; overflow-x: auto; }
  .stack-back .logo-board.compact { transform: none; grid-template-columns: repeat(var(--count, 12), 64px); width: max-content; }
  .stack-front { margin-left: 0; }
}
.stack-back .board-name, .logo-board.compact .board-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
.stack-back .board-name { font-size: 10px; }
/* Side by side inside an application's card: the environments of its services. */
.stack-front .env-boards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.stack-front .env-board .logo-board.compact { padding: 14px; border-radius: 24px; }

/* The command palette (Ctrl+K). */
.palette-open {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; margin-left: auto;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
}
.palette-open:hover { color: var(--ink); border-color: var(--faint); }
.palette-open kbd { font: 600 11px var(--sans); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface); }
.palette-backdrop { position: fixed; inset: 0; z-index: 100; background: rgb(10 14 30 / 0.38); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette {
  width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 80px rgb(10 14 30 / 0.35); animation: palette-in 0.14s ease-out;
}
@keyframes palette-in { from { transform: translateY(-8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.palette-input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 16px; background: transparent; outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.palette-item.on { background: var(--accent-soft); }
.palette-mark { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.palette-mark.kind-target { background: var(--faint); border-radius: 50%; }
.palette-mark.kind-page { background: transparent; box-shadow: inset 0 0 0 2px var(--faint); }
.palette-mark.tcell.none { background: var(--line); }
.palette-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.palette-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-kind { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.palette-empty { padding: 18px; color: var(--muted); text-align: center; }
.palette-hint { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); }
.shortcuts { max-width: 520px; }
.shortcuts:focus { outline: none; }
.shortcuts-title { margin: 0; padding: 16px 18px 6px; font-size: 16px; }
.shortcuts-list { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; margin: 0; padding: 10px 18px 16px; align-items: center; overflow-y: auto; }
.shortcuts-list dt { display: flex; gap: 4px; justify-content: flex-end; }
.shortcuts-list dd { margin: 0; color: var(--muted); font-size: 13.5px; }
.shortcuts-list kbd { font: 600 12px var(--sans); min-width: 22px; text-align: center; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--bg); color: var(--ink); }
@media (max-width: 720px) { .palette-open span, .palette-open kbd { display: none; } .palette-backdrop { padding-top: 8vh; } }

/* A channel's own mail server. */
fieldset.smtp { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px 16px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
fieldset.smtp legend { font-weight: 600; padding: 0 6px; }
fieldset.smtp .hint, details.smtp .hint { margin: 0; }
details.smtp { border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; }
details.smtp[open] { display: flex; flex-direction: column; gap: 12px; }
details.smtp summary { cursor: pointer; font-weight: 600; color: var(--muted); }

/* Web push: the answer to Notify this browser. */
.push-note { margin: 0; padding: 10px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }
.push-note.good { background: var(--accent-soft); color: var(--ink); }
.push-note.bad { background: color-mix(in srgb, #ffb347 18%, var(--surface)); color: var(--ink); }
.row-actions.push-actions { margin-right: 12px; padding-right: 12px; border-right: 1px solid var(--line); }

/* Recent deliveries on the Notifications page. */
.deliveries .delivery-text { max-width: 520px; overflow-wrap: anywhere; }
.delivery-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.delivery-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.delivery-status.sent::before { background: #30a46c; }
.delivery-status.retrying::before { background: #ffb347; }
.delivery-status.failed { color: #c9373c; }
.delivery-status.failed::before { background: #e5484d; }
.delivery-status.waiting::before { background: #8aa4ff; }
.delivery-error { font-size: 11.5px; color: var(--muted); margin-top: 3px; max-width: 360px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }

/* Notifications: channels, rules and deliveries one under another; their tables need the width. */
.notif-panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.notif-panels table td.num { white-space: nowrap; }

/* Badges on the service page. */
.embed-badges { display: flex; flex-direction: column; gap: 10px; }
.embed-badges p { margin: 0 0 4px; }
.badge-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.badge-row img { display: block; }

/* Links inside running text are underlined, not told apart by colour alone. */
p a, .hint a, .sub a { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
@media (prefers-color-scheme: dark) { .delivery-status.failed { color: #ff6b6f; } }

/* Applications and teams. */
.app-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 16px; align-items: start; margin-bottom: 22px; }
.app-card { border-top: 4px solid var(--line); }
.app-card.s-current { border-top-color: var(--logo-cell); }
.app-card.s-behind { border-top-color: color-mix(in srgb, var(--logo-cell) 45%, var(--logo-bg)); }
.app-card.s-attention { border-top-color: var(--logo-warm); }
.app-body { display: flex; flex-direction: column; gap: 10px; }
.app-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.app-from { display: inline-flex; gap: 6px; align-items: center; }
.app-services { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.app-services li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.app-services .tcell { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.app-services.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.app-actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.app-actions form.inline { display: flex; gap: 6px; flex: 1 1 260px; margin: 0; }
.app-actions input { flex: 1; min-width: 0; }
.app-from form.inline, .app-meta form.inline { display: inline; margin: 0; }
.app-meta .badge { font-size: 11.5px; }

.map-only { margin-top: 6px; }

.map-all { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }

/* Passkeys */
.passkeys { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.passkeys li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.passkeys li input { width: 180px; }
.passkeys li .muted { font-size: 12.5px; flex: 1; min-width: 160px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.inline-form label { flex: 0 1 260px; }

/* Public demo */
.demo-banner { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-bottom: 16px; border-radius: 8px; background: var(--accent-soft, var(--surface-2)); border: 1px solid var(--line); font-size: 13px; }
.demo-banner code { font-size: 12px; overflow-wrap: anywhere; }
