/* Outlay — expense reports for Cove & Co.
   Finance desk: dark green rail, quiet gray canvas, white documents.
   IBM Plex Sans runs the tool; IBM Plex Serif names the report and its total. */

:root {
  color-scheme: light;
  --brand: #173024;
  --brand-accent: #1B7A43;
  --brand-ink: #173024;
  --ink: #152219;
  --ink-2: #3b4a40;
  --muted: #5f6f65;
  --faint: #8a978f;
  --green: var(--brand-accent);
  --green-deep: #14603a;
  --green-soft: #e3f2e8;
  --canvas: #f2f5f2;
  --card: #ffffff;
  --line: #dde5df;
  --line-2: #c9d4cc;
  --hover: #f6f9f6;
  --return: #9b2c20;
  --return-soft: #fdeceb;
  --amber: #8a4b08;
  --amber-soft: #fff1dd;
  --blue: #1f4b7a;
  --blue-soft: #e6eef8;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(21, 34, 25, 0.06);
  --shadow-doc: 0 1px 2px rgba(21, 34, 25, 0.05), 0 12px 32px rgba(21, 34, 25, 0.06);
  --rail: 236px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
a { color: var(--green-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
::selection { background: #bfe3cc; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.mast :focus-visible { outline-color: #fff; }

.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;
}
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.skip {
  position: absolute;
  left: 12px;
  top: 0;
  transform: translateY(-120%);
  background: var(--brand);
  color: #fff;
  padding: 8px 12px;
  border-radius: 0 0 8px 8px;
  z-index: 50;
  text-decoration: none;
}
.skip:focus { transform: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  width: min(440px, calc(100% - 24px));
  background: var(--brand);
  color: #f4f8f4;
  border-left: 4px solid var(--green);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(21, 34, 25, 0.25);
}
.toast--err { border-left-color: #f0a090; }

/* ───────────── Brand lockup ───────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand-mark { width: 22px; height: 28px; flex: none; color: var(--brand-accent); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-word { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }
.brand-firm { font-size: 0.78rem; font-weight: 500; opacity: 0.7; }

/* ───────────── Sidebar rail ───────────── */
.mast {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--rail);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 12px 14px;
  background: var(--brand);
  color: #e7f3ea;
}
.mast .brand { padding: 0 6px; }
.mast .brand-mark { color: #9fd8b4; }
.mast .brand-firm { color: #b9d3c1; opacity: 1; }
.mast-role {
  margin: 2px 6px 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8fb39c;
}
.desk-switch { display: flex; flex-direction: column; gap: 2px; }
.nav-kicker {
  margin: 8px 6px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7fa58d;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #d3e6d9;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.93rem;
  line-height: 1.3;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item[aria-current="page"] { background: rgba(27, 122, 67, 0.42); color: #fff; font-weight: 600; }
.nav-item:disabled { opacity: 0.6; cursor: progress; }
.nav-ico { width: 16px; height: 16px; flex: none; color: #9fd8b4; }
.nav-ico svg { width: 100%; height: 100%; }
.nav-item[aria-current="page"] .nav-ico { color: #c6ecd3; }
.nav-label { flex: 1; min-width: 0; }
.nav-badge {
  background: #f0b05b;
  color: #2d1b05;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 7px;
  border-radius: 99px;
  line-height: 1.5;
}
.who {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.who:empty { display: none; }
.who-card { display: flex; align-items: center; gap: 10px; padding: 0 4px; min-width: 0; }
.who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who-name { font-weight: 600; font-size: 0.9rem; color: #f4f8f4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-email { font-size: 0.78rem; color: #a9c6b3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-out {
  background: transparent;
  border: 1px solid rgba(244, 248, 244, 0.28);
  color: #f4f8f4;
  padding: 7px 12px;
  min-height: 34px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
}
.btn-out:hover { background: rgba(255, 255, 255, 0.08); }

/* Avatars */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #d8e8dd;
  color: #1e3b2a;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: none;
}
.avatar--who { width: 32px; height: 32px; font-size: 0.78rem; background: #2f8a55; color: #fff; }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }

/* ───────────── Canvas ───────────── */
main { flex: 1; min-width: 0; margin-left: var(--rail); }
.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 22px 28px 60px; }
.boot { margin: 22px 28px; color: var(--muted); margin-left: calc(var(--rail) + 28px); }
.foot { margin-left: var(--rail); padding: 0 28px 28px; color: var(--muted); font-size: 0.88rem; }
.foot-pitch { max-width: 70ch; }
body:has(#desk:not([hidden])) .foot-pitch { display: none; }
.foot-dim { margin-top: 6px; }
.reset-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.reset-ask { flex: 1 1 220px; margin: 0; color: var(--ink); }

.crumbs { display: flex; gap: 8px; align-items: center; font-size: 0.84rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 500; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs span:last-child { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.page-sub { margin-top: 2px; color: var(--muted); font-size: 0.92rem; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line-2);
  color: var(--ink);
  padding: 7px 12px;
  min-height: 36px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--shadow);
}
.btn:hover { background: var(--hover); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-deep); border-color: var(--green-deep); }
.btn-danger { color: var(--return); border-color: #e9bdb7; }
.btn-danger:hover { background: var(--return-soft); }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 0.84rem; }
.btn-wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.linklike {
  border: 0;
  background: none;
  padding: 0;
  color: var(--green-deep);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* Fields */
.field { margin-top: 12px; }
label, .field-hint, .demo-note, .hint { color: var(--muted); }
label { display: block; font-weight: 600; font-size: 0.86rem; margin-bottom: 4px; color: var(--ink-2); }
.field-hint, .demo-note, .hint { font-size: 0.84rem; margin-top: 6px; }
input, select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 38px;
  color: var(--ink);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
input[type="file"] { padding: 6px 8px; font-size: 0.86rem; }
textarea { min-height: 84px; resize: vertical; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--return); background: #fff8f7; }
.form-err {
  color: var(--return);
  background: var(--return-soft);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 10px;
  font-size: 0.9rem;
}
.form-acts { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.check-field { display: flex; gap: 10px; align-items: center; margin-block: 10px; color: var(--ink-2); }
.check-field input { width: 18px; height: 18px; min-height: 0; flex: 0 0 auto; accent-color: var(--green); }

/* Pills */
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  background: #e9eeea;
  color: #3b4a40;
  vertical-align: middle;
}
.pill--draft { background: #e9eeea; color: #4a5a50; }
.pill--submitted { background: var(--amber-soft); color: var(--amber); }
.pill--approved { background: var(--green-soft); color: #166534; }
.pill--processing { background: var(--blue-soft); color: var(--blue); }
.pill--reimbursed { background: #d6ead9; color: #0f4f2a; }
.pill--returned { background: var(--return-soft); color: var(--return); }
.pill--archived { background: #eef0ee; color: var(--faint); }
.dot { color: var(--faint); margin: 0 6px; }

/* ───────────── Summary cards ───────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px 11px;
  min-width: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.stat:hover { border-color: var(--line-2); box-shadow: 0 3px 10px rgba(21, 34, 25, 0.08); }
.stat.is-on { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green), var(--shadow); }
.stat-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; text-align: left; color: var(--ink); }
.stat-sub { font-size: 0.8rem; color: var(--faint); }
.stat.is-hot .stat-label::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e59a2b;
  margin-right: 6px;
  vertical-align: 1px;
}

/* ───────────── Toolbar ───────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); flex: 1 1 auto; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px 9px;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 -2px 0 transparent;
}
.tab:hover { color: var(--ink); background: #e9efea; }
.tab[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--green); }
.tab-n { font-size: 0.74rem; font-weight: 700; color: var(--muted); background: #e5ebe6; padding: 0 6px; border-radius: 99px; line-height: 1.5; min-width: 1.4rem; text-align: center; }
.tab[aria-pressed="true"] .tab-n { background: var(--green-soft); color: var(--green-deep); }
.toolbar-right { display: flex; gap: 8px; align-items: center; padding-bottom: 6px; }
.search { position: relative; width: min(100%, 300px); }
.search-ico { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 32px; min-height: 36px; font-size: 0.9rem; }
.search input::placeholder { color: var(--faint); }

/* ───────────── Tables ───────────── */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  background: #f7faf7;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.92rem;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.row { cursor: pointer; }
.table tbody tr.row:hover td { background: var(--hover); }
.table tfoot td { background: #f7faf7; border-top: 1px solid var(--line); border-bottom: 0; color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.table tfoot .num { color: var(--ink); font-size: 0.95rem; font-weight: 700; }
.table .num { font-weight: 600; }
.row-title { display: block; color: var(--ink); font-weight: 600; text-decoration: none; }
.row-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.row-sub { display: block; color: var(--faint); font-size: 0.8rem; margin-top: 1px; }
.row-note { display: block; color: var(--return); font-size: 0.8rem; margin-top: 4px; max-width: 36ch; white-space: normal; }
/* Report list: one dense line per report (Ramp/Brex style) */
@media (min-width: 761px) {
  .table.report-list td { padding: 8px 14px; }
  .table.report-list th { padding: 8px 14px; }
  .report-list td[data-label="Report"] { max-width: 0; width: 30%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .report-list td[data-label="Client"], .report-list td[data-label="Employee"] { white-space: nowrap; }
  .report-list .row-title { display: inline; }
  .report-list .row-sub { display: inline; margin: 0 0 0 8px; }
  .report-list .row-note { display: block; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .report-list td[data-label="Status"] { max-width: 0; width: 18%; overflow: hidden; }
}
.col-when, .col-period { color: var(--muted); white-space: nowrap; }

/* ───────────── Empty, loading, cards ───────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
}
.card--form { max-width: 560px; }
.card--form .field:first-child { margin-top: 0; }
.empty, .loading {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 22px;
}
.empty h1, .empty h2 { font-size: 1.15rem; font-weight: 700; }
.empty p { color: var(--muted); margin-top: 6px; max-width: 56ch; }
.empty .btn, .empty .form-acts { margin-top: 14px; }
.loading { color: var(--muted); }

/* ───────────── Report document ───────────── */
.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}
.doc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-doc);
  padding: 26px 28px 24px;
  min-width: 0;
}
.doc-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--brand);
}
.doc-id { min-width: 0; }
.eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--green-deep); }
.doc h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.15; letter-spacing: -0.015em; margin: 6px 0 8px; overflow-wrap: anywhere; }
.doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; color: var(--muted); font-size: 0.88rem; }
.doc-meta .person span:last-child { color: var(--ink-2); font-weight: 500; }
.doc-total { display: grid; justify-items: end; gap: 4px; text-align: right; flex: none; }
.doc-total-label { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.doc-total-value { font-family: var(--serif); font-weight: 500; font-size: 2rem; line-height: 1; letter-spacing: -0.02em; color: var(--ink); }

.notice {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  line-height: 1.45;
}
.notice--returned { background: var(--return-soft); color: #5e1a12; border-left: 3px solid var(--return); }
.notice--approved { background: var(--green-soft); color: #14432a; border-left: 3px solid var(--green); }
.notice--sample { background: #f7faf7; color: var(--muted); border-left: 3px solid var(--line); }

.doc-lines { border-radius: 8px; box-shadow: none; }
.lines th { background: #f7faf7; }
.lines td { vertical-align: top; }
.lines .col-date { white-space: nowrap; color: var(--muted); }
.lines .line-merchant { font-weight: 600; color: var(--ink); }
.lines .col-note { color: var(--ink-2); min-width: 18ch; }
.lines .col-receipt { white-space: nowrap; }
.lines .col-acts { white-space: nowrap; text-align: right; }
.lines .foot-label { text-transform: none; letter-spacing: 0; font-size: 0.86rem; }
.lines .foot-total { font-family: var(--serif); font-size: 1.1rem; font-weight: 500; }
.cat {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  background: #eef2ef;
  color: var(--ink-2);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.line-edit td { background: #f7faf7; padding: 14px; }
.line-grid { display: grid; grid-template-columns: 11rem minmax(0, 1fr) 12rem; gap: 10px 14px; }
.line-grid .field { margin-top: 0; }
.span-all { grid-column: 1 / -1; }
.row-acts { display: inline-flex; align-items: center; gap: 10px; }
.row-acts--confirm { gap: 8px; }
.row-acts .linklike { font-size: 0.86rem; }
.confirm-ask { color: var(--return); font-size: 0.86rem; font-weight: 600; }

.receipt-hint { color: var(--faint); font-size: 0.84rem; }
.receipt-hint--warn { color: var(--amber); }
.receipt-file { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.receipt-link { display: inline-flex; align-items: center; gap: 5px; font-size: 0.86rem; text-decoration: none; }
.receipt-link svg { width: 14px; height: 14px; }
.receipt-link:hover { text-decoration: underline; }
.receipt-file .hint { margin: 0; font-size: 0.78rem; }
.receipt-more { font-size: 0.84rem; }
.receipt-more summary { cursor: pointer; color: var(--green-deep); font-weight: 600; list-style: none; }
.receipt-more summary::-webkit-details-marker { display: none; }
.receipt-more summary::after { content: " ▾"; color: var(--faint); font-size: 0.8em; }
.receipt-more[open] summary::after { content: " ▴"; }
.receipt-more form { margin-top: 8px; display: grid; gap: 6px; white-space: normal; max-width: 260px; }
.receipt-more label { font-size: 0.8rem; margin: 0; }

.doc-cats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; padding-top: 10px; color: var(--muted); font-size: 0.84rem; }
.cat-sum { display: inline-flex; align-items: center; gap: 8px; }
.cat-sum .num { color: var(--ink-2); font-weight: 600; }
.doc-empty { padding: 22px 18px; border: 1px dashed var(--line-2); border-radius: 8px; text-align: center; }
.doc-empty h2 { font-size: 1rem; font-weight: 700; }
.doc-empty p { color: var(--muted); margin-top: 4px; max-width: 50ch; margin-inline: auto; }
.doc-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.fold { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.fold summary { cursor: pointer; font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.fold summary:hover { color: var(--ink); }

/* Rail */
.doc-rail { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rail-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
}
.rail-card h2 { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.rail-copy { font-size: 0.88rem; color: var(--ink-2); margin-bottom: 12px; }
.rail-card .field:first-of-type { margin-top: 0; }
.rail-card .split { display: grid; gap: 14px; }
.rail-card .split form + form { padding-top: 14px; border-top: 1px solid var(--line); }
.rail-card legend { font-size: 0.9rem; }
.rail-card .lifecycle-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.rail-card .lifecycle-form:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.rail-card .hint { margin-top: 0; margin-bottom: 8px; }
.rail-card .form-acts { margin-top: 10px; }
.rail-card .form-acts .btn { flex: 1 1 auto; }
.rail-card--tools { padding: 10px; }
.steps { list-style: none; margin: 0; padding: 0; position: relative; }
.step { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); column-gap: 10px; padding: 0 0 12px; font-size: 0.88rem; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: -2px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step-dot { grid-row: 1 / span 2; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--line-2); margin-top: 3px; }
.step.is-done .step-dot { background: var(--green); border-color: var(--green); }
.step.is-done::before { background: var(--green); }
.step.is-current .step-dot { border-color: var(--green); border-width: 4px; }
.step-label { color: var(--faint); font-weight: 500; }
.step.is-done .step-label, .step.is-current .step-label { color: var(--ink); font-weight: 600; }
.step-when { grid-column: 2; color: var(--muted); font-size: 0.8rem; margin-top: 1px; }

/* ───────────── Company settings ───────────── */
.company-settings h2 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.company-settings .hint { max-width: 72ch; }
.company-roster, .company-reviewers { margin-top: 4px; }
.company-roster + .company-reviewers { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.company-person { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 1fr); gap: 16px; padding-block: 14px; border-bottom: 1px solid var(--line); }
.company-person h3 { font-size: 0.95rem; font-weight: 600; }
.company-person p { color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.company-person .person-form button { margin-top: 6px; }
#companyMemberForm { margin-top: 18px; padding: 16px; background: #f7faf7; border-radius: 8px; }
.company-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 4px 16px; margin-top: 4px; }
.reviewer-list { list-style: none; margin: 6px 0 10px; padding: 0; display: grid; gap: 6px; }
.reviewer-list li { display: flex; align-items: center; gap: 8px; }

/* ───────────── Sign-in gate ───────────── */
body:has(#gate:not([hidden])) .mast,
body:has(#gate:not([hidden])) .foot { display: none; }
#gate.wrap {
  margin-left: 0;
  max-width: none;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px 48px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(27, 122, 67, 0.35), transparent 50%),
    #173024;
}
body:has(#gate:not([hidden])) main { margin-left: 0; }
.gate-grid {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 400px);
  gap: 28px;
  align-items: center;
}
.gate-copy { color: #e7f3ea; }
.gate-brand { margin-bottom: 20px; }
.gate-copy .brand-word { font-size: 1.3rem; color: #fff; }
.gate-copy .brand-firm { color: #b9d3c1; }
.gate-copy .brand-mark { color: #9fd8b4; }
.gate-copy h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  max-width: 16ch;
  color: #fff;
}
.lede { margin-top: 14px; max-width: 52ch; font-size: 1.02rem; color: #c7dccd; }
.sheet { background: var(--card); border-radius: 12px; }
.sample { margin-top: 24px; padding: 16px 18px 14px; box-shadow: var(--shadow-doc); color: var(--ink); }
.sample-kicker { font-size: 0.76rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--green-deep); }
.sample h2 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; margin-top: 4px; }
.sample-state { color: var(--muted); font-size: 0.86rem; }
.ledger { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.86rem; }
.ledger th, .ledger td { text-align: left; vertical-align: top; padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); }
.ledger th { color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.ledger .num { font-weight: 600; }
.total { display: flex; justify-content: space-between; padding: 8px 0 0; font-weight: 600; }
.total .num { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.slip { padding: 24px 24px 22px; box-shadow: var(--shadow-doc); }
.slip h2 { font-size: 1.15rem; font-weight: 700; }
.slip .field:first-of-type { margin-top: 14px; }
.slip .btn-wide { margin-top: 16px; }
.demo-slot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.demo-tag { font-weight: 700; font-size: 0.86rem; }
.demo-rows { margin: 8px 0 0; font-size: 0.9rem; }
.demo-rows div { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 8px; padding: 2px 0; }
.demo-rows dt { color: var(--muted); }
.demo-rows dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.demo-slot .btn-wide { margin-top: 10px; }
.card-alt { margin-top: 16px; font-size: 0.9rem; color: var(--muted); }
#signupForm { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ───────────── Responsive ───────────── */
@media (max-width: 1100px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
}
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gate-grid { grid-template-columns: 1fr; }
  .gate-copy h1 { max-width: none; }
  .sample { display: none; }
}
@media (max-width: 800px) {
  .company-person { grid-template-columns: 1fr; }
  .line-grid { grid-template-columns: 1fr; }
  .span-all { grid-column: auto; }
}
@media (max-width: 760px) {
  :root { --rail: 0px; }
  .mast {
    position: sticky;
    width: auto;
    bottom: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 14px;
  }
  .mast .brand { flex: 1 1 auto; }
  .mast-role { display: none; }
  .desk-switch { order: 3; flex: 1 0 100%; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav-kicker { display: none; }
  .nav-item { width: auto; min-height: 44px; flex: 1 1 auto; padding: 6px 10px; font-size: 0.88rem; }
  .who { margin: 0; padding: 0; border: 0; flex-direction: row; align-items: center; gap: 8px; }
  .who-text { display: none; }
  .avatar--who { width: 28px; height: 28px; font-size: 0.7rem; }
  main, .foot, .boot { margin-left: 0; }
  .wrap { padding: 16px 14px 48px; }
  .foot { padding: 0 14px 20px; }
  .page-head .btn { flex: 1 1 auto; }
  .toolbar-right { width: 100%; }
  .search { flex: 1 1 auto; width: auto; }
  .doc { padding: 18px 16px 18px; }
  .doc-head { flex-direction: column; gap: 12px; }
  .doc-total { justify-items: start; text-align: left; }
  .doc-total-value { font-size: 1.7rem; }

  /* Tables stack into labelled rows */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td, .table tfoot { display: block; width: 100%; }
  .table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { padding: 3px 0; border: 0; text-align: left; }
  .table td::before { content: attr(data-label); display: block; color: var(--faint); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
  .table td[data-label="Report"]::before, .table td[data-label="Merchant"]::before, .table td[data-label="Actions"]::before { display: none; }
  .table td.num { text-align: left; }
  .table tfoot tr { display: flex; justify-content: space-between; gap: 12px; }
  .table tfoot td { padding: 0; width: auto; background: transparent; border: 0; }
  .lines .col-acts { text-align: left; }
  .line-edit td::before { display: none; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat-value { font-size: 1.15rem; }
  .demo-rows div { grid-template-columns: 5rem minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ───────────── Motion ─────────────
   Short and eased. A page eases in when it changes; the page it replaces
   stays put, dimmed, while the ledger fetches; a thin bar runs along the
   top of the canvas meanwhile. Reduced motion keeps the hold, drops the rest. */
:root { --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1); --dur: 180ms; }
@keyframes view-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.view-enter { animation: view-enter var(--dur) var(--ease-out) both; }
#deskView { transition: opacity 160ms var(--ease-out) 120ms; }
#deskView.is-stale { opacity: 0.55; pointer-events: none; }
.nav-item, .btn, .btn-out, .tab, .tab-n, .table tbody tr.row td, .crumbs a, .row-title, .linklike, .stat {
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), opacity 160ms var(--ease-out);
}

/* Fetch bar */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: var(--rail);
  right: 0;
  height: 2px;
  background: var(--green);
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
  z-index: 70;
  pointer-events: none;
  transition: opacity 160ms var(--ease-out);
}
body.is-loading::before { opacity: 1; animation: load-bar 1.1s var(--ease-out) infinite; }
@keyframes load-bar {
  0% { transform: translateX(-100%) scaleX(0.35); }
  60% { transform: translateX(40%) scaleX(0.5); }
  100% { transform: translateX(100%) scaleX(0.35); }
}
body:has(#gate:not([hidden]))::before { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .view-enter { opacity: 1; transform: none; }
  body.is-loading::before { transform: none; opacity: 1; }
}
