/* Back office styles: black and gold. Warm near-black surfaces, ivory text, one metallic gold accent used sparingly
   (brand, primary actions, the active place, focus); status colours are kept clear of the gold so "warning" never
   reads as "brand". A serif carries headings and figures, a system sans everything else.
   No inline styles anywhere (the CSP forbids them): every look is a class here. */

:root {
  --bg: #09090a;
  --surface: #111113;
  --surface-2: #161618;
  --surface-3: #1d1d20;
  --border: #252528;
  --border-strong: #353539;
  --text: #ede8dd;
  --text-2: #cdc6b7;
  --muted: #958d7e;
  --accent: #d4af37;
  --accent-hover: #e4c35a;
  --accent-weak: #231e10;
  --accent-text: #0b0906;
  --accent-line: #8a7230;
  --focus: #e7c763;
  --gold-gradient: linear-gradient(135deg, #f5dd94 0%, #ddb94a 38%, #c39b32 72%, #a6832b 100%);
  --gold-hairline: linear-gradient(90deg, transparent 0%, #8a7230 18%, #e4c35a 50%, #8a7230 82%, transparent 100%);

  --good: #67c493;
  --good-bg: #0f2419;
  --warn: #f29a52;
  --warn-bg: #2c1a0b;
  --bad: #f07a6d;
  --bad-bg: #2d110e;
  --info: #93b6e6;
  --info-bg: #111c2c;
  --neutral: #aba496;
  --neutral-bg: #1f1f22;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 1px 3px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .015);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .7), 0 0 0 1px rgba(212, 175, 55, .08);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar-w: 236px;
  --topbar-h: 62px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
  scrollbar-color: #3a3a3f var(--bg);
}

::selection { background: rgba(212, 175, 55, .32); color: #fff8e6; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: radial-gradient(1100px 520px at 78% -12%, rgba(212, 175, 55, .07), transparent 62%) fixed, var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga";
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: .005em; }
h1 { font-size: 26px; line-height: 1.2; color: #f4efe3; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1 .mono { font-size: .9em; }
pre { font-family: var(--mono); font-size: 12px; margin: 0; white-space: pre-wrap; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* Gold accents shared by the page furniture. */
.gold { color: var(--accent); }
.serif { font-family: var(--serif); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c2c30; border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #4a4234; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }
.mb { margin-bottom: 16px; }
.gap-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.noscript { padding: 24px; }

/* ---------- boot / loading ---------- */
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; display: inline-block; flex: none;
  border: 2px solid #2c2a25; border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 4px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  grid-template-areas: "side top" "side main";
  min-height: 100vh;
}
.sidebar {
  grid-area: side;
  background: linear-gradient(180deg, #0e0e10 0%, #0a0a0b 100%);
  border-right: 1px solid #1f1d18;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 18px;
  border-bottom: 1px solid #1f1d18; font-weight: 650; color: var(--text); flex: none; position: relative;
}
.brand::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--gold-hairline); opacity: .55; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--gold-gradient); color: var(--accent-text); display: grid; place-items: center; flex: none;
  box-shadow: 0 0 0 1px rgba(245, 221, 148, .25) inset, 0 4px 14px rgba(212, 175, 55, .22);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text span { font-family: var(--serif); font-size: 16.5px; font-weight: 600; letter-spacing: .02em; color: #f4efe3; }
.brand-text small { font-weight: 600; color: #b39a55; font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em; margin-top: 2px; }
.nav { padding: 10px 10px 24px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .16em; color: #a88d45; padding: 16px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; position: relative; transition: background-color .12s, color .12s;
}
.nav-item svg { flex: none; color: #8a8478; transition: color .12s; }
.nav-item:hover { background: #17161a; text-decoration: none; color: var(--text); }
.nav-item:hover svg { color: var(--text-2); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(212, 175, 55, .15) 0%, rgba(212, 175, 55, .03) 100%); color: #f0d27a;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.active svg { color: var(--accent); }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 750;
  background: var(--gold-gradient); color: var(--accent-text); display: inline-grid; place-items: center; font-variant-numeric: tabular-nums;
}

.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 18px; padding: 0 24px;
  background: rgba(10, 10, 11, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #1f1d18;
  position: sticky; top: 0; z-index: 5;
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--gold-hairline); opacity: .55; pointer-events: none; }
.bank-name { font-family: var(--serif); font-weight: 600; font-size: 17px; letter-spacing: .03em; white-space: nowrap; color: #f4efe3; }
.bizdate {
  display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 999px;
  background: rgba(212, 175, 55, .06); border: 1px solid rgba(212, 175, 55, .28);
}
.bizdate-label { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .14em; color: #a88d45; }
.bizdate-value { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.who-name { font-weight: 600; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.who-role { font-size: 10.5px; color: #b39a55; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }

.main { grid-area: main; padding: 26px 30px 56px; min-width: 0; outline: none; }
.page { max-width: 1480px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-head .sub { color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, #141416 0%, var(--surface) 140px); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .025); min-width: 0;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { font-size: 16px; color: #f4efe3; }
.card-head .head-actions { margin-left: auto; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card + .card, .grid-3 > .card + .card { margin-top: 0; }
.stack > * + * { margin-top: 16px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: linear-gradient(160deg, #17171a 0%, #111113 60%); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .03); display: flex; flex-direction: column; gap: 5px; color: var(--text); min-width: 0;
  position: relative; overflow: hidden; transition: border-color .15s;
}
a.kpi:hover { text-decoration: none; border-color: var(--accent-line); }
.kpi-label { font-size: 10.5px; font-weight: 650; color: #a88d45; text-transform: uppercase; letter-spacing: .14em; }
.kpi-value { font-family: var(--serif); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; letter-spacing: 0; color: #f4efe3; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }
.kpi.tone-warn { border-left: 3px solid var(--warn); }
.kpi.tone-bad { border-left: 3px solid var(--bad); }
.kpi.tone-good { border-left: 3px solid var(--good); }
.kpi.tone-accent { border-left: 3px solid var(--accent); }

/* balances on account / loan pages */
.balances { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.bal { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; min-width: 0; }
.bal-label { font-size: 12px; color: var(--muted); }
.bal-value { font-family: var(--serif); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.bal.primary { background: linear-gradient(150deg, rgba(212, 175, 55, .14), rgba(212, 175, 55, .03)); border-color: rgba(212, 175, 55, .3); }
.bal.primary .bal-value { color: var(--accent); font-size: 24px; }

/* ---------- description lists ---------- */
.dl { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 7px 18px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.dl-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 28px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th {
  font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .12em; color: #b09a5c;
  background: #141416; white-space: nowrap; position: sticky; top: 0; border-bottom-color: #2a2720;
}
.table td { border-bottom-color: #1e1e21; }
.table tbody tr:hover td { background: rgba(212, 175, 55, .035); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn + .btn { margin-left: 4px; }
.action-stack { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.action-stack .btn + .btn { margin-left: 0 !important; }
.action-wrap { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; min-width: 200px; max-width: 290px; margin-left: auto; white-space: normal; }
.action-wrap .btn + .btn { margin-left: 0 !important; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 2px solid var(--border-strong); border-bottom: 0; }
.table tr.row-muted td { color: var(--muted); }
.table tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.table tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.table tr.row-good td:first-child { box-shadow: inset 3px 0 0 var(--good); }
.table tr.row-section td { background: var(--surface-3); font-weight: 650; }
.table.compact th, .table.compact td { padding: 6px 10px; }
.cell-main { font-weight: 550; color: #f1ece1; }
.cell-sub { font-size: 12px; color: var(--muted); }
.trunc { display: inline-block; vertical-align: bottom; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money .ccy { color: var(--muted); font-size: .86em; font-weight: 500; }
.money.neg { color: var(--bad); }
.money.big { font-size: 1.15em; font-weight: 650; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px;
  font-weight: 600; white-space: nowrap; line-height: 1.6;
}
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.dc { display: inline-block; width: 22px; text-align: center; border-radius: 4px; font-weight: 700; font-size: 12px; }
.dc-D { background: var(--info-bg); color: var(--info); }
.dc-C { background: var(--good-bg); color: var(--good); }

/* ---------- 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: #161618; color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .12s, border-color .12s, color .12s, filter .12s;
}
.btn:hover { background: #1d1c1f; border-color: #4a4232; color: #fff8e8; text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: #161618; border-color: var(--border-strong); }
.btn-primary {
  background: var(--gold-gradient); border-color: #b8912c; color: var(--accent-text); font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255, 245, 210, .45), 0 2px 10px rgba(212, 175, 55, .16);
}
.btn-primary:hover { background: var(--gold-gradient); border-color: #e4c35a; color: var(--accent-text); filter: brightness(1.08); }
.btn-primary:disabled:hover { background: var(--gold-gradient); border-color: #b8912c; filter: none; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #1b0b0a; }
.btn-danger:hover { filter: brightness(.94); background: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; height: auto; font-weight: 500; cursor: pointer; font: inherit; }
.btn-link:hover { text-decoration: underline; background: none; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--border-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.btn-primary.busy::after, .btn-danger.busy::after { border-color: rgba(11, 9, 6, .3); border-top-color: var(--accent-text); }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 4px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn-group-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 2px; }
.action-bar { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; padding: 12px 16px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline .field-label { white-space: nowrap; }
.field-inline input[type="number"] { width: 90px; }
input, select, textarea {
  font: inherit; color: var(--text); background: #0d0d0f; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 0 10px; height: 34px; min-width: 0; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: #46413a; }
textarea { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; height: auto; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212, 175, 55, .22); }
input:read-only { background: var(--surface-2); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-section { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 -2px; grid-column: 1 / -1; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.input-row { display: flex; gap: 6px; }
.input-row input { flex: 1; }
.form-error {
  margin-top: 12px; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--bad-bg); color: var(--bad);
  font-weight: 500;
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filters .field { width: auto; }
.filters input, .filters select { width: auto; min-width: 130px; }
.filters input.wide { min-width: 240px; }
.filters .btn { align-self: flex-end; }
.picker-result { font-size: 12.5px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--muted); }
.picker-result.ok { border-style: solid; border-color: var(--good); color: var(--text); background: var(--good-bg); }
.picker-result.err { border-style: solid; border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.quote-box { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.quote-box.ok { border-color: var(--good); }

/* ---------- alerts ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid transparent; margin-bottom: 12px; }
.alert-error { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert-good { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert .btn { margin-left: 10px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tab {
  border: 0; background: none; font: inherit; color: var(--muted); padding: 11px 12px 10px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; white-space: nowrap;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: #f0d27a; border-bottom-color: var(--accent); }
.tabs-page { padding: 0; margin-bottom: 16px; }

/* ---------- pager ---------- */
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.pager .spacer { flex: 1; }

/* ---------- modal (native <dialog>) ---------- */
dialog.modal {
  border: 1px solid #2e2a20; border-radius: 12px; padding: 0; width: min(580px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); background: #121214; color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal.modal-wide { width: min(900px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .66); backdrop-filter: blur(3px); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); position: relative; }
.modal-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--gold-hairline); opacity: .45; }
.modal-head h2 { font-size: 18px; flex: 1; color: #f4efe3; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-body > p:last-child { margin-bottom: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--border); background: #0e0e10; border-radius: 0 0 12px 12px; }
.modal-summary { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 12px; }
.secret { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--surface-3); border-radius: var(--radius-sm); margin: 10px 0; }
.secret code { flex: 1; font-size: 14px; overflow-wrap: anywhere; user-select: all; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; max-width: min(440px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px 11px 14px; border-radius: var(--radius);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--info); animation: toast-in .18s ease-out;
}
.toast-msg { flex: 1; overflow-wrap: anywhere; }
.toast-success { border-left-color: var(--good); }
.toast-warn { border-left-color: var(--warn); }
.toast-error { border-left-color: var(--bad); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- details / json ---------- */
details.expander > summary { cursor: pointer; color: var(--accent); list-style: none; }
details.expander > summary::-webkit-details-marker { display: none; }
details.expander > summary::before { content: "▸ "; color: var(--muted); }
details.expander[open] > summary::before { content: "▾ "; }
.json { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin-top: 6px; max-width: 640px; }
.eod-run { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.eod-run + .eod-run { margin-top: 8px; }
.eod-run > summary { display: flex; gap: 14px; align-items: center; padding: 10px 14px; cursor: pointer; flex-wrap: wrap; list-style: none; }
.eod-run > summary::-webkit-details-marker { display: none; }
.eod-run > summary::before { content: "▸"; color: var(--muted); }
.eod-run[open] > summary::before { content: "▾"; }
.eod-run[open] > summary { border-bottom: 1px solid var(--border); }
.eod-body { padding: 14px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.fact { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.fact span:first-child { color: var(--muted); }
.fact span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- login ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(700px 420px at 50% 0%, rgba(212, 175, 55, .11), transparent 70%), radial-gradient(900px 600px at 50% 120%, rgba(212, 175, 55, .05), transparent 70%), var(--bg);
}
.auth-card {
  width: min(420px, 100%); background: linear-gradient(180deg, #151517 0%, #0f0f11 100%); border: 1px solid #2a261c; border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .03); padding: 34px 32px 30px; position: relative; overflow: hidden;
}
.auth-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--gold-hairline); }
.auth-card .brand-mark { width: 46px; height: 46px; border-radius: 11px; margin-bottom: 18px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card form { display: flex; flex-direction: column; gap: 15px; margin-top: 24px; }
.auth-card .btn { height: 40px; }
.auth-card .btn-primary { margin-top: 4px; font-size: 14.5px; letter-spacing: .02em; }
.rules { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.rules li.ok { color: var(--good); }

/* ---------- misc ---------- */
.journal-totals { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); margin-top: 10px; }
.journal-line { display: grid; grid-template-columns: minmax(0, 2.2fr) 96px minmax(0, 1fr) minmax(0, 1.6fr) 32px; gap: 8px; align-items: center; margin-top: 8px; }
.journal-head { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 12px; }
.journal-head.journal-line { margin-top: 12px; }
.inline-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.kv-tag { display: inline-flex; gap: 6px; padding: 2px 8px; border-radius: 4px; background: var(--surface-3); font-size: 12.5px; }
.denied { padding: 40px 20px; text-align: center; color: var(--muted); }
.result-ok { color: var(--good); font-weight: 600; }
.result-bad { color: var(--bad); font-weight: 600; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.schedule-wrap { max-height: 420px; overflow-y: auto; }

/* ---------- SWIFT, compliance, partners ---------- */
.test-mode {
  display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 4px 12px; border-radius: var(--radius);
  background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  font-size: 12.5px; line-height: 1.2; min-width: 150px; max-width: 380px; overflow: hidden; flex: 0 1 auto; max-height: calc(var(--topbar-h) - 6px);
}
.test-mode strong { letter-spacing: .06em; font-weight: 800; white-space: nowrap; }
.test-mode-long { font-size: 11px; font-weight: 500; }
.alert-test { background: var(--warn-bg); color: var(--warn); border: 2px dashed color-mix(in srgb, var(--warn) 55%, transparent); font-weight: 550; }
.alert-test strong { letter-spacing: .06em; }
.code-block {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
  max-height: 520px; overflow: auto; white-space: pre; word-break: normal; font-size: 12px; line-height: 1.5; tab-size: 2;
}
.copy-btn { height: 24px; padding: 0 6px; gap: 4px; font-size: 12px; vertical-align: middle; }
.id-line { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; max-width: 100%; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: #121214; border: 2px solid var(--accent);
}
.timeline li.tl-bad::before { border-color: var(--bad); background: var(--bad-bg); }
.timeline li.tl-good::before { border-color: var(--good); background: var(--good-bg); }
.timeline li.tl-warn::before { border-color: var(--warn); background: var(--warn-bg); }
.tl-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tl-event { font-weight: 600; }
.tl-at { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-detail { font-size: 12px; color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.tl-detail .kv-tag { margin: 2px 4px 0 0; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer; background: var(--surface);
}
.choice:hover { background: var(--surface-2); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.choice input { margin-top: 3px; }
.choice-text { display: flex; flex-direction: column; gap: 2px; }
.choice-title { font-weight: 650; }
.choice-desc { font-size: 12.5px; color: var(--text-2); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.check-grid label { display: inline-flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check-grid input { margin-top: 3px; }
.check-grid .choice-desc { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--surface-3); font-size: 12.5px; }
.chip .icon-btn { padding: 2px; }
.search-results { border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 220px; overflow-y: auto; }
.search-results:empty { display: none; }
.search-result { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.search-result:last-child { border-bottom: 0; }
.search-result .spacer { flex: 1; }
.field-invalid input, .field-invalid select, input.invalid, select.invalid { border-color: var(--bad); outline-color: var(--bad); }
.field-invalid .field-label { color: var(--bad); }
.kpi-value.kpi-text { font-size: 18px; overflow-wrap: anywhere; }
.result-box { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.result-box.ok { border-color: var(--good); background: var(--good-bg); color: var(--text); }
.result-box.bad { border-color: var(--bad); background: var(--bad-bg); color: var(--text); }
.score { font-variant-numeric: tabular-nums; font-weight: 650; }
.score.score-high { color: var(--bad); }
.score.score-mid { color: var(--warn); }
.legend { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; align-items: baseline; }
.swift-section { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); }
.swift-section .form-section:first-child { margin-top: 0; }
.mono-wrap { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.file-list { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); }

/* ---------- bank connections (plug-ins besides SWIFT) ---------- */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.conn-card {
  display: flex; flex-direction: column; gap: 9px; padding: 14px 16px; min-width: 0; color: var(--text);
  background: linear-gradient(160deg, #17171a 0%, #111113 70%); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .03); transition: border-color .15s, background-color .15s;
}
a.conn-card:hover { text-decoration: none; border-color: var(--accent-line); color: var(--text); }
.conn-card.conn-builtin { border-left: 3px solid var(--accent); }
.conn-card.conn-attention { border-left: 3px solid var(--warn); }
.conn-card.conn-broken { border-left: 3px solid var(--bad); }
.conn-card.conn-muted { opacity: .72; }
.conn-card-head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.conn-card-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.conn-card-title { font-family: var(--serif); font-size: 16.5px; font-weight: 600; color: #f4efe3; overflow-wrap: anywhere; }
.conn-card-sub { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.conn-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.conn-card-note { font-size: 12.5px; color: var(--text-2); }
.conn-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.conn-fact { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; min-width: 0; }
.conn-fact-label { display: block; font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: #a88d45; overflow-wrap: anywhere; }
.conn-fact-value { display: block; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.conn-fact-value.tone-warn { color: var(--warn); }
.conn-fact-value.tone-bad { color: var(--bad); }
.conn-pick { cursor: pointer; position: relative; }
.conn-pick input[type="radio"] { position: absolute; top: 16px; right: 16px; }
.conn-pick:hover { border-color: #4a4232; }
.conn-pick:has(input:checked) { border-color: var(--accent); background: linear-gradient(160deg, #221d10 0%, #121214 75%); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow); }
.conn-pick:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.conn-section { margin-top: 22px; }
.conn-section-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.conn-section-head h2 { font-size: 18px; color: #f4efe3; }
.bank-card .conn-card-title { font-size: 19px; }
.bank-ways { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.bank-way { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 9px; border-top: 1px solid var(--border); }
.bank-way:first-child { border-top: 0; padding-top: 0; }
.bank-way-label { font-weight: 550; color: var(--text); }
.bank-way-btn { margin-left: auto; }
.bank-way-note { flex-basis: 100%; font-size: 12px; color: var(--muted); }

/* environment of a connection: the simulator is test furniture, production is the real thing */
.env-badge {
  display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; font-size: 10.5px; font-weight: 750;
  text-transform: uppercase; letter-spacing: .1em; line-height: 1.75; white-space: nowrap; border: 1px solid transparent;
}
.env-simulator { background: var(--warn-bg); color: var(--warn); border: 1px dashed color-mix(in srgb, var(--warn) 60%, transparent); }
.env-sandbox { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.env-production { background: var(--gold-gradient); color: var(--accent-text); border-color: #b8912c; }
.env-test { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.env-off { background: var(--neutral-bg); color: var(--neutral); border-color: var(--border-strong); }

/* connection status (bank_connections.status) */
.status-draft { background: var(--neutral-bg); color: var(--neutral); }
.status-enabled { background: var(--good-bg); color: var(--good); }
.status-disabled { background: var(--warn-bg); color: var(--warn); }
.status-suspended { background: var(--bad-bg); color: var(--bad); }
.status-builtin { background: var(--accent-weak); color: #f0d27a; }

/* health: a dot and a line of text */
.health { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; background: var(--neutral); }
.health-ok { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 18%, transparent); }
.health-warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent); }
.health-bad { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.health-stopped { background: transparent; border: 2px solid var(--neutral); }

.cap-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cap-chip { display: inline-flex; padding: 0 8px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); font-size: 11.5px; color: var(--text-2); line-height: 1.7; white-space: nowrap; }
.cap-chip.cap-off { color: var(--muted); text-decoration: line-through; }
.via-conn { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--accent-line); background: var(--accent-weak); color: #f0d27a; font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
a.via-conn:hover { text-decoration: none; border-color: var(--accent); color: #f7dd8f; }

/* settings that must come from the bank at onboarding */
.confirm-tag {
  display: inline-flex; align-items: center; padding: 0 7px; border-radius: 4px; font-size: 10.5px; font-weight: 750; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .08em; color: var(--warn); border: 1px dashed color-mix(in srgb, var(--warn) 65%, transparent); line-height: 1.7;
}
.confirm-note { font-size: 12px; color: var(--warn); }
.required-mark { color: var(--accent); font-weight: 700; }
.settings-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 14px 0 0; min-width: 0; background: rgba(255, 255, 255, .012); }
.settings-group > legend { padding: 0 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: #b39a55; }
.setting-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setting-key { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.setting-value { overflow-wrap: anywhere; }

/* secrets: only whether each is set; never a value */
.secret-table td { vertical-align: middle; }
.secret-table .envvar { white-space: nowrap; overflow-wrap: normal; }
.envvar {
  font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3);
  border: 1px solid var(--border); color: #f0d27a; overflow-wrap: anywhere; white-space: normal;
}
.env-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.env-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.env-preview { margin-top: 8px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.yes { color: var(--good); font-weight: 600; }
.no { color: var(--bad); font-weight: 600; }

/* documents as stored (pain.001, pain.002, camt, pacs.008 wrapper, instructions) */
.xml-view {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 0;
  max-height: 560px; overflow: auto; white-space: pre; word-break: normal; font-size: 12px; line-height: 1.5; tab-size: 2;
}

.check-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.check-list li { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.check-ok { color: var(--good); font-weight: 700; }
.check-bad { color: var(--bad); font-weight: 700; }
.alert-list { margin: 4px 0 0; padding-left: 18px; }
.alert-list li + li { margin-top: 2px; }
.step-title { display: flex; align-items: center; gap: 10px; }
.step-num {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--gold-gradient); color: var(--accent-text); font-weight: 750; font-size: 12.5px;
}
.notes-list { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); }
.notes-list li + li { margin-top: 3px; }

/* ---------- AI assistant ---------- */
.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; }
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 170px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.chat-model { margin: -8px 0 12px; font-size: 12.5px; }
.chat-empty { margin: auto; max-width: 560px; text-align: center; color: var(--text-2); }
.chat-empty > svg { width: 28px; height: 28px; color: var(--accent); }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.suggestions .btn { white-space: normal; height: auto; min-height: 28px; padding: 5px 10px; max-width: 100%; text-align: left; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.msg-user { justify-content: flex-end; }
.msg-user .msg-body { background: var(--accent-weak); border-color: color-mix(in srgb, var(--accent) 25%, transparent); white-space: pre-wrap; max-width: min(720px, 85%); }
.msg-body { border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; min-width: 0; overflow-wrap: anywhere; }
.msg-assistant .msg-body { flex: 1; max-width: 920px; }
.msg-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); }
.typing { display: flex; align-items: center; gap: 10px; color: var(--muted); flex: none !important; }
.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md .md-h { font-weight: 650; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 4px; border-radius: 4px; }
.md .table-wrap { margin: 6px 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.steps { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.steps ul { margin: 6px 0 0; padding-left: 18px; }
.proposal { margin-top: 12px; border: 1px solid var(--border-strong); border-left: 4px solid var(--warn); border-radius: var(--radius-sm); background: var(--surface); padding: 12px 14px; }
.proposal-done { border-left-color: var(--good); }
.proposal-pending_approval { border-left-color: var(--info); }
.proposal-discarded { border-left-color: var(--border-strong); opacity: .75; }
.proposal-failed, .proposal-unknown { border-left-color: var(--bad); }
.proposal-warn { border-left-color: var(--warn); }
.proposal:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.proposal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.proposal-summary { margin: 0 0 8px; }
.proposal .facts { grid-template-columns: minmax(0, 1fr); gap: 0; max-width: 640px; }
.proposal-value { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; overflow-wrap: anywhere; }
.proposal-check { font-weight: 400; color: var(--good); font-size: 12px; }
.proposal-check-bad { color: var(--bad); font-weight: 600; }
.proposal-endpoint { margin-top: 8px; font-size: 12px; color: var(--muted); }
.proposal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.proposal-note { font-size: 12.5px; }
.proposal-outcome { margin: 10px 0 0; font-weight: 600; }
.chat-form { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-form textarea { flex: 1; resize: vertical; min-height: 44px; max-height: 200px; font: inherit; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.chat-form textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.chat-form .btn { height: 44px; padding: 0 20px; }
.chat-form .btn-icon { width: 44px; padding: 0; display: grid; place-items: center; flex: none; }
.chat-drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
.chat-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 0; border-top: 1px solid var(--border); }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; white-space: normal; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: 12.5px; min-width: 0; }
.file-chip small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.file-chip.file-error { border-color: var(--bad); }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.file-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; background: #fff; flex: none; }
.file-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 4px; background: var(--surface-3); color: var(--muted); flex: none; }
.file-remove { color: var(--muted); display: grid; place-items: center; }
.file-remove:hover { color: var(--bad); }
.tray-total { align-self: center; font-size: 12px; }

/* ---------- crypto ---------- */
/* Test networks in the warning colour (dashed, like SWIFT test mode); live mainnet in the error colour: it has been
   tested on test networks only. */
.crypto-banner { margin-bottom: 14px; }
.crypto-test { background: var(--warn-bg); color: var(--warn); border: 2px dashed color-mix(in srgb, var(--warn) 55%, transparent); }
.crypto-live { background: var(--bad-bg); color: var(--bad); border: 2px solid color-mix(in srgb, var(--bad) 65%, transparent); }
.crypto-banner strong, .crypto-mode strong { letter-spacing: .05em; }
.crypto-mode {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: var(--radius); font-size: 12px; font-weight: 700;
  white-space: nowrap; flex: 0 1 auto; overflow: hidden; max-height: calc(var(--topbar-h) - 6px);
}
.crypto-amount { white-space: nowrap; }
.hash { overflow-wrap: anywhere; }
.address { display: inline-block; max-width: 100%; }
.crypto-bytes { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; max-height: 260px; }
.crypto-checks li { align-items: flex-start; }
.crypto-checks .cell-sub { display: block; }
.crypto-warnings li { margin-bottom: 4px; }
.crypto-cancelling .dl { margin-bottom: 0; }
.crypto-checks-eod { margin-top: 10px; }
.treasury-address { font-size: 1.3em; font-weight: 650; color: var(--accent); margin: 4px 0 6px; }
.treasury-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.treasury-steps .code-block { margin: 6px 0 4px; }
.deposit-address + .deposit-address { margin-top: 8px; }
.table tr.row-focus td { background: var(--accent-weak); }
.stepper { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; padding: 0; counter-reset: none; }
.stepper-step { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12.5px; }
.stepper-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); font-size: 11.5px; font-weight: 700; }
.stepper-done { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.stepper-done .stepper-dot { background: var(--good-bg); }
.stepper-current { color: var(--accent); border-color: var(--accent-line); background: var(--accent-weak); }
.stepper-current .stepper-dot { background: var(--accent); color: var(--accent-text); }
.stepper-stuck { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: var(--warn-bg); }
.stepper-stuck .stepper-dot { background: var(--warn); color: var(--accent-text); }
.stepper-todo .stepper-label { opacity: .8; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1300px) {
  .test-mode-long { display: none; }
}
@media (max-width: 1000px) {
  :root { --sidebar-w: 62px; }
  .brand { padding: 0; justify-content: center; }
  .brand-text, .nav-label, .nav-section { display: none; }
  .nav-item { justify-content: center; padding: 9px 0; position: relative; }
  .nav-count { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
  .main { padding: 18px 16px 40px; }
  .topbar { padding: 0 14px; gap: 12px; }
  .bizdate-label { display: none; }
  .topbar [data-act="logout"] span { display: none; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .dl-2col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .bank-name, .who-role, .bizdate-label { display: none; }
  .test-mode-long { display: none; }
  .topbar-right [data-act="password"] { display: none; }
  .topbar [data-act="logout"] span { display: none; }
  .bizdate { padding: 4px 8px; gap: 6px; }
  .bizdate-value { font-size: 15px; }
  .who-name { max-width: 120px; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .journal-line { grid-template-columns: minmax(0, 1fr) 88px minmax(0, 1fr) 32px; }
  .journal-line .jl-narr { display: none; }
  .chat { height: calc(100vh - var(--topbar-h) - 150px); }
  .msg-avatar { display: none; }
  .msg-user .msg-body { max-width: 92%; }
}
@media (max-width: 560px) {
  .who { display: none; }
  .crypto-mode { padding: 3px 8px; font-size: 11px; }
  .test-mode { min-width: 0; padding: 3px 8px; font-size: 11.5px; flex-shrink: 0; }
  .test-mode-swift { display: none; }
  .bizdate [data-biz-status] { display: none; }
  .bizdate-value { font-size: 14px; }
}

/* OpenPayd (#/openpayd/...): live and test banners, the hard rule, balance differences, sub-headings, the payee-name
   advice on the payment form (advice only: it never blocks the payment), the sandbox tools and the customer IBAN block */
.opd-banner { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.opd-banner strong { letter-spacing: .05em; }
.opd-banner-codes { font-family: var(--mono); font-size: 12px; opacity: .85; }
.opd-test { background: var(--warn-bg); color: var(--warn); border: 2px dashed color-mix(in srgb, var(--warn) 55%, transparent); }
.opd-live { background: var(--bad-bg); color: var(--bad); border: 2px solid color-mix(in srgb, var(--bad) 65%, transparent); }
.opd-rule { margin: 0 0 14px; padding: 9px 12px; border-left: 3px solid var(--accent-line); background: var(--surface-2); border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; }
.opd-subhead { margin: 4px 0 8px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.opd-connection .kpis { margin-bottom: 14px; }
.opd-error { color: var(--bad); overflow-wrap: anywhere; }
.opd-diff { color: var(--bad); font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.opd-reason { color: var(--text-2); font-size: 12.5px; }
.opd-past { color: var(--bad); font-weight: 600; }
.opd-bound { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-2); font-size: 13px; }
.opd-iban-card { border-left: 3px solid var(--accent-line); }
.opd-sandbox { border-style: dashed; }
.opd-urls > summary { padding: 10px 16px; }
.opd-filters { border-bottom: 0; }
.opd-payee { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.opd-advice { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.opd-advice .cell-sub { display: block; margin-top: 2px; }
.opd-match { border-color: var(--good); background: var(--good-bg); }
.opd-match strong { color: var(--good); }
.opd-close { border-color: var(--warn); background: var(--warn-bg); }
.opd-close strong { color: var(--warn); }
.opd-nomatch { border-color: var(--bad); background: var(--bad-bg); }
.opd-nomatch strong { color: var(--bad); }
.opd-unknown { border-style: dashed; color: var(--text-2); }

/* Securities custody (#/custody/...): mode and simulator banners, quantities, the set-up form's side card, settlement
   instructions for counterparties, the flow steps, the upload note and the simulator's buttons */
.custody-banner { margin-bottom: 12px; }
.custody-banner strong { letter-spacing: .05em; }
.custody-test { background: var(--warn-bg); color: var(--warn); border: 2px dashed color-mix(in srgb, var(--warn) 55%, transparent); }
.custody-live { background: var(--bad-bg); color: var(--bad); border: 2px solid color-mix(in srgb, var(--bad) 65%, transparent); }
.custody-sim { background: var(--info-bg); color: var(--info); border: 2px dashed color-mix(in srgb, var(--info) 55%, transparent); }
.custody-rule { margin: 0; padding: 9px 12px; border-left: 3px solid var(--accent-line); background: var(--surface-2); border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px; }
.custody-note { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.custody-qty { font-variant-numeric: tabular-nums; white-space: nowrap; }
.custody-neg { color: var(--bad); }
.custody-unit { color: var(--muted); font-size: .86em; }
.custody-qty-input { font-variant-numeric: tabular-nums; }
.custody-diff { color: var(--bad); }
.custody-upload { color: var(--warn); font-weight: 550; }
.custody-upload-note { margin-bottom: 14px; }
.custody-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 16px; align-items: start; }
.custody-side { position: sticky; top: 12px; }
.custody-supplies { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.custody-supplies li strong { display: block; color: var(--text); }
.custody-ssi { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.custody-ssi-text { margin: 0; flex: 1; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.custody-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
.custody-steps strong { color: var(--text); }
.custody-subhead { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.custody-agent { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px 14px; }
.custody-simulator { border-style: dashed; }
.custody-sim-actions { margin-top: 8px; }
@media (max-width: 900px) {
  .custody-layout { grid-template-columns: minmax(0, 1fr); }
  .custody-side { position: static; }
  .custody-agent { grid-template-columns: minmax(0, 1fr); }
}

/* Non-SWIFT settlement (#/non-swift/...): mode, simulator and breaker banners, funding cells, the receipt dialog */
.nss-banner { margin-bottom: 12px; }
.nss-banner strong { letter-spacing: .05em; }
.nss-test { background: var(--warn-bg); color: var(--warn); border: 2px dashed color-mix(in srgb, var(--warn) 55%, transparent); }
.nss-live { background: var(--bad-bg); color: var(--bad); border: 2px solid color-mix(in srgb, var(--bad) 65%, transparent); }
.nss-sim { background: var(--info-bg); color: var(--info); border: 2px dashed color-mix(in srgb, var(--info) 55%, transparent); }
.nss-breaker { margin-bottom: 12px; }
.nss-unfunded { color: var(--muted); font-style: italic; }
.nss-funding { display: inline-flex; flex-direction: column; gap: 2px; }
.nss-funded-by { margin: 12px 0 0; color: var(--text-2); }
.nss-fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px 12px; margin: 12px 0 0; }
.nss-fieldset legend { padding: 0 6px; color: var(--muted); font-size: 12.5px; }
.nss-candidates { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; margin-bottom: 12px; }
.nss-candidate .choice-title { font-variant-numeric: tabular-nums; }
.nss-rules { margin-top: 12px; }
.nss-warnings li { align-items: flex-start; }
.nss-sim-actions { margin-top: 8px; }
.nss-prepaid-notice a { margin-left: 4px; }
