/* DumpCat UI — tokens */
:root {
  color-scheme: light;
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f4f4f1;
  --surface-3: #ecebe6;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6b6963;
  --input-border: #8d8b84;
  --btn-primary: #2368c4;
  --btn-primary-hover: #1c5cab;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --accent-soft: rgba(42, 120, 214, 0.10);
  --accent-ink: #1c5cab;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: rgba(12, 163, 12, 0.10);
  --warning: #fab219;
  --warning-ink: #8a5a00;
  --warning-soft: rgba(250, 178, 25, 0.16);
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-ink: #a32424;
  --critical-soft: rgba(208, 59, 59, 0.10);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.18);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar: 232px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #222220;
    --surface-3: #2c2c2a;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #8f8d86;
    --input-border: #6a6964;
    --btn-primary: #2b6fc7;
    --btn-primary-hover: #3a7fd4;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --grid: #2c2c2a;
    --axis: #383835;
    --accent: #3987e5;
    --accent-hover: #5598e7;
    --accent-soft: rgba(57, 135, 229, 0.16);
    --accent-ink: #86b6ef;
    --good-ink: #2fc22f;
    --good-soft: rgba(12, 163, 12, 0.16);
    --warning-ink: #fab219;
    --warning-soft: rgba(250, 178, 25, 0.14);
    --critical-ink: #ef7575;
    --critical-soft: rgba(208, 59, 59, 0.18);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222220;
  --surface-3: #2c2c2a;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #8f8d86;
  --input-border: #6a6964;
  --btn-primary: #2b6fc7;
  --btn-primary-hover: #3a7fd4;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --grid: #2c2c2a;
  --axis: #383835;
  --accent: #3987e5;
  --accent-hover: #5598e7;
  --accent-soft: rgba(57, 135, 229, 0.16);
  --accent-ink: #86b6ef;
  --good-ink: #2fc22f;
  --good-soft: rgba(12, 163, 12, 0.16);
  --warning-ink: #fab219;
  --warning-soft: rgba(250, 178, 25, 0.14);
  --critical-ink: #ef7575;
  --critical-soft: rgba(208, 59, 59, 0.18);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.break { word-break: break-all; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 16px; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; display: block; flex: none; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }
.nav { padding: 6px 10px 16px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 0 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-weight: 650; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .menu-btn { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { flex: 1; min-width: 200px; }
.page-head > div:not(.btn-group) { flex: 1; min-width: 200px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 16px; }
.grid > * { margin-top: 0 !important; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.stat { padding: 16px 18px; }
.stat .label { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.stat .label svg { width: 15px; height: 15px; flex: none; }
.stat .hint svg { width: 13px; height: 13px; vertical-align: -2px; }
/* icons inside running text are centred on the text instead of sitting on its baseline
   (measured within ±1px for 12–14px text); flex layouts (buttons, badges, alerts) ignore vertical-align */
svg { flex-shrink: 0; vertical-align: -0.125em; }
:is(.sub, .help, .small) > svg { width: 13px; height: 13px; }
.stat .value { font-size: 26px; font-weight: 650; margin-top: 4px; letter-spacing: -0.02em; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.kv > div:nth-child(even) { min-width: 0; overflow-wrap: anywhere; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--btn-primary); border-color: var(--btn-primary); color: #fff; }
.btn-primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }
.btn-danger { color: var(--critical-ink); border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.btn-danger:hover { background: var(--critical-soft); }
.btn-danger-solid { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn-danger-solid:hover { filter: brightness(1.08); background: var(--critical); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 32px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label { font-weight: 550; font-size: 13px; color: var(--text); }
.field .help { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=url], input[type=search], input[type=datetime-local], input[type=date], input[type=time], select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--input-border); background: var(--surface); color: var(--text);
  font: inherit; outline: none;
}
textarea { height: auto; min-height: 86px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--critical); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-weight: 450; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check .help { display: block; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input, .inline > select { flex: 1; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.radio-card { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; display: block; background: var(--surface); }
.radio-card:hover { border-color: var(--accent); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); background: var(--accent-soft); }
.radio-card .rc-title { font-weight: 650; display: flex; align-items: flex-start; gap: 8px; }
/* keep the icon on the first line when the title wraps */
.radio-card .rc-title svg { margin-top: calc((1lh - 16px) / 2); }
.radio-card .rc-desc { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.radio-card .rc-meta { font-size: 12px; margin-top: 6px; }
.section-title { font-weight: 650; margin: 4px 0 10px; font-size: 13.5px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.req::after { content: " *"; color: var(--critical-ink); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table td.actions { text-align: right; white-space: nowrap; }
.table .sub { color: var(--muted); font-size: 12px; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
/* only the illustration: a button in the empty state keeps its normal icon */
.empty > svg { width: 34px; height: 34px; opacity: 0.6; display: block; margin: 0 auto 8px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge svg { width: 13px; height: 13px; }
.badge.good { background: var(--good-soft); color: var(--good-ink); }
.badge.warn { background: var(--warning-soft); color: var(--warning-ink); }
.badge.bad { background: var(--critical-soft); color: var(--critical-ink); }
.badge.info { background: var(--accent-soft); color: var(--accent-ink); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.good { background: var(--good); }
.dot.bad { background: var(--critical); }
.dot.warn { background: var(--warning); }

/* ---------- alerts ---------- */
.alert { border-radius: var(--radius-sm); padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; }
.alert > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.alert.bad { background: var(--critical-soft); border-color: color-mix(in srgb, var(--critical) 35%, transparent); }
.alert.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.alert.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.alert + .alert { margin-top: 8px; }
/* a small button inside an alert sentence must not make its line taller (that pushes the text below the alert icon) */
:is(.alert, .banner-danger) .btn-sm { height: 24px; padding: 0 8px; margin: -2px 0; vertical-align: middle; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- progress ---------- */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.6s ease; }
.progress.indeterminate > div { width: 30% !important; animation: indet 1.4s infinite ease-in-out; }
@keyframes indet { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
.task { padding: 12px 18px; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.task-top .name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- log viewer ---------- */
.log {
  background: #0f1012; color: #d6d6d0; border-radius: var(--radius-sm); padding: 12px 14px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; max-height: 520px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; margin: 0;
}
.log .l-err { color: #ff8f8f; }
.log .l-ok { color: #8be38b; }
.log .l-warn { color: #ffd479; }
.log .l-cmd { color: #8fc1ff; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; border: 1px solid var(--border); max-height: 88vh; display: flex; flex-direction: column; }
.modal-head, .modal-foot { flex: none; }
body.modal-open { overflow: hidden; }
.modal.lg { max-width: 820px; }
.modal.xl { max-width: 1040px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); gap: 10px; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 20px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; flex-wrap: wrap; }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start; animation: tin 0.2s ease; }
.toast > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .toast-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; margin-left: 4px; }
.toast .toast-x svg { width: 15px; height: 15px; margin: 0; }
.toast.good > svg { color: var(--good); }
.toast.bad > svg { color: var(--critical); }
.toast.warn > svg { color: var(--warning-ink); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* ---------- dropdown ---------- */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); min-width: 190px; padding: 4px; z-index: 50; }
.dropdown-menu button, .dropdown-menu a { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 10px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; border-radius: 4px; cursor: pointer; }
.dropdown-menu button:hover, .dropdown-menu a:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu svg { width: 16px; height: 16px; }
.dropdown-menu .btn-danger { color: var(--critical-ink); }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-menu button:focus-visible { background: var(--surface-2); outline: none; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; font: inherit; font-weight: 550; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ---------- chart ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar-good { fill: var(--good); }
.chart .bar-bad { fill: var(--critical); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + g rect, .chart g.col:hover rect.bar { opacity: 0.85; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); align-items: center; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; min-width: 140px; z-index: 10; transform: translate(-50%, calc(-100% - 10px)); }
.tooltip b { display: block; margin-bottom: 4px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { justify-content: center; padding: 0 0 18px; font-size: 20px; }
.auth-card .brand-logo { width: 40px; height: 40px; border-radius: 10px; }
.auth-card .card-body { padding: 26px; }
.auth-card .field + .field { margin-top: 14px; }
.oauth-done { display: grid; place-items: center; min-height: 100vh; }
.oauth-done .card { padding: 28px; max-width: 460px; text-align: center; }

/* ---------- misc ---------- */
.copy-box { display: flex; gap: 8px; align-items: stretch; }
.copy-box code { flex: 1; background: var(--surface-2); border: 1px solid var(--border); padding: 8px 10px; border-radius: var(--radius-sm); overflow-x: auto; white-space: nowrap; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; margin: 6px 0 0; }
.digest-frame { display: block; width: 100%; height: min(70vh, 900px); border: 1px solid var(--border); border-radius: var(--radius-sm); background: #f6f6f3; }
.pagination { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 12px 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.filters select, .filters input { width: auto; min-width: 160px; height: 32px; }
.filters input[type=search] { min-width: 220px; }
.filters .grow { flex: 1; }
.status-strip { display: inline-flex; gap: 2px; }
.status-strip i { width: 6px; height: 16px; border-radius: 2px; background: var(--surface-3); display: inline-block; }
.status-strip i.good { background: var(--good); }
.status-strip i.bad { background: var(--critical); }
.status-strip i.warn { background: var(--warning); }
.db-pick { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.db-pick .check { padding: 4px 0; }
.qr { background: #fff; padding: 10px; border-radius: 8px; display: inline-block; }
.qr img { display: block; width: 180px; height: 180px; image-rendering: pixelated; }
.loading-page { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }
details.adv { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 14px; }
details.adv > summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
details.adv[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }
details.adv[open] { padding-bottom: 14px; }
.backdrop-mobile { display: none; }

@media (max-width: 1440px) {
  .hide-lg { display: none; }
}
@media (max-width: 1280px) {
  .hide-md { display: none; }
}
@media (max-width: 1100px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .backdrop-mobile { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 80; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3, .grid-4, .grid-5, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv > div:nth-child(even) { margin-bottom: 8px; }
  .table th, .table td { padding: 9px 10px; }
  .filters > * { flex: 1 1 140px; min-width: 0 !important; width: auto; }
  .grid-5.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat { padding: 12px 14px; }
  .stats .stat .value { font-size: 20px; }
  .sticky-actions { margin: 16px -16px -16px; padding: 10px 16px; }
  .hide-sm { display: none; }
}

/* ---------- accessibility & polish ---------- */
:where(a, button, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.radio-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .spin, .progress.indeterminate > div { animation: none !important; }
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* whole-row links: keyboard/screen-reader friendly, open in new tab works */
.table tbody tr.clickable { position: relative; }
.table a.row-link { color: inherit; }
.table a.row-link::after { content: ""; position: absolute; inset: 0; }
.table tr.clickable a:not(.row-link), .table tr.clickable button { position: relative; z-index: 1; }
.cell-ellipsis { display: block; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* sticky save bar for long forms */
.sticky-actions { position: sticky; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.06); padding: 12px 24px; margin: 16px -24px -24px; display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.sticky-actions .dirty-note { margin-right: auto; color: var(--muted); font-size: 13px; }
.form-error { margin-bottom: 14px; }

/* breadcrumbs in the top bar */
.topbar .title .crumb { color: var(--text-2); font-weight: 500; }
.topbar .title .crumb:hover { color: var(--text); }
.topbar .title .crumb-sep { color: var(--muted); margin: 0 6px; font-weight: 400; }

/* section jump links for the job editor */
.jump { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 14px; }
.jump a { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.jump a:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }

/* onboarding checklist */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; }
.steps .step-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border-strong); color: var(--muted); font-size: 12px; font-weight: 600; flex: none; }
.steps li.done .step-dot { background: var(--good); border-color: var(--good); color: #fff; }
.steps li.done .step-text { color: var(--muted); text-decoration: line-through; }
.steps .step-text { flex: 1; }
.empty .btn { margin-top: 12px; }
.banner-danger { border: 1px solid color-mix(in srgb, var(--critical) 45%, transparent); background: var(--critical-soft); border-radius: var(--radius-sm); padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start; }
.banner-danger > svg { color: var(--critical-ink); width: 18px; height: 18px; flex: none; margin-top: 2px; }

/* delay the page spinner so fast loads do not flash */
.loading-page { animation: mv-appear 0.15s ease 0.15s both; }
@keyframes mv-appear { from { opacity: 0; } to { opacity: 1; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.jump .jump-link { font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; }
.jump .jump-link:hover { color: var(--text); border-color: var(--border-strong); }
details.adv-card > summary { cursor: pointer; list-style: none; }
details.adv-card > summary::-webkit-details-marker { display: none; }
details.adv-card > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); margin-left: auto; transition: transform 0.15s ease; flex: none; }
details.adv-card[open] > summary::after { transform: rotate(45deg); }
details.adv-card:not([open]) > summary { border-bottom: 0; }
details.adv-card > summary h2 { flex: none; }
[id^="sec-"] { scroll-margin-top: 72px; }
.h1-status .badge { vertical-align: 3px; font-size: 12px; margin-left: 4px; }
@media (max-width: 860px) {
  .sticky-actions { margin: 16px -16px -16px; padding: 10px 16px; }
}
.release-notes { white-space: pre-wrap; font: inherit; font-size: 13px; margin: 8px 0 4px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 240px; overflow: auto; }
.sidebar-foot .badge { margin-left: 6px; }

/* connection diagram (agents, WireGuard): an SVG drawing on a dotted canvas; the tall
   variant replaces the wide one when the card is narrow */
.topo-canvas { container-type: inline-size; margin: 0; padding: 16px 16px 12px; border: 1px solid var(--border); border-radius: 14px;
  background: radial-gradient(circle, var(--grid) 1px, transparent 1.4px) 0 0 / 18px 18px, var(--surface-2); }
.tp { display: block; width: 100%; height: auto; max-width: 860px; margin: 0 auto; overflow: visible; }
.tp-v { display: none; max-width: 380px; }
@container (max-width: 560px) { .tp-h { display: none; } .tp-v { display: block; } }
.tp text { font-family: inherit; }
.tp-panel { fill: var(--surface); stroke: var(--border-strong); filter: drop-shadow(0 6px 14px rgba(9, 30, 66, 0.08)); }
.tp-title { fill: var(--text); font-size: 15px; font-weight: 700; }
.tp-sub { fill: var(--muted); font-size: 12px; }
.tp-chip { fill: var(--surface-2); stroke: var(--border); }
.tp-chip.accent { fill: color-mix(in srgb, var(--accent) 9%, var(--surface)); stroke: color-mix(in srgb, var(--accent) 45%, transparent); }
.tp-chip-t { fill: var(--text); font-size: 12.5px; font-weight: 650; }
.tp-chip-s { fill: var(--muted); font-size: 11px; }
.tp-ico-bg { fill: var(--surface); stroke: var(--border); }
.tp-ico-bg.big { fill: var(--accent-soft); stroke: color-mix(in srgb, var(--accent) 35%, transparent); }
.tp-ico { color: var(--accent-ink); }
.tp-conn { fill: none; stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 3 3; }
.tp-mono { fill: var(--muted); font: 10.5px var(--mono); }
.tp-cyl { fill: var(--accent-soft); stroke: var(--accent-ink); stroke-width: 1.6; }
.tp-brick-bg { fill: var(--surface-3); }
.tp-brick-line { fill: none; stroke: var(--border-strong); stroke-width: 1.4; }
.tp-wall { stroke: var(--border-strong); }
.tp-wall-t { fill: var(--muted); font-size: 10.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.tp-pipe { fill: color-mix(in srgb, var(--good) 13%, var(--surface)); stroke: color-mix(in srgb, var(--good) 70%, transparent); stroke-width: 1.5; }
.tp-rim { fill: var(--surface); stroke: var(--border-strong); }
.tp-dot.out { fill: var(--good); }
.tp-dot.in { fill: var(--accent); }
.tp-pill { fill: var(--surface); stroke: color-mix(in srgb, var(--good) 55%, transparent); }
.tp-pill-t { fill: var(--good-ink); font-size: 11.5px; font-weight: 650; }
.tp-pill-s { fill: var(--muted); font-size: 10.5px; }
.tp-block { fill: none; stroke: var(--critical); stroke-width: 1.6; stroke-dasharray: 5 4; }
.tp-x-bg { fill: color-mix(in srgb, var(--critical) 14%, var(--surface)); stroke: var(--critical); }
.tp-x { stroke: var(--critical); stroke-width: 2; stroke-linecap: round; }
.tp-block-t { fill: var(--critical-ink); font-size: 11px; font-weight: 650; }
.tp-block-s { fill: var(--muted); font-size: 10.5px; }
.tp-foot { fill: var(--muted); font-size: 11.5px; }
.tp-ok-dot { fill: var(--good); }
.tp-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.tp-legend span { display: inline-flex; align-items: center; gap: 7px; }
.tp-legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.tp-legend i.in { background: var(--accent); width: 6px; height: 6px; }
@media (prefers-reduced-motion: reduce) { .tp-dots { display: none; } }

/* storage type picker */
.type-pick { display: grid; gap: 18px; }
.type-group-title { font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.type-card { appearance: none; font: inherit; color: inherit; text-align: left; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease; }
.type-card:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--accent-soft); }
.type-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.type-card:active { transform: translateY(1px); }
.type-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.type-icon svg { width: 18px; height: 18px; }
.type-card:hover .type-icon { background: var(--surface); }
.type-text { min-width: 0; }
.type-text b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.type-text span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.topo-steps { list-style: none; counter-reset: ts; margin: 14px 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.topo-steps li { counter-increment: ts; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; color: var(--text-2); line-height: 1.45; }
.topo-steps li::before { content: counter(ts); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 12.5px; }
.topo-steps b { display: block; color: var(--text); font-weight: 650; margin-bottom: 2px; }

/* shown when the server runs a newer UI than this page */
.update-banner { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 250; display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 32px); padding: 10px 12px 10px 14px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: tin 0.2s ease; }
.update-banner > svg { width: 18px; height: 18px; color: var(--accent-ink); flex: none; }
.update-banner .btn { flex: none; }

/* point-in-time recovery: target choice, timeline, plan */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 14px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg label:hover span { color: var(--text); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.pitr-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.pitr-row .field { min-width: 220px; }
.pitr-row .field.grow { flex: 1 1 280px; }
.pitr-row .help.full { flex-basis: 100%; font-size: 12.5px; color: var(--muted); }
.pitr-quick { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 2px; }
.chip { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 12.5px/1 inherit; padding: 9px 12px; border-radius: 999px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }

.pt-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.pt-head .field { min-width: 260px; flex: 0 1 380px; }
.pt-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-fact { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.chip-fact svg { width: 14px; height: 14px; }
.chip-fact .live { color: var(--good-ink); font-weight: 650; }
.pt-tl { margin-top: 44px; }
.pt-track { position: relative; height: 64px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.pt-off { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px 0 0 10px; background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--muted) 14%, transparent) 6px 8px); }
.pt-stream { position: absolute; bottom: 10px; height: 16px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.pt-replay { position: absolute; bottom: 10px; height: 16px; border-radius: 3px; background: var(--accent); }
.pt-bk { position: absolute; top: 8px; width: 3px; height: 26px; margin-left: -1.5px; border-radius: 2px; background: var(--text); opacity: 0.75; }
.pt-bk.incr { top: 16px; height: 18px; opacity: 0.35; }
.pt-bk.base { opacity: 1; background: var(--accent); width: 5px; margin-left: -2.5px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.pt-pin { position: absolute; top: -8px; bottom: -8px; width: 0; border-left: 2px solid var(--accent); pointer-events: none; z-index: 2; }
.pt-pin span { position: absolute; top: -20px; left: 6px; white-space: nowrap; font: 600 11px/1.6 var(--mono); color: #fff; background: var(--accent); padding: 0 6px; border-radius: 4px; }
.pt-pin.flip span { left: auto; right: 6px; }
.pt-range { position: absolute; inset: -8px 0; width: 100%; height: calc(100% + 16px); margin: 0; opacity: 0; cursor: ew-resize; z-index: 3; }
.pt-axis { position: relative; height: 22px; margin-top: 6px; font: 500 11px/1 var(--mono); color: var(--muted); }
.pt-axis span { position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.pt-axis span:first-child { transform: none; }
.pt-axis span:last-child { transform: translateX(-100%); }
.pt-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.pt-legend li { display: inline-flex; align-items: center; gap: 7px; }
.pt-legend i { display: inline-block; }
.lg-full { width: 3px; height: 14px; border-radius: 2px; background: var(--text); opacity: 0.75; }
.lg-incr { width: 3px; height: 10px; border-radius: 2px; background: var(--text); opacity: 0.35; }
.lg-stream { width: 16px; height: 9px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.lg-replay { width: 16px; height: 9px; border-radius: 2px; background: var(--accent); }
.lg-pin { width: 2px; height: 14px; background: var(--accent); }
@media (max-width: 640px) { .pt-axis span:nth-child(even) { display: none; } }

.pitr-plan { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 8px; }
.pp-step { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.pp-step.stop { border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 6%, var(--surface)); }
.pp-ico { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink); }
.pp-step.stop .pp-ico { background: var(--good-soft); color: var(--good-ink); }
.pp-ico svg { width: 17px; height: 17px; }
.pp-step > div { display: grid; gap: 2px; min-width: 0; }
.pp-step small { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pp-step b { font-size: 14px; overflow-wrap: anywhere; }
.pp-step b a { color: inherit; }
.pp-step span { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.pp-step code { font-size: 11.5px; }
.pp-arrow { display: grid; place-items: center; color: var(--muted); }
.pp-arrow svg { width: 16px; height: 16px; transform: rotate(-90deg); }
@media (max-width: 900px) {
  .pitr-plan { grid-template-columns: minmax(0, 1fr); }
  .pp-arrow svg { transform: none; }
}
