/* Container Doctor dashboard.
   Colours follow the reference data-viz palette: fixed status ramp
   (good/warning/serious/critical), a single sequential blue for meters, and
   neutral ink for all text. A status colour never carries meaning alone -
   every one is paired with a glyph and a word. */

:root {
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --surface-sunken: #f2f1ed;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);

  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --accent: #2a78d6;
  --accent-soft: #cde2fb;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 4px 16px rgba(11, 11, 11, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane: #0d0d0d;
    --surface: #1a1a19;
    --surface-sunken: #131312;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-muted: #898781;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-soft: #184f95;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0d0d;
  --surface: #1a1a19;
  --surface-sunken: #131312;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --ink-muted: #898781;
  --hairline: #2c2c2a;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-soft: #184f95;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

/* --- top bar ----------------------------------------------------------- */

/* One row at every width: the brand on the left, the poll ring and the
   account on the right. Model, build and theme live in Settings. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { font-size: 24px; line-height: 1; flex: none; }
.brand h1 {
  font-size: 17px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }

/* --- poll ring ---------------------------------------------------------- */
.poll {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  cursor: default;
}
.poll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.poll svg { width: 26px; height: 26px; transform: rotate(-90deg); }
.poll circle { fill: none; stroke-width: 4; }
.poll-track { stroke: var(--surface-sunken); }
.poll-fill {
  stroke: var(--ink-muted);
  stroke-linecap: round;
  stroke-dasharray: 94.25;
  stroke-dashoffset: 94.25;
  transition: stroke-dashoffset 1s linear, stroke 0.2s ease;
}
.poll[data-state="live"] .poll-fill { stroke: var(--good); }
.poll[data-state="late"] .poll-fill { stroke: var(--warning); }
.poll[data-state="down"] .poll-fill { stroke: var(--critical); }
/* Until the first poll there is no interval to fill, so it turns instead. */
.poll[data-state="connecting"] .poll-fill { stroke-dashoffset: 70; }
.poll[data-state="connecting"] svg { animation: poll-spin 1.2s linear infinite; }
@keyframes poll-spin { to { transform: rotate(270deg); } }
@media (prefers-reduced-motion: reduce) {
  .poll[data-state="connecting"] svg { animation: none; }
  .poll-fill { transition: stroke 0.2s ease; }
}

/* Anchored to the right edge, which is where the ring sits, so it can never
   run off the side of a phone. */
.poll-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: -4px;
  width: max-content;
  max-width: min(260px, calc(100vw - 24px));
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  visibility: hidden;
  opacity: 0;
  transition: opacity 120ms ease, visibility 0s linear 120ms;
  pointer-events: none;
  z-index: 40;
}
.poll:hover .poll-tip, .poll:focus .poll-tip {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.ghost-btn {
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  cursor: pointer;
}
.ghost-btn:hover { background: var(--surface-sunken); color: var(--ink); }

/* --- layout ------------------------------------------------------------ */

/* `display: flex` below outranks the browser's [hidden] rule, so hiding the
   dashboard while signed out needs saying explicitly. */
[hidden] { display: none !important; }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.warnings {
  border: 1px solid var(--warning);
  border-left-width: 3px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.warnings p { margin: 0 0 6px; }
.warnings p:last-child { margin-bottom: 0; }
.warnings strong { color: var(--ink); }

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  /* Clears the sticky header when a tile jumps here. */
  scroll-margin-top: 64px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 14px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); }
.panel-sub { margin: 0; font-size: 12.5px; color: var(--ink-muted); }

/* --- stat tiles -------------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}
.tile:hover { border-color: var(--ink-muted); }
.tile:has(.tile-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); font-weight: 600; }
.tile-value { margin: 6px 0 2px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
/* The number is the link, stretched over the whole tile; the info button sits
   above it so it still opens its explanation rather than jumping. */
.tile-link { color: inherit; text-decoration: none; }
.tile-link:focus-visible { outline: none; }
.tile-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tile .info-wrap { position: relative; z-index: 1; }
/* Each of those is its own stacking layer, so an open one must rise above its
   neighbours - otherwise the next tile's circle shows through its pop. */
.tile .info-wrap:hover, .tile .info-wrap:focus-within { z-index: 20; }
.tile-note { margin: 0; font-size: 12px; color: var(--ink-muted); }

/* --- meters ------------------------------------------------------------ */

.meter {
  height: 6px;
  border-radius: 4px;
  background: var(--surface-sunken);
  overflow: hidden;
  margin: 8px 0 6px;
}
.meter-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.meter-fill[data-level="warning"] { background: var(--warning); }
.meter-fill[data-level="critical"] { background: var(--critical); }

/* --- container cards --------------------------------------------------- */

.container-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 16px;
}

.card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card.is-down { border-left: 3px solid var(--critical); }
.card.is-unhealthy { border-left: 3px solid var(--warning); }
.card.is-unwatched { opacity: 0.6; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-name { font-weight: 600; font-size: 14.5px; word-break: break-all; }
.card-image { font-size: 11.5px; color: var(--ink-muted); font-family: var(--mono); word-break: break-all; }

.card-metrics { display: grid; gap: 6px; }
.metric-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.metric-row span:last-child { font-variant-numeric: tabular-nums; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-muted); }

/* --- status pills ------------------------------------------------------ */

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
  flex: none;
}
.status::before { font-size: 10px; line-height: 1; }
.status[data-level="good"]     { color: var(--good); }
.status[data-level="good"]::before     { content: "\25CF"; }
.status[data-level="warning"]  { color: var(--warning); }
.status[data-level="warning"]::before  { content: "\25B2"; }
.status[data-level="serious"]  { color: var(--serious); }
.status[data-level="serious"]::before  { content: "\25C6"; }
.status[data-level="critical"] { color: var(--critical); }
.status[data-level="critical"]::before { content: "\2715"; }
.status[data-level="neutral"]  { color: var(--ink-muted); }
.status[data-level="neutral"]::before  { content: "\25CB"; }

/* --- incidents --------------------------------------------------------- */

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit;
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.chip.is-active { background: var(--accent-soft); border-color: transparent; color: var(--ink); }

.incident-list { display: flex; flex-direction: column; }

.incident {
  border-bottom: 1px solid var(--hairline);
  padding: 12px 16px;
}
.incident:last-child { border-bottom: none; }

.incident-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.incident-title { flex: 1; min-width: 0; }
.incident-title strong { display: block; font-size: 14px; font-weight: 600; }
.incident-meta { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.incident-meta code { font-family: var(--mono); font-size: 11.5px; }
.chevron { color: var(--ink-muted); flex: none; transition: transform 0.15s ease; }
.incident[open] .chevron, .incident.is-open .chevron { transform: rotate(90deg); }

.incident-body { margin-top: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.incident-body[hidden] { display: none; }
.incident-body .dl dd { overflow-wrap: anywhere; }

.dl { display: grid; grid-template-columns: minmax(96px, max-content) 1fr; gap: 4px 14px; font-size: 13px; }
.dl dt { color: var(--ink-muted); }
.dl dd { margin: 0; color: var(--ink-2); }

.steps { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.steps li { margin-bottom: 3px; }

.evidence {
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-2);
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.confidence { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.confidence .meter { flex: 1; max-width: 140px; margin: 0; }

.action-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--surface-sunken); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn-danger { color: var(--critical); border-color: var(--critical); }

.empty { padding: 28px 16px; text-align: center; color: var(--ink-muted); font-size: 13.5px; }

/* --- disk -------------------------------------------------------------- */

.disk-list { padding: 16px; display: grid; gap: 14px; }
.disk-row { display: grid; gap: 4px; }
.disk-row .label { display: flex; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; font-size: 13px; }
.disk-row .label code { word-break: break-all; }
.disk-row .disk-volume { font-size: 12px; margin-left: 6px; }
.disk-moved { margin: 0; font-size: 12.5px; }
.disk-row .label code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.disk-row .label span:last-child { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* --- action log ----------------------------------------------------------

   A list rather than a table: four columns across on a desktop with the
   reason on a line of its own beneath, and stacked on a phone. A table scrolled
   sideways there, and a long reason in a narrow cell made rows screens tall. */

.audit-head, .audit-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1.1fr) minmax(0, 1fr) auto;
  column-gap: 16px;
  padding: 0 16px;
}
.audit-head {
  padding-top: 10px;
  padding-bottom: 8px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--hairline);
}
.audit { list-style: none; margin: 0; padding: 0; }
.audit-row {
  grid-template-areas:
    "when container action outcome"
    ".    reason    reason reason"
    ".    toggle    toggle toggle";
  row-gap: 0;
  align-items: baseline;
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 13px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--hairline);
}
.audit-row:last-child { border-bottom: none; }
.a-when { grid-area: when; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.a-container { grid-area: container; color: var(--ink); overflow-wrap: anywhere; }
.a-action { grid-area: action; }
.a-by { font-size: 12px; color: var(--ink-muted); }
.a-by::before { content: "\00b7  "; }
.a-outcome { grid-area: outcome; justify-self: end; }
.a-reason {
  grid-area: reason;
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
}
.a-reason.is-clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.a-more {
  grid-area: toggle;
  justify-self: start;
  margin-top: 2px;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
}
.audit .empty { list-style: none; }

/* --- appearance ---------------------------------------------------------- */
.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-sunken);
}
.segmented button {
  font: inherit;
  font-size: 12.5px;
  padding: 3px 12px;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.segmented button[aria-checked="true"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn-quiet { background: transparent; }

/* --- toast ------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13.5px;
  max-width: calc(100vw - 32px);
  z-index: 50;
}
.toast[data-level="error"] { border-left-color: var(--critical); }

@media (max-width: 560px) {
  main { padding: 16px; }

  .audit-head { display: none; }
  .audit-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "container outcome"
      "action    when"
      "reason    reason"
      "toggle    toggle";
  }
  .a-container { font-weight: 600; }
  .a-action, .a-when { margin-top: 2px; }
  .a-when { justify-self: end; font-size: 12px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }

  /* Two up rather than one. At 200px minimum each tile claimed a whole row on
     a phone, so four of them pushed the containers most of a screen down. */
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 12px; }
  .tile-value { font-size: 24px; }
  .tile-note { display: none; }
  .panel-tools { width: 100%; }
  .search { flex: 1; min-width: 0; }
}

/* --- incident-scoped log views ----------------------------------------- */

.log-summary { cursor: pointer; font-size: 13px; color: var(--ink-2); }

.log-bar { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-small { font-size: 12px; padding: 4px 10px; }

.log-out:empty { display: none; }
.log-out { display: grid; gap: 6px; }

.log-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}
.log-head span { font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.log-list li { font-size: 13px; }
.log-list .muted { color: var(--ink-muted); font-size: 12px; margin-left: 6px; }

.history-list { gap: 4px; max-height: 420px; overflow: auto; }
.history-list summary { cursor: pointer; font-variant-numeric: tabular-nums; }
.history-list .evidence { margin-top: 6px; }
.history-when { font-size: 13px; }
.history-summary { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.history-note { margin: 0; font-size: 12px; }

/* --- triggering log lines ----------------------------------------------- */
.trigger { margin-top: 14px; }
.trigger-head {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.trigger .evidence {
  border-left: 3px solid var(--warning);
  max-height: 260px;
  overflow: auto;
}

/* --- panel tools (filter, search, bulk actions) ------------------------- */
.panel-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search {
  min-width: 190px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}
.cls-gauge-mark-label[data-edge="end"] { transform: translateX(-100%); }
.cls-gauge-mark-label[data-edge="start"] { transform: none; }

/* --- notices, paging ---------------------------------------------------- */
.warnings summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.warnings details[open] summary { margin-bottom: 8px; }
.more-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--hairline);
  font-size: 12.5px;
}
.more-bar .muted { margin-left: auto; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* --- sign-in ------------------------------------------------------------ */
.signin {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.signin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;              /* was margin on one child, which let the text and
                             the button overlap */
  width: min(24rem, 100%);
  padding: 32px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.signin-mark { font-size: 32px; line-height: 1; }
.signin-card h2 { font-size: 18px; }
.signin-card p { font-size: 14px; color: var(--ink-2); margin: 0; }
.signin-btn { margin-top: 8px; text-decoration: none; }

/* Whether Pocket ID answers, under the button: a green dot that breathes when
   it does, a red one and the reason when it does not. */
.signin-card .provider-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 4px 12px 4px 10px;
  font-size: 12.5px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface-sunken);
  font-variant-numeric: tabular-nums;
}
.provider-dot {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-muted);
}
.provider-status[data-state="online"] .provider-dot { background: var(--good); }
.provider-status[data-state="offline"] .provider-dot { background: var(--critical); }
.signin-card .provider-status[data-state="offline"] { color: var(--critical); }
.provider-status[data-state="online"] .provider-dot::after,
.provider-status[data-state="checking"] .provider-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: provider-pulse 2s ease-out infinite;
}
@keyframes provider-pulse { from { transform: scale(1); opacity: 0.6; } to { transform: scale(2.6); opacity: 0; } }
.signin-btn[data-provider="offline"] { opacity: 0.55; }
@media (prefers-reduced-motion: reduce) {
  .provider-status[data-state] .provider-dot::after { animation: none; }
}

/* --- account menu ------------------------------------------------------- */
.account { position: relative; }
.account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.account-btn:hover { color: var(--ink); border-color: var(--ink-muted); }
.avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-sunken);
  border-radius: 50%;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* --- profile ------------------------------------------------------------ */
.profile-body { padding: 14px 16px; display: grid; gap: 14px; }
.profile-body .dl dd { overflow-wrap: anywhere; }
.profile-who { display: flex; align-items: center; gap: 12px; }
.profile-who > div { display: grid; gap: 2px; min-width: 0; }
.profile-who .muted { font-size: 12.5px; overflow-wrap: anywhere; }
.profile-avatar { width: 48px; height: 48px; font-size: 16px; flex: none; }
.session-list { list-style: none; margin: 0; padding: 0; }
.session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.session:last-child { border-bottom: 0; }
.session[data-current] { background: var(--surface-sunken); }
.session-main { display: grid; gap: 3px; min-width: 0; font-size: 13px; }
.session-main .muted { font-size: 12px; overflow-wrap: anywhere; }
.session-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.session-actions { display: flex; gap: 6px; flex: none; }
.account-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.account-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}
.account-head strong { font-size: 13px; color: var(--ink); }
.account-head span { font-size: 12px; color: var(--ink-muted); }
.account-menu button, .account-menu a {
  display: block;
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.account-menu button:hover, .account-menu a:hover {
  color: var(--ink);
  background: var(--surface-sunken);
}

@media (max-width: 560px) {
  /* A note that is a number stays on a phone; prose notes do not. */
  .tile-note.is-data { display: block; font-size: 12px; }
  /* The avatar is enough; the name is in its menu. After the account rules
     above, or their padding wins. */
  .account-name { display: none; }
  .account-btn { padding: 3px; }
}

/* --- info circles ------------------------------------------------------- */
.info-wrap { position: relative; display: inline-block; margin-left: 4px; }
.info {
  width: 15px;
  height: 15px;
  padding: 0;
  font: 600 10px/15px var(--font);
  font-style: italic;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: help;
  vertical-align: middle;
}
.info-wrap:hover .info, .info:focus-visible { color: var(--accent); border-color: var(--accent); }
.info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Fixed, and placed by placePop() in app.js: an absolute pop ran off the edge
   of a phone, was clipped by the panel it sat in, and widened the page even
   while hidden. */
.info-pop {
  position: fixed;
  z-index: 40;
  top: 0;
  left: 0;
  width: max-content;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  font: 400 13px/1.5 var(--font);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  /* Hidden rather than display:none so it is still announced to a screen
     reader that follows the focused button. */
  visibility: hidden;
  opacity: 0;
  /* Lingers briefly, so the pointer can cross the gap onto the pop. */
  transition: opacity 120ms ease, visibility 0s linear 120ms;
}
.info-wrap:hover .info-pop,
.info-wrap:focus-within .info-pop { visibility: visible; opacity: 1; transition-delay: 0s; }
.info-pop code { font-family: var(--mono); font-size: 12px; }
/* Paragraphs and lists, so a pop reads as points rather than one block. */
.info-pop p, .info-pop ul { margin: 0 0 8px; }
.info-pop > :last-child { margin-bottom: 0; }
.info-pop ul { padding-left: 16px; }
.info-pop li + li { margin-top: 4px; }
.info-pop strong { color: var(--ink); }

/* --- settings ----------------------------------------------------------- */
/* Laid out like a product's account settings: the sections in a nav on the
   left, each group a card of rows - what a setting is on the left, its value
   on the right. */
.settings-page { display: grid; gap: 20px; scroll-margin-top: 64px; }
.settings-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px 24px;
  flex-wrap: wrap;
}
.settings-title .panel-sub { font-size: 13.5px; }
.settings-actions { display: flex; gap: 8px; }
.settings-actions { align-items: center; }
.settings-grid a.btn { text-decoration: none; }
.settings-legend { display: inline-grid; place-items: center; width: 30px; height: 30px; }
.settings-legend .info-wrap { margin: 0; }
.settings-legend:empty { display: none; }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}
.icon-btn .icon { width: 16px; height: 16px; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { color: var(--ink); background: var(--surface-sunken); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* A filter is on: a dot, so the closed menu does not hide it. */
.icon-btn.is-active { color: var(--accent); }
.icon-btn.is-active::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--plane);
}

.settings-search-wrap { display: flex; align-items: center; }
.settings-search {
  width: 0;
  min-width: 0;
  padding: 6px 0;
  border-color: transparent;
  opacity: 0;
  transition: width 0.18s ease, opacity 0.18s ease, padding 0.18s ease;
}
.settings-search-wrap.is-open .settings-search {
  width: 240px;
  padding: 6px 10px;
  margin-right: 4px;
  border-color: var(--border);
  opacity: 1;
}

.settings-filter { position: relative; }
.settings-filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  display: grid;
  gap: 2px;
  min-width: 180px;
  padding: 4px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.settings-filter-menu[hidden] { display: none; }
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 6px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
}
.settings-toggle::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-size: 10px;
  line-height: 13px;
  text-align: center;
  color: #fff;
}
.settings-toggle:hover { background: var(--surface-sunken); color: var(--ink); }
.settings-toggle[aria-pressed="true"] { color: var(--ink); }
.settings-toggle[aria-pressed="true"]::before { content: "\2713"; background: var(--accent); border-color: var(--accent); }
.settings-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.settings-key + p { margin: 8px 0 0; }


.settings-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.settings-nav { position: sticky; top: 76px; display: grid; gap: 16px; }
.settings-tabs { display: flex; flex-direction: column; gap: 2px; }
.settings-tabs button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  padding: 7px 10px;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.settings-tabs button:hover { background: var(--surface-sunken); color: var(--ink); }
.settings-tabs button[aria-selected="true"] {
  color: var(--ink);
  background: var(--surface-sunken);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.settings-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* While the filter searches every tab, no one tab is the one on show. */
.settings-tabs.is-searching button[aria-selected="true"] {
  background: transparent;
  box-shadow: none;
  font-weight: inherit;
  color: var(--ink-2);
}
.settings-tab-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.settings-main { display: grid; gap: 14px; min-width: 0; }
.settings-key {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 12px;
  margin: 0;
  align-items: center;
}
.settings-key dd { margin: 0; color: var(--ink-2); }

.settings-grid { display: grid; gap: 16px; }
.settings-group {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.settings-group h3 {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-sunken);
}
.settings-group dl { margin: 0; }
.setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 6px 24px;
  padding: 14px 18px;
  border-top: 1px solid var(--hairline);
}
.setting:first-child { border-top: 0; }
/* The first row the filter left on show takes the place of the first. */
.setting[hidden], .settings-group[hidden] { display: none; }
.settings-group dt { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 4px 8px; min-width: 0; }
.settings-group dd { margin: 0; min-width: 0; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.setting-label { font-size: 13.5px; font-weight: 500; color: var(--ink); overflow-wrap: break-word; }
.setting-marks { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.setting-desc {
  flex-basis: 100%;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-muted);
}
.setting-desc::first-letter { text-transform: uppercase; }
.setting-control { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 26px; }
.setting-value { font-variant-numeric: tabular-nums; }
.setting[data-changed] .setting-value { font-weight: 600; }

/* Changed from its default, where it comes from, or fixed by the compose file. */
.setting-mark {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
}
.setting-mark::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-muted);
}
.setting-mark.is-changed { color: var(--ink); background: var(--accent-soft); border-color: transparent; }
.setting-mark.is-changed::before { background: var(--accent); }
.setting-mark.is-env::before { background: var(--warning); }
.setting-mark.is-saved::before { background: var(--good); }
.setting-mark.is-fixed::before { background: transparent; border: 1px solid var(--ink-muted); width: 4px; height: 4px; }

.env-chip[data-source="env"] { border-color: var(--warning); }
.env-chip[data-source="saved"] { border-color: var(--good); }

/* Every choice of a closed-set setting; the one in use stands out. */
.choices {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0;
  padding: 2px;
  list-style: none;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}
.choice {
  display: block;
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-size: 12.5px;
  line-height: 20px;
  color: var(--ink-muted);
}
.choice.is-current {
  background: var(--surface);
  border-color: var(--border);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.choice.is-unknown {
  border-color: var(--critical);
  color: var(--critical);
  font-weight: 600;
}
.choice.is-unknown::before { content: "?\00a0"; }
.choice-none { font-size: 12px; color: var(--ink-muted); }
button.choice { font: inherit; font-size: 12.5px; background: transparent; cursor: pointer; }
button.choice:hover:not(.is-current) { color: var(--ink); background: var(--surface); }
button.choice.is-current { background: var(--surface); }
button.choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.setting-pending {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 11.5px;
  color: var(--ink);
}
.setting-pending::before { content: "\21bb"; }
.link-btn {
  font: inherit;
  font-size: 11.5px;
  margin-left: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.settings-grid .link-btn { margin-left: 0; font-size: 12px; color: var(--ink-muted); }
.settings-grid .link-btn:hover { color: var(--accent); }
.setting-edit-open { padding: 2px 10px; font-size: 12px; }
.setting-edit-open[aria-expanded="true"] { background: var(--surface-sunken); }
.setting-editor {
  flex-basis: 100%;
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}
.setting-editor[hidden] { display: none; }
.setting-field { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; }
.setting-field-name { font-family: var(--mono); font-size: 11px; color: var(--ink-muted); flex-basis: 100%; }
.setting-field input, .setting-field select {
  font: inherit;
  font-size: 13px;
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.setting-field input:focus-visible, .setting-field select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.setting-field-note { font-family: var(--font); font-style: italic; }
.setting-editor-actions { display: flex; gap: 6px; }
.setting-editor-actions .btn[type="submit"] { background: var(--accent); border-color: transparent; color: #fff; }

.settings-pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 13px;
}
.settings-pending[hidden] { display: none; }

.settings-history {
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.settings-history[hidden] { display: none; }
.settings-history summary {
  cursor: pointer;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.settings-history[open] summary { border-bottom: 1px solid var(--hairline); }
.settings-history-list {
  margin: 0;
  padding: 0 18px;
  list-style: none;
  display: grid;
  max-height: 280px;
  overflow-y: auto;
}
.settings-history-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hairline);
}
.settings-history-list li:last-child { border-bottom: none; }
.settings-history-list code:not(.env-chip) { font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }
.settings-history-when { color: var(--ink-muted); min-width: 4.5em; }
.settings-history-who { font-weight: 600; }
.settings-history-default { font-style: italic; color: var(--ink-muted); }

/* The variable and default, on request. */
.setting-detail { display: none; }
.show-details .setting-detail {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-size: 11.5px;
  color: var(--ink-muted);
}
.env-chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.setting[data-kind="fixed"] .env-chip { border-style: dashed; }
.settings-none {
  margin: 0;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  color: var(--ink-muted);
  font-size: 13px;
}
.settings-none[hidden] { display: none; }

@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; gap: 16px; }
  .settings-nav { position: static; }
  .settings-tabs {
    flex-direction: row;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--hairline);
    gap: 0;
  }
  .settings-tabs button { border-radius: 0; padding: 8px 12px; }
  .settings-tabs button[aria-selected="true"] { background: transparent; box-shadow: inset 0 -2px 0 var(--accent); }
}
@media (max-width: 560px) {
  .settings-tabs button { flex: 1; justify-content: center; }
  .settings-search-wrap.is-open .settings-search { width: min(200px, 50vw); }
  .setting { grid-template-columns: 1fr; padding: 12px 14px; }
  .settings-group h3 { padding: 10px 14px; }
}

.trend-soon { color: var(--serious); }

.root-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--serious);
}

/* --- image updates ----------------------------------------------------- */

.image-list { padding: 16px; display: grid; gap: 10px; }
.image-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.image-row code {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  word-break: break-all;
}
.image-users { font-size: 11.5px; color: var(--ink-muted); }
/* The stack a container sits in, kept on one line with its "in". */
.image-stack { white-space: nowrap; }
.image-none { margin: 0; font-size: 13px; color: var(--ink-muted); }
/* During a check: last check's answer, until this one reaches the image. */
.image-row.is-stale { opacity: 0.5; }
/* The images the running check has not answered yet. */
.image-pending .image-main { flex: 1; gap: 6px; }
.image-pending .skeleton { height: 9px; }
/* Releases still in their cooldown, and what could not be checked: below
   the list, quieter than it. */
.image-cooling, .image-unchecked { border-top: 1px solid var(--hairline); }
.image-cooling > .image-row, .image-unchecked > .image-row { opacity: 0.8; }
.image-section-head { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
/* The badge and the redeploy button, kept together at the row's end. */
.image-side { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; flex: none; }
@media (max-width: 640px) {
  /* The badge and the button under the name, which needs the width. */
  .image-row { flex-wrap: wrap; }
  .image-row > .image-main { flex: 1 1 100%; }
  .image-side { justify-content: flex-start; }
}
.image-user { color: inherit; text-decoration: none; }
.image-user:hover, .image-user:focus-visible { color: var(--accent); text-decoration: underline; }
/* Check now, and beside it how old the last check is. */
.refresh-age {
  margin-left: 2px;
  padding-left: 8px;
  border-left: 1px solid var(--hairline);
  color: var(--ink-muted);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.refresh-age[hidden] { display: none; }
/* Release notes, opened in place under their image. */
.link-btn.notes-toggle { font-size: 12px; color: var(--accent); }
.image-notes {
  display: grid;
  gap: 12px;
  margin: -2px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  max-height: 420px;
  overflow: auto;
  font-size: 12.5px;
}
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.notes-head code { font-family: var(--mono); font-size: 11.5px; }
.notes-source { text-decoration: none; white-space: nowrap; }
.release { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.release-head { display: flex; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; }
.release-head a { color: inherit; }
.release-head a:hover { color: var(--accent); }
.release-body { color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.release-body p, .release-body ul, .release-body ol, .release-body pre { margin: 0 0 6px; }
.release-body ul, .release-body ol { padding-left: 20px; }
.release-body .release-h { font-weight: 600; color: var(--ink); margin-top: 8px; }
.release-body a { color: var(--accent); }
.release-body code { font-family: var(--mono); font-size: 11.5px; }
.release-body pre { padding: 8px 10px; background: var(--surface); border-radius: var(--radius-sm); overflow: auto; }
.image-behind {
  font-family: var(--font);
  font-weight: 600;
  color: var(--warning);
  white-space: nowrap;
}

/* --- container links and stacks ------------------------------------------ */

/* The name is the card's link, stretched over the card; the restart button
   is raised above it so it remains its own target. */
.card { position: relative; }
.card-link { color: inherit; text-decoration: none; display: inline-block; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card-link:hover { color: var(--accent); }
.card-link:focus-visible { outline: none; }
.card:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.card .ghost-btn, .card .image-behind { position: relative; z-index: 1; }
.card:hover { border-color: var(--border); }

.stack-list { display: grid; }
.stack-group { border-top: 1px solid var(--hairline); }
.stack-group:first-child { border-top: none; }
.stack-group > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
}
.stack-group > summary::-webkit-details-marker { display: none; }
.stack-group > summary .chevron { transition: transform 0.15s ease; color: var(--ink-muted); }
.stack-group[open] > summary .chevron { transform: rotate(90deg); }
.stack-group > summary .muted { font-size: 12.5px; }
.stack-group > summary .status { margin-left: auto; }
.stack-group .container-grid { padding-top: 0; }

/* --- charts ------------------------------------------------------------- */

.chart { position: relative; min-height: 20px; touch-action: pan-y; }
.chart-svg { display: block; overflow: visible; }
.chart-grid { stroke: var(--hairline); stroke-width: 1; }
.chart-axis { fill: var(--ink-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--accent); opacity: 0.1; }
/* The one dashed line: what the fitted rate says comes next. */
.chart-projection { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; }
.chart-ref { stroke: var(--ink-muted); stroke-width: 1; }
.chart-ref[data-kind="warning"] { stroke: var(--warning); }
.chart-ref-label { fill: var(--ink-2); font-size: 11px; }
.chart-end, .chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-cross { stroke: var(--ink-muted); stroke-width: 1; }
.chart-tip {
  position: absolute;
  top: -6px;
  transform: translateY(-100%);
  display: grid;
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  pointer-events: none;
  z-index: 2;
}
.chart-tip span { color: var(--ink-muted); font-size: 11.5px; }
.chart-empty { margin: 0; padding: 18px 0; font-size: 12.5px; color: var(--ink-muted); }
.chart-table { font-size: 12.5px; }
.chart-table summary { cursor: pointer; color: var(--ink-2); }
.chart-table table { border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { text-align: left; padding: 3px 14px 3px 0; border-bottom: 1px solid var(--hairline); }
.chart-table th { color: var(--ink-muted); font-weight: 500; }

.disk-row { gap: 6px; }
.disk-row .chart { margin-top: 26px; }

/* --- disk arrays ---------------------------------------------------------- */

/* One column no wider than the panel: a long line in a snippet scrolls inside
   it instead of widening every pool beyond the screen. */
.array-list { padding: 0 16px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.array-list:empty { display: none; }
.sub-head { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.array-row { display: grid; gap: 4px; }
.array-row .label { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.array-row .label code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.array-row .label span:not(.status) { color: var(--ink-2); }
.array-row .label .status { margin-left: auto; }
.array-note { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.array-row .muted { font-size: 12px; }
.array-none { margin: 0; font-size: 12.5px; }
.array-detail { margin: 0; font-size: 12px; }
.array-detail p { margin: 0; }
.pool { display: grid; gap: 10px; padding-left: 12px; border-left: 2px solid var(--hairline); }
.pool-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.pool-head span { color: var(--ink-2); }
.pool-head code { font-family: var(--mono); font-size: 12px; }
.pool-volume { margin: -4px 0 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.pool-volume strong { font-weight: 600; }
.pool-volume span { color: var(--ink-2); }
.pool-volume code { font-family: var(--mono); font-size: 11.5px; }

/* --- drive bays ------------------------------------------------------------ */

/* One colour per SHR layer, the same on the tiles, the legend and the drive page. */
.bays-wrap, .detail, .pool {
  --layer-0: var(--accent);
  --layer-1: color-mix(in srgb, var(--accent) 55%, var(--surface));
  --layer-2: color-mix(in srgb, var(--accent) 32%, var(--surface));
  --layer-3: color-mix(in srgb, var(--good) 60%, var(--surface));
  /* An SSD cache: in front of a volume, none of its data. */
  --layer-cache: color-mix(in srgb, #a78bfa 70%, var(--surface));
}
.bays-wrap { display: grid; gap: 8px; }
.bays {
  --bay: 68px;
  --sled: 58px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--bay), 1fr));
  gap: 8px;
}
.bays[data-density="roomy"] { --bay: 104px; --sled: 76px; }
.bays[data-density="dense"] { --bay: 46px; --sled: 30px; gap: 6px; }
.bays > div { min-width: 0; }
.bay {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 7px 7px 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.bay:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.bay:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bay[data-level="warning"] { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 8%, var(--surface-sunken)); }
.bay[data-level="critical"] { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 10%, var(--surface-sunken)); }
/* A fixed height, so a flagged tile's glyph (often from a fallback font with a
   taller line) cannot push its sled below its neighbours'. */
.bay-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; height: 16px; line-height: 16px; }
.bay-num {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bay-flag { font-size: 10px; line-height: 1; flex: none; }
.bay[data-level="warning"] .bay-flag { color: var(--warning); }
.bay[data-level="warning"] .bay-flag::before { content: "\25B2"; }
.bay[data-level="critical"] .bay-flag { color: var(--critical); }
.bay[data-level="critical"] .bay-flag::before { content: "\2715"; }
.bay[data-level="neutral"] .bay-flag { color: var(--ink-muted); }
.bay[data-level="neutral"] .bay-flag::before { content: "\25CB"; }
/* The sled: the drive as tall as its size next to the biggest in the pool. */
.bay-sled {
  height: var(--sled);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 4px;
  background: repeating-linear-gradient(0deg, var(--hairline) 0 1px, transparent 1px 6px);
}
.bay-disk {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  border-radius: 4px;
  overflow: hidden;
}
.bay-seg { flex: 0 0 auto; min-height: 3px; background: var(--layer-0); }
.bay-seg[data-layer="1"], .bay-swatch[data-layer="1"] { background: var(--layer-1); }
.bay-seg[data-layer="2"], .bay-swatch[data-layer="2"] { background: var(--layer-2); }
.bay-seg[data-layer="3"], .bay-swatch[data-layer="3"] { background: var(--layer-3); }
.bay-seg[data-layer="cache"], .bay-swatch[data-layer="cache"] { background: var(--layer-cache); }
.bay-seg.bay-free, .bay-swatch.bay-free {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border);
  border-radius: 2px;
}
.bay-seg.is-failed { background: var(--critical); }
/* A layer being rebuilt, reshaped or scrubbed moves: on the tiles, in the
   legend and in its array's progress bar alike. */
.bay-seg.is-busy, .bay-swatch.is-busy, .meter-fill.is-busy {
  background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.28) 0 4px, transparent 4px 8px);
  background-size: 11.3px 11.3px;
  animation: bay-busy 1.2s linear infinite;
}
@keyframes bay-busy { to { background-position: 11.3px 0; } }
.meter-fill[data-layer="0"] { background-color: var(--layer-0); }
.meter-fill[data-layer="1"] { background-color: var(--layer-1); }
.meter-fill[data-layer="2"] { background-color: var(--layer-2); }
.meter-fill[data-layer="3"] { background-color: var(--layer-3); }
.meter-fill[data-layer="cache"] { background-color: var(--layer-cache); }
.bay-size {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bay-temp { position: absolute; right: 7px; bottom: 6px; font-size: 10.5px; color: var(--ink-muted); }
.bays[data-density="normal"] .bay-temp { display: none; }
.bays[data-density="dense"] .bay { padding: 5px 4px 4px; gap: 3px; }
.bays[data-density="dense"] .bay-num { font-size: 10.5px; }
.bays[data-density="dense"] .bay-size { font-size: 10px; }
.bays[data-density="roomy"] .bay-num { font-size: 13px; }
.bays[data-density="roomy"] .bay-size { font-size: 12.5px; }
.bay-legend { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 11.5px; }
.bay-legend > span { display: inline-flex; align-items: center; gap: 6px; line-height: 16px; }
.bay-legend code { font-family: var(--mono); font-size: 11px; line-height: 16px; color: var(--ink-muted); }
.bay-layer { color: var(--ink-2); }
.bay-op { color: var(--ink-muted); }
.bay-op::before { content: "\00b7"; margin-right: 6px; }
.bay-hint { margin-left: auto; }
.bay-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--layer-0);
  flex: none;
}
.drive-bar {
  display: flex;
  gap: 2px;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
}
.drive-bar .bay-seg { min-height: 0; min-width: 3px; }
.drive-nosmart { margin: 0; font-size: 12px; }
.drive-facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px 16px;
  font-size: 12.5px;
}
.drive-facts div { min-width: 0; }
.drive-facts dt { color: var(--ink-muted); font-size: 11.5px; }
.drive-facts dd { margin: 2px 0 0; color: var(--ink-2); font-family: var(--mono); overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) {
  .bay, .bay:hover { transition: none; transform: none; }
  .bay-seg.is-busy, .bay-swatch.is-busy, .meter-fill.is-busy { animation: none; }
}
@media (max-width: 560px) {
  .bay-legend > .bay-hint { display: none; }
}

/* --- newer versions ------------------------------------------------------- */

.image-main { min-width: 0; display: grid; gap: 3px; }
.image-newer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.image-note { margin: 0; font-size: 12px; color: var(--ink-2); }
.image-note code { display: inline; }
.image-warn { border-left: 2px solid var(--warning); padding-left: 8px; }
.notes-link, .image-note a { color: var(--accent); }

/* --- linked incident ------------------------------------------------------- */

.incident { scroll-margin-top: 64px; }
.incident.is-linked { box-shadow: inset 3px 0 0 var(--accent); }

/* --- container detail ------------------------------------------------------ */

.detail {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.detail::backdrop { background: rgba(11, 11, 11, 0.45); }
.detail-body { padding: 18px 20px 22px; display: grid; gap: 14px; }
.detail-loading { margin: 0; }
.detail-head { display: flex; align-items: flex-start; gap: 12px; }
.detail-title { min-width: 0; flex: 1; }
.detail-title h2 { font-size: 18px; word-break: break-all; }
.detail-title p { margin: 2px 0 0; font-family: var(--mono); font-size: 12px; word-break: break-all; }
.detail-close {
  flex: none;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.detail-close:hover { color: var(--ink); }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-actions:empty { display: none; }
.detail-section { display: grid; gap: 8px; border-top: 1px solid var(--hairline); padding-top: 12px; }
.detail-section h3 { font-size: 13.5px; }
.detail-section p { margin: 0; font-size: 13px; }
.detail-section code { font-family: var(--mono); font-size: 12px; }
.drive-temp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sleep-bar { position: relative; height: 22px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-sunken); box-shadow: inset 0 0 0 1px var(--hairline); }
.sleep-bar i { position: absolute; top: 0; bottom: 0; }
.sleep-bar i[data-state="asleep"], .sleep-key i[data-state="asleep"] { background: var(--accent); }
.sleep-bar i[data-state="awake"], .sleep-key i[data-state="awake"] {
  background: color-mix(in srgb, var(--ink-muted) 45%, var(--surface)); }
.sleep-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-muted); }
.sleep-key { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.sleep-key span { display: inline-flex; align-items: center; gap: 6px; }
.sleep-key i { width: 10px; height: 10px; border-radius: 2px; background: var(--surface-sunken);
  box-shadow: inset 0 0 0 1px var(--hairline); }
.detail-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.detail-chart { margin: 0; display: grid; gap: 4px; min-width: 0; }
.detail-chart figcaption { font-size: 12.5px; color: var(--ink-2); }
.detail-chart .chart { margin-top: 22px; }
.detail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.detail-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-list li .status { margin-left: auto; }
.detail-list a { color: var(--accent); }
.detail-list .muted { font-size: 12px; }
.detail-dl { font-size: 12.5px; }
.detail-dl dd { font-family: var(--mono); word-break: break-all; }

@media (max-width: 560px) {
  /* A sheet from the bottom edge, the width of the phone. */
  .detail {
    width: 100vw;
    max-width: 100vw;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0;
  }
  .detail-body { padding: 16px 16px 24px; }
}

.muted { color: var(--ink-muted); }

/* --- re-diagnose with context --------------------------------------------- */

.operator-note {
  margin: 0 0 4px;
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: var(--surface-sunken);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.operator-note figcaption { font-size: 12px; color: var(--ink-muted); }
.operator-note blockquote {
  margin: 2px 0 0;
  font-size: 13.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.diagnose-form {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}
.diagnose-form label { font-size: 13px; font-weight: 600; }
.diagnose-form label .muted { font-weight: 400; }
.diagnose-form textarea {
  font: inherit;
  font-size: 13.5px;
  width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  resize: vertical;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.diagnose-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.diagnose-note { margin: 0; font-size: 12px; }
.diagnose-form .action-bar { margin: 0; }

/* --- hand-off to a local LLM agent ---------------------------------------- */

.handoff-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.handoff-download { color: var(--accent); font-size: 12.5px; }
.handoff-bar .muted { font-size: 12px; }
.handoff-text {
  width: 100%;
  min-height: 50dvh;
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px;
  color: var(--ink);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
}
.handoff-dialog .detail-actions .btn { text-decoration: none; }

/* ==========================================================================
   App shell: a sidebar of sections on wide screens, a tab bar on phones, one
   section on screen at a time. Tokens are re-stated here, after the ones at
   the top, so the whole look can be tuned from one place.
   ========================================================================== */

:root {
  --plane: #f6f6f4;
  --surface: #ffffff;
  --surface-sunken: #f2f2ef;
  --hairline: #e7e6e1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 16, 14, 0.04), 0 2px 8px rgba(16, 16, 14, 0.04);
  --shadow-raised: 0 2px 4px rgba(16, 16, 14, 0.05), 0 12px 32px rgba(16, 16, 14, 0.08);
  --tint: color-mix(in srgb, var(--accent) 10%, transparent);
  --sidebar: 236px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --plane: #111110;
    --surface: #1a1a19;
    --surface-sunken: #141413;
    --hairline: #2a2a28;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-raised: 0 2px 4px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
    --tint: color-mix(in srgb, var(--accent) 18%, transparent);
  }
}
:root[data-theme="dark"] {
  --plane: #111110;
  --surface: #1a1a19;
  --surface-sunken: #141413;
  --hairline: #2a2a28;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-raised: 0 2px 4px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
  --tint: color-mix(in srgb, var(--accent) 18%, transparent);
}

body { font-size: 14.5px; }
.icon, .nav-item svg, .tab svg, .tab-menu svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}
.shell[hidden] { display: none; }

/* --- sidebar -------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 16px;
  color: var(--ink);
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand-mark { width: 28px; height: 28px; border-radius: 8px; }
.nav { display: grid; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item:hover { background: var(--surface-sunken); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--tint); color: var(--ink); }
.nav-item[aria-current="page"] svg { color: var(--accent); }
.nav-item:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: var(--surface-sunken);
  color: var(--ink-2);
}
.nav-badge[hidden] { display: none; }
.nav-badge[data-level="attention"] { background: color-mix(in srgb, var(--warning) 26%, transparent); color: var(--ink); }
.nav-badge[data-level="critical"] { background: var(--critical); color: #fff; }
.nav-badge[data-level="info"] { background: var(--tint); color: var(--accent); }

/* --- top bar and page --------------------------------------------------------- */

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: color-mix(in srgb, var(--plane) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.topbar-brand { display: none; }
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.page-sub { margin: 1px 0 0; font-size: 13px; color: var(--ink-muted); }
.topbar-right { margin-left: auto; }

main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 32px 72px;
  gap: 20px;
}
.view { display: flex; flex-direction: column; gap: 20px; }
.view[hidden] { display: none; }

.panel { border-radius: var(--radius); }
.panel-head { padding: 16px 18px; }
.panel-head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-transform: none;
  color: var(--ink);
}
.tile { border-radius: var(--radius); padding: 16px 18px; }
.tile h2 { font-size: 12.5px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.tile-value { font-size: 28px; }
.btn { border-radius: var(--radius-sm); }

/* --- the briefing ----------------------------------------------------------- */

.briefing {
  position: relative;
  overflow: hidden;
  padding: 22px 24px 24px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
/* A band in the colour of the worst section: the state before the words. */
.briefing::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--good);
}
.briefing[data-level="info"]::before { background: var(--accent); }
.briefing[data-level="attention"]::before { background: var(--warning); }
.briefing[data-level="critical"]::before { background: var(--critical); }

.briefing-loading {
  margin: 0;
  height: 96px;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  background: linear-gradient(90deg, var(--surface-sunken), var(--surface), var(--surface-sunken));
  background-size: 200% 100%;
  animation: brief-shimmer 1.4s ease-in-out infinite;
  display: grid;
  place-items: center;
  font-size: 13px;
}
.brief-head { display: flex; align-items: center; gap: 12px; }
.brief-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-muted); }
.brief-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.brief-meta .icon { width: 14px; height: 14px; }
.brief-refresh { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.brief-refresh .icon { width: 14px; height: 14px; }
.brief-refresh:disabled .icon, .brief-busy .icon { animation: brief-spin 1s linear infinite; }
.brief-busy { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 550; }
.brief-busy .icon { width: 13px; height: 13px; }
.brief-headline {
  margin: 14px 0 0;
  font-size: 23px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.018em;
  text-wrap: balance;
}
.brief-error { margin: 8px 0 0; font-size: 13px; color: var(--serious); }

.brief-priorities { list-style: none; counter-reset: priority; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; }
.brief-priorities li { counter-increment: priority; }
.brief-priorities li > a, .brief-priorities li > span {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-sunken);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.brief-priorities li > *::before {
  content: counter(priority);
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-2);
}
.brief-priorities a:hover { background: var(--tint); }
.brief-priorities a .icon { margin-left: auto; width: 16px; height: 16px; color: var(--ink-muted); }
.brief-priorities a:hover .icon { color: var(--accent); }

/* Two by two: four sections never leave one stranded on a row of its own. */
.brief-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}
@media (max-width: 640px) { .brief-grid { grid-template-columns: minmax(0, 1fr); } }
.brief-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.brief-card:hover { border-color: var(--border); box-shadow: var(--shadow-raised); }
.brief-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brief-card-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
.brief-card-head .icon { width: 16px; height: 16px; color: var(--ink-muted); }
.brief-card-head .status { margin-left: auto; }
.brief-card-headline { font-size: 15px; font-weight: 600; line-height: 1.35; }
.brief-card ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 13px; color: var(--ink-2); }
.brief-card-foot { margin-top: auto; padding-top: 4px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-muted); }
.brief-stale { color: var(--ink-muted); font-style: italic; }
.brief-open { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 550; color: var(--accent); }
.brief-open .icon { width: 14px; height: 14px; }

/* Skeletons: the shape of the words that are on their way, with a sheen
   sweeping across them, each line a beat after the one above. */
.skeleton-stack { display: grid; gap: 8px; align-content: start; }
.skeleton-gap { height: 2px; }
.skeleton {
  position: relative;
  overflow: hidden;
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-sunken);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--accent-soft) 55%, transparent) 45%,
    color-mix(in srgb, var(--surface) 80%, transparent) 50%,
    color-mix(in srgb, var(--accent-soft) 55%, transparent) 55%, transparent);
  animation: skeleton-sweep 1.6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.12s);
}
.skeleton-title { height: 14px; }
.skeleton-headline { height: 22px; border-radius: 8px; }
.brief-top-loading { margin-top: 16px; gap: 10px; }
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-sunken) 60%, transparent);
}
.skeleton-row .skeleton { background: var(--hairline); }
.skeleton-row .skeleton::after { animation-delay: calc(var(--i, 0) * 0.12s + 0.2s); }
.skeleton-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; }
.brief-card-loading { border-style: dashed; }
.brief-card-loading .skeleton-stack { margin-top: 2px; }
/* Fresh words settle in, once, where the skeleton was. */
.brief-reveal { animation: brief-reveal 0.45s ease-out both; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@keyframes skeleton-sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes brief-reveal { from { opacity: 0; transform: translateY(4px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes brief-spin { to { transform: rotate(360deg); } }
@keyframes brief-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) {
  .brief-refresh:disabled .icon, .brief-busy .icon, .briefing-loading,
  .skeleton::after, .brief-reveal { animation: none; }
  .brief-card { transition: none; }
}

/* --- phones: a tab bar instead of the sidebar ------------------------------------ */

.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar-brand { display: block; line-height: 0; }
  .topbar-brand img { border-radius: 7px; }
  .topbar-title h1 { font-size: 17px; }
  .page-sub { display: none; }
  main { padding: 16px 16px calc(88px + env(safe-area-inset-bottom)); }
  .briefing { padding: 18px 16px 18px; border-radius: 14px; }
  .brief-headline { font-size: 19px; }
  /* Pill and refresh on one line, the when and by whom beneath them. */
  .brief-head { flex-wrap: wrap; row-gap: 8px; }
  .brief-meta { order: 3; flex-basis: 100%; }
  .brief-refresh span { display: none; }
  .brief-refresh { padding: 6px 8px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--hairline);
  }
  .tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0 4px;
    border: 0;
    background: none;
    font: inherit;
    font-size: 10.5px;
    font-weight: 550;
    color: var(--ink-muted);
    text-decoration: none;
    cursor: pointer;
  }
  .tab svg { width: 22px; height: 22px; }
  .tab[aria-current="page"] { color: var(--accent); }
  .tab .nav-badge {
    position: absolute;
    top: 0;
    left: 50%;
    margin-left: 5px;
    min-width: 17px;
    padding: 0 5px;
    font-size: 10px;
    line-height: 16px;
  }
  .tab-menu {
    position: absolute;
    right: 8px;
    bottom: calc(100% + 8px);
    min-width: 200px;
    padding: 6px;
    display: grid;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: var(--shadow-raised);
  }
  .tab-menu[hidden] { display: none; }
  .tab-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
  }
  .tab-menu a[aria-current="page"] { background: var(--tint); }
  .tab-menu a .nav-badge { margin-left: auto; }
}

.warnings.is-offpage { display: none; }

/* --- compact rows ---------------------------------------------------------
   Every list has a second density: one line per item, for the overview
   rather than the detail. The panel carries the choice as data-density, so
   the rules below restyle the full rendering - the containers alone are drawn
   as rows of their own, since a card has no one-line shape. */

.icon-switch button {
  display: inline-grid;
  place-items: center;
  padding: 4px 9px;
}
.icon-switch .icon { width: 16px; height: 16px; }
/* When the head wraps under a long subtitle, the switch stays on the right. */
.panel-head .panel-tools { margin-left: auto; }

/* Containers */
.container-rows { display: grid; padding: 4px 0; }
.stack-group .container-rows { padding-top: 0; }
.crow {
  position: relative;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 76px 76px 104px 76px;
  align-items: center;
  column-gap: 12px;
  min-height: 38px;
  padding: 3px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--hairline);
}
.crow:last-child { border-bottom: none; }
.crow:hover { background: var(--surface-sunken); }
.crow.is-down { box-shadow: inset 3px 0 0 var(--critical); }
.crow.is-unhealthy { box-shadow: inset 3px 0 0 var(--warning); }
.crow.is-unwatched { opacity: 0.6; }
.crow-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}
.crow-name .card-link { font-weight: 600; flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
/* The whole row opens the container, as the card does. */
.crow .card-link::after { content: ""; position: absolute; inset: 0; }
.crow-image {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-muted);
}
.crow .image-behind { font-size: 11.5px; }
.crow-num { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; text-align: right; }
.crow-num small { font-size: 10.5px; color: var(--ink-muted); letter-spacing: 0.03em; }
.crow-restarts { color: var(--ink-muted); font-size: 12px; }
.crow-act { justify-self: end; }
.crow .ghost-btn { position: relative; z-index: 1; padding: 2px 10px; font-size: 12px; }
.crow:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Incidents: the title and its facts share one line. */
[data-density="compact"] .incident { padding: 7px 16px; }
[data-density="compact"] .incident-head { align-items: center; }
[data-density="compact"] .incident-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  white-space: nowrap;
}
[data-density="compact"] .incident-title strong,
[data-density="compact"] .incident-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
[data-density="compact"] .incident-title strong { flex: 0 1 auto; font-size: 13.5px; }
[data-density="compact"] .incident-meta { flex: 1 1 0; }
/* Opened, it is the full incident again: the summary may wrap. */
[data-density="compact"] .incident.is-open .incident-title { white-space: normal; flex-wrap: wrap; }

/* Image updates: image, who runs it, the newer version - no notes. */
[data-density="compact"] .image-list { gap: 0; padding: 4px 0; }
[data-density="compact"] .image-row {
  min-height: 36px;
  padding: 4px 16px;
  border-bottom: 1px solid var(--hairline);
}
[data-density="compact"] .image-row:last-child { border-bottom: none; }
[data-density="compact"] .image-main {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}
[data-density="compact"] .image-main code,
[data-density="compact"] .image-users {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-density="compact"] .image-main code { flex: 0 1 auto; }
[data-density="compact"] .image-users { flex: 1 1 0; }
[data-density="compact"] .image-newer { flex: none; flex-wrap: nowrap; }
[data-density="compact"] .image-note { display: none; }
[data-density="compact"] .image-none { padding: 12px 16px; }
[data-density="compact"] .image-section-head { padding: 8px 16px 4px; }
[data-density="compact"] .image-notes { margin: 6px 16px; }
[data-density="compact"] .image-unchecked .image-note { display: block; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Action log: the four columns; the reason is the row's tooltip. */
[data-density="compact"] .audit-row { padding-top: 6px; padding-bottom: 6px; }
[data-density="compact"] .a-reason,
[data-density="compact"] .a-more { display: none; }

/* Storage: each disk on one line, meter between name and figures. */
[data-density="compact"] .disk-list { gap: 10px; }
[data-density="compact"] .disk-row {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 2fr);
  align-items: center;
  column-gap: 16px;
}
[data-density="compact"] .disk-row .meter { margin: 0; }
[data-density="compact"] .disk-row .chart,
[data-density="compact"] .disk-row .disk-table,
[data-density="compact"] .disk-row .disk-moved { display: none; }
[data-density="compact"] .array-list { gap: 6px; }

@media (max-width: 560px) {
  /* A phone keeps state, name and the two numbers; the image, restarts and
     the button are one tap away on the container's view. */
  .crow { grid-template-columns: auto minmax(0, 1fr) auto auto; column-gap: 10px; padding: 4px 16px; }
  .crow-image, .crow-restarts, .crow-act, .crow .image-behind { display: none; }
  .crow-name .card-link { max-width: none; }
  .crow .status { font-size: 0; gap: 0; padding: 3px; border: 0; }

  [data-density="compact"] .incident-title { flex-direction: column; gap: 1px; }
  [data-density="compact"] .incident-title strong,
  [data-density="compact"] .incident-meta { max-width: 100%; }
  [data-density="compact"] .incident-meta { flex: none; }
  [data-density="compact"] .image-users { display: none; }
  [data-density="compact"] .disk-row { grid-template-columns: minmax(0, 1fr); row-gap: 4px; }
}

/* --- memory limits -----------------------------------------------------------
   One row per container worth a look: who, how much of its limit its peak
   reaches, the verdict; the reason and the line to put in the compose file
   underneath. Compact keeps the first line. */

.mem-list { list-style: none; margin: 0; padding: 0; }
.mem-list .empty { padding: 14px 16px; }
.mem-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  grid-template-areas:
    "name usage verdict"
    "reason reason reason"
    "fix fix fix";
  column-gap: 16px;
  align-items: center;
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--hairline);
}
.mem-row:last-child { border-bottom: none; }
.mem-name { grid-area: name; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.mem-name a { color: var(--ink); font-weight: 600; text-decoration: none; }
.mem-name a:hover { color: var(--accent); }
.mem-name .muted { font-size: 12px; }
.mem-usage { grid-area: usage; min-width: 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mem-usage .meter { margin: 5px 0 0; }
.mem-verdict { grid-area: verdict; justify-self: end; }
.mem-reason { grid-area: reason; margin: 6px 0 0; font-size: 12.5px; color: var(--ink-muted); }
.mem-fix { grid-area: fix; margin: 4px 0 0; font-size: 12.5px; color: var(--ink-2); }
.mem-fix code, .detail-section .mem-fix code { font-family: var(--mono); font-size: 12px; }

[data-density="compact"] .mem-row { padding: 6px 16px; }
[data-density="compact"] .mem-reason,
[data-density="compact"] .mem-fix { display: none; }

@media (max-width: 560px) {
  .mem-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name verdict"
      "usage usage"
      "reason reason"
      "fix fix";
    row-gap: 4px;
  }
}
.mem-group { border-bottom: 1px solid var(--hairline); }
.mem-group:last-child { border-bottom: none; }
.mem-group > details > summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  font-size: 13px;
  cursor: pointer;
  list-style: none;
}
.mem-group > details > summary::-webkit-details-marker { display: none; }
.mem-group > details[open] > summary .chevron { transform: rotate(90deg); }
.mem-group .muted { font-size: 12.5px; }
.mem-group .mem-list { border-top: 1px solid var(--hairline); }
.mem-group .mem-row { padding-left: 34px; }

/* The changes reuse the action log's rows; what changed is the long column. */
/* A fixed kind column: each row is its own grid, so an auto one sized itself
   per row and walked the other columns left and right. */
#panel-changes .audit-head, #panel-changes .audit-row {
  grid-template-columns: 72px minmax(0, 0.7fr) minmax(0, 2.2fr) 104px;
}
@media (max-width: 560px) {
  #panel-changes .audit-row { grid-template-columns: minmax(0, 1fr) auto; }
}
#panel-changes .a-container a { color: var(--ink); text-decoration: none; }
#panel-changes .a-container a:hover { color: var(--accent); }
.detail-memory { display: grid; gap: 6px; }
.detail-memory .meter { margin: 0; }
.detail-memory .mem-fix { grid-area: auto; margin: 0; }

/* --- the LLM page -------------------------------------------------------------
   Categorical slots 1-3 of the validated palette, stepped for each mode; the
   fourth series is a neutral, never a hue - it is "other", not a category. */

:root {
  --series-diagnosis: #2a78d6;
  --series-briefing: #eb6834;
  --series-classifier: #1baf7a;
  --series-other: #b4b2aa;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --series-diagnosis: #3987e5;
    --series-briefing: #d95926;
    --series-classifier: #199e70;
    --series-other: #5f5e59;
  }
}
:root[data-theme="dark"] {
  --series-diagnosis: #3987e5;
  --series-briefing: #d95926;
  --series-classifier: #199e70;
  --series-other: #5f5e59;
}

.spend-bar[data-series="diagnosis"], .swatch[data-series="diagnosis"] { fill: var(--series-diagnosis); background: var(--series-diagnosis); }
.spend-bar[data-series="briefing"], .swatch[data-series="briefing"] { fill: var(--series-briefing); background: var(--series-briefing); }
.spend-bar[data-series="classifier"], .swatch[data-series="classifier"] { fill: var(--series-classifier); background: var(--series-classifier); }
.spend-bar[data-series="other"], .swatch[data-series="other"] { fill: var(--series-other); background: var(--series-other); }
.spend-hit { fill: transparent; cursor: default; }
.spend-hit.is-hover { fill: var(--ink); opacity: 0.05; }

.spend-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--hairline);
}
.spend-stat { display: grid; gap: 2px; padding: 14px 18px; border-right: 1px solid var(--hairline); }
.spend-stat:last-child { border-right: none; }
.spend-stat span { font-size: 12px; color: var(--ink-muted); }
.spend-stat strong { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.spend-stat small { font-size: 12px; color: var(--ink-muted); }
.spend-body { padding: 14px 18px 16px; display: grid; gap: 10px; }
.spend-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.spend-legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.spend-chart { min-height: 190px; }
/* Loading: bars and rows in the shape of what is coming. Once there is data,
   a refresh dims it instead, so a filter change is visibly under way. */
.chart-skeleton { height: 190px; display: flex; align-items: flex-end; gap: 3px; padding-bottom: 18px; }
.chart-skeleton .chart-skeleton-bar { flex: 1 1 0; min-width: 0; border-radius: 4px 4px 0 0; }
.list-skeleton-row { list-style: none; margin: 6px 0; grid-column: 1 / -1; }
.list-skeleton-row .skeleton:last-child { margin-left: auto; }
.spend-stat .skeleton { margin-top: 6px; }
#panel-spend[aria-busy="true"] .spend-body:not(:has(.chart-skeleton)),
#panel-spend[aria-busy="true"] .spend-stats:not(:has(.skeleton)),
#panel-calls[aria-busy="true"] .audit:not(:has(.list-skeleton-row)) {
  opacity: 0.55;
  transition: opacity 0.2s 0.15s;
}
.chart-tip .tip-row { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.chart-tip .tip-row b { margin-left: auto; padding-left: 12px; font-weight: 600; color: var(--ink); }

.link-btn {
  padding: 0;
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.link-btn:hover { color: var(--accent); text-decoration: underline; }
/* A fixed outcome column: each row is its own grid, so an auto one sized
   itself per row and walked the model column left and right. */
#panel-calls .audit-head, #panel-calls .audit-row {
  grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1.3fr) 92px;
}
.call-row .a-action code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.call-row .a-action .a-by { display: block; }
.call-row .a-action .a-by::before, .call-row .a-container .a-by::before { content: ""; }
.call-row .a-container .a-by { display: block; font-family: var(--mono); font-size: 11.5px; }
.call-cost { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
[data-density="compact"] .call-row .a-by { display: none; }

.call-text {
  margin: 0;
  max-height: 340px;
  overflow: auto;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}

@media (max-width: 560px) {
  .spend-stats { grid-template-columns: minmax(0, 1fr); }
  .spend-stat { border-right: none; border-bottom: 1px solid var(--hairline); padding: 10px 16px; }
  .spend-stat:last-child { border-bottom: none; }
  .spend-body { padding: 12px 16px 14px; }
}
@media (max-width: 560px) {
  #panel-calls .audit-row { grid-template-columns: minmax(0, 1fr) auto; }
}

/* The classifier's note on an incident, and its panel. */
.second-opinion {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
}
.second-opinion .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--series-classifier); }
.second-opinion > span { flex: 1; min-width: 0; }
.second-opinion .status { flex: none; }
.second-opinion-wrap { min-width: 0; background: var(--surface-sunken); border-radius: var(--radius-sm); }
.cls-details { padding: 0 10px 8px 33px; font-size: 12.5px; color: var(--ink-2); }
.cls-details > summary {
  cursor: pointer;
  width: max-content;
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}
.cls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 14px 20px;
  margin-top: 10px;
}
.cls-grid section { min-width: 0; }
.cls-grid h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--ink); }
.cls-foot { margin: 6px 0 0; font-size: 12px; color: var(--ink-muted); }
.cls-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.cls-bars li {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
}
.cls-bars li.is-chosen .cls-bar-label { color: var(--ink); font-weight: 600; }
.cls-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cls-bar-value { text-align: right; font-variant-numeric: tabular-nums; }
.cls-bar-track, .cls-gauge-track {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--hairline);
  overflow: hidden;
}
.cls-bar-fill, .cls-gauge-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
}
.cls-bar-fill[data-tone="real"] { background: var(--critical); }
.cls-bar-fill[data-tone="noise"] { background: var(--series-classifier); }
.cls-bar-fill[data-tone="neutral"] { background: var(--ink-muted); }
.cls-gauge-fill.is-over { background: var(--series-classifier); }
.cls-gauge-track { overflow: visible; }
.cls-gauge-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
}
.cls-gauge-scale {
  position: relative;
  height: 14px;
  margin-top: 4px;
  font-size: 11px;
}
.cls-gauge-mark-label {
  position: absolute;
  transform: translateX(-50%);
  color: var(--ink-2);
  white-space: nowrap;
}
.cls-gauge-mark-label[data-edge="end"] { transform: translateX(-100%); }
.cls-gauge-mark-label[data-edge="start"] { transform: none; }
.cls-ladder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cls-step {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1px;
  min-height: 64px;
  padding: 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-align: center;
}
.cls-step > * { position: relative; }
.cls-step strong { font-size: 12px; color: var(--ink); text-transform: capitalize; }
.cls-step small { font-size: 11px; font-variant-numeric: tabular-nums; }
.cls-step-who { color: var(--ink-muted); }
.cls-step-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0.28;
  background: var(--accent);
}
.cls-step[data-level="warning"] .cls-step-fill { background: var(--warning); }
.cls-step[data-level="critical"] .cls-step-fill { background: var(--critical); }
.cls-step.is-chosen { border-color: var(--ink-2); }
.cls-meta { margin-top: 12px; font-size: 12px; }
@media (max-width: 560px) {
  .cls-details { padding-left: 10px; }
}
#panel-classifier .audit-head, #panel-classifier .audit-row {
  grid-template-columns: 72px minmax(0, 0.8fr) minmax(0, 1.6fr) 128px;
}
#panel-classifier .a-by { display: block; font-size: 12px; }
#panel-classifier .a-by::before { content: ""; }
#panel-classifier .a-container a { color: var(--ink); text-decoration: none; }
#panel-classifier .empty { padding: 14px 16px; list-style: none; }
@media (max-width: 560px) {
  #panel-classifier .audit-row { grid-template-columns: minmax(0, 1fr) auto; }
}

/* A refresh that takes a while: the icon turns until it is done. */
.refresh-btn { display: inline-flex; align-items: center; gap: 6px; }
.refresh-btn .icon { width: 14px; height: 14px; }
.refresh-btn.is-busy .icon { animation: brief-spin 1s linear infinite; }
.refresh-btn:disabled { cursor: progress; }
@media (prefers-reduced-motion: reduce) {
  .refresh-btn.is-busy .icon { animation: none; }
}

/* How far a long check is: a bar, and what it is waiting on. */
/* It fades in after a second, so the quick polls every 30s do not flicker it. */
.progress-strip { flex-basis: 100%; display: grid; gap: 6px; margin-top: 4px; animation: strip-in .2s ease-out 1s both; }
.progress-strip[hidden] { display: none; }
.progress-bar {
  position: relative; height: 6px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--ink-muted) 22%, transparent);
}
.progress-bar span {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit;
  background: var(--accent); transition: width .3s ease;
}
.progress-bar.is-indeterminate span { width: 30%; animation: progress-slide 1.2s ease-in-out infinite; }
.progress-text {
  margin: 0; font-size: 12.5px; color: var(--ink-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@keyframes strip-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes progress-slide { from { left: -30%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .progress-strip { animation: none; }
  .progress-bar span { transition: none; }
  .progress-bar.is-indeterminate span { animation: none; width: 100%; opacity: .5; }
}

/* --- out of reach ------------------------------------------------------- */
/* Under the top bar; the ring in the bar stays red for as long as it lasts. */
.offline {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 12px 16px 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.offline[hidden] { display: none; }
.offline-icon {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  fill: none;
  stroke: var(--warning);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.offline-body { display: grid; gap: 6px; min-width: 0; }
.offline-body strong { font-size: 15px; }
.offline-body p { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.offline-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.offline-when { font-size: 12.5px; color: var(--ink-muted); }
/* What is on screen is a picture of the past; say so without hiding it. */
body[data-offline] main { opacity: 0.55; filter: saturate(0.4); transition: opacity 0.2s ease; }
@media (min-width: 900px) {
  .offline { margin: 16px 32px 0; }
}

/* --- network ---------------------------------------------------------------- */

/* Dividers on the items, not the grid's background, so a last row that is not
   full shows no grey gap. */
.net-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
}
.net-stats:empty { display: none; }
.net-stat {
  padding: 10px 16px;
  display: grid;
  gap: 2px;
  margin: 0 -1px -1px 0;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.net-stat span { font-size: 12px; color: var(--ink-muted); }
.net-stat strong { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.net-findings:empty, .net-bridges:empty { display: none; }
.net-finding-list { list-style: none; margin: 0; padding: 12px 16px; display: grid; gap: 8px; border-bottom: 1px solid var(--hairline); }
.net-finding { display: flex; align-items: baseline; gap: 10px; font-size: 13px; color: var(--ink-2); }
.net-finding .status { flex: none; }
.net-finding a { color: var(--ink); text-decoration: none; }
.net-finding a:hover { text-decoration: underline; }
.net-finding > span:not(.status) { flex: 1; min-width: 0; }
.net-finding-act { flex: none; align-self: center; }
.net-finding.is-dismissed { color: var(--ink-muted); }
.net-dismissed { border-bottom: 1px solid var(--hairline); }
.net-dismissed > summary { padding: 8px 16px; font-size: 12px; color: var(--ink-muted); cursor: pointer; }
.net-dismissed .net-finding-list { padding-top: 0; border-bottom: 0; }

.net-bridges { padding: 12px 16px 4px; display: grid; gap: 8px; border-bottom: 1px solid var(--hairline); overflow: hidden; }
.net-graph { display: block; max-width: 100%; }
.net-edge { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.55; transition: opacity 0.12s ease; }
.net-node { cursor: default; outline: none; }
.net-node rect { fill: var(--surface-sunken); stroke: var(--hairline); transition: stroke 0.12s ease, fill 0.12s ease; }
.net-node-net rect { fill: var(--accent-soft); stroke: transparent; }
.net-node text { fill: var(--ink); font-size: 12.5px; font-family: var(--font); }
.net-node-net text { font-family: var(--mono); font-size: 12px; }
.net-node:focus-visible rect { stroke: var(--accent); stroke-width: 2; }
.net-node-dot[data-level="good"] { fill: var(--good); }
.net-node-dot[data-level="warning"] { fill: var(--warning); }
.net-node-dot[data-level="serious"] { fill: var(--serious); }
.net-node-dot[data-level="critical"] { fill: var(--critical); }
.net-node-dot[data-level="neutral"] { fill: var(--ink-muted); }

.net-body { padding: 16px; display: grid; gap: 12px; }
.net-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.net-card {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
  transition: border-color 0.12s ease, opacity 0.12s ease;
}
/* The kind is drawn as a rule down the left: shared networks in the accent,
   internal ones dashed, Docker's default bridge muted. */
.net-card { border-left: 3px solid var(--accent); }
/* The proxy network holds half the host; it gets a row of its own. */
.net-card.is-wide { grid-column: 1 / -1; }
.net-card[data-kind~="stack"] { border-left-color: var(--hairline); }
.net-card[data-kind~="default"] { border-left-color: var(--ink-muted); }
.net-card[data-kind~="internal"] { border-left-style: dashed; }
.net-card.is-unused { border-left-color: var(--hairline); opacity: 0.75; }
.net-card.is-unused .net-members { display: none; }
.net-card-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.net-name { font-family: var(--mono); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.net-figures { flex-basis: 100%; font-size: 12px; color: var(--ink-muted); }
.net-card-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-muted); }
.net-figures code { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.net-tag {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
}

.net-members { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.net-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface-sunken);
  color: var(--ink);
  font-size: 12.5px;
  text-decoration: none;
  transition: border-color 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}
.net-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.net-chip code { font-family: var(--mono); font-size: 11px; color: var(--ink-muted); }
.net-chip.is-bridge { border-color: var(--accent); }
.net-multi { font-size: 11px; font-weight: 600; color: var(--accent); }
.net-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.net-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); }
.net-dot[data-level="good"] { background: var(--good); }
.net-dot[data-level="warning"] { background: var(--warning); }
.net-dot[data-level="serious"] { background: var(--serious); }
.net-dot[data-level="critical"] { background: var(--critical); }

/* Pointing at one thing dims the rest, so where it appears stands out. */
#panel-network.is-pointing .net-chip:not(.is-hot) { opacity: 0.35; }
#panel-network.is-pointing .net-card.is-hot { border-color: var(--accent); }
#panel-network.is-pointing .net-chip.is-hot { background: var(--accent-soft); border-color: var(--accent); }
#panel-network.is-pointing .net-edge:not(.is-hot) { opacity: 0.12; }
#panel-network.is-pointing .net-edge.is-hot { opacity: 1; stroke-width: 2.5; }
#panel-network.is-pointing .net-node:not(.is-hot) { opacity: 0.45; }
#panel-network.is-pointing .net-node-member.is-hot rect { stroke: var(--accent); }
#panel-network.is-pointing .net-matrix .is-hot { background: var(--accent-soft); }

.net-special { margin: 0; font-size: 13px; color: var(--ink-2); }
.net-special a { color: var(--ink); }

.net-matrix-wrap { overflow-x: auto; }
.net-matrix, .net-ports { border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.net-matrix th, .net-matrix td { border-bottom: 1px solid var(--hairline); padding: 4px 8px; }
.net-matrix thead th { vertical-align: bottom; font-weight: 500; color: var(--ink-2); }
.net-matrix thead th:not(.net-matrix-corner) { height: 120px; padding-bottom: 6px; }
/* Network names stand on end so twenty of them fit across. */
.net-matrix thead th span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}
.net-matrix-corner { text-align: left; }
.net-matrix tbody th { text-align: left; font-weight: 500; white-space: nowrap; }
.net-matrix tbody th a { color: var(--ink); text-decoration: none; margin-left: 6px; }
.net-matrix tbody th .muted { font-weight: 400; font-size: 11.5px; }
.net-matrix tr.is-bridge th a { font-weight: 600; }
.net-matrix td { text-align: center; min-width: 28px; }
.net-cell { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

#network-ports { padding: 4px 16px 16px; }
.net-ports { width: 100%; }
.net-ports-head { margin: 18px 0 6px; font-size: 13px; font-weight: 600; }
.net-ports th, .net-ports td { text-align: left; padding: 6px 14px 6px 0; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.net-ports th { font-weight: 500; color: var(--ink-muted); }
.net-ports code { font-family: var(--mono); font-size: 12px; }
.net-ports td .net-dot { margin-right: 6px; }
.net-ports a { color: var(--ink); text-decoration: none; }
.net-ports a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .net-body { padding: 12px; }
  .net-grid { grid-template-columns: minmax(0, 1fr); }
}

/* --- host ------------------------------------------------------------------- */

.host-alerts:empty { display: none; }
.host-alert-line { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--hairline);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; }
/* Dividers drawn by each tile, not by the grid's background: a last row that
   is not full would otherwise show the background through the gap. The
   container hides the outer edges. */
.host-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  overflow: hidden;
}
.host-tile {
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  align-content: start;
  margin: 0 -1px -1px 0;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.host-tile-label { font-size: 12px; color: var(--ink-muted); }
.host-tile-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.host-tile-note { font-size: 12px; color: var(--ink-2); }
.host-tiles .empty { grid-column: 1 / -1; margin: 0; }

.host-charts { padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px 24px; }
.host-chart { display: grid; gap: 6px; min-width: 0; }
.host-reboots:empty { display: none; }
.array-snippet { margin: 6px 0 0; padding: 8px 10px; background: var(--surface-sunken);
  border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  overflow-x: auto; white-space: pre; }
.host-reboots { padding: 0 16px 16px; display: grid; gap: 6px; }
.host-reboot-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.host-reboot-list li { display: flex; gap: 10px; }

.host-detail { padding: 12px 16px 16px; display: grid; gap: 8px; }
.host-table { border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; width: 100%; }
.host-table th, .host-table td { text-align: left; padding: 6px 14px 6px 0; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.host-table th { font-weight: 500; color: var(--ink-muted); }
.host-table code { font-family: var(--mono); font-size: 12px; }
.host-busy { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.host-busy .meter { flex: 1; min-width: 60px; }
.host-note { margin: 0 0 8px; font-size: 12px; }
.host-detail .sub-head:not(:first-child) { margin-top: 8px; }

@media (max-width: 560px) {
  .host-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .host-charts { grid-template-columns: minmax(0, 1fr); padding: 12px; }
}

/* --- internet and DNS ---------------------------------------------------------- */

#connectivity { padding: 12px 16px 16px; display: grid; gap: 10px; }
.conn-summary { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.conn-list { list-style: none; margin: 0; padding: 0; display: grid; }
.conn-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 140px minmax(0, 1fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 6px 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
}
.conn-what { display: flex; align-items: center; gap: 8px; min-width: 0; }
.conn-what code { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-state { display: flex; align-items: center; gap: 8px; }
.conn-ms { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 48px; }
.conn-detail { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-history { display: flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 0; }
.conn-uptime { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.net-strip { display: flex; gap: 1px; height: 16px; align-items: stretch; overflow: hidden; }
.net-strip i { width: 3px; border-radius: 1px; background: var(--good); opacity: 0.75; }
.net-strip i[data-ok="false"] { background: var(--critical); opacity: 1; }

@media (max-width: 760px) {
  .conn-row { grid-template-columns: minmax(0, 1fr) auto; }
  .conn-detail { grid-column: 1 / -1; }
  .conn-history { grid-column: 1 / -1; justify-content: flex-start; }
}

/* --- drive health ------------------------------------------------------------- */

#drive-health { padding: 4px 16px 16px; }
#drive-health .empty { padding: 16px 0; }
/* One row per drive: columns on a wide screen, folded under the name on a
   phone. The header only exists for the wide layout. */
.smart-head, .smart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 64px 96px minmax(0, 0.7fr);
  gap: 4px 14px;
  align-items: start;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.smart-head { padding: 6px 0; border-bottom: 1px solid var(--hairline); font-weight: 500; color: var(--ink-muted); }
.smart-list { list-style: none; margin: 0; padding: 0; }
.smart-row { padding: 6px 0; border-bottom: 1px solid var(--hairline); }
.smart-name { min-width: 0; overflow-wrap: anywhere; }
.smart-serial { font-size: 11.5px; white-space: nowrap; }
.smart-facts { display: contents; }
.smart-k { display: none; }
.smart-problem { grid-column: 1 / -1; color: var(--ink-2); }
.smart-problem span { display: block; }
.smart-problem span::before { content: "\25B2  "; color: var(--warning); font-size: 10px; }

@media (max-width: 640px) {
  .smart-head { display: none; }
  .smart-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 0; }
  /* Temp, hours and counters share the line under the name, each labelled. */
  .smart-facts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--ink-2); }
  .smart-k { display: inline; margin-right: 5px; color: var(--ink-muted); }
}
