/* =============================================================================
   First Class Accounts · Employee Reimbursement Automation — concept demo
   Brand: white surfaces, First Class Accounts red, grey type. Kept deliberately
   plain — this is a bookkeeping tool, not a dashboard demo.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Roboto+Mono:wght@400;500&display=swap');

/* --- Tokens -------------------------------------------------------------- */
:root {
  /* Surfaces */
  --bg: #ffffff;
  --bg-2: #fafafb;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --surface-3: #eceef2;

  /* Lines */
  --line: #e6e8ec;
  --line-2: #d5d9e0;

  /* Type */
  /* Grey ramp kept dark enough to stay legible on white at 10–13px. */
  --text: #14181f;
  --text-2: #48515c;
  --text-3: #5f6875;
  --text-4: #78818d;

  /* First Class Accounts red, sampled from the brand mark */
  --accent: #d91e4b;
  --accent-dark: #b81840;
  --accent-soft: #fdeef2;
  --accent-line: #f5c6d2;

  /* Secondary slate, from the National Site button */
  --ink: #2e4854;
  --ink-soft: #eaf0f4;

  /* Functional states — muted, so the chrome stays white/red/grey */
  --good: #0e7a3c;
  --good-soft: #e9f6ef;
  --warn: #a85b00;
  --warn-soft: #fff4e5;
  --bad: #c2173f;
  --bad-soft: #fdebef;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.16);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 40px;

  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Manrope', system-ui, -apple-system, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --sidebar-w: 236px;
  --topbar-h: 62px;
}

/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -0.015em; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
input, select, textarea { font: inherit; }
::selection { background: rgba(217, 30, 75, 0.15); }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3d7de; border-radius: 10px; border: 3px solid #fff; }
::-webkit-scrollbar-thumb:hover { background: #b9bec7; }

/* --- Demo banner --------------------------------------------------------- */
.demo-banner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 7px 16px; text-align: center;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-line);
  font-size: 12.5px; color: var(--accent-dark); letter-spacing: 0.01em;
}
.demo-banner strong { color: var(--accent); font-weight: 700; }
.demo-banner span { color: var(--text-3); }

/* --- App shell ----------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - 32px); }

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  padding: 16px 12px 24px;
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}

/* --- Brand mark ---------------------------------------------------------- */
.brand { padding: 4px 8px 16px; }
.brand-logo { display: block; width: 100%; max-width: 186px; height: auto; }
.brand-sub {
  display: block; margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--text-4); letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.4;
}

.nav-group { margin-top: 4px; }
.nav-label { font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--text-4); padding: 13px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 14.5px; text-align: left;
  transition: background 0.14s, color 0.14s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.nav-item .ico { width: 17px; flex: 0 0 17px; color: var(--text-4); }
.nav-item.is-active .ico { color: var(--accent); }
.nav-count {
  margin-left: auto; font-size: 11.5px; font-weight: 600; min-width: 22px; text-align: center;
  padding: 1px 6px; border-radius: 20px; background: var(--surface-3); color: var(--text-3);
}
.nav-count.is-alert { background: var(--accent); color: #fff; }
.nav-foot { margin-top: auto; padding: 16px 12px 0; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-4); line-height: 1.65; }
.nav-foot b { color: var(--text-3); font-weight: 600; }

/* --- Top bar ------------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 18px; }
.topbar .sub { color: var(--text-4); font-size: 12.5px; margin-left: 1px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }

.clock {
  display: flex; align-items: center; gap: 7px; padding: 6px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  font-size: 12.5px; color: var(--text-3); background: #fff;
}
.clock b { color: var(--text); font-weight: 600; }
.clock .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.select, .input {
  background: #fff; border: 1px solid var(--line-2); color: var(--text-2);
  border-radius: var(--r-sm); padding: 8px 11px; font-size: 13.5px; outline: none;
  transition: border-color 0.14s, box-shadow 0.14s;
}
.select:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 30, 75, 0.12); color: var(--text); }
.input::placeholder { color: var(--text-4); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff; color: var(--text-2); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 9px 15px; font-size: 13.5px; font-weight: 500;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: #fff; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-ink { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.btn-ink:hover { background: #243a44; color: #fff; }
.btn-danger { background: #fff; border-color: var(--accent-line); color: var(--accent-dark); }
.btn-danger:hover { background: var(--accent-soft); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* --- Content ------------------------------------------------------------- */
.content { padding: 26px; flex: 1; min-width: 0; }
.view-head { margin-bottom: 20px; max-width: 860px; }
.view-head h2 { font-size: 26px; margin-bottom: 7px; letter-spacing: -0.02em; }
.view-head p { color: var(--text-2); font-size: 14.5px; }
.accent { color: var(--accent); font-weight: 500; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 18px; box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 16px; }
.card-head .spacer { margin-left: auto; }
.card-sub { color: var(--text-3); font-size: 13px; }

.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* --- Metric tiles -------------------------------------------------------- */
.metric {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.metric .k { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-4); font-weight: 600; }
.metric .v { font-family: var(--display); font-size: 31px; font-weight: 700; line-height: 1.15; margin-top: 8px; letter-spacing: -0.03em; }
.metric .v.brand { color: var(--accent); }
.metric .v.warnc { color: var(--warn); }
.metric .v.badc { color: var(--bad); }
.metric .foot { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }

/* --- Pills / badges ------------------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-review { background: var(--surface-2); color: var(--text-3); border-color: var(--line); }
.pill-held { background: var(--bad-soft); color: var(--bad); border-color: var(--accent-line); }
.pill-queued { background: var(--warn-soft); color: var(--warn); border-color: #f4dfbe; }
.pill-written { background: var(--ink-soft); color: var(--ink); border-color: #cfdde5; }
.pill-paid { background: var(--good-soft); color: var(--good); border-color: #c5e6d3; }
.pill-closed { background: var(--surface-2); color: var(--text-4); border-color: var(--line); }
.pill-routed { background: var(--warn-soft); color: var(--warn); border-color: #f4dfbe; }
.pill-id { background: var(--surface-2); color: var(--text-3); border-color: var(--line); font-family: var(--mono); font-weight: 400; }
.pill-auto { background: var(--surface-2); color: var(--text-3); border-color: var(--line); letter-spacing: 0.08em; font-size: 10px; text-transform: uppercase; }
.pill-you { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent-line); letter-spacing: 0.08em; font-size: 10px; text-transform: uppercase; }

.tag { font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; font-weight: 700; }
.tag-bad { background: var(--bad-soft); color: var(--bad); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-good { background: var(--good-soft); color: var(--good); }
.tag-neutral { background: var(--surface-2); color: var(--text-3); }

.region { font-family: var(--mono); font-size: 10px; color: var(--text-4); border: 1px solid var(--line-2); border-radius: 3px; padding: 1px 4px; }

/* --- Tables -------------------------------------------------------------- */
.tbl { font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-4); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--text); }
.tbl .strong { color: var(--text); font-weight: 600; }
.tbl-rows tr { transition: background 0.12s; }
.tbl-rows tr:hover { background: var(--surface-2); cursor: pointer; }
.tbl-rows tr.is-selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.tbl-rows tr.is-exception td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
/* Wide tables scroll inside their card rather than pushing the page sideways. */
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r-md); overflow-x: auto; background: var(--surface); box-shadow: var(--shadow-sm); }

/* --- Queue toolbar ------------------------------------------------------- */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs {
  display: flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 3px; max-width: 100%; overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 6px 12px; border-radius: 4px; font-size: 13px; color: var(--text-3);
  display: flex; align-items: center; gap: 7px; font-weight: 500; transition: background 0.14s, color 0.14s;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.tab .n { font-size: 11px; color: var(--text-4); font-family: var(--mono); }
.tab.is-active .n { color: var(--accent); }

/* --- Confidence meter ---------------------------------------------------- */
.conf { display: flex; align-items: center; gap: 8px; }
.conf-bar { width: 44px; height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.conf-bar i { display: block; height: 100%; border-radius: 3px; background: var(--good); }
.conf-bar.mid i { background: var(--warn); }
.conf-bar.low i { background: var(--accent); }
.conf-val { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }

/* --- Drawer -------------------------------------------------------------- */
.scrim {
  position: fixed; inset: 0; background: rgba(20, 24, 31, 0.32);
  z-index: 60; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.scrim.is-open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(1020px, 94vw);
  background: #fff; border-left: 1px solid var(--line-2);
  z-index: 61; transform: translateX(100%); transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer.is-open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; gap: 12px; padding: 15px 22px;
  border-bottom: 1px solid var(--line); flex: 0 0 auto; background: #fff;
}
.drawer-head h3 { font-size: 18px; }
.drawer-body { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 400px 1fr; }
.drawer-left { border-right: 1px solid var(--line); padding: 22px 20px; background: var(--bg-2); }
.drawer-right { padding: 20px 22px 40px; min-width: 0; }
.drawer-foot {
  flex: 0 0 auto; padding: 13px 22px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 9px; background: var(--bg-2);
}
.drawer-foot .spacer { margin-left: auto; }
.icon-btn { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--text-3); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* --- Receipt facsimile --------------------------------------------------- */
.receipt-frame { display: grid; place-items: center; padding: 6px 0 16px; }
.receipt {
  width: 272px; background: #fffdf8; color: #22201c; border: 1px solid #e8e2d5; border-radius: 3px;
  padding: 20px 20px 26px; font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.13); transform: rotate(-1deg);
  position: relative;
}
/* Torn bottom edge. Needs its own shadow, or it floats free of the paper. */
.receipt::after {
  content: ''; position: absolute; left: -1px; right: -1px; bottom: -7px; height: 8px;
  background: repeating-linear-gradient(135deg, #fffdf8 0 7px, transparent 7px 14px);
  filter: drop-shadow(0 4px 4px rgba(16, 24, 40, 0.12));
}
.receipt.is-faded { color: #8b857a; background: #f7f4ec; filter: blur(0.35px) contrast(0.88); }
.receipt h4 { font-family: var(--mono); font-size: 14px; font-weight: 700; text-align: center; letter-spacing: 0.06em; margin-bottom: 2px; color: #14181f; }
.receipt .r-meta { text-align: center; color: #7a746a; font-size: 10px; margin-bottom: 12px; }
.receipt .r-rule { border-top: 1px dashed #cdc6b6; margin: 9px 0; }
.receipt .r-line { display: flex; justify-content: space-between; gap: 10px; }
.receipt .r-line span:first-child { flex: 1; }
.receipt .r-tot { font-weight: 700; font-size: 13px; }
.receipt .r-foot { text-align: center; color: #7a746a; font-size: 9.5px; margin-top: 12px; }
.receipt .r-gstfree { color: #8b857a; }
.receipt .dim { color: #b3aca0; }

.email-card {
  width: 300px; background: #fff; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  overflow: hidden; box-shadow: var(--shadow-md);
}
.email-head { padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.email-head .from { font-size: 12.5px; color: var(--text); font-weight: 600; }
.email-head .subj { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.email-body { padding: 14px; font-size: 12px; color: var(--text-2); }
.email-body .row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); }
.email-body .row:last-child { border-bottom: 0; }

.source-note { font-size: 12px; color: var(--text-4); text-align: center; line-height: 1.6; margin-top: 4px; }
.source-note b { color: var(--text-3); font-weight: 600; }

/* --- Detail blocks ------------------------------------------------------- */
.block { margin-bottom: 22px; }
.block-title { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-4); font-weight: 700; margin-bottom: 9px; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 2px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-4); padding: 5px 0; }
.kv dd { margin: 0; padding: 5px 0; color: var(--text); }
.kv dd .muted { color: var(--text-3); }

/* The selected account's own description, straight off the Xero chart. */
.acct-desc {
  font-size: 12px; color: var(--text-4); margin: -4px 0 10px 128px;
  line-height: 1.5; min-height: 1px;
}

/* Account-type group headers in the chart of accounts. */
.tbl .grp td {
  background: var(--surface-2); font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-3); font-weight: 700; padding: 8px 12px;
}

.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.field-row label { font-size: 12.5px; color: var(--text-4); width: 118px; flex: 0 0 118px; }
.field-row .select, .field-row .input { flex: 1; }

.alert {
  border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 18px;
  border: 1px solid transparent; font-size: 13.5px;
}
.alert h4 { font-family: var(--sans); font-size: 14px; font-weight: 700; margin-bottom: 5px; display: flex; align-items: center; gap: 8px; }
.alert p { color: var(--text-2); margin: 0 0 6px; }
.alert p:last-child { margin-bottom: 0; }
.alert-bad { background: var(--bad-soft); border-color: var(--accent-line); }
.alert-bad h4 { color: var(--bad); }
.alert-warn { background: var(--warn-soft); border-color: #f2dcb8; }
.alert-warn h4 { color: var(--warn); }
.alert-good { background: var(--good-soft); border-color: #c5e6d3; }
.alert-good h4 { color: var(--good); }
.alert-info { background: var(--surface-2); border-color: var(--line); }
.alert-info h4 { color: var(--text); }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.compare-cell { background: #fff; border: 1px solid var(--line-2); border-radius: 6px; padding: 10px 12px; }
.compare-cell .lbl { font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-4); font-weight: 700; margin-bottom: 4px; }
.compare-cell .val { font-family: var(--mono); font-size: 15px; color: var(--text); }
.compare-cell.is-bad { border-color: var(--accent-line); }
.compare-cell.is-bad .val { color: var(--bad); }
.compare-cell.is-good { border-color: #c5e6d3; }
.compare-cell.is-good .val { color: var(--good); }

.why { font-size: 13px; color: var(--text-3); border-left: 2px solid var(--accent); padding: 3px 0 3px 12px; margin-top: 10px; }

/* --- Xero write preview -------------------------------------------------- */
.xero-preview { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.xero-step { display: flex; gap: 12px; padding: 13px 15px; border-bottom: 1px solid var(--line); background: #fff; }
.xero-step:last-child { border-bottom: 0; }
.xero-step .bullet {
  width: 21px; height: 21px; flex: 0 0 21px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line-2); color: var(--text-4); font-size: 10.5px; font-family: var(--mono);
  transition: all 0.24s;
}
.xero-step .body { min-width: 0; flex: 1; }
.xero-step .t { font-size: 13.5px; color: var(--text); font-weight: 500; }
.xero-step .d { font-size: 12.5px; color: var(--text-3); margin-top: 2px; word-break: break-word; }
.xero-step.is-running { background: var(--accent-soft); }
.xero-step.is-running .bullet { border-color: var(--accent); color: var(--accent); animation: pulse 1s infinite; }
.xero-step.is-done .bullet { border-color: var(--good); background: var(--good); color: #fff; }
.xero-step.is-done .t { color: var(--good); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 30, 75, 0.35); } 50% { box-shadow: 0 0 0 5px rgba(217, 30, 75, 0); } }

.key-line { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); margin-top: 5px; word-break: break-all; }

/* --- Intake -------------------------------------------------------------- */
.mailbox { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.mailbox:last-child { border-bottom: 0; }
.mailbox:hover { background: var(--surface-2); }
.mailbox .addr { font-family: var(--mono); font-size: 12.5px; color: var(--accent); }
.mailbox .who { font-size: 13.5px; color: var(--text); font-weight: 500; }
.mailbox .meta { margin-left: auto; font-size: 12px; color: var(--text-4); text-align: right; }

.pipeline { display: flex; align-items: center; gap: 0; }
.pipe-step {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-4);
  padding: 3px 9px; border-radius: 20px; border: 1px solid transparent; transition: all 0.3s;
}
.pipe-step .d { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pipe-step.is-on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); font-weight: 600; }
.pipe-step.is-done { color: var(--text-3); }
.pipe-arrow { color: var(--text-4); font-size: 11px; opacity: 0.6; }

/* --- Pay runs ------------------------------------------------------------ */
.run-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.run-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.run-head h3 { font-size: 17px; }
.run-head .spacer { margin-left: auto; }
.run-body { padding: 2px 0; }
.run-empty { padding: 26px 18px; color: var(--text-4); font-size: 13.5px; text-align: center; }
.run-note { padding: 13px 18px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }

.emp-group { padding: 10px 18px; border-bottom: 1px solid var(--line); }
.emp-group:last-child { border-bottom: 0; }
.emp-head { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.emp-head .name { font-size: 13.5px; color: var(--text); font-weight: 600; }
.emp-head .org { font-size: 12px; color: var(--text-4); }
.emp-head .tot { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--text); }
.pay-line {
  display: flex; align-items: center; gap: 10px; padding: 6px 0 6px 14px;
  font-size: 13px; color: var(--text-2); border-left: 2px solid var(--line);
}
.pay-line:hover { border-left-color: var(--accent); }
.pay-line .desc { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.pay-line .amt { margin-left: auto; font-family: var(--mono); font-size: 12.5px; color: var(--text); }

/* --- Reconciliation ------------------------------------------------------ */
.recon-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.recon-row:last-child { border-bottom: 0; }
.recon-row .who { min-width: 190px; }
.recon-row .who .n { font-size: 14px; color: var(--text); font-weight: 600; }
.recon-row .who .s { font-size: 11.5px; color: var(--text-4); }
.recon-row .bars { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.recon-row .val { font-family: var(--mono); font-size: 13px; text-align: right; min-width: 104px; font-weight: 500; }
.recon-row .val.zero { color: var(--good); }
.recon-row .val.off { color: var(--bad); }
.mini { font-size: 11px; color: var(--text-4); }

.trace {
  margin: 0 18px 16px; background: var(--bad-soft);
  border: 1px solid var(--accent-line); border-radius: var(--r-sm); padding: 15px 16px;
}
.trace h5 { font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--bad); margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.trace-line { display: flex; gap: 10px; font-size: 13px; color: var(--text-2); padding: 7px 0; border-bottom: 1px solid var(--accent-line); }
.trace-line:last-of-type { border-bottom: 0; }
.trace-line .side { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-4); font-weight: 700; width: 74px; flex: 0 0 74px; padding-top: 2px; }

/* --- Activity log -------------------------------------------------------- */
.log-row { display: flex; gap: 13px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.log-row:last-child { border-bottom: 0; }
.log-row .when { font-family: var(--mono); font-size: 11.5px; color: var(--text-4); width: 96px; flex: 0 0 96px; padding-top: 2px; }
.log-row .what { flex: 1; min-width: 0; }
.log-row .what .a { color: var(--text); font-weight: 500; }
.log-row .what .o { color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.log-row .what .d { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.log-row .badge { flex: 0 0 auto; }
.log-row.is-guard { background: var(--warn-soft); }
.log-row.is-recon { background: var(--good-soft); }

/* --- Concept pages ------------------------------------------------------- */
.stage {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 16px; align-items: start;
  padding: 18px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); margin-bottom: 10px; box-shadow: var(--shadow-sm);
  transition: border-color 0.16s;
}
.stage:hover { border-color: var(--line-2); }
.stage.is-you { border-color: var(--accent-line); background: var(--accent-soft); }
.stage .n { font-family: var(--display); font-size: 24px; font-weight: 700; color: var(--text-4); line-height: 1.1; }
.stage.is-you .n { color: var(--accent); }
.stage h4 { font-size: 16px; margin-bottom: 5px; }
.stage p { color: var(--text-2); font-size: 13.5px; margin: 0; }
.stage .go { font-size: 12px; color: var(--accent); margin-top: 8px; display: inline-flex; gap: 5px; align-items: center; font-weight: 600; }

.split-list { list-style: none; margin: 0; padding: 0; }
.split-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); }
.split-list li:last-child { border-bottom: 0; }
.split-list .m { color: var(--good); flex: 0 0 auto; }
.split-list.you .m { color: var(--accent); }

.cons { display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding: 17px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.cons .n { font-family: var(--mono); font-size: 15px; color: var(--text-4); }
.cons h4 { font-size: 15.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cons p { font-size: 13.5px; color: var(--text-2); margin: 0; }

.phase { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.phase:last-child { border-bottom: 0; }
.phase .p { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); font-weight: 700; padding-top: 3px; }
.phase h4 { font-size: 15.5px; margin-bottom: 5px; }
.phase p { font-size: 13.5px; color: var(--text-2); margin: 0; }

.qlist { counter-reset: q; list-style: none; padding: 0; margin: 0; }
.qlist li { counter-increment: q; position: relative; padding: 12px 0 12px 34px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--text-2); }
.qlist li:last-child { border-bottom: 0; }
.qlist li::before {
  content: counter(q); position: absolute; left: 0; top: 12px;
  width: 21px; height: 21px; border-radius: 50%; border: 1px solid var(--accent-line);
  display: grid; place-items: center; font-size: 11px; font-family: var(--mono); color: var(--accent);
  background: var(--accent-soft);
}

/* --- Toast --------------------------------------------------------------- */
.toast-stack { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 17px;
  background: var(--text); border: 1px solid var(--text); border-radius: var(--r-pill);
  font-size: 13.5px; color: #fff; box-shadow: var(--shadow-md);
  animation: rise 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}
.toast .m { color: #6ee7a8; display: grid; place-items: center; }
.toast.is-warn .m { color: #fbbf5a; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* --- Empty state --------------------------------------------------------- */
.empty { padding: 56px 20px; text-align: center; color: var(--text-4); }
.empty .big { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 420px; margin: 0 auto; }

/* --- Utility ------------------------------------------------------------- */
.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.dim { color: var(--text-4); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.row { display: flex; align-items: center; gap: 9px; }
.wrap { flex-wrap: wrap; }
.fade-in { animation: fade 0.22s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1180px) {
  .drawer-body { grid-template-columns: 330px 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 236px; z-index: 70;
    transform: translateX(-100%); transition: transform 0.24s; background: #fff;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: none; }
  .menu-btn { display: grid !important; }
  .content { padding: 16px; }
  .drawer-body { grid-template-columns: 1fr; }
  .drawer-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar h1 { font-size: 15.5px; }
  .topbar .sub, .clock { display: none; }
  .topbar-right { gap: 7px; flex: 0 0 auto; }
  /* A long view title truncates instead of shoving the controls off-screen. */
  .topbar > div:not(.topbar-right) { min-width: 0; flex: 1 1 auto; }
  .topbar h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #org-filter { max-width: 132px; padding: 8px 6px; font-size: 12.5px; }
  #reset { font-size: 12.5px; }
  /* Tabs get their own scrollable row, search takes the next. */
  .tabs { width: 100%; }
  #q-search { flex: 1 1 140px; min-width: 0; width: auto !important; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { padding-bottom: 0; }
  .acct-desc { margin-left: 0; }
  .recon-row { flex-wrap: wrap; }
  .recon-row .bars { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .grid-4 { grid-template-columns: 1fr; }
  .tbl .hide-sm { display: none; }
  .compare { grid-template-columns: 1fr; }
}
.menu-btn { display: none; }
