/* Sentinel UI — Apple-style redesign (2026-11-03).
   Principles: one thing per screen at a glance; content over chrome; sentence
   case everywhere; large titles; generous space; system colours; the numbers
   are the interface. Light + dark via tokens. No inline styles (CSP). */
:root {
  --bg: #f5f5f7;
  --bg-soft: #ececf0;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --sidebar: rgba(246, 246, 248, .78);
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .14);
  --text: #1d1d1f;
  --text-2: #424245;
  --muted: #86868b;
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, .10);
  --up: #1f9d48;
  --down: #e5322d;
  --warn: #b25f00;
  --warn-dot: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, .13);
  --down-soft: rgba(255, 59, 48, .10);
  --up-soft: rgba(52, 199, 89, .13);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --shadow-pop: 0 20px 60px rgba(0, 0, 0, .22);
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-soft: #1c1c1e;
    --surface: #1c1c1e;
    --surface-2: #232325;
    --sidebar: rgba(28, 28, 30, .72);
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .16);
    --text: #f5f5f7;
    --text-2: #d2d2d7;
    --muted: #8e8e93;
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, .18);
    --up: #30d158;
    --down: #ff453a;
    --warn: #ffb340;
    --warn-dot: #ff9f0a;
    --warn-soft: rgba(255, 159, 10, .16);
    --down-soft: rgba(255, 69, 58, .16);
    --up-soft: rgba(48, 209, 88, .15);
    --shadow: none;
    --shadow-pop: 0 24px 80px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.47 var(--font);
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100dvh; overflow: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); }
code, .mono { font-family: var(--mono); font-size: 12px; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

/* ---------- shell: sidebar + content ---------- */
.shell { display: flex; height: 100dvh; }
.sidebar {
  flex: none; width: 236px; display: flex; flex-direction: column;
  padding: 18px 12px 14px;
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--line);
  overflow-y: auto; scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 18px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(160deg, #3d9bff, #0060df);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.02em; }
.mode-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  color: var(--warn); background: var(--warn-soft);
  padding: 2px 8px; border-radius: 999px;
}

.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-group { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 16px 10px 5px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-2); padding: 6px 10px; border-radius: 8px;
  font-size: 13.5px; font-weight: 450; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.nav a:hover { background: var(--line); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent); color: #fff; font-weight: 500; }
.nav a.active .ico { stroke: #fff; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.sidebar-foot { display: flex; flex-direction: column; gap: 8px; padding: 14px 4px 0; border-top: 1px solid var(--line); margin-top: 14px; }
.status-list { display: flex; flex-direction: column; gap: 6px; }
.btn.btn-kill {
  width: 100%; justify-content: center;
  color: var(--down); background: var(--down-soft); border-color: transparent; font-weight: 600;
}
.btn.btn-kill:hover { background: var(--down); color: #fff; border-color: var(--down); }
.signout { align-self: center; }

/* status chips: quiet text with a coloured dot (state at a glance, no noise) */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; padding: 5px 10px; border-radius: 8px;
  background: transparent; color: var(--muted); border: 0; text-align: left;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.chip.ok { color: var(--text-2); }
.chip.ok::before { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.chip.bad { color: var(--down); background: var(--down-soft); }
.chip.bad::before { background: var(--down); }
.chip.warn { color: var(--warn); }
.chip.warn::before { background: var(--warn-dot); }
.chip-btn { font: inherit; font-size: 12.5px; cursor: pointer; }
.chip-btn:disabled { cursor: default; }
.chip-btn.bad:not(:disabled):hover { filter: brightness(1.05); text-decoration: underline; }

/* ---------- banners: one calm line, never a wall ---------- */
.banner { flex: none; padding: 9px 20px; font-size: 13px; text-align: center; }
.banner-alert {
  color: var(--text-2); background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.banner-alert::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn-dot); margin-right: 9px; vertical-align: 1px; }
.banner-kill { background: var(--down); color: #fff; font-weight: 600; }
.banner a { color: var(--accent); text-decoration: none; font-weight: 500; }
.banner-kill a { color: #fff; text-decoration: underline; }

/* ---------- layout ---------- */
.main {
  flex: 1; min-height: 0; overflow: auto; outline: none;
  padding: 34px max(28px, calc((100% - 1180px) / 2)) 64px;
}
.main.fill { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 20px; }
.main.fill > .page-head, .main.fill > .fill-fixed { flex: none; }
.main.fill > .fill-grow { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 18px; }
.main.fill > .fill-grow > .card-head { flex: none; }
.main.fill > .fill-grow > .scroll-y { flex: 1; min-height: 0; overflow: auto; }
.main.fill > .fill-grow > .empty { flex: 1; }
table.sticky-head thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line); }
@media (max-width: 860px), (max-height: 560px) {
  .main.fill { display: block; overflow: auto; }
  .main.fill > .fill-grow > .scroll-y { overflow: visible; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 32px; line-height: 1.1; font-weight: 700; letter-spacing: -.025em; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head > .btn-row .sub { margin-right: 4px; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 960px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .grid-4 { grid-template-columns: 1fr; } }
.section { margin-top: 20px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0;
  overflow: hidden;
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 16px 20px 12px;
}
.card-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head + .card-pad { padding-top: 4px; }
.card-head + .table-wrap { border-top: 1px solid var(--line); }

/* stat tiles: the number is the hero */
.label { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: -.005em; }
.stat {
  font-family: var(--font-display); font-size: 30px; line-height: 1.15; font-weight: 600;
  letter-spacing: -.025em; margin-top: 6px; font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.grid > .card.card-pad { padding: 18px 20px 20px; }
.up { color: var(--up); }
.down { color: var(--down); }
.warn-text { color: var(--warn); }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- tables: airy rows, quiet headers ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--muted);
  padding: 10px 14px; white-space: nowrap; background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover td { background: var(--surface-2); }
th.num, td.num { text-align: right; }
td b { font-weight: 600; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }

.col-check { width: 40px; padding-right: 0; }
.col-check input { width: 16px; height: 16px; margin: 2px 0 0; cursor: pointer; accent-color: var(--accent); }
.col-check input:disabled { cursor: not-allowed; opacity: .3; }
tr.row-active td { background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
tr.row-selected td, tbody tr.row-selected:hover td { background: var(--accent-soft); }
.event-list { margin: 0 0 12px; padding-left: 18px; font-size: 13px; max-height: 160px; overflow: auto; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* capsules */
.pill {
  display: inline-block; font-size: 11.5px; font-weight: 500; line-height: 1.5;
  padding: 1px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--bg-soft); color: var(--text-2);
}
.pill.ok { background: var(--up-soft); color: var(--up); }
.pill.bad { background: var(--down-soft); color: var(--down); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--accent-soft); color: var(--accent); }

.bar { height: 6px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.hot > i { background: linear-gradient(90deg, var(--warn-dot), var(--down)); }
.bar.mini { height: 4px; margin-top: 4px; min-width: 64px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; line-height: 1.2;
  padding: 8px 16px; border-radius: 980px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text);
  transition: background-color .15s ease, filter .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn-danger { background: var(--down); border-color: transparent; color: #fff; }
.btn-danger:hover { filter: brightness(1.08); border-color: transparent; }
.btn-danger-outline { background: transparent; border-color: color-mix(in srgb, var(--down) 55%, transparent); color: var(--down); }
.btn-danger-outline:hover { background: var(--down-soft); border-color: var(--down); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { flex-wrap: wrap; }

/* segmented control */
.tabs { display: inline-flex; padding: 2px; gap: 2px; border-radius: 9px; background: var(--bg-soft); }
.tabs button {
  font: inherit; font-size: 13px; font-weight: 500; border: none; background: transparent; color: var(--text-2);
  padding: 5px 14px; border-radius: 7px; cursor: pointer; transition: background-color .15s ease, box-shadow .15s ease;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }

input, select, textarea {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 8px 12px; min-width: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.btn:focus-visible, .nav a:focus-visible, .tabs button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { width: 100%; font-family: var(--mono); font-size: 12.5px; min-height: 90px; resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1 1 160px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.check-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; margin-right: 16px; color: var(--text); }
.check-inline input { accent-color: var(--accent); }
.check-inline.ack { align-items: flex-start; gap: 9px; line-height: 1.45; color: var(--down); }
.check-inline.ack input { margin-top: 3px; flex: none; }

pre.json {
  margin: 0; padding: 16px 20px; overflow: auto; max-height: 520px;
  font: 12.5px/1.6 var(--mono); background: var(--surface-2); color: var(--text-2);
  border-top: 1px solid var(--line);
}
details > summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "›"; display: inline-block; width: 14px; transition: transform .15s ease; font-weight: 600; }
details[open] > summary::before { transform: rotate(90deg); }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; padding: 36px 32px 30px; text-align: center; box-shadow: var(--shadow-pop); }
.login-card .brand { justify-content: center; font-size: 22px; padding: 0 0 8px; color: var(--accent); }
.login-card .brand span { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.login-card p { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-card input[type=password] { padding: 11px 14px; font-size: 15px; }
.login-card label.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.login-card .err { color: var(--down); font-size: 12.5px; min-height: 18px; }
.login-card .btn { justify-content: center; padding: 11px 16px; font-size: 15px; }

/* ---------- modal + toasts ---------- */
.modal { border: none; padding: 0; background: transparent; max-width: 480px; width: calc(100% - 32px); }
.modal::backdrop { background: rgba(0, 0, 0, .32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal[open] .modal-card { animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-card { background: var(--surface); border-radius: 18px; padding: 26px 26px 22px; color: var(--text); box-shadow: var(--shadow-pop); border: 1px solid var(--line); }
.modal-card h2 { font-size: 19px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 12px; }
.modal-card p { margin: 0 0 12px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal-why { margin-right: auto; align-self: center; font-size: 12.5px; color: var(--warn); }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 50; }
.toast {
  background: color-mix(in srgb, var(--text) 88%, transparent); color: var(--bg);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  padding: 11px 18px; border-radius: 14px; font-size: 13.5px; font-weight: 500;
  max-width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-pop);
  animation: rise .22s ease;
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.bad { background: var(--down); color: #fff; }
.toast.ok { background: var(--up); color: #fff; }

.noscript { text-align: center; padding: 40px; color: var(--muted); }
.spinner { color: var(--muted); padding: 60px 20px; text-align: center; font-size: 13.5px; }
.spinner::before {
  content: ""; display: block; width: 22px; height: 22px; margin: 0 auto 12px; border-radius: 50%;
  border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.rationale { white-space: pre-wrap; font-size: 13.5px; line-height: 1.65; }
.stale-note { font-size: 12.5px; color: var(--warn); margin-left: 8px; }
.stale-note::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-dot); margin-right: 6px; vertical-align: 1px; }

/* ---------- presentation pieces used by the redesigned pages ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero-figure { font-family: var(--font-display); font-size: 56px; line-height: 1; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.hero-sub { color: var(--muted); font-size: 14px; margin-top: 10px; }
.hero-side { display: flex; gap: 32px; flex-wrap: wrap; }
.hero-side .label { font-size: 12.5px; }
.hero-side .v { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -.015em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.notes { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notes li { font-size: 13px; color: var(--text-2); padding-left: 16px; position: relative; line-height: 1.5; }
.notes li::before { content: ""; position: absolute; left: 0; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-dot); }
.notes-more { margin-top: 12px; }
.notes-more .notes { max-height: 260px; overflow: auto; }
.inst { font-weight: 600; color: var(--text); }
a.inst:hover { color: var(--accent); }
.cfg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.cfg-list > div { background: var(--surface); padding: 14px 20px; }
.cfg-list .k { font-size: 12.5px; color: var(--muted); }
.cfg-list .v { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -.015em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cfg-list .raw { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Events legend + blocks bar */
.legend { margin: 6px 0 0; }
.legend summary { padding: 6px 0; }
.legend-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 10px; }
@media (max-width: 960px) { .legend-grid { grid-template-columns: 1fr; } }
.legend-grid table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.legend-grid td { font-size: 12.5px; }
.legend-chip { width: 1%; white-space: nowrap; }
.main.fill > details.legend[open] { max-height: 40vh; overflow: auto; }
.blocks-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding: 14px 20px; }
.blocks-bar .label { margin-right: 8px; }

/* utility classes (no inline style attributes: the CSP forbids them) */
.mt-6 { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.grow-2 { flex: 2 1 260px !important; }
.narrow { flex: 0 1 90px !important; }
.tiny { font-size: 11.5px; }
.inline-banner { text-align: left; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); padding: 10px 14px; line-height: 1.5; }
.callout-warn { margin-bottom: 20px; border-color: color-mix(in srgb, var(--warn-dot) 50%, transparent); background: color-mix(in srgb, var(--warn-soft) 40%, var(--surface)); }
.stat, .stat-sub, .kv dd, td, .hint, .card-head .sub { overflow-wrap: anywhere; }

/* ---------- small screens: sidebar becomes a top bar ---------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: auto; flex-direction: row; align-items: center; gap: 10px;
    padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line);
    overflow-x: auto; overflow-y: hidden;
  }
  .brand { padding: 0; }
  .brand-name, .mode-badge { display: none; }
  .nav { flex-direction: row; flex: 1; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-group { display: none; }
  .nav a { padding: 6px 10px; }
  .nav a .ico { display: none; }
  .sidebar-foot { flex-direction: row; align-items: center; border: 0; margin: 0; padding: 0; }
  .status-list { flex-direction: row; }
  #chip-loop { display: none; }
  .btn-kill { width: auto; padding: 5px 12px; font-size: 12.5px; }
  .signout { display: none; }
  .main { padding: 22px 16px 48px; }
  .page-head h1 { font-size: 26px; }
  .hero-figure { font-size: 42px; }
}

/* ---------- positions: one card per position (2026-11-05) ---------- */
.pos-list { display: flex; flex-direction: column; gap: 16px; }
.pos-card { padding: 20px 22px; }
.pos-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pos-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.pos-head .stat-sub .pill { margin-right: 6px; }
.pos-pnl { text-align: right; }
.hero-figure-sm { font-family: var(--font-display); font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pos-grid, .pos-alloc-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px; }
.pos-grid { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.pos-grid .v, .pos-alloc-row .v { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.pos-alloc { margin-top: 18px; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.calc-big { font-family: var(--font-display); font-size: 22px; letter-spacing: -.02em; }
@media (max-width: 900px) { .pos-grid, .pos-alloc-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pos-pnl { text-align: left; } }

/* ---------- second UX pass (2026-11-05) ---------- */
.status-line { display: flex; align-items: center; gap: 10px; margin: -8px 0 20px; font-size: 14px; color: var(--text-2); flex-wrap: wrap; }
.status-line b { color: var(--text); font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--up); box-shadow: 0 0 0 4px var(--up-soft); }
.dot.bad { background: var(--down); box-shadow: 0 0 0 4px var(--down-soft); }
.inline-details { display: inline; }
.inline-details > summary { display: inline; font-size: 12.5px; }
.inline-details[open] { display: block; margin-top: 6px; color: var(--muted); }
td pre.json { max-height: 260px; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.hero-card .label { font-weight: 500; }

/* Settings catalogue */
.settings-list { display: flex; flex-direction: column; }
.setting { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; padding: 16px 20px; border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; }
.setting-label { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.setting-help { color: var(--muted); font-size: 13px; line-height: 1.5; margin-top: 4px; max-width: 70ch; }
.setting .raw { font-family: var(--mono, ui-monospace, monospace); font-size: 11.5px; color: var(--muted); margin-top: 6px; opacity: .8; }
.setting-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.setting-value { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.setting-edit { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.setting-edit[hidden] { display: none; }
.setting-edit .field { min-width: 220px; }
@media (max-width: 640px) {
  .setting { grid-template-columns: 1fr; }
  .setting-side { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---------- third UX pass (2026-11-06) ---------- */
.nowrap { white-space: nowrap; }
.kv-wide { grid-template-columns: 140px 1fr; }
.bar.good > i { background: var(--up); }
.card-foot { border-top: 1px solid var(--line); padding-top: 12px; padding-bottom: 14px; }
.card-foot .hint p { margin: 8px 0 0; }
.gap-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.gap-head .stat-sub { margin-top: 0; }

/* positions: the premium-kept meter under the header */
.keep { margin-top: 16px; }
.keep-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.keep-row b { font-variant-numeric: tabular-nums; }
.keep .bar { margin-top: 6px; }
.pos-more { margin-top: 16px; }
.pos-more > summary { font-size: 13px; }
.pos-more .pos-alloc { margin-top: 12px; }

/* settings: search + jump chips */
.settings-bar { position: sticky; top: -34px; z-index: 5; margin: -6px 0 4px; padding: 10px 0 12px; background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.settings-bar input[type=search] { width: 100%; max-width: 520px; padding: 10px 14px; border-radius: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-link {
  font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text-2);
}
.chip-link:hover { border-color: var(--accent); color: var(--accent); }
.setting-group { scroll-margin-top: 110px; }
.legacy-settings > summary { margin-top: 4px; }
