/* dynoadmin: operations console. Plain CSS, no external assets. */
:root {
  color-scheme: light dark;
  --bg: #e7ebef;
  --surface: #ffffff;
  --surface-2: #f3f5f7;
  --ink: #15202b;
  --muted: #55626e;
  --line: #c8d0d8;
  --line-strong: #9aa7b3;
  --accent: #1d4f91;
  --accent-ink: #ffffff;
  --accent-soft: #dce7f5;
  --ok: #1f6b45;
  --ok-lamp: #2f9e62;
  --warn: #8a5600;
  --warn-lamp: #e09a1f;
  --warn-bg: #fff0d2;
  --bad: #a1211a;
  --bad-lamp: #d8433a;
  --bad-bg: #fde2df;
  --off-lamp: #9aa7b3;
  --focus: #2b6cd4;
  --radius-s: 4px;
  --radius-m: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f161d;
    --surface: #17212b;
    --surface-2: #1d2934;
    --ink: #e1e7ed;
    --muted: #96a3af;
    --line: #2c3a47;
    --line-strong: #4a5b6b;
    --accent: #8cb3ee;
    --accent-ink: #0c1828;
    --accent-soft: #1d3150;
    --ok: #79c79d;
    --ok-lamp: #46b277;
    --warn: #f0b85a;
    --warn-lamp: #e6a332;
    --warn-bg: #362a12;
    --bad: #f3928a;
    --bad-lamp: #e5554b;
    --bad-bg: #3b1b19;
    --off-lamp: #4f5f6e;
    --focus: #8cb3ee;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.45rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.08rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 650; }
p { margin: 0 0 0.6em; }
code, .mono { font-family: var(--mono); font-size: 0.86em; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: 8px; z-index: 50; background: var(--surface); padding: 6px 10px; }

/* Top bar */
.top {
  display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap;
  padding: 8px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1rem; color: var(--ink); text-decoration: none; margin-right: 8px; }
.brand svg { width: 16px; height: 16px; }
.brand small { font-weight: 400; color: var(--muted); }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a {
  color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: var(--radius-s);
  font-weight: 550;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }

/* Buttons and fields */
button, .btn {
  font: inherit; font-weight: 560; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  min-height: 34px; padding: 5px 13px; border-radius: var(--radius-s);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  text-decoration: none; white-space: nowrap;
}
button:hover:not(:disabled) { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger.primary { background: var(--bad); color: var(--surface); }
button.quiet { border-color: transparent; background: transparent; color: var(--accent); padding: 5px 8px; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button svg { width: 15px; height: 15px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

label { display: block; font-weight: 560; margin-bottom: 4px; }
.field { margin-bottom: 14px; max-width: 34rem; }
.field .help { color: var(--muted); font-size: 0.86rem; margin: 4px 0 0; }
.field .err { color: var(--bad); font-size: 0.88rem; margin: 4px 0 0; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=file], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 7px 9px; min-height: 36px;
}
input[type=file] { padding: 5px; }
textarea { min-height: 5.5em; resize: vertical; }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--bad); }
input.code { font-family: var(--mono); letter-spacing: 0.25em; max-width: 11rem; font-size: 1.1rem; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 450; margin: 4px 0; }
.check input { width: 18px; height: 18px; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 12px 10px; margin: 0 0 14px; max-width: 34rem; }
legend { font-weight: 560; padding: 0 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; max-width: 34rem; }
.row2 .field { max-width: none; }

/* Layout */
.main { max-width: 1240px; margin: 0 auto; padding: 18px 20px 60px; }
.main:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.section {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 16px 18px; margin-bottom: 16px;
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.empty { color: var(--muted); padding: 10px 0; }
.loading { color: var(--muted); }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.cols > div > .section:last-child { margin-bottom: 0; }

/* Banners */
.banners { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.banners:empty { display: none; }
.banner {
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  margin-top: 10px; padding: 9px 14px; border-radius: var(--radius-m);
  border: 1px solid var(--line); border-left-width: 4px; background: var(--surface);
}
.banner svg { width: 16px; height: 16px; flex: none; }
.banner .txt { flex: 1; min-width: 12rem; }
.banner.bad { border-color: var(--bad); background: var(--bad-bg); color: var(--ink); }
.banner.bad svg { color: var(--bad); }
.banner.warn { border-color: var(--warn-lamp); background: var(--warn-bg); }
.banner.warn svg { color: var(--warn); }
.banner.pending { border-color: var(--accent); background: var(--accent-soft); }
.banner.pending .count { font-weight: 700; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }

/* Instrument panel (dashboard tiles) */
.panel {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  margin-bottom: 16px; overflow: hidden;
}
.tile { padding: 12px 14px 13px; border-left: 1px solid var(--line); min-width: 0; }
.tile:first-child { border-left: 0; }
.tile .k { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 0.84rem; font-weight: 560; }
.tile .v { font-size: 1.7rem; font-weight: 650; line-height: 1.15; margin-top: 6px; letter-spacing: -0.01em; }
.tile .v.word { font-size: 1.15rem; padding-top: 5px; }
.tile .d { color: var(--muted); font-size: 0.84rem; margin-top: 3px; overflow-wrap: anywhere; }
.tile .d.warnx { color: var(--warn); }
.tile .d.badx { color: var(--bad); }
.tile.amber { box-shadow: inset 0 3px 0 var(--warn-lamp); }
.tile.red { box-shadow: inset 0 3px 0 var(--bad-lamp); }
.lamp { width: 9px; height: 9px; border-radius: 50%; background: var(--off-lamp); flex: none; }
.lamp.ok { background: var(--ok-lamp); }
.lamp.warn { background: var(--warn-lamp); }
.lamp.bad { background: var(--bad-lamp); }
.split { display: flex; gap: 14px; align-items: baseline; }
.split .v span { font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-left: 3px; }
.clients { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 8px 14px; }
.clients summary { cursor: pointer; color: var(--accent); font-weight: 560; }
.clients ul { columns: 14rem auto; margin: 8px 0 2px; padding-left: 18px; font-family: var(--mono); font-size: 0.85rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td a { font-weight: 600; }
tr.dim td { color: var(--muted); }
.wrap-any { overflow-wrap: anywhere; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 600;
  padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap;
}
.chip.pending { color: var(--accent); border-color: var(--accent); }
.chip.warn { color: var(--warn); border-color: var(--warn-lamp); background: var(--warn-bg); }
.chip.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.chip.ok { color: var(--ok); border-color: var(--ok); }
.chip button { min-height: 0; padding: 0 2px; border: 0; background: transparent; color: inherit; font-size: 0.95rem; line-height: 1; }

/* Definition lists */
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* Card section */
.card-now { display: flex; gap: 10px 18px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.card-now .ver { font-size: 1.3rem; font-weight: 650; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.note-box { border-left: 3px solid var(--warn-lamp); background: var(--warn-bg); padding: 8px 12px; border-radius: var(--radius-s); margin-bottom: 12px; }
.err-box { border-left: 3px solid var(--bad); background: var(--bad-bg); padding: 8px 12px; border-radius: var(--radius-s); margin: 8px 0; }
.ok-box { border-left: 3px solid var(--ok-lamp); background: var(--surface-2); padding: 8px 12px; border-radius: var(--radius-s); margin: 8px 0; }

/* Diff */
.diff { margin: 8px 0 12px; padding: 8px 10px; list-style: none; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); max-height: 40vh; overflow: auto; font-family: var(--mono); font-size: 0.82rem; }
.diff li { white-space: pre-wrap; overflow-wrap: anywhere; padding: 1px 0; }
.diff li.add { color: var(--ok); }
.diff li.del { color: var(--bad); }
.diff li.chg { color: var(--warn); }

/* Dialogs */
dialog {
  border: 1px solid var(--line-strong); border-radius: var(--radius-m); padding: 0;
  background: var(--surface); color: var(--ink); width: min(36rem, calc(100vw - 24px)); max-height: calc(100vh - 32px);
}
dialog::backdrop { background: rgba(10, 18, 26, 0.55); }
.dlg { padding: 18px 20px; }
.dlg h2 { margin-bottom: 10px; }
.dlg .btn-row { justify-content: flex-end; margin-top: 16px; }

/* Lock screen and first run */
.gate { max-width: 27rem; margin: 9vh auto 0; }
.gate.wide { max-width: 36rem; }
.gate .mark { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.05rem; margin-bottom: 14px; }
.gate .mark svg { width: 18px; height: 18px; }
.gate .section { padding: 20px 22px; }
.gate h1 { margin-bottom: 6px; }
.gate .field { max-width: none; }
.qr { display: block; width: 216px; height: 216px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: var(--radius-s); border: 1px solid var(--line); margin: 10px 0; }
.secret { font-family: var(--mono); font-size: 0.95rem; letter-spacing: 0.06em; word-spacing: 0.35em; overflow-wrap: anywhere; background: var(--surface-2); padding: 6px 9px; border-radius: var(--radius-s); }
.steps { margin: 0 0 12px; padding-left: 20px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--surface); padding: 9px 16px; border-radius: var(--radius-m);
  font-weight: 560; opacity: 0; pointer-events: none; transition: opacity 0.18s;
}
.toast.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* Responsive */
@media (max-width: 1100px) {
  .panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile:nth-child(3n + 1) { border-left: 0; }
  .tile:nth-child(n + 4) { border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .top { padding: 8px 16px; }
  .main { padding: 14px 16px 50px; }
  .banners { padding: 0 16px; }
  .section { padding: 14px; }
  .panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile, .tile:nth-child(3n + 1) { border-left: 1px solid var(--line); }
  .tile:nth-child(2n + 1) { border-left: 0; }
  .tile:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .tile .v { font-size: 1.4rem; }
  .row2 { grid-template-columns: minmax(0, 1fr); }
  /* Stacked tables: each row becomes a block, labels from data-label. */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 2px 0; display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 8px; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 0.84rem; }
  table.stack td.num { text-align: left; }
  .gate { margin-top: 4vh; }
}

/* Fixes after the screenshot review */
h1[tabindex="-1"]:focus { outline: none; }
.hist-h { margin: 16px 0 4px; }
ul.hist { list-style: none; margin: 0; padding: 0; }
ul.hist > li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.hist > li:last-child { border-bottom: 0; }
ul.hist summary { cursor: pointer; color: var(--accent); margin-top: 4px; }
.cert + .cert { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.add-ch { margin-top: 12px; }
@media (max-width: 640px) {
  .top { justify-content: space-between; }
  .nav { order: 3; flex: 1 0 100%; gap: 0; margin: 0 -8px; }
  .nav a { padding: 5px 8px; }
  .brand small { display: none; }
}
.add-member { margin-top: 6px; flex-wrap: nowrap; }
.add-member select { width: auto; flex: 1; min-width: 0; }
.waiting { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; padding: 6px 12px; border: 1px dashed var(--accent); border-radius: var(--radius-s); background: var(--accent-soft); }
