/* Backup console
 *
 * Instrument panel, not dashboard. The page answers one question — am I
 * covered — so the verdict is set large and in plain words, and the coverage
 * matrix is read like the face of a switch: one row per app, one lit port per
 * target. Everything else stays quiet.
 */

:root {
  --paper:   #fbfbfd;
  --panel:   #ffffff;
  --ink:     #10141a;
  --ink-2:   #454e5a;
  --ink-3:   #7b8694;
  --rule:    #e0e4ea;
  --rule-2:  #eef1f5;

  --signal:  #0a55c4;   /* actions, links, focus */
  --ok:      #0d7a4b;
  --warn:    #a86400;
  --fail:    #bd2419;

  --ok-bg:   #e8f6ee;
  --warn-bg: #fdf3e3;
  --fail-bg: #fdecea;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --gap: 1.5rem;
  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #0e1116;
    --panel:   #161b22;
    --ink:     #e8ecf1;
    --ink-2:   #a4b0be;
    --ink-3:   #6e7b8b;
    --rule:    #262d38;
    --rule-2:  #1d232c;

    --signal:  #5b9cff;
    --ok:      #46c88a;
    --warn:    #e0a340;
    --fail:    #ef6b5e;

    --ok-bg:   #10261c;
    --warn-bg: #2a2012;
    --fail-bg: #2b1512;
  }
}

* { box-sizing: border-box; }

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

a { color: var(--signal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: 2px;
}

code, pre, .mono-sm { font-family: var(--mono); }

/* Micro-labels: the engineering-documentation register that ties the page
   together. Used for every section eyebrow and column head. */
.eyebrow,
.matrix thead th,
.check-name,
.legend {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

/* ---- Chrome ------------------------------------------------------------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}

.brand { display: flex; align-items: baseline; gap: 0.6rem; }

.brand-mark {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
  align-self: center;
}

.brand-name { font-weight: 640; letter-spacing: -0.01em; }

.brand-host {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}

.nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.nav a {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
}

.nav a:hover { background: var(--rule-2); color: var(--ink); }

.nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
}

.nav-out { margin-left: 0.5rem; color: var(--ink-3) !important; }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--gap) 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

main.bare {
  max-width: 30rem;
  padding-top: 15vh;
}

.foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 12px;
  color: var(--ink-3);
}

.foot code { font-size: 11px; }

/* ---- The verdict: the page's thesis ------------------------------------- */

.verdict {
  padding: 1.6rem 1.75rem;
  border: 1px solid var(--rule);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--panel);
}

.verdict h1 {
  margin: 0.4rem 0 0;
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.022em;
  font-weight: 620;
  text-wrap: balance;
}

.verdict-ok   { border-left-color: var(--ok); }
.verdict-warn { border-left-color: var(--warn); }
.verdict-fail { border-left-color: var(--fail); }

.verdict-ok   h1 { color: var(--ok); }
.verdict-warn h1 { color: var(--warn); }
.verdict-fail h1 { color: var(--fail); }

.lede { margin: 0.6rem 0 0; color: var(--ink-2); }

.running::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--signal);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
  .running::before { animation: none; }
}

/* ---- Panels ------------------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1.5rem;
}

.panel-head { margin-bottom: 1rem; }

.panel h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.panel-note {
  margin: 0.35rem 0 0;
  font-size: 13px;
  color: var(--ink-2);
  max-width: 62ch;
}

.subhead {
  margin: 1.5rem 0 0.6rem;
  font-size: 13px;
  font-weight: 640;
  color: var(--ink-2);
}

.split {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.empty { color: var(--ink-3); font-size: 14px; margin: 0; }

/* ---- Coverage matrix: the signature ------------------------------------- */

.matrix-scroll { overflow-x: auto; }

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.matrix thead th {
  text-align: left;
  padding: 0 0.75rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

.matrix tbody th,
.matrix tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--rule-2);
  text-align: left;
  font-weight: 400;
  white-space: nowrap;
}

.matrix tbody th {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

.matrix tbody tr:last-child th,
.matrix tbody tr:last-child td { border-bottom: 0; }

.matrix tbody tr:hover { background: var(--rule-2); }

.row-sel { background: color-mix(in srgb, var(--signal) 7%, transparent); }
.row-stale .col-when { color: var(--warn); }
.row-never th, .row-never .never { color: var(--fail); }

.col-port { width: 1%; text-align: center !important; }
.col-size, .col-when { font-family: var(--mono); font-size: 13px; }

.when-clock { color: var(--ink); }
.when-ago { color: var(--ink-3); margin-left: 0.5rem; font-size: 12px; }
.never { font-family: var(--mono); font-size: 13px; }

/* Link lights. Shape carries meaning as well as colour, so the matrix is
   still readable without colour vision. */
.led {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}

.led-on   { background: var(--ok);   box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.led-bad  { background: var(--fail); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fail) 20%, transparent); }
.led-idle { background: var(--warn); opacity: 0.65; }
.led-off  { background: transparent; border: 1.5px solid var(--rule); }

.legend {
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
}

.legend .led { margin-right: 0.25rem; }

/* ---- Run list ----------------------------------------------------------- */

.runs { list-style: none; margin: 0; padding: 0; }

.runs li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule-2);
  font-size: 13px;
}

.runs li:last-child { border-bottom: 0; }

.run-name { font-family: var(--mono); }
.run-meta { color: var(--ink-3); }
.run-ago { margin-left: auto; color: var(--ink-3); font-family: var(--mono); font-size: 12px; }

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  margin-right: 0.15rem;
}

.dot-completed { background: var(--ok); }
.dot-partial   { background: var(--warn); }
.dot-failed    { background: var(--fail); }
.dot-running   { background: var(--signal); animation: pulse 1.6s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) { .dot-running { animation: none; } }

/* ---- Figures and meter -------------------------------------------------- */

.figure {
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.figure span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: 0;
  margin-left: 0.3rem;
}

.meter {
  height: 6px;
  background: var(--rule-2);
  border-radius: 99px;
  overflow: hidden;
}

.meter-fill { height: 100%; background: var(--signal); }
.meter-hot  { background: var(--fail); }

/* ---- Checks ------------------------------------------------------------- */

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }

.check {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: var(--radius);
}

.check-ok   { border-left-color: var(--ok); }
.check-warn { border-left-color: var(--warn); }
.check-bad  { border-left-color: var(--fail); }

.check-val { font-family: var(--mono); font-size: 14px; }
.check-note { font-size: 12.5px; color: var(--ink-3); }

.pct-hot { color: var(--fail); font-weight: 600; }
.muted { color: var(--ink-3); }
.mono-sm { font-family: var(--mono); font-size: 12px; }

/* ---- Forms -------------------------------------------------------------- */

.choices { display: grid; gap: 0.6rem; }

.choice {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
}

.choice:hover { border-color: var(--ink-3); }
.choice:has(input:checked) {
  border-color: var(--signal);
  background: color-mix(in srgb, var(--signal) 5%, transparent);
}

.choice input { margin-top: 0.25rem; accent-color: var(--signal); flex: none; }
.choice-body { display: grid; gap: 0.2rem; }
.choice-title { font-weight: 600; font-size: 14px; }
.choice-note { font-size: 13px; color: var(--ink-2); max-width: 58ch; }

.choice select {
  margin-top: 0.4rem;
  justify-self: start;
  padding: 0.35rem 0.5rem;
  font-family: var(--mono);
  font-size: 13px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  justify-self: start;
}

.btn-primary { background: var(--signal); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }

.signin { display: grid; gap: 0.9rem; margin-top: 1.25rem; }
.signin label { display: grid; gap: 0.3rem; }
.signin span { font-size: 13px; color: var(--ink-2); }

.signin input {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

/* ---- Messages ----------------------------------------------------------- */

.flash {
  margin: 0;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid transparent;
}

.flash-ok  { background: var(--ok-bg);  color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-bad { background: var(--fail-bg); color: var(--fail); border-color: color-mix(in srgb, var(--fail) 30%, transparent); }

.alerts { display: grid; gap: 0.5rem; }

.alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  border-left-width: 3px;
  background: var(--panel);
  font-size: 13.5px;
}

.alert-critical { border-left-color: var(--fail); background: var(--fail-bg); }
.alert-warn     { border-left-color: var(--warn); background: var(--warn-bg); }
.alert-info     { border-left-color: var(--signal); }

.alert-level {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.alert-critical .alert-level { color: var(--fail); }
.alert-warn .alert-level     { color: var(--warn); }

.alert-msg { flex: 1 1 20ch; }
.alert-age { color: var(--ink-3); font-size: 12px; font-family: var(--mono); }

.alert-ack button {
  font: inherit;
  font-size: 12px;
  padding: 0.2rem 0.6rem;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink-2);
  cursor: pointer;
}

.alert-ack button:hover { border-color: var(--ink-3); color: var(--ink); }

/* ---- Log and commands --------------------------------------------------- */

.log {
  margin: 0;
  padding: 0.9rem 1rem;
  background: var(--rule-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.65;
  overflow-x: auto;
  max-height: 26rem;
  white-space: pre;
}

.cmds { margin: 0; display: grid; gap: 1rem; }
.cmds dt { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.cmds dd { margin: 0.3rem 0 0; }

.cmds code {
  display: block;
  padding: 0.6rem 0.8rem;
  background: var(--rule-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 12.5px;
  overflow-x: auto;
  white-space: pre;
}

.cmd-note { margin: 0.4rem 0 0; font-size: 12.5px; color: var(--ink-3); max-width: 62ch; }

.plain { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.plain th, .plain td {
  text-align: left;
  padding: 0.45rem 0.75rem 0.45rem 0;
  border-bottom: 1px solid var(--rule-2);
  font-weight: 400;
}

.plain th { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.plain tr:last-child th, .plain tr:last-child td { border-bottom: 0; }

.sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  main { padding: 1rem 1rem 3rem; }
  .topbar { padding: 0.75rem 1rem; }
  .panel { padding: 1rem 1rem 1.25rem; }
  .verdict { padding: 1.25rem 1.15rem; }
}
