:root{
  --raised:#eceff1; --button:#256345; --button-ink:#ffffff;
  --bg:#f2f3f5; --card:#ffffff; --field:#ffffff; --fg:#1b2027; --hint:#58616c;
  --line:#ccd2d8; --line2:#ccd2d8;
  --green:#226342; --green-soft:#eceff1; --green-ink:#ffffff; --accent:#226342;
  --brass:#226342; --brass-ink:#226342; --brass-soft:#eceff1;
  --ok:#1f7a59; --ok-soft:#e9f4ee;
  --warn:#8f6420; --warn-soft:#fbf2e2;
  --danger:#b3313a; --danger-soft:#fbeeee;
  --hero-bg:var(--card); --hero-fg:var(--fg); --hero-sub:var(--hint);
  --hero-line:var(--line); --hero-gold:var(--accent); --hero-num:var(--fg);
  --r-sm:9px; --r:14px; --r-lg:16px;
  color-scheme:light;
}
:root[data-theme="dark"]{
  --raised:#22252a;
  --bg:#101113; --card:#191b1e; --field:#22252a; --fg:#f1f2f4; --hint:#a5aab3;
  --line:#373c43; --line2:#373c43;
  --green:#86bd9e; --green-soft:#22252a; --green-ink:#101113; --accent:#86bd9e;
  --brass:#86bd9e; --brass-ink:#86bd9e; --brass-soft:#22252a;
  --ok:#5cc79b; --ok-soft:#16281f;
  --warn:#e0b568; --warn-soft:#2b2214;
  --danger:#f08a90; --danger-soft:#33201f;
  --hero-bg:#191b1e; --hero-fg:#f1f2f4; --hero-sub:#a5aab3;
  --hero-line:#373c43; --hero-gold:#86bd9e; --hero-num:var(--fg);
  color-scheme:dark;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --raised:#22252a;
    --bg:#101113; --card:#191b1e; --field:#22252a; --fg:#f1f2f4; --hint:#a5aab3;
    --line:#373c43; --line2:#373c43;
    --green:#86bd9e; --green-soft:#22252a; --green-ink:#101113; --accent:#86bd9e;
    --brass:#86bd9e; --brass-ink:#86bd9e; --brass-soft:#22252a;
    --ok:#5cc79b; --ok-soft:#16281f;
    --warn:#e0b568; --warn-soft:#2b2214;
    --danger:#f08a90; --danger-soft:#33201f;
    --hero-bg:#191b1e; --hero-fg:#f1f2f4; --hero-sub:#a5aab3;
    --hero-line:#373c43; --hero-gold:#86bd9e; --hero-num:var(--fg);
    color-scheme:dark;
  }
}
/* The admin wears the product's identity. The colour tokens are prepended
   at serve time from internal/adapter/in/design/tokens.css; this sheet
   names no colour of its own, only the roles the admin adds: the sidebar,
   the zebra stripe, the spacing scale. Semantic colours (ok/warn/danger)
   stay their own hues and never stand in for the accent. */
:root {
  --panel: var(--card); --ink: var(--fg); --muted: var(--hint); --line-strong: var(--line2);
  --accent-ink: var(--green-ink); --accent-soft: var(--green-soft);
  --stop: var(--danger); --stop-soft: var(--danger-soft);
  --side: #0f3b30; --side-deep: #0a2f26; --side-ink: #b9cdc5; --side-on: #ffffff; --side-hover: rgba(255,255,255,.1);
  --zebra: color-mix(in srgb, var(--fg) 3%, var(--card)); --focus: var(--brass);
  --radius: 12px;
  /* spacing scale: every margin and padding below is one of these */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
}
:root[data-theme="dark"] { --side: #121a17; --side-deep: #0f1412; --side-ink: #98a49e; --side-on: #eef1ee; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --side: #121a17; --side-deep: #0f1412; --side-ink: #98a49e; --side-on: #eef1ee; }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14.5px/1.5 -apple-system, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
b, strong { font-weight: 600; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 99; padding: 9px 14px; background: var(--panel); border: 2px solid var(--focus); border-radius: 6px; }
.skip:focus { top: 12px; }
.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; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "JetBrains Mono", Menlo, monospace; font-size: .88em; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, monospace; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ago { color: var(--muted); font-size: 12px; margin-left: var(--s1); white-space: nowrap; }
abbr[title] { text-decoration: none; cursor: help; border-bottom: 1px dotted var(--line-strong); }

/* keyboard focus is the one state that must never be subtle: brass */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100%; }
aside.side {
  background: var(--side); color: var(--side-ink); padding: 20px 12px 16px;
  display: flex; flex-direction: column; gap: var(--s1); position: sticky; top: 0; height: 100vh;
}
aside .brand { display: flex; align-items: center; gap: 10px; color: var(--side-on); font-weight: 600; font-size: 19px; letter-spacing: -.3px; padding: 0 10px 18px; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(255,255,255,.28); border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--brass); }
aside .group { color: var(--side-ink); opacity: .65; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; padding: var(--s3) 10px var(--s1); }
aside a.nav {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--side-ink); font-size: 14px;
}
aside a.nav:hover { background: var(--side-hover); text-decoration: none; color: var(--side-on); }
/* the open section carries the brass mark, not a filled slab: a bookmark, not a button */
aside a.nav[aria-current=page] { background: var(--side-hover); color: var(--side-on); font-weight: 600; box-shadow: inset 3px 0 0 var(--brass); }
aside a.nav .ic { width: 18px; text-align: center; opacity: .8; }
aside a.nav .count {
  margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: rgba(255,255,255,.14); color: var(--side-on);
}
aside a.nav .count.hot { background: var(--stop); color: #fff; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.14); padding: 14px 10px 0; display: grid; gap: 10px; font-size: 12px; }
.side-foot .build { display: flex; align-items: center; gap: 6px; min-width: 0; }
.side-foot .build .mono { overflow: hidden; text-overflow: ellipsis; }
.side-action { color: var(--side-on); border: 0; background: transparent; padding: 4px 0; min-height: auto; font-weight: 500; }
.status-dot { display: inline-block; width: 8px; height: 8px; background: var(--ok); border-radius: 50%; }

.workspace { min-width: 0; }
header.topbar {
  display: flex; align-items: center; gap: 18px; padding: 12px 28px; min-height: 68px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
}
header.topbar .heading { min-width: 0; }
header.topbar h1 {
  font-size: 18px; margin: 0; letter-spacing: -.2px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
header.topbar .actions { display: flex; gap: var(--s2); align-items: center; }
header.topbar .actions form { display: inline; }
header.topbar .actions button { padding: 6px 12px; font-size: 13px; }
header.topbar form.search { margin-left: auto; display: flex; position: relative; }
header.topbar form.search input { width: 300px; padding-right: 40px; }
.search-button { position: absolute; right: 2px; top: 2px; width: 34px; min-height: 34px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 20px; }
header.topbar .env {
  font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--ink); display: inline-flex; gap: 6px; align-items: center; text-transform: capitalize;
}
.operator { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13px; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 600; }
main { padding: 24px 28px 60px; max-width: 1480px; margin: 0 auto; }
p.lead { color: var(--muted); margin: 0 0 var(--s4); max-width: 900px; }
h2 {
  font-size: 12.5px; margin: var(--s5) 0 10px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .6px;
  display: flex; align-items: center; gap: 10px;
}
h2::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
h2:first-child { margin-top: 0; }
.crumbs { font-size: 12.5px; color: var(--muted); margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { margin: 0 var(--s1); opacity: .6; }
.subtitle { color: var(--muted); margin: 0 0 var(--s4); display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; font-size: 13.5px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  aside.side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px; }
  aside .brand { padding: var(--s1) 10px; width: 100%; }
  aside .group, aside .foot { display: none; }
  aside form.out { margin-left: auto; }
  header.topbar { flex-wrap: wrap; gap: var(--s2); padding: 10px 14px; }
  header.topbar form.search { margin-left: 0; width: 100%; order: 5; }
  header.topbar form.search input { width: 100%; }
  main { padding: var(--s4) 14px 50px; }
  /* compact tables: tighter cells and a smaller face, so a phone shows a row per line */
  table { font-size: 12.5px; }
  th { padding: 7px 9px; font-size: 10.5px; }
  td { padding: 5px 9px; }
  .ago { display: none; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .card .n { font-size: 22px; }
}

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: var(--s3); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px var(--s4);
}
.card .n { font-size: 26px; font-weight: 600; letter-spacing: -.6px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.card .k { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 6px; }
.card.alert { border-color: var(--stop); }
.card.alert .n { color: var(--stop); }
.card.good .n { color: var(--ok); }
a.card { color: inherit; }
a.card:hover { text-decoration: none; border-color: var(--accent); }
a.card .go { display: block; color: var(--accent); font-size: 12px; margin-top: 6px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: var(--s4); align-items: start; }

/* ---------- health strip ---------- */
.health {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: center;
  padding: var(--s2) 14px; margin-bottom: var(--s4); font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.health .item { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.health .item b { color: var(--ink); font-weight: 600; }
.health .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.health .dot.bad { background: var(--stop); }
.health.down { border-color: var(--stop); background: var(--stop-soft); }

/* ---------- panels & tables ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: var(--s4);
}
.panel > .hd {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  padding: 11px var(--s4); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13.5px;
}
.panel > .hd .tools { margin-left: auto; display: flex; gap: 10px; align-items: center; font-weight: 400; }
.panel > .bd { padding: var(--s4); }
.panel > .bd + .bd { border-top: 1px solid var(--line); }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .4px;
  padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel);
  position: sticky; top: 0; z-index: 1;
}
td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:nth-child(even) td { background: var(--zebra); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--accent-soft); }
tr.dim td { color: var(--muted); }
tr.today td { font-weight: 600; }
td.num, th.num { text-align: right; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }
td.actions form + form, td.actions a + form, td.actions form + a { margin-left: 10px; }
td.err { color: var(--stop); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.diff.same { color: var(--ok); }
td.diff.off { color: var(--stop); font-weight: 600; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; letter-spacing: .2px; line-height: 1.3;
}
.t-ok { color: var(--ok); background: var(--ok-soft); }
.t-warn { color: var(--warn); background: var(--warn-soft); }
.t-stop { color: var(--stop); background: var(--stop-soft); }
.t-mute { color: var(--muted); background: var(--green-soft); }

.empty { padding: var(--s6) var(--s4); text-align: center; color: var(--muted); }
.empty .next { display: block; margin-top: var(--s2); font-size: 13px; }
.note { padding: 10px 14px; border-radius: var(--radius); margin-bottom: var(--s4); font-size: 14px; }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.note.bad { background: var(--stop-soft); color: var(--stop); }
.note.info { background: var(--accent-soft); color: var(--accent); }

/* ---------- filter bar ---------- */
form.filters { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
form.filters label { margin: 0 0 3px; }
form.filters input, form.filters select { width: auto; min-width: 150px; }
form.filters button { padding: 8px 14px; }
.pills { display: flex; gap: var(--s1); flex-wrap: wrap; margin-bottom: 14px; }
a.pill {
  display: inline-flex; gap: 6px; align-items: center; padding: 4px 11px; border-radius: 999px;
  font-size: 13px; color: var(--muted); border: 1px solid var(--line);
}
a.pill:hover { background: var(--accent-soft); text-decoration: none; }
a.pill[aria-current=page] { background: var(--green); color: var(--green-ink); border-color: var(--green); font-weight: 600; }
a.pill .n { font-size: 11px; opacity: .8; }

/* ---------- forms ---------- */
form.stack { display: grid; gap: 13px; max-width: 560px; }
form.wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3) 14px; align-items: end; }
form.wide .span { grid-column: 1 / -1; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: var(--s1); font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--field); color: var(--ink); font: inherit; min-height: 38px;
}
textarea { min-height: 120px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; resize: vertical; }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--stop); }
.field-error { color: var(--stop); font-size: 12.5px; margin-top: var(--s1); font-weight: 500; }
button {
  padding: 8px 16px; border-radius: 9px; border: 1px solid var(--green); min-height: 38px;
  background: var(--green); color: var(--green-ink); font: inherit; font-weight: 600; cursor: pointer;
}
button.quiet { background: none; color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
button.danger { background: var(--stop); border-color: var(--stop); color: #fff; }
button.danger.quiet { background: none; color: var(--stop); }
button:hover { filter: brightness(1.06); }
button.link {
  background: none; border: none; padding: 0; font: inherit; font-size: 13px; min-height: 0;
  color: var(--accent); cursor: pointer;
}
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--stop); background: none; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.checks label { display: flex; gap: 7px; align-items: center; font-weight: 400; color: var(--ink); }
.checks input { width: auto; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.confirm { display: flex; gap: var(--s2); align-items: center; font-weight: 400; color: var(--ink); font-size: 13px; }
.confirm input { width: auto; }
.actions-row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- the borrower's view: the same hero and rows as the Mini App ---------- */
.borrower { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(220px, 1.2fr); gap: var(--s4); align-items: start; }
.hero { background: var(--hero-bg); color: var(--hero-fg); border: 1px solid var(--hero-line); border-radius: var(--radius); padding: 14px 16px; }
.hero .k { font-size: 12px; color: var(--hero-sub); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hero .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; color: var(--hero-num); font-variant-numeric: tabular-nums; }
.hero .sub { font-size: 12.5px; color: var(--hero-sub); margin-top: 2px; }
.hero .tag { background: var(--hero-line); color: var(--hero-fg); }
.track { height: 4px; border-radius: 2px; background: var(--hero-line); margin-top: 10px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--brass); border-radius: 2px; }
.rows { display: flex; flex-direction: column; font-size: 13.5px; }
.rows div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.rows div:first-child { border-top: 0; padding-top: 0; }
.rows span { color: var(--muted); }
.rows b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .borrower { grid-template-columns: 1fr; } }

/* ---------- charts (pure CSS bars) ---------- */
.chart { display: grid; grid-template-columns: max-content 1fr; gap: 0 var(--s2); }
.chart .axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 10.5px; color: var(--muted); text-align: right; padding-bottom: 20px; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: var(--s1); height: 96px; padding: 6px 0 0; border-left: 1px solid var(--line); padding-left: 6px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .b i { display: block; background: var(--green); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .55; }
.bars .b:hover i { opacity: 1; }
/* today is the brass mark on the chart, the same mark as everywhere else */
.bars .b.today i { opacity: 1; background: var(--brass); }
.bars .b.today span { color: var(--ink); font-weight: 600; }
.bars .b span { font-size: 10px; color: var(--muted); text-align: center; margin-top: var(--s1); overflow: hidden; white-space: nowrap; }
.chart-total { font-size: 13px; color: var(--muted); }

/* ---------- misc ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.steps li { display: grid; grid-template-columns: 96px 1fr; gap: var(--s3); padding: var(--s2) 10px; border: 1px solid var(--line); border-radius: 8px; }
.steps li .d { font-family: ui-monospace, Menlo, monospace; color: var(--muted); font-size: 13px; }
/* an extra payment is the borrower's money working: brass, not semantic green */
.steps li.extra { border-color: var(--brass); background: var(--brass-soft); }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; }
details.fold > summary { padding: var(--s3) var(--s4); font-weight: 500; border-top: 1px solid var(--line); }
details.fold[open] > summary { border-bottom: 1px solid var(--line); }
pre.explain { margin: 6px 0 0; padding: var(--s2) 10px; background: var(--bg); border-radius: 6px; font-size: 12px; white-space: pre-wrap; }
pre.support {
  margin: 0; padding: var(--s3) 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; line-height: 1.55; white-space: pre-wrap; user-select: all;
}
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 8px 1fr; gap: var(--s3); padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line); font-size: 13.5px; }
.timeline li:last-child { border-bottom: none; }
.timeline li .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--muted); }
.timeline li .dot.in { background: var(--accent); }
.timeline li .dot.dead { background: var(--stop); }
.timeline li .dot.ok { background: var(--ok); }
.timeline li .when { display: block; color: var(--muted); font-size: 12px; }
.timeline li .err { color: var(--stop); }
.login { max-width: 380px; margin: 14vh auto; padding: 0 var(--s4); }
.login .panel { padding: 26px 24px; }
.login .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 20px; margin: 0 0 4px; }
.login .brand .brand-mark { border-color: var(--line-strong); }
.login .lead { margin: 0 0 18px; font-size: 13.5px; }
.login form button { margin-top: 4px; }
footer { color: var(--muted); font-size: 12.5px; padding: 18px 26px; }

/* ---------- operations overview ---------- */
.status-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 20px; min-height: 56px;
}
.status-strip > span { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 18px; border-right: 1px solid var(--line); white-space: nowrap; font-size: 13.5px; }
.status-strip > span:last-child { border-right: 0; }
.status-strip.down { border-color: var(--stop); background: var(--stop-soft); }
.status-icon { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); font-size: 0; }
.status-icon.info { background: var(--line-strong); }
.status-strip.down .status-icon:not(.info) { background: var(--stop); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { display: grid; gap: 2px; padding: 16px 18px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.metric:hover { text-decoration: none; border-color: var(--accent); }
.metric b { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.metric strong { font-size: 30px; line-height: 1.15; letter-spacing: -.8px; font-variant-numeric: tabular-nums; font-weight: 600; }
.metric small { color: var(--muted); margin-top: 6px; }
.metric.warning strong { color: var(--warn); }
.metric.critical strong { color: var(--stop); }

.dashboard-grid { display: grid; grid-template-columns: .9fr 1.2fr 1.2fr; gap: 14px; align-items: stretch; }
.dashboard-grid .panel { margin-bottom: 20px; }
.queue-list { display: grid; }
.queue-list a { display: grid; grid-template-columns: 1fr 46px 70px; gap: 10px; color: var(--ink); padding: 11px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.queue-list a:last-child { border-bottom: 0; }
.queue-list a:hover { background: var(--accent-soft); text-decoration: none; }
.queue-list a span { display: flex; align-items: center; gap: 9px; }
.queue-list a b { text-align: right; font-variant-numeric: tabular-nums; }
.queue-list a small { color: var(--muted); text-align: right; }
.queue-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.queue-dot.ok { background: var(--ok); }.queue-dot.warn { background: var(--warn); }.queue-dot.stop { background: var(--stop); }
.chart-panel .bd { min-height: 188px; display: flex; align-items: center; }
.chart-panel .chart { width: 100%; }
.chart-panel .bars { height: 140px; }
.incidents .review { display: inline-flex; justify-content: center; min-width: 82px; padding: 4px 12px; border: 1px solid var(--brass); border-radius: 999px; color: var(--brass-ink); font-size: 12.5px; font-weight: 600; }
.incidents .review:hover { background: var(--brass-soft); text-decoration: none; }
.good-empty span { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; color: #fff; background: var(--ok); }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .queue-panel { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .status-strip { grid-template-columns: 1fr 1fr; }
  .status-strip > span:nth-child(2) { border-right: 0; }
  .status-strip > span { justify-content: flex-start; border-bottom: 1px solid var(--line); }
  .status-strip > span:nth-last-child(-n+2) { border-bottom: 0; }
  .metric-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .queue-panel { grid-column: auto; }
  .operator span:last-child, header.topbar .env { display: none; }
}

/* ---------- print: a loan page on paper is the schedule and the facts, nothing to click ---------- */
@media print {
  aside.side, header.topbar form.search, header.topbar .actions, .operator, .no-print, td.actions, th.actions,
  form, details summary, .note { display: none !important; }
  .shell { display: block; }
  header.topbar { position: static; border: none; padding: 0 0 var(--s2); }
  main { padding: 0; max-width: none; }
  body { background: #fff; color: #000; font-size: 11px; }
  .panel, .card { border-color: #999; break-inside: avoid; margin-bottom: var(--s3); }
  th { position: static; }
  tbody tr:nth-child(even) td, tbody tr:hover td { background: none; }
  pre.explain { display: none; }
  a { color: inherit; }
  h2::after { border-color: #999; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .hero { background: none; color: #000; border-color: #999; }
}

/* Management records reuse the operational token sheet and form rhythm. */
.management-facts { display:grid; grid-template-columns:minmax(100px,160px) minmax(0,1fr); gap:8px 18px; margin:0 0 20px; }
.management-facts dt { color:var(--muted); }
.management-facts dd { margin:0; min-width:0; }
.management-links { display:flex; flex-wrap:wrap; gap:16px; }
.management-links p { flex-basis:100%; }
.break-word { overflow-wrap:anywhere; }
.preserve-lines { white-space:pre-wrap; overflow-wrap:anywhere; }
.history-record + .history-record { border-top:1px solid var(--line); margin-top:24px; padding-top:20px; }
label.check { display:flex; align-items:baseline; gap:8px; }
form.stack fieldset { border:1px solid var(--line); border-radius:9px; padding:12px; }
@media(max-width:640px) { .management-facts { grid-template-columns:1fr; gap:4px; } .management-facts dd { margin-bottom:12px; } .grid2 { grid-template-columns:1fr; } }
