/* ============ Tokens ============
   Paper and ink: flat surfaces separated by thin rules, square corners, colour only where it
   carries meaning (approved / warning / declined). Same palette as the sign-in page. */
:root {
  --bg: #f5f3ef;
  --bg-grad: none;
  --surface: #fcfbf9;
  --surface-2: #f3f1ec;
  --surface-3: #eae7e0;
  --border: #dcd8cf;
  --border-strong: #bdb7ab;
  --text: #15181d;
  --text-2: #3a3f47;
  --muted: #6b717a;
  --accent: #15181d;          /* ink: primary actions, selection, chart line (keep 6-digit hex) */
  --accent-2: #2c3138;
  --accent-soft: rgba(21, 24, 29, 0.06);
  --accent-ring: rgba(21, 24, 29, 0.25);
  --on-accent: #f5f3ef;       /* text on ink */
  --ok: #1d7a52;
  --ok-soft: rgba(29, 122, 82, 0.09);
  --bad: #b3261e;
  --bad-soft: rgba(179, 38, 30, 0.07);
  --warn: #9a6a0f;
  --warn-soft: rgba(154, 106, 15, 0.09);
  --input: #ffffff;
  --shadow: none;
  --radius: 3px;
  --radius-sm: 3px;
  --ink: #0d1014;             /* top bar, always dark */
  --ink-text: #e8e6e1;
  --ink-muted: #8c929b;
  --ink-rule: rgba(232, 230, 225, 0.14);
  --ink-ok: #4fbf8b;
  --ink-bad: #ef7b72;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1215;
    --surface: #15191e;
    --surface-2: #12161a;
    --surface-3: #1d2228;
    --border: #272c33;
    --border-strong: #3b414a;
    --text: #e6e4df;
    --text-2: #bdbab3;
    --muted: #8b9199;
    --accent: #e6e4df;
    --accent-2: #ffffff;
    --accent-soft: rgba(230, 228, 223, 0.07);
    --accent-ring: rgba(230, 228, 223, 0.3);
    --on-accent: #111417;
    --ok: #4fbf8b;
    --ok-soft: rgba(79, 191, 139, 0.12);
    --bad: #ef7b72;
    --bad-soft: rgba(239, 123, 114, 0.1);
    --warn: #d6a54a;
    --warn-soft: rgba(214, 165, 74, 0.12);
    --input: #111418;
    --ink: #0a0c0f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1215;
  --surface: #15191e;
  --surface-2: #12161a;
  --surface-3: #1d2228;
  --border: #272c33;
  --border-strong: #3b414a;
  --text: #e6e4df;
  --text-2: #bdbab3;
  --muted: #8b9199;
  --accent: #e6e4df;
  --accent-2: #ffffff;
  --accent-soft: rgba(230, 228, 223, 0.07);
  --accent-ring: rgba(230, 228, 223, 0.3);
  --on-accent: #111417;
  --ok: #4fbf8b;
  --ok-soft: rgba(79, 191, 139, 0.12);
  --bad: #ef7b72;
  --bad-soft: rgba(239, 123, 114, 0.1);
  --warn: #d6a54a;
  --warn-soft: rgba(214, 165, 74, 0.12);
  --input: #111418;
  --ink: #0a0c0f;
  color-scheme: dark;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.mono { font-family: var(--mono); font-feature-settings: "zero" 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
b { font-weight: 600; }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; stroke: none; }
.bm-bg { fill: var(--accent); }
.bm-line { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.bm-dot { fill: #fff; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }
.target-wrap { position: relative; margin-left: auto; display: flex; align-items: center; gap: 10px; }
.target {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.15s;
}
.target:hover, .target[aria-expanded="true"] { border-color: var(--accent); }
.target .chev { margin-left: 0; width: 14px; height: 14px; }
.target[aria-expanded="true"] .chev { transform: rotate(180deg); }
.target-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.target-name { font-weight: 600; font-size: 13px; }
.target-value { font-size: 12.5px; color: var(--text-2); }

.target-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 40;
  width: min(520px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.6);
  padding: 14px;
  animation: toast-in 0.15s ease-out;
}
.pop-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pop-sub { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.target-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.t-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
}
.t-item:hover { border-color: var(--border-strong); }
.t-item.active { border-color: var(--accent); background: var(--accent-soft); }
.t-radio { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; }
.t-item.active .t-radio { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 45%, transparent 50%); }
.t-main { flex: 1; min-width: 0; }
.t-name { font-weight: 600; font-size: 13px; }
.t-addr { font: 12px var(--mono); color: var(--muted); }
.t-status { font-size: 11.5px; font-family: var(--mono); white-space: nowrap; }
.t-status.ok { color: var(--ok); }
.t-status.bad { color: var(--bad); }
.t-actions { display: flex; gap: 2px; }
.t-btn {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 7px;
  background: transparent; border: none; color: var(--muted);
}
.t-btn:hover { background: var(--surface-3); color: var(--text); }
.t-btn.del:hover { background: var(--bad-soft); color: var(--bad); }
.t-btn svg { width: 14px; height: 14px; }
.target-form { border-top: 1px solid var(--border); padding-top: 12px; }
.tf-grid { display: grid; grid-template-columns: 1.1fr 1.3fr 0.7fr; gap: 8px; }
.tf-grid .field { margin-bottom: 8px; }
.tf-actions { display: flex; align-items: center; gap: 6px; }
.tf-msg { flex: 1; font-size: 12px; font-family: var(--mono); color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-msg.ok { color: var(--ok); }
.tf-msg.bad { color: var(--bad); }
.btn.ghost-plain { background: var(--surface-3); color: var(--text-2); }
.btn.ghost-plain:hover:not(:disabled) { color: var(--text); }
.btn.primary-sm { background: var(--accent); color: #fff; }
.btn.primary-sm:hover:not(:disabled) { background: var(--accent-2); }
.sub { font-size: 11px; color: var(--muted); font-family: var(--font); margin-top: 2px; }
.conn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--surface-3); color: var(--muted);
}
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.conn.online { background: var(--ok-soft); color: var(--ok); }
.conn.online .conn-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn.offline { background: var(--bad-soft); color: var(--bad); }
.conn.offline .conn-dot { background: var(--bad); }
.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2);
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); }

/* ============ Layout ============ */
.layout {
  display: grid;
  grid-template-columns: minmax(380px, 460px) minmax(0, 1fr);
  gap: 20px;
  padding: 20px 28px 0;
  align-items: start;
}
.compose, .monitor { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.compose { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; padding-bottom: 4px; scrollbar-width: thin; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.open-card { margin: 20px 28px 32px; }

/* ============ Cards ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em; }
.step {
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent);
  font: 600 12px var(--mono);
}
.summary-hint { font-size: 12px; color: var(--muted); }
.hint { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.hint.inline { margin: 0; flex: 1 1 320px; }
.link-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  color: var(--accent); font-size: 12.5px; font-weight: 500;
}
.link-btn:hover { background: var(--accent-soft); }
.link-btn.danger { color: var(--bad); }
.link-btn.danger:hover { background: var(--bad-soft); }
.link-btn svg { width: 14px; height: 14px; }

/* Collapsible card */
.collapsible > summary { list-style: none; cursor: pointer; margin-bottom: 0; }
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible[open] > summary { margin-bottom: 12px; }
.chev { margin-left: auto; color: var(--muted); transition: transform 0.2s; }
.collapsible[open] .chev { transform: rotate(180deg); }
.collapsible .summary-hint { font-family: var(--mono); font-size: 11.5px; }

/* ============ Transaction type tiles ============ */
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.type-tile {
  position: relative;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.type-tile:hover { border-color: var(--border-strong); }
.type-tile:active { transform: scale(0.99); }
.type-tile[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.type-ico {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface-3); color: var(--text-2);
}
.type-tile[aria-checked="true"] .type-ico { background: var(--accent); color: #fff; }
.type-name { display: block; font-weight: 600; font-size: 13px; line-height: 1.25; }
.type-code { display: block; font: 11px var(--mono); color: var(--muted); margin-top: 2px; }
.type-tag {
  display: inline-block; margin-top: 5px;
  font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--warn); background: var(--warn-soft);
  padding: 1px 6px; border-radius: 5px;
}

/* ============ Data set ============ */
.format { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.format-label { font-size: 12px; color: var(--muted); }
.format-cols { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.col-chip {
  font: 500 11.5px var(--mono);
  padding: 3px 8px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--border);
}
.col-chip.req { color: var(--text); border-color: var(--border-strong); }
.col-sep { color: var(--muted); font-size: 12px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 20px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer; text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.drop input { display: none; }
.drop-icon { width: 22px; height: 22px; color: var(--accent); margin-bottom: 4px; }
.drop-title { font-weight: 500; }
.drop-title u { color: var(--accent); text-decoration: none; }
.drop-sub { font-size: 12px; color: var(--muted); }
.drop.loaded .drop-title::before { content: "✓ "; color: var(--ok); }

.paste { margin-top: 10px; }
.paste summary { font-size: 12.5px; color: var(--muted); cursor: pointer; width: fit-content; }
.paste summary:hover { color: var(--text-2); }
.paste textarea { margin-top: 8px; }

.preview { margin-top: 12px; }
.preview-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.preview-total { font: 12px var(--mono); color: var(--muted); }
.empty-note { font-size: 13px; color: var(--muted); padding: 14px; background: var(--surface-2); border-radius: 10px; border: 1px dashed var(--border); }

/* ============ Fields ============ */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field > span em { font-style: normal; opacity: 0.8; font-weight: 400; }
.field-row { display: grid; gap: 10px; }
.field-row.two { grid-template-columns: 1fr 1fr; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.field-row .field { margin-bottom: 10px; }
input[type="text"], input[type="number"], textarea {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="number"], input.mono, textarea { font-family: var(--mono); font-size: 13px; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tps {
  margin-left: auto;
  font: 500 12px var(--mono);
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 9px; border-radius: 999px;
}

/* Switch */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin-top: 2px; }
.switch input { display: none; }
.switch-track {
  position: relative; width: 32px; height: 18px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background 0.15s; flex-shrink: 0;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted); transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); background: #fff; }
.switch-label { font-size: 13px; color: var(--text-2); }
.switch-label em { font-style: normal; color: var(--muted); font-family: var(--mono); font-size: 12px; }

/* ============ Fire bar ============ */
.fire-bar {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 -10px 30px -20px rgba(0, 0, 0, 0.5);
}
.fire-summary { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.fire-summary b { color: var(--text); }
.fire-actions { display: flex; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px;
  font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.1s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -8px var(--accent-ring); }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.primary svg { fill: currentColor; stroke: none; width: 13px; height: 13px; }
.btn.ghost { background: transparent; border-color: var(--border-strong); color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.sm.ok { background: var(--ok-soft); color: var(--ok); }
.btn.sm.ok:hover:not(:disabled) { background: var(--ok); color: #fff; }
.btn.sm.bad { background: var(--bad-soft); color: var(--bad); }
.btn.sm.bad:hover:not(:disabled) { background: var(--bad); color: #fff; }
.banner {
  padding: 10px 14px; border-radius: 10px;
  background: var(--bad-soft); color: var(--bad);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  font-size: 13px;
}

/* ============ Monitor ============ */
.run-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.run-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.run-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.status {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--muted);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.running { background: var(--accent-soft); color: var(--accent); }
.status.running::before { animation: pulse 1.1s ease-in-out infinite; }
.status.done { background: var(--ok-soft); color: var(--ok); }
.status.cancelled { background: var(--warn-soft); color: var(--warn); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-bottom: 16px; }
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  border-radius: 999px; transition: width 0.35s ease;
}

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--border-strong); }
.kpi.ok::before { background: var(--ok); }
.kpi.bad::before { background: var(--bad); }
.kpi.warn::before { background: var(--warn); }
.kpi-val { font: 600 22px var(--mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi.ok .kpi-val { color: var(--ok); }
.kpi.bad .kpi-val { color: var(--bad); }
.kpi.warn .kpi-val { color: var(--warn); }
.kpi-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.legend { margin-left: auto; display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 3px; border-radius: 3px; display: inline-block; }
.lg-tps { background: var(--accent); }
.lg-lat { background: var(--warn); }
.chart-wrap { position: relative; height: 190px; }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); }

.code-bars { display: flex; flex-direction: column; gap: 10px; }
.code-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.code-badge { font: 600 12px var(--mono); text-align: center; padding: 3px 0; border-radius: 6px; background: var(--surface-3); }
.code-badge.ok { background: var(--ok-soft); color: var(--ok); }
.code-badge.bad { background: var(--bad-soft); color: var(--bad); }
.code-badge.warn { background: var(--warn-soft); color: var(--warn); }
.code-main { min-width: 0; }
.code-desc { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-track { height: 5px; border-radius: 5px; background: var(--surface-3); margin-top: 4px; overflow: hidden; }
.code-fill { height: 100%; border-radius: 5px; background: var(--muted); transition: width 0.35s; }
.code-fill.ok { background: var(--ok); }
.code-fill.bad { background: var(--bad); }
.code-fill.warn { background: var(--warn); }
.code-count { font: 500 12.5px var(--mono); color: var(--text-2); font-variant-numeric: tabular-nums; }

.error-list { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow-y: auto; }
.error-list li {
  font: 12px var(--mono); color: var(--bad);
  padding: 6px 8px; border-radius: 6px; margin-bottom: 4px;
  background: var(--bad-soft); word-break: break-word;
}
.error-list li.muted { background: none; color: var(--muted); font-family: var(--font); padding: 0; }

/* ============ Tables ============ */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 11px; }
.table-wrap.short { max-height: 230px; }
.table-wrap.tall { max-height: 380px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  text-align: left; font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); background: var(--surface-2);
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.muted { font-family: var(--font); }
.tbl tr.row-bad td { background: var(--bad-soft); }
.tbl td.reason { color: var(--bad); font-family: var(--font); }
.tbl input.settle { width: 100px; padding: 4px 8px; font-size: 12px; }
.tbl .actions { display: flex; gap: 6px; align-items: center; }
.result-msg { font-family: var(--font); font-size: 12px; }
.result-msg.ok { color: var(--ok); }
.result-msg.bad { color: var(--bad); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; font-family: var(--font);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.neutral { background: var(--surface-3); color: var(--text-2); }
.pill.code { font-family: var(--mono); }
.ccy { color: var(--muted); }

/* ============ Toasts ============ */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  min-width: 240px; max-width: 380px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: 0 14px 40px -16px rgba(0, 0, 0, 0.55);
  font-size: 13px;
  animation: toast-in 0.2s ease-out;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.bad { border-left: 3px solid var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ Responsive ============ */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .compose { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 720px) {
  .topbar { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .target-wrap { margin-left: 0; order: 3; width: 100%; justify-content: space-between; }
  .target-value { display: none; }
  .target-pop { right: auto; left: 0; }
  .tf-grid { grid-template-columns: 1fr 1fr; }
  .layout { padding: 16px 16px 0; }
  .open-card { margin: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .field-row.three { grid-template-columns: 1fr 1fr; }
  .brand-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============ View tabs ============ */
.views { display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.view-tab { border: none; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); }
.view-tab:hover { color: var(--text); }
.view-tab[aria-selected="true"] { background: var(--accent); color: #fff; }
.saved-note { font: 12px var(--mono); color: var(--muted); min-height: 16px; margin: -4px 0 8px; }
.saved-note.ok { color: var(--ok); }
.saved-note.bad { color: var(--bad); }

/* ============ UAT ============ */
.uat-layout {
  display: grid; grid-template-columns: minmax(380px, 1fr) minmax(0, 1.25fr);
  gap: 20px; padding: 20px 28px 32px; align-items: start;
}
.uat-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.uat-lib { position: sticky; top: 76px; max-height: calc(100vh - 92px); display: flex; flex-direction: column; }
.head-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.head-actions label.btn { cursor: pointer; }
.uat-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.uat-toolbar input[type="search"] {
  flex: 1; min-width: 0; background: var(--input); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 10px; outline: none; font-size: 13px;
}
.uat-toolbar input[type="search"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.uat-toolbar .link-btn { margin-left: 0; }
.link-btn:disabled { opacity: 0.4; cursor: not-allowed; background: none; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

.case-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.case-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer;
}
.case-item:hover { border-color: var(--border-strong); }
.case-item.sel { border-color: var(--accent); background: var(--accent-soft); }
.case-item .case-chk { margin-top: 2px; }
.case-main { flex: 1; min-width: 0; }
.case-title { font-weight: 600; font-size: 13px; }
.case-id { font-size: 11.5px; color: var(--accent); font-weight: 600; margin-right: 4px; }
.case-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 7px; }
.chain-step { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; }
.chain-step .pill { font-size: 11px; padding: 1px 7px; }
.chain-step .expect { color: var(--text-2); font-size: 11px; }
.chain-arrow { color: var(--muted); }
.case-item .t-actions { opacity: 0.55; }
.case-item:hover .t-actions { opacity: 1; }

.defaults-line { font-size: 12px; color: var(--text-2); padding: 9px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fire-bar.flat { position: static; box-shadow: none; border-color: var(--border); background: var(--surface-2); }
.run-actions { display: flex; gap: 8px; margin: -4px 0 12px; flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.progress-fill.bad { background: linear-gradient(90deg, var(--accent), var(--bad)); }

.uat-results { display: flex; flex-direction: column; gap: 6px; }
.res-case { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.res-head {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  background: var(--surface-2); border: none; text-align: left;
}
.res-head:hover { background: var(--surface-3); }
.res-head .chev { width: 14px; height: 14px; color: var(--muted); transition: transform 0.15s; }
.res-case.open .res-head .chev { transform: rotate(90deg); }
.res-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-steps { font-size: 11.5px; }
.res-body { display: none; border-top: 1px solid var(--border); }
.res-case.open .res-body { display: block; }
.tbl tr.row-warn td { background: var(--warn-soft); }
.tbl .sub.err { color: var(--bad); white-space: normal; max-width: 260px; }
.tbl tr.current td { background: var(--accent-soft); }
.link-plain { background: none; border: none; padding: 0; font: 600 12px var(--mono); color: var(--accent); }
.link-plain:hover { text-decoration: underline; }

/* Case editor */
.case-dlg {
  width: min(1060px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 18px 20px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
}
.case-dlg::backdrop { background: rgba(5, 8, 16, 0.55); backdrop-filter: blur(2px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dlg-head h2 { margin: 0; font-size: 16px; }
.cd-grid { display: grid; grid-template-columns: 220px 1fr; gap: 10px; }
.cd-steps-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 6px 0 8px; }
.cd-steps td { padding: 4px 4px; }
.cd-steps input, .cd-steps select {
  width: 100%; min-width: 70px; background: var(--input); border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 7px; font: 12px var(--mono); outline: none;
}
.cd-steps input.sm { min-width: 48px; width: 56px; }
.cd-steps select { font-family: var(--font); min-width: 120px; }
.cd-steps input:disabled { opacity: 0.35; }
.cd-steps input:focus, .cd-steps select:focus { border-color: var(--accent); }
.cd-steps .t-btn { width: 24px; height: 24px; font-size: 12px; }
.cd-add { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.dlg-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

@media (max-width: 1100px) {
  .uat-layout { grid-template-columns: 1fr; }
  .uat-lib { position: static; max-height: none; }
}
@media (max-width: 720px) {
  .uat-layout { padding: 16px; }
  .views { order: 2; }
  .cd-grid { grid-template-columns: 1fr; }
  .case-dlg { padding: 14px; }
}

/* Account roles */
.roles { border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; margin-bottom: 12px; background: var(--surface-2); }
.roles summary { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; list-style: none; font-size: 13px; font-weight: 500; }
.roles summary::-webkit-details-marker { display: none; }
.roles summary .chev { margin-left: auto; width: 14px; height: 14px; color: var(--muted); transition: transform 0.15s; }
.roles[open] summary .chev { transform: rotate(180deg); }
.roles .hint { margin-bottom: 10px; }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 6px 12px; max-height: 320px; overflow-y: auto; padding: 2px; }
.role-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px; align-items: center; gap: 8px; font-size: 12px; }
.role-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.role-row input { padding: 5px 8px !important; font-size: 12px !important; }
.role-row.need > span { color: var(--bad); }
.role-row.need input { border-color: var(--bad); }
.chain-step .role { font-size: 10.5px; color: var(--accent); }
.cd-grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .cd-grid.two { grid-template-columns: 1fr; } .role-row { grid-template-columns: 1fr; } }

/* ============ Paper & ink: console components ============
   Overrides the base component styles above to match the sign-in page:
   ink top bar, serif section titles, ledger-style figures, square controls. */

/* ---- top bar: ink band ---- */
.topbar {
  background: var(--ink); backdrop-filter: none; color: var(--ink-text);
  border-bottom: 1px solid #000; padding: 10px 28px; gap: 28px;
}
.brand-mark { width: 22px; height: 22px; fill: none; stroke: var(--ink-text); stroke-width: 1.6; stroke-linecap: square; stroke-linejoin: miter; }
.brand-name { font: 600 13px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.brand-sub { font-size: 11.5px; color: var(--ink-muted); }
.views { background: transparent; border: 0; border-radius: 0; padding: 0; gap: 18px; align-self: stretch; }
.view-tab {
  border-radius: 0; padding: 0 2px; font: 500 13px var(--font); color: var(--ink-muted);
  border-bottom: 2px solid transparent; margin-bottom: -11px; padding-bottom: 9px;
}
.view-tab:hover { color: var(--ink-text); }
.view-tab[aria-selected="true"] { background: transparent; color: var(--ink-text); border-bottom-color: var(--ink-text); }
.target { background: transparent; border: 1px solid var(--ink-rule); border-radius: var(--radius); padding: 6px 12px; color: var(--ink-text); }
.target:hover, .target[aria-expanded="true"] { border-color: var(--ink-muted); }
.target-label { color: var(--ink-muted); font: 500 10.5px var(--mono); letter-spacing: 0.1em; }
.target-name { font-weight: 600; }
.target-value { color: var(--ink-muted); }
.target .chev { color: var(--ink-muted); }
.conn { background: transparent; border-radius: 0; padding: 0; color: var(--ink-muted); font: 500 11.5px var(--mono); }
.conn-dot { border-radius: 0; width: 6px; height: 6px; }
.conn.online { background: transparent; color: var(--ink-muted); }
.conn.online .conn-dot { background: var(--ink-ok); box-shadow: none; }
.conn.offline { background: transparent; color: var(--ink-bad); }
.conn.offline .conn-dot { background: var(--ink-bad); }
.icon-btn { background: transparent; border: 1px solid var(--ink-rule); border-radius: var(--radius); color: var(--ink-text); width: 34px; height: 34px; }
.icon-btn:hover { border-color: var(--ink-muted); color: #fff; }
.topbar .btn.ghost-plain { background: transparent; border-color: var(--ink-rule); color: var(--ink-text); }
.topbar .btn.ghost-plain:hover:not(:disabled) { border-color: var(--ink-muted); }
.user-email { color: var(--ink-muted); }
/* the target menu opens below the bar on paper */
.target-pop { color: var(--text); border-radius: var(--radius); box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.45); border-color: var(--border-strong); }
.pop-head b { font: 400 19px var(--serif); }
.t-item { border-radius: var(--radius); background: var(--surface); }
.t-item.active { border-color: var(--accent); background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
.t-btn { border-radius: var(--radius); }

/* ---- page ---- */
body { font-size: 14px; }
.layout { padding-top: 24px; gap: 24px; }
.uat-layout { padding-top: 24px; gap: 24px; }
.compose, .monitor, .uat-side { gap: 18px; }
.compose { top: 70px; }
.uat-lib { top: 70px; }

/* ---- cards: flat, ruled ---- */
.card { border-radius: var(--radius); box-shadow: none; padding: 18px 20px 20px; }
.card-head { margin-bottom: 16px; }
.card-head h2 { font: 400 19px/1.2 var(--serif); letter-spacing: -0.005em; }
.step {
  width: auto; height: auto; border-radius: 0; background: none; color: var(--muted);
  font: 500 11px var(--mono); letter-spacing: 0.08em; padding-top: 2px;
}
.summary-hint { font-family: var(--font); }
.link-btn { color: var(--text); border-radius: var(--radius); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.link-btn:hover { background: transparent; text-decoration-color: currentColor; }
.link-btn.danger { color: var(--bad); text-decoration-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.link-btn.danger:hover { background: transparent; }
.link-plain { color: var(--text); font-family: var(--mono); }

/* ---- transaction tiles ---- */
.type-tile { border-radius: var(--radius); background: var(--surface); }
.type-tile[aria-checked="true"] { background: var(--surface); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.type-ico { border-radius: 2px; background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.type-tile[aria-checked="true"] .type-ico { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.type-ico svg { stroke-width: 1.6; }
.type-tag { border-radius: 2px; background: transparent; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); font-family: var(--mono); letter-spacing: 0.08em; }

/* ---- data set ---- */
.col-chip { border-radius: 2px; background: var(--surface-2); }
.drop { border-radius: var(--radius); border-width: 1px; background: transparent; }
.drop:hover, .drop.drag { border-color: var(--accent); background: var(--surface-2); }
.drop-icon { color: var(--text-2); }
.drop-title u { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.empty-note { border-radius: var(--radius); }

/* ---- fields & controls ---- */
.field > span { color: var(--text-2); }
input[type="text"], input[type="number"], input[type="search"], textarea, select { border-radius: var(--radius-sm); }
input:focus, textarea:focus, select:focus,
.uat-toolbar input[type="search"]:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tps { background: transparent; border: 1px solid var(--border); border-radius: 2px; color: var(--text-2); }
.switch-track { border-radius: 2px; }
.switch-track::after { border-radius: 1px; }
.switch input:checked + .switch-track::after { background: var(--on-accent); }

.btn { border-radius: var(--radius); font-weight: 500; }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.btn.primary:hover:not(:disabled) { background: var(--accent); opacity: 0.88; }
.btn.primary-sm { background: var(--accent); color: var(--on-accent); }
.btn.primary-sm:hover:not(:disabled) { background: var(--accent); opacity: 0.88; }
.btn.ghost { border-color: var(--border-strong); color: var(--text); }
.btn.ghost-plain { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn.ghost-plain:hover:not(:disabled) { border-color: var(--accent); }
.btn.sm { border-radius: var(--radius); }
.btn.sm.ok { background: transparent; border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); }
.btn.sm.ok:hover:not(:disabled) { background: var(--ok); color: var(--on-accent); }
.btn.sm.bad { background: transparent; border-color: color-mix(in srgb, var(--bad) 50%, transparent); color: var(--bad); }
.btn.sm.bad:hover:not(:disabled) { background: var(--bad); color: #fff; }
.fire-bar { border-radius: var(--radius); box-shadow: 0 -8px 20px -16px rgba(0, 0, 0, 0.35); }
.fire-bar.flat { box-shadow: none; }
.banner { border-radius: var(--radius); }

/* ---- monitor ---- */
.run-title { font: 400 22px/1.2 var(--serif); letter-spacing: -0.01em; }
.status { border-radius: 2px; background: transparent; border: 1px solid currentColor; padding: 3px 9px; font: 500 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.status::before { border-radius: 0; width: 6px; height: 6px; }
.status.idle { color: var(--muted); border-color: var(--border-strong); }
.status.running, .status.done, .status.cancelled { background: transparent; }
.progress { height: 3px; border-radius: 0; }
.progress-fill { background: var(--accent); border-radius: 0; }
.progress-fill.bad { background: var(--bad); }

.kpis { gap: 0; border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.kpi { border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; padding: 12px 14px 10px; }
.kpi::before { display: none; }
.kpi-val { font: 500 24px var(--mono); letter-spacing: -0.02em; }
.kpi-label { font: 500 10.5px var(--mono); letter-spacing: 0.1em; }

.lg { border-radius: 0; height: 2px; }
.code-badge { border-radius: 2px; background: transparent; border: 1px solid var(--border); }
.code-badge.ok { background: transparent; border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.code-badge.bad { background: transparent; border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.code-badge.warn { background: transparent; border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.code-track { height: 3px; border-radius: 0; }
.code-fill { border-radius: 0; }
.error-list li { border-radius: 2px; }

/* ---- tables ---- */
.table-wrap { border-radius: var(--radius); }
.tbl th { font: 500 10.5px var(--mono); letter-spacing: 0.1em; }
.pill { border-radius: 2px; padding: 1px 8px; }
.pill.ok { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 45%, transparent); }
.pill.bad { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 40%, transparent); }
.pill.warn { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent); }
.pill.neutral { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); color: var(--text-2); }

/* ---- toasts ---- */
.toast { border-radius: var(--radius); box-shadow: 0 12px 30px -18px rgba(0, 0, 0, 0.4); }

/* ---- UAT ---- */
.case-item { border-radius: var(--radius); background: var(--surface); }
.case-item.sel { border-color: var(--accent); background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
.case-id { color: var(--text); }
.chain-step .role { color: var(--text-2); }
.res-case, .roles { border-radius: var(--radius); }
.res-head { background: var(--surface-2); }
.case-dlg { border-radius: var(--radius); box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.55); }
.case-dlg::backdrop { background: rgba(13, 16, 20, 0.45); backdrop-filter: none; }
.dlg-head h2 { font: 400 22px var(--serif); }
.cd-steps input, .cd-steps select { border-radius: 2px; }

@media (max-width: 720px) {
  .topbar { padding: 10px 16px; gap: 12px; }
  .views { align-self: auto; }
  .view-tab { margin-bottom: 0; padding-bottom: 4px; }
}

/* ============ Hosted: header menu ============ */
.hosted-only { display: none; }
body.hosted.agent-ok .hosted-only { display: flex; }
.user-menu { align-items: center; gap: 6px; }
.user-email { font-size: 12px; color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .user-email { display: none; } }

/* ============ Hosted: sign-in / connect ============
   Split screen: an ink panel describing the product (with a sample ISO 8583 message log),
   and a plain paper panel with the form. Own palette, independent of the console theme. */
.gate {
  --gx-ink: #0d1014;
  --gx-ink-2: #12161c;
  --gx-ink-rule: rgba(232, 230, 225, 0.09);
  --gx-ink-text: #e8e6e1;
  --gx-ink-muted: #8c929b;
  --gx-signal: #4fbf8b;
  --gx-amber: #d6a54a;
  --gx-paper: #f5f3ef;
  --gx-text: #15181d;
  --gx-muted: #5d636c;
  --gx-rule: #d8d4cc;
  --gx-field: #ffffff;
  --gx-btn: #15181d;
  --gx-btn-text: #f5f3ef;
  --gx-bad: #b3261e;
  --gx-ok: #1d7a52;
  --gx-serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --gx-sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --gx-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  position: fixed; inset: 0; z-index: 60; overflow-y: auto;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  background: var(--gx-paper); color: var(--gx-text);
  font-family: var(--gx-sans); -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gate {
    --gx-paper: #111417; --gx-text: #e6e4df; --gx-muted: #979da6; --gx-rule: #2b3038;
    --gx-field: #171b20; --gx-btn: #e6e4df; --gx-btn-text: #111417; --gx-bad: #f2867d; --gx-ok: #5fcf99;
  }
}
:root[data-theme="dark"] .gate {
  --gx-paper: #111417; --gx-text: #e6e4df; --gx-muted: #979da6; --gx-rule: #2b3038;
  --gx-field: #171b20; --gx-btn: #e6e4df; --gx-btn-text: #111417; --gx-bad: #f2867d; --gx-ok: #5fcf99;
}
.gate[hidden] { display: none; }

/* ---- product side (always ink) ---- */
.gx-side {
  position: relative; background: var(--gx-ink); color: var(--gx-ink-text);
  /* faint ledger grid, fading out towards the bottom */
  background-image:
    linear-gradient(to bottom, rgba(13, 16, 20, 0) 0%, var(--gx-ink) 85%),
    repeating-linear-gradient(0deg, var(--gx-ink-rule) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, var(--gx-ink-rule) 0 1px, transparent 1px 32px);
}
.gx-side-inner { max-width: 660px; margin: 0 auto; padding: clamp(28px, 6vh, 64px) clamp(24px, 5vw, 64px) 40px; }
.gx-mark { display: flex; align-items: center; gap: 10px; margin-bottom: clamp(40px, 9vh, 88px); }
.gx-mark svg { width: 22px; height: 22px; fill: none; stroke: var(--gx-ink-text); stroke-width: 1.6; stroke-linecap: square; stroke-linejoin: miter; }
.gx-mark .brand-name { font: 600 13px var(--gx-mono); letter-spacing: 0.14em; text-transform: uppercase; }
.gx-kicker { font: 500 11.5px var(--gx-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gx-ink-muted); margin: 0 0 18px; }
.gx-title {
  font-family: var(--gx-serif); font-weight: 400; font-optical-sizing: auto;
  font-size: clamp(30px, 3.4vw, 46px); line-height: 1.08; letter-spacing: -0.015em;
  margin: 0 0 18px; max-width: 16ch; text-wrap: balance;
}
.gx-lead { font-size: 15.5px; line-height: 1.6; color: #b9bdc4; margin: 0 0 36px; max-width: 54ch; }

.gx-trace { margin: 0 0 40px; border: 1px solid var(--gx-ink-rule); background: rgba(18, 22, 28, 0.85); }
.gx-trace figcaption {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid var(--gx-ink-rule);
  font: 500 10.5px var(--gx-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gx-ink-muted);
}
.gx-live { display: inline-flex; align-items: center; gap: 7px; }
.gx-live i { width: 6px; height: 6px; background: var(--gx-signal); animation: gx-pulse 2.4s ease-in-out infinite; }
.gx-trace ol { list-style: none; margin: 0; padding: 10px 0; font: 12px/1.9 var(--gx-mono); font-variant-numeric: tabular-nums; }
.gx-trace li {
  display: grid; grid-template-columns: 92px 16px 44px minmax(0, 1fr) auto; gap: 8px; padding: 0 14px;
  color: #aeb3ba; white-space: nowrap; animation: gx-line 0.45s ease-out both;
}
.gx-trace li.in { color: var(--gx-ink-text); }
.gx-trace .t { color: #5f6670; }
.gx-trace .d { color: #5f6670; }
.gx-trace .m { color: var(--gx-ink-text); font-weight: 500; }
.gx-trace .x { overflow: hidden; text-overflow: ellipsis; }
.gx-trace .r { text-align: right; font-weight: 500; }
.gx-trace .r.ok { color: var(--gx-signal); }
.gx-trace .r.warn { color: var(--gx-amber); }
.gx-trace .r em { font-style: normal; color: var(--gx-signal); margin-left: 6px; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.08em; }
.gx-trace li:nth-child(1) { animation-delay: 0.25s; }
.gx-trace li:nth-child(2) { animation-delay: 0.55s; }
.gx-trace li:nth-child(3) { animation-delay: 0.85s; }
.gx-trace li:nth-child(4) { animation-delay: 1.15s; }
.gx-trace li:nth-child(5) { animation-delay: 1.45s; }
.gx-trace li:nth-child(6) { animation-delay: 1.75s; }
.gx-trace li:nth-child(7) { animation-delay: 2.05s; }
.gx-trace li:nth-child(8) { animation-delay: 2.35s; }
.gx-trace li:nth-child(9) { animation-delay: 2.65s; }
.gx-trace li:nth-child(10) { animation-delay: 2.95s; }
@keyframes gx-line { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes gx-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.gx-caps { margin: 0 0 36px; border-top: 1px solid var(--gx-ink-rule); }
.gx-caps > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--gx-ink-rule); }
.gx-caps dt { font: 500 11px/1.9 var(--gx-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gx-ink-muted); }
.gx-caps dd { margin: 0; font-size: 14px; line-height: 1.6; color: #c9ccd1; }
.gx-foot { margin: 0; font-size: 11.5px; line-height: 1.6; color: #666d77; max-width: 60ch; }

/* ---- form side ---- */
.gx-main {
  display: flex; align-items: flex-start; justify-content: center; padding: clamp(28px, 6vh, 64px) clamp(24px, 4vw, 56px) 40px;
  position: sticky; top: 0; align-self: start; min-height: 100vh; box-sizing: border-box;   /* form stays put while the product side scrolls */
  border-left: 1px solid var(--gx-rule);
}
.gx-panel { width: 100%; max-width: 400px; padding-top: clamp(0px, 14vh, 150px); }
.gate-step[data-step="connect"] { max-width: 440px; }
.gx-eyebrow { font: 500 11px var(--gx-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gx-muted); margin: 0 0 10px; }
.gate h2 { font: 400 32px/1.1 var(--gx-serif); letter-spacing: -0.01em; margin: 0 0 28px; }
.gx-note { font-size: 14px; line-height: 1.6; color: var(--gx-muted); margin: -14px 0 24px; }
.gx-field { display: block; margin-bottom: 18px; }
.gx-field > span { display: block; font-size: 12.5px; font-weight: 500; color: var(--gx-text); margin-bottom: 7px; }
.gx-field > span em { font-style: normal; font-weight: 400; color: var(--gx-muted); }
.gate .gx-field input {
  width: 100%; height: 44px; padding: 0 12px; box-sizing: border-box;
  background: var(--gx-field); color: var(--gx-text); border: 1px solid var(--gx-rule); border-radius: 3px;
  font: 15px var(--gx-sans); outline: none; box-shadow: none; transition: border-color 0.12s;
}
.gate .gx-field input.mono { font: 13.5px var(--gx-mono); }
.gate .gx-field input:hover { border-color: #b9b4aa; }
.gate .gx-field input:focus { border-color: var(--gx-text); box-shadow: inset 0 0 0 1px var(--gx-text); }
.gx-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 46px; padding: 0 18px;
  background: var(--gx-btn); color: var(--gx-btn-text); border: 1px solid var(--gx-btn); border-radius: 3px;
  font: 500 14.5px var(--gx-sans); letter-spacing: 0.01em; cursor: pointer; transition: opacity 0.12s;
}
.gx-btn:hover { opacity: 0.88; }
.gx-btn:focus-visible { outline: 2px solid var(--gx-text); outline-offset: 2px; }
.gx-btn-quiet { background: transparent; color: var(--gx-text); border-color: var(--gx-rule); height: 40px; }
.gate-msg { font-size: 13px; line-height: 1.5; min-height: 20px; color: var(--gx-muted); margin: 2px 0 10px; }
.gate-msg.ok { color: var(--gx-ok); }
.gate-msg.bad { color: var(--gx-bad); }
.gate-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--gx-rule); }
.gx-link { background: none; border: none; padding: 0; font: 500 13.5px var(--gx-sans); color: var(--gx-text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--gx-rule); cursor: pointer; }
.gx-link:hover { text-decoration-color: currentColor; }

.gx-steps { list-style: none; margin: 0 0 20px; padding: 0; counter-reset: gx; border-top: 1px solid var(--gx-rule); }
.gx-steps li { counter-increment: gx; position: relative; padding: 16px 0 16px 44px; border-bottom: 1px solid var(--gx-rule); }
.gx-steps li::before { content: counter(gx, decimal-leading-zero); position: absolute; left: 0; top: 17px; font: 500 12px var(--gx-mono); color: var(--gx-muted); }
.gx-steps li > b { display: block; font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.gx-steps li > span { display: block; font-size: 13.5px; line-height: 1.55; color: var(--gx-muted); }
.gx-steps li > span b { color: var(--gx-text); font-weight: 600; }
.gate-row { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-top: 12px; }
.gate-manual { margin-top: 4px; }
.gate-manual summary { cursor: pointer; font-size: 13.5px; font-weight: 500; margin-bottom: 14px; }

/* ---- narrow screens: product summary first, form next, log hidden ---- */
@media (max-width: 960px) {
  .gate { grid-template-columns: 1fr; }
  .gx-main { position: static; min-height: 0; border-left: 0; }
  .gx-mark { margin-bottom: 28px; }
  .gx-panel { padding-top: 0; }
  .gx-trace { display: none; }
  .gx-caps > div { grid-template-columns: 1fr; gap: 4px; }
  .gx-lead { margin-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .gx-trace li, .gx-live i { animation: none; }
}

/* ISO version tag on the target button; profile picker */
.target-fmt { font: 500 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); border: 1px solid var(--ink-rule); border-radius: 2px; padding: 1px 6px; }
.target-fmt.warn { color: #d6a54a; border-color: rgba(214, 165, 74, 0.5); }
.target-form select { width: 100%; background: var(--input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text); }
@media (max-width: 720px) { .target-fmt { display: none; } }

/* ============ Placeholder card warning ============ */
.sample-banner {
  display: flex; align-items: flex-start; gap: 14px; justify-content: space-between;
  padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent);
  border-left: 3px solid var(--warn); border-radius: var(--radius);
  background: var(--warn-soft); color: var(--text); font-size: 13px; line-height: 1.5;
}
.sample-banner b { font-weight: 600; }
.sample-banner .btn { flex-shrink: 0; }
.uat-side .sample-banner { margin-bottom: 12px; }
.sample-note { font-size: 12.5px; color: var(--warn); margin: -2px 0 10px; }
input.is-sample { border-color: var(--warn) !important; box-shadow: inset 0 0 0 1px var(--warn) !important; }

/* ============ Open transactions: filters, bulk actions ============ */
.ot-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ot-toolbar select, .ot-toolbar input[type="search"] {
  background: var(--input); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 9px; font-size: 13px; color: var(--text); outline: none;
}
.ot-toolbar input[type="search"] { flex: 1; min-width: 200px; }
.ot-toolbar input[type="search"]:focus, .ot-toolbar select:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ot-bulk {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 9px 12px; margin-bottom: 10px; border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--surface-2);
}
.ot-bulk-count { font-weight: 600; font-size: 13px; }
.ot-bulk-total { font-size: 12px; color: var(--text-2); }
.ot-bulk-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ot-bulk-actions .link-btn { margin-left: 0; }
.ot-progress { margin-bottom: 10px; }
.ot-progress-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 12px var(--mono); color: var(--text-2); margin-bottom: 6px; }
.ot-progress .progress { margin-bottom: 0; }
.ot-summary { padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: var(--radius); font-size: 13px; position: relative; }
.ot-summary.bad { border-left-color: var(--bad); }
.ot-summary .bad { color: var(--bad); }
.ot-summary ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: var(--text-2); }
.ot-summary .link-btn { position: absolute; top: 6px; right: 6px; }
#authTableBody tr.selected td { background: var(--accent-soft); }
.tbl th.c, .tbl td.c { width: 32px; text-align: center; }

/* ============ Feedback: requests & ideas ============ */
.fb-open { position: relative; }
.fb-badge {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; margin-left: 6px; padding: 0 4px;
  border-radius: 2px; background: #d6a54a; color: #0d1014; font: 600 10px var(--mono);
}
.fb-dlg {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 20px 22px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.55);
}
.fb-dlg::backdrop { background: rgba(13, 16, 20, 0.45); }
.fb-eyebrow { margin: 0 0 4px; font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.fb-dlg h2 { margin: 0; font: 400 24px var(--serif); }
.fb-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin: 14px 0 14px; }
.fb-tab { border: 0; background: none; padding: 0 0 8px; margin-bottom: -1px; font: 500 13.5px var(--font); color: var(--muted); border-bottom: 2px solid transparent; }
.fb-tab:hover { color: var(--text); }
.fb-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.fb-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.fb-toolbar select, .fb-toolbar input, .fb-dlg form select, .fb-admin select {
  background: var(--input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 9px; font-size: 13px; color: var(--text); outline: none;
}
.fb-dlg form select { width: 100%; padding: 8px 10px; }
.fb-toolbar input { flex: 1; min-width: 160px; }
.fb-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.fb-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.fb-vote {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 0 5px; width: 44px;
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-2); font: 500 12px var(--mono);
}
.fb-vote svg { width: 14px; height: 14px; }
.fb-vote:hover { border-color: var(--accent); }
.fb-vote.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.fb-head { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; }
.fb-title { display: block; font-weight: 600; font-size: 14px; }
.fb-meta { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.fb-meta b { color: var(--text-2); font-weight: 500; }
.fb-meta .fb-new { color: var(--warn); }
.fb-detail { display: none; margin-top: 10px; }
.fb-item.open .fb-detail { display: block; }
.fb-text { margin: 0; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; color: var(--text-2); }
.fb-reply { margin-top: 10px; padding: 10px 12px; border-left: 2px solid var(--accent); background: var(--surface-2); }
.fb-reply span { font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.fb-reply p { margin: 4px 0 0; font-size: 13.5px; white-space: pre-wrap; }
.fb-admin { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.fb-admin .fb-requester { grid-column: 1 / -1; font: 12px var(--mono); color: var(--muted); }
.fb-admin textarea { grid-column: 1 / -1; }
.fb-status { font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px; border: 1px solid currentColor; border-radius: 2px; color: var(--muted); white-space: nowrap; }
.fb-status.s-planned, .fb-status.s-in_progress { color: var(--text); }
.fb-status.s-done { color: var(--ok); }
.fb-status.s-declined { color: var(--bad); }
.fb-empty { padding: 18px 0; color: var(--muted); font-size: 13px; }
.fb-lead { margin: 0 0 14px; font-size: 13.5px; color: var(--text-2); }
.fb-privacy { margin: 0 0 12px; font-size: 12.5px; color: var(--warn); }
.fb-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.fb-msg { font-size: 12.5px; color: var(--muted); }
.fb-msg.ok { color: var(--ok); }
.fb-msg.bad { color: var(--bad); }
@media (max-width: 720px) { .fb-item { grid-template-columns: 40px minmax(0, 1fr); } .fb-status { grid-column: 2; justify-self: start; } }

/* ---- errors card: grouped messages + explanation ---- */
.error-list { max-height: 280px; }
.error-list li .err-n { font-weight: 600; margin-right: 4px; }
.error-list li.err-hint {
  font: 13px/1.5 var(--font); color: var(--text); background: var(--warn-soft);
  box-shadow: inset 2px 0 0 var(--warn);
}

/* ---- load test: single type / bundle ---- */
.mode-seg { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.mode-tab { border: 0; background: var(--surface); color: var(--muted); font: 500 12.5px var(--font); padding: 5px 11px; cursor: pointer; }
.mode-tab + .mode-tab { border-left: 1px solid var(--border); }
.mode-tab:hover { color: var(--text); }
.mode-tab[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.type-tile:disabled { opacity: 0.45; cursor: not-allowed; }
.type-tile:disabled:active { transform: none; }

.bundle { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.bundle-presets { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.bundle-presets .format-label { margin-right: 6px; }
.bundle-bar { display: flex; height: 8px; gap: 2px; margin-bottom: 10px; }
.bundle-bar:empty { display: none; }
.bundle-bar span { min-width: 3px; }
/* Shares are told apart by shade, not hue: colour is kept for outcomes. */
.bb-0 { background: color-mix(in srgb, var(--text) 88%, transparent); }
.bb-1 { background: color-mix(in srgb, var(--text) 62%, transparent); }
.bb-2 { background: color-mix(in srgb, var(--text) 42%, transparent); }
.bb-3 { background: color-mix(in srgb, var(--text) 26%, transparent); }
.bb-4 { background: color-mix(in srgb, var(--text) 15%, transparent); }
.bb-5 { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--text) 45%, transparent) 0 2px, transparent 2px 5px); }
.bundle-list { list-style: none; margin: 0; padding: 0; }
/* Two lines per item, so it reads the same in a narrow column: name, weight, remove / follow-up. */
.bundle-item {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 24px; align-items: center; gap: 6px 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.bi-swatch { width: 10px; height: 10px; }
.bi-name { font-size: 13.5px; font-weight: 500; min-width: 0; }
.bi-name .type-code { display: inline; margin-left: 8px; font-weight: 400; }
.bi-name .type-tag { vertical-align: 1px; }
.bi-weight { display: inline-flex; align-items: center; gap: 6px; }
.bi-weight input { width: 58px; padding: 5px 6px; text-align: right; font: 13px var(--mono); background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.bi-share { font: 12px var(--mono); color: var(--muted); min-width: 34px; text-align: right; }
.bundle-item select { grid-column: 2 / 4; justify-self: start; padding: 4px 6px; font-size: 12.5px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.bundle-item select:disabled { color: var(--muted); }
.bi-remove { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0; }
.bi-remove:hover { color: var(--bad); }
.bundle-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
.bundle-effect { margin: 10px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.bundle-effect b { color: var(--text); }

/* ---- monitor: per-type breakdown ---- */
.kind-tbl .kind-follow td { color: var(--muted); }
.kind-tbl .kind-follow td:first-child { padding-left: 22px; }
.kind-tbl td.t-bad { color: var(--bad); }
.kind-tbl td.t-warn { color: var(--warn); }
.tbl td.type-cell { white-space: nowrap; }

/* ---- money side: bank database, money trail, load-test check ---- */
.money-actions { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; }
.money-col { display: none; }
#resultsTable.with-money .money-col { display: table-cell; }
.mt-link { cursor: pointer; border: 0; font: inherit; }
.pill.mt-link:hover { text-decoration: underline; }
.money-sum { margin: -4px 0 12px; padding: 9px 12px; font-size: 13px; border: 1px solid var(--border); border-left: 3px solid var(--muted); background: var(--surface-2); }
.money-sum.all-ok { border-left-color: var(--ok); }
.money-sum.has-bad { border-left-color: var(--bad); }
.money-sum ul { margin: 6px 0 0; padding-left: 18px; }
.money-sum li { margin: 2px 0; }
.ok-t { color: var(--ok); }
.bad-t { color: var(--bad); }
.money-line { margin-top: 4px; }
.money-line .pill { font-size: 11px; padding: 1px 7px; }

.money-dlg .field-row { margin-bottom: 10px; }
.money-dlg form select { width: 100%; padding: 8px 10px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.db-driver { font-size: 12.5px; color: var(--muted); margin: 10px 0; overflow-wrap: anywhere; }
.db-driver.bad { color: var(--bad); }
.db-driver .link-btn { margin-left: 4px; padding: 0 4px; }
.db-driver-box { margin: 10px 0; }
.db-driver-box .db-driver { margin: 0 0 8px; }
.db-driver-edit .field { margin-bottom: 4px; }
.db-driver-edit .field > span:first-child { display: block; margin-bottom: 6px; }
.db-driver-row { display: flex; gap: 8px; }
.db-driver-row input { flex: 1; min-width: 0; padding: 7px 10px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; }
.db-driver-hint { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
#dbDriverMsg:empty { display: none; }
@media (max-width: 640px) { .db-driver-row { flex-direction: column; } }
.db-test { border: 1px solid var(--border); background: var(--surface-2); padding: 10px 12px; margin-bottom: 10px; font-size: 13px; }
.db-test p { margin: 0 0 6px; }
.db-test p.ok b { color: var(--ok); }
.db-test p.bad b { color: var(--bad); }
.db-tables { list-style: none; margin: 0; padding: 0; }
.db-tables li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--border); }
.db-tables li::before { content: '✓'; color: var(--ok); width: 14px; flex: none; }
.db-tables li.bad::before { content: '✗'; color: var(--bad); }
.db-tables li.muted::before { content: '–'; color: var(--muted); }
.db-tables li span:first-of-type { flex: 1; }
.db-tables li .mono { font-size: 12px; color: var(--muted); }

.mt-dlg { width: min(980px, calc(100vw - 32px)); }
.mt-form { display: flex; gap: 8px; align-items: center; margin: 4px 0 14px; flex-wrap: wrap; }
.mt-form input { width: 220px; padding: 7px 10px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.mt-msgs { list-style: none; margin: 0 0 6px; padding: 0; }
.mt-msg { border: 1px solid var(--border); border-left: 3px solid var(--ok); padding: 9px 12px; margin-bottom: 8px; }
.mt-msg.is-bad { border-left-color: var(--bad); }
.mt-msg-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mt-mti { font-weight: 600; }
.mt-kind { flex: 1; min-width: 180px; font-size: 13px; color: var(--muted); }
.mt-checks { margin: 6px 0 4px; padding-left: 0; list-style: none; font-size: 13px; }
.mt-checks li { padding-left: 20px; position: relative; margin: 2px 0; }
.mt-checks li::before { position: absolute; left: 0; content: '✓'; color: var(--ok); }
.mt-checks li.bad { color: var(--bad); }
.mt-checks li.bad::before { content: '✗'; color: var(--bad); }
.mt-checks li.muted { color: var(--muted); }
.mt-checks li.muted::before { content: '•'; color: var(--muted); }
.mt-meta { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.mt-h { font: 500 10.5px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.mt-h .muted { text-transform: none; letter-spacing: 0; }
.warn-t { color: var(--warn); }
.money-sum.has-wait { border-left-color: var(--warn); }
.money-sum p { margin: 6px 0 0; }
.mt-msg.is-wait { border-left-color: var(--warn); }
.mt-checks li.wait { color: var(--warn); }
.mt-checks li.wait::before { content: '⏳'; font-size: 11px; }
.bal-line { margin-top: 4px; font-size: 12px; color: var(--text); white-space: normal; }
.bal-line b { font: 500 12px var(--mono); }
.mt-checks li.warn { color: var(--warn); }
.mt-checks li.warn::before { content: '⚠'; color: var(--warn); }
.mt-stmt { margin-top: 8px; }
.mt-stmt th { white-space: nowrap; }
.mt-stmt .mt-sep { width: 10px; border-left: 1px solid var(--border-strong); padding: 0; }

/* ---- plans ---- */
.plan-badge {
  border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; color: #f3f1ec;
  font: 500 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 9px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
}
.plan-badge:hover { border-color: rgba(255, 255, 255, 0.6); }
.plan-badge.p-team, .plan-badge.p-enterprise { background: #f3f1ec; color: #15181d; border-color: #f3f1ec; }
.plan-badge.p-developer { border-style: dashed; }
.plan-hint { font-size: 12px; color: var(--warn); }
p.plan-hint { margin: 0 0 10px; }
.mode-tab.locked::after { content: ' 🔒'; font-size: 11px; }
.plan-dlg { width: min(560px, calc(100vw - 32px)); }
.plan-sub { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 6px 0 12px; }
.plan-features { list-style: none; margin: 0 0 14px; padding: 0; border-top: 1px solid var(--border); }
.plan-features li { padding: 7px 0 7px 22px; border-bottom: 1px solid var(--border); font-size: 13.5px; position: relative; }
.plan-features li::before { position: absolute; left: 2px; content: '✓'; color: var(--ok); }
.plan-features li.off { color: var(--muted); }
.plan-features li.off::before { content: '🔒'; font-size: 11px; top: 9px; }
.plan-features li.note { color: var(--muted); font-size: 12.5px; padding-left: 2px; }
.plan-features li.note::before { content: none; }
.plan-code .field > span:first-child { display: block; margin-bottom: 6px; }
.plan-code-row { display: flex; gap: 8px; }
.plan-code-row input { flex: 1; padding: 7px 10px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); text-transform: uppercase; }
.plan-local { font-size: 13px; color: var(--muted); }
.plan-paste { margin: 12px 0; font-size: 13px; }
.plan-paste summary { cursor: pointer; color: var(--muted); }
.plan-paste textarea { width: 100%; margin: 8px 0; padding: 7px 9px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 11.5px; }
.upgrade-dlg { width: min(480px, calc(100vw - 32px)); }
.access-dlg { width: min(980px, calc(100vw - 32px)); }
.access-dlg .field-row { margin-bottom: 10px; }
.access-dlg form select, .access-dlg form input { width: 100%; padding: 7px 9px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.acc-form { margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.acc-submit { display: flex; align-items: flex-end; justify-content: flex-end; }
.acc-actions { white-space: nowrap; text-align: right; }
.acc-actions .link-btn { margin-left: 2px; padding: 5px 6px; }
.tbl tr.row-muted td { color: var(--muted); }

/* ============ Buying: offers, "Talk to us", admin renewals & sales ============ */
.plan-buy { margin: 0 0 14px; }
.plan-offers { display: grid; gap: 10px; }
.plan-offers:empty { display: none; }
.plan-offer { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.plan-offer-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.plan-offer-head strong { font-size: 15px; }
.plan-price { font-size: 12.5px; color: var(--muted); }
.plan-offer p { margin: 4px 0 10px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.plan-buy-foot { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.plan-buy-foot .link-btn { padding: 0; }
.quote-dlg { width: min(520px, calc(100vw - 32px)); }
.quote-dlg input, .quote-dlg select, .quote-dlg textarea { width: 100%; padding: 7px 9px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; }
.quote-dlg textarea { resize: vertical; }
.quote-dlg .fb-actions { margin-top: 6px; }
.tab-count { margin-left: 6px; font: 600 11px var(--mono); color: #d6a54a; }
.tab-count:empty { display: none; }
.acc-h { font-size: 13px; font-weight: 600; margin: 4px 0 8px; }
.acc-h:not(:first-child) { margin-top: 18px; }
.tbl td.sales-msg { min-width: 160px; max-width: 280px; white-space: pre-wrap; font: 12.5px var(--font); }
.sales-status { padding: 3px 6px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; }
.access-dlg .fb-tabs { flex-wrap: wrap; gap: 8px 18px; }
.access-dlg .fb-tab { white-space: nowrap; }
.tbl td.wrap { white-space: normal; min-width: 150px; max-width: 280px; font-family: var(--font); }
@media (max-width: 640px) {
  .quote-dlg .field-row.two { grid-template-columns: 1fr; }
  .sales-msg { max-width: 180px; }
}

/* ============ Public pages: pricing, terms, privacy, refunds ============ */
body.doc-page { background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
.doc-top { border-bottom: 1px solid var(--border); background: var(--surface); }
.doc-top-in, .doc-foot-in { max-width: 920px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.doc-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font: 600 12px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.doc-brand svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.doc-nav { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.doc-nav a, .doc-foot a { color: var(--muted); text-decoration: none; }
.doc-nav a:hover, .doc-foot a:hover { color: var(--text); text-decoration: underline; }
.doc-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.doc { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 36px 20px 56px; }
.doc.wide { max-width: 920px; }
.doc h1 { font: 500 38px/1.15 var(--serif); margin: 0 0 8px; letter-spacing: -0.01em; }
.doc .doc-meta { color: var(--muted); font-size: 13px; margin: 0 0 28px; }
.doc .doc-lead { font-size: 16px; line-height: 1.6; margin: 0 0 26px; }
.doc h2 { font: 600 17px/1.3 var(--font); margin: 32px 0 8px; }
.doc h3 { font: 600 14.5px/1.3 var(--font); margin: 20px 0 6px; }
.doc p, .doc li { font-size: 14.5px; line-height: 1.65; }
.doc p { margin: 0 0 12px; }
.doc ul { margin: 0 0 12px; padding-left: 22px; }
.doc li { margin-bottom: 5px; }
.doc a { color: var(--text); text-underline-offset: 3px; }
.doc .doc-box { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0 0 18px; }
.doc .doc-box p:last-child { margin-bottom: 0; }
.doc-foot { border-top: 1px solid var(--border); }
.doc-foot-in { font-size: 12.5px; color: var(--muted); }
.doc-foot-in span { margin-right: auto; }
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0 0 22px; }
.price-card { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 18px; display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--text); }
.price-card h2 { margin: 0 0 4px; font: 500 24px var(--serif); }
.price-card .price { font: 600 15px var(--mono); margin: 4px 0 2px; min-height: 22px; }
.price-card .price-note { font-size: 12px; color: var(--muted); margin: 0 0 12px; min-height: 16px; }
.price-card ul { list-style: none; padding: 0; margin: 0 0 16px; flex: 1; }
.price-card li { font-size: 13.5px; padding: 6px 0 6px 20px; border-top: 1px solid var(--border); position: relative; margin: 0; }
.price-card li::before { content: '✓'; position: absolute; left: 2px; color: var(--ok); }
.price-card .doc-cta { display: inline-block; text-align: center; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--text); color: var(--text); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.price-card.featured .doc-cta { background: var(--text); color: var(--bg); }
.gx-legal { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; }
.gx-legal a { color: inherit; opacity: 0.75; }
.gx-legal a:hover { opacity: 1; }
.plan-legal { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.plan-legal a { color: inherit; }
@media (max-width: 760px) {
  .price-grid { grid-template-columns: 1fr; }
  .doc h1 { font-size: 30px; }
  .doc-nav { margin-left: 0; width: 100%; }
}

/* ============ Top bar: account menu, quieter target ============ */
.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; }
.view-tab { white-space: nowrap; }
.topbar .brand { gap: 10px; }
.topbar .target { gap: 8px; white-space: nowrap; }
.topbar .target-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.topbar .target-fmt:not(.warn) { display: none; }
.topbar .target .conn { display: inline-flex; align-items: center; }
.acct { position: relative; align-items: center; }
.acct-btn { position: relative; width: 34px; height: 34px; display: grid; place-items: center; background: transparent; border: 1px solid var(--ink-rule); border-radius: 50%; color: var(--ink-text); cursor: pointer; font: 600 13px var(--mono); }
.acct-btn:hover, .acct-btn[aria-expanded="true"] { border-color: var(--ink-muted); }
.acct-dot { position: absolute; top: 1px; right: 1px; width: 8px; height: 8px; border-radius: 50%; background: #d6a54a; box-shadow: 0 0 0 2px var(--ink); }
.acct-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 230px; padding: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.45); }
.acct-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.acct-label { font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.acct-menu .user-email { max-width: 260px; font-size: 13px; color: var(--text); }
.acct-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 10px; background: none; border: 0; border-radius: var(--radius-sm); color: var(--text); font: 500 13px var(--font); text-align: left; cursor: pointer; }
.acct-item:hover, .acct-item:focus-visible { background: var(--surface-2); outline: none; }
.acct-item[hidden] { display: none; }
.acct-item[data-signout] { color: var(--bad); }
.acct-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.acct-menu .fb-badge { margin-left: auto; }
.gx-note-upgrade { border-left: 2px solid #d6a54a; padding-left: 10px; }
