/* Stratum — the whole design system in one stylesheet.
   Tokens first; then the shell, then components; then each screen.
   Dynamic values (bar widths, a row's colour) are set from JS through
   element.style, which the Content-Security-Policy allows. */

@font-face {
  font-family: 'Geist';
  src: url('/fonts/geist.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/fonts/geist-mono.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #F2F3EE;
  --ink: #10140F;
  --ink-2: #262E26;
  --text: #10140F;
  --muted: #5B6157;
  --muted-2: #4A5046;
  --faint: #9AA093;
  --surface: #FFFFFF;
  --surface-2: #FAFAF7;
  --surface-3: #F7F8F3;
  --surface-4: #F3F4EE;
  --chip: #EEF0E8;
  --chip-fg: #3D4339;
  --seg: #E6E8DF;
  --line: #E2E4DC;
  --line-2: #ECEEE6;
  --line-3: #F0F1EB;
  --field: #D9DCD2;
  --field-hover: #B9BDAF;
  --lime: #CDEB5B;
  --lime-hover: #BEDD47;
  --olive: #7A9644;
  --olive-2: #4C6626;
  --ok-bg: #EAF0D6;
  --ok-fg: #3A4A12;
  --cons-bg: #F6F8EE;
  --cons-head: #EEF2E0;
  --cons-total: #E8EDD6;
  --warn-bg: #FBF1E7;
  --warn-bg-2: #FBEDE2;
  --warn-line: #F0D7C0;
  --warn-fg: #8A3D12;
  --warn-strong: #C2541B;
  --warn-cell: #9A4416;
  --peach: #F2B48F;
  --blue: #2F5BD3;
  --blue-bg: #E8EDF8;
  --blue-fg: #2B3F7A;

  --side: #0F1410;
  --side-fg: #C9CEC4;
  --side-hi: #F4F6EF;
  --side-mute: #8E9589;
  --side-card: #171E18;
  --side-line: #242C25;
  --side-active: #1E261F;
  --side-hover: #1A211B;
  --side-track: #2A332B;

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --shadow-pop: 0 18px 40px -12px rgba(16, 20, 15, .28);
  --shadow-modal: 0 30px 80px -20px rgba(16, 20, 15, .45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: var(--ink); }
a:hover { color: var(--ok-fg); }
h1, h2, h3, p { margin: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #6E8F1F;
  outline-offset: 2px;
}
.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;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.noscript { padding: 24px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.spin { animation: spin 1s linear infinite; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
.rise { animation: rise .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes slide { from { background-position: -60% 0; } to { background-position: 160% 0; } }
@media (prefers-reduced-motion: reduce) {
  .spin, .pulse, .rise { animation: none; }
}

/* Waiting on the server: a bar across the top, shown only if it takes a moment.
   Olive shows against both the dark sidebar and the light page. */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90; pointer-events: none;
  opacity: 0; transition: opacity .15s;
  background: linear-gradient(90deg, transparent, var(--olive) 50%, transparent) no-repeat;
  background-size: 40% 100%;
}
.progress.is-on { opacity: 1; transition-delay: .15s; animation: slide 1.1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .progress.is-on { animation: none; background: var(--olive); }
}

/* ------------------------------------------------------------------ shell -- */

.app { min-height: 100vh; display: flex; flex-wrap: wrap; align-items: stretch; }
.boot {
  margin: auto; display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: var(--muted); padding-top: 30vh;
}

.side {
  flex: 1 1 248px; max-width: 100%;
  background: var(--side); color: var(--side-fg);
  display: flex; flex-direction: column; gap: 28px; padding: 22px 14px 18px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-size: 18px; font-weight: 650; letter-spacing: -.02em; color: var(--side-hi); }
.brand-sub { font-size: 12px; color: var(--side-mute); }

.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-item {
  flex: 1 1 200px; display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px;
  border: none; border-radius: var(--r); text-align: left; background: transparent;
  color: var(--side-fg); font-weight: 500; text-decoration: none;
}
.nav-item svg { stroke: var(--side-mute); }
.nav-item:hover { background: var(--side-hover); color: var(--side-hi); }
.nav-item[aria-current="page"] { background: var(--side-active); color: var(--side-hi); font-weight: 600; }
.nav-item[aria-current="page"] svg { stroke: var(--lime); }
.nav-label { flex: 1; }
.badge {
  min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; background: var(--lime);
  color: var(--ink); font-size: 11.5px; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center;
}
.badge--warn { background: var(--peach); }
.side-spacer { flex: 1; }

.health {
  display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px;
  background: var(--side-card); border: 1px solid var(--side-line);
}
.health-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--side-hi); font-weight: 550; }
.health-sub { font-size: 12px; color: var(--side-mute); }
.dot { width: 8px; height: 8px; border-radius: 99px; flex: none; display: inline-block; }
.track { height: 4px; border-radius: 99px; background: var(--side-track); overflow: hidden; }
.track > span { display: block; height: 4px; background: var(--lime); border-radius: 99px; }

.me { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.me-avatar {
  width: 34px; height: 34px; border-radius: 99px; background: var(--lime); color: var(--ink);
  font-weight: 650; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.me-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.me-name { color: var(--side-hi); font-weight: 550; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { color: var(--side-mute); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout {
  width: 44px; height: 44px; border: none; border-radius: var(--r); background: transparent; color: var(--side-mute);
  display: inline-flex; align-items: center; justify-content: center;
}
.signout:hover { background: var(--side-hover); color: var(--side-hi); }

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 32px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs strong { color: var(--ink); font-weight: 600; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.live-pill {
  height: 28px; padding: 0 10px; border-radius: 999px; background: var(--seg); color: var(--muted-2);
  font-size: 12px; font-weight: 550; display: inline-flex; align-items: center; gap: 6px;
}

.page { padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 22px; }
.page--narrow { max-width: 980px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { display: flex; flex-direction: column; gap: 6px; }
.page-title h1 { font-size: 32px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; }
.page-title p { color: var(--muted); max-width: 620px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .page { padding: 20px 16px 48px; }
  .page-title h1 { font-size: 26px; }
  .side { gap: 18px; padding: 16px 12px; }
  .nav-item { flex-basis: 150px; }
  .side-spacer, .health { display: none; }
}

/* ------------------------------------------------------------- components -- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--field);
  background: var(--surface); color: var(--ink); font-weight: 550; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--line-2); color: var(--ink); }
.btn--ink { background: var(--ink); border-color: var(--ink); color: var(--side-hi); }
.btn--ink:hover { background: var(--ink-2); color: var(--side-hi); }
.btn--lime { background: var(--lime); border-color: var(--lime); color: var(--ink); font-weight: 650; }
.btn--lime:hover { background: var(--lime-hover); }
.btn--danger { color: var(--warn-fg); }
.btn--danger-line { color: var(--warn-fg); border-color: #E3BFA2; font-weight: 600; }
.btn--lg { height: 44px; padding: 0 18px; border-radius: 11px; }
.btn--sm { height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13px; }
.btn--block { width: 100%; height: 48px; font-size: 15px; font-weight: 650; border-radius: 12px; }
.btn--icon { width: 44px; height: 44px; padding: 0; border: none; background: transparent; color: var(--muted); }
.btn--icon:hover { background: var(--line-2); }
.btn[aria-busy="true"], .switch[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"]::after {
  content: ''; flex: none; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn--icon[aria-busy="true"] > svg { display: none; }
.switch[aria-busy="true"] { opacity: .7; }
@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"]::after { animation: none; border-right-color: currentColor; opacity: .5; }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; }
.card-pad { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.card-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.card-head strong { font-weight: 650; }
.card-foot {
  display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 14px 20px; border-top: 1px solid var(--line-2);
  font-size: 12.5px; color: var(--muted); background: var(--surface-2);
}

.seg { display: flex; padding: 4px; gap: 2px; border-radius: 12px; background: var(--seg); flex-wrap: wrap; }
.seg--soft { background: var(--chip); }
.seg--fit { align-self: flex-start; }
.seg button {
  min-height: 36px; padding: 0 14px; border-radius: 9px; border: none; font-weight: 550;
  background: transparent; color: var(--muted-2);
}
.seg button[aria-pressed="true"] {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 20, 15, .12), 0 0 0 1px rgba(16, 20, 15, .05);
}

.switch-row { display: flex; align-items: center; gap: 10px; }
.switch {
  width: 44px; height: 26px; border-radius: 999px; border: none; padding: 3px; background: #C9CDC2;
  display: flex; justify-content: flex-start; flex: none;
  /* A 44px touch target without changing how the switch looks. */
  position: relative;
}
.switch::after { content: ''; position: absolute; inset: -9px 0; }
.switch > span { width: 20px; height: 20px; border-radius: 999px; background: var(--surface); }
.switch[aria-pressed="true"] { background: var(--ink); justify-content: flex-end; }
.switch[aria-pressed="true"] > span { background: var(--lime); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--field);
  background: var(--surface); color: var(--ink); font-weight: 550; display: inline-flex; align-items: center; gap: 8px;
}
.chip-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--side-hi); }
.chip-btn .mono { font-size: 12px; opacity: .75; }
.tag {
  height: 22px; padding: 0 8px; border-radius: 6px; background: var(--chip); color: var(--chip-fg);
  font-size: 12px; font-weight: 550; display: inline-flex; align-items: center; white-space: nowrap;
}
.tag--ink { background: var(--ink); color: var(--side-hi); }
.tag--warn { background: var(--warn-bg-2); color: var(--warn-fg); }
.tag--blue { background: var(--blue-bg); color: var(--blue-fg); }
.tag--ic { height: 18px; padding: 0 6px; border-radius: 5px; background: #F4E7DA; color: var(--warn-fg); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; flex: none; }

.search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--field); background: var(--surface-2); flex: 0 1 300px; min-width: 180px;
}
.search input { border: none; outline: none; background: transparent; flex: 1; min-width: 0; }
.search:focus-within { outline: 2px solid #6E8F1F; outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 550; color: var(--muted); }
.field input, .field select, .input, .select {
  height: 44px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--field);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 400;
}
.select--sm, .input--sm { height: 36px; padding: 0 8px; border-radius: var(--r-sm); font-size: 13.5px; }
.field-error { color: var(--warn-fg); font-size: 12.5px; font-weight: 500; }

.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 10px; background: #E3E8D3; color: var(--ink);
  font-family: var(--mono); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}
.avatar--sm { width: 30px; height: 30px; border-radius: 8px; font-size: 10px; }
.code-chip { background: #E3E8D3; color: var(--ink); }
:is(.avatar, .code-chip).avatar--hold { background: var(--ink); color: var(--lime); }
:is(.avatar, .code-chip).avatar--trust { background: #DFE4EE; }
:is(.avatar, .code-chip).avatar--fx { background: #F0E4D6; }
.avatar--person { border-radius: 99px; font-family: var(--font); font-size: 13px; font-weight: 650; width: 38px; height: 38px; }

.alert {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--r-lg);
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: #5C2A0C;
}
.alert > span { flex: 1 1 280px; }
.alert--error { background: var(--warn-bg-2); }
.alert--info { background: var(--surface-3); border-color: var(--line); color: var(--muted-2); }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty strong { color: var(--ink); font-size: 16px; }

/* Tables are CSS grids that scroll sideways inside their card on a phone. */
.scroll-x { overflow-x: auto; }
.grid-head, .grid-row { display: grid; align-items: center; }
.grid-head {
  font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.grid-head > div, .grid-row > div { padding: 10px 12px; min-width: 0; }
.grid-row { border-bottom: 1px solid var(--line-3); background: var(--surface); }
.grid-row:hover { background: var(--surface-2); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.sub { font-size: 12.5px; color: var(--muted); }
.right { text-align: right; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 80;
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px;
  background: var(--ink); color: var(--side-hi); font-weight: 550; box-shadow: 0 16px 40px -12px rgba(16, 20, 15, .5);
  max-width: calc(100% - 32px);
}
.toast-mark {
  width: 22px; height: 22px; border-radius: 99px; background: var(--lime); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.toast--error .toast-mark { background: var(--peach); }

.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(16, 20, 15, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  width: 540px; max-width: 100%; max-height: 92vh; overflow-y: auto; background: var(--surface);
  border-radius: 20px; box-shadow: var(--shadow-modal); display: flex; flex-direction: column; gap: 16px; padding: 22px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal h2 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.steps { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--faint); }
.step > span {
  width: 22px; height: 22px; border-radius: 99px; background: var(--chip); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px;
}
.step.is-active { color: var(--ink); }
.step.is-active > span { background: var(--ink); color: var(--lime); }
.step.is-done { color: var(--ink); }
.step.is-done > span { background: var(--lime); }
.scope-list { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-lg); background: var(--surface-3); }
.scope-list > span { display: flex; gap: 10px; align-items: center; }
.pick {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); text-align: left; color: var(--ink); width: 100%;
  cursor: pointer;
}
.pick.is-on { border-color: var(--ink); background: var(--cons-bg); }
.pick input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.radio { width: 18px; height: 18px; border-radius: 99px; border: 2px solid var(--field-hover); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pick.is-on .radio { border-color: var(--ink); }
.pick.is-on .radio::after { content: ''; width: 8px; height: 8px; border-radius: 99px; background: var(--ink); }
.picks { display: flex; flex-direction: column; gap: 8px; }
.picks--row { flex-direction: row; flex-wrap: wrap; }
.picks--row .pick { width: auto; min-height: 44px; padding: 0 12px; }

/* ---------------------------------------------------------------- reports -- */

.group-switch { position: relative; display: flex; flex-direction: column; gap: 6px; }
.group-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 0; border: none; background: transparent;
  color: var(--ink); font-size: 34px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; text-align: left;
}
.group-btn .chev { width: 30px; height: 30px; border-radius: 9px; background: var(--seg); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.menu {
  position: absolute; top: 100%; left: 0; margin-top: 10px; z-index: 30; width: 360px; max-width: 86vw;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.menu-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: none; border-radius: var(--r);
  background: transparent; text-align: left; color: var(--ink); min-height: 44px;
}
.menu-item:hover, .menu-item[aria-selected="true"] { background: var(--surface-4); }
.menu-sep { height: 1px; background: var(--line-2); margin: 6px 4px; }
.report-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
@media (max-width: 720px) { .group-btn { font-size: 26px; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  display: flex; flex-direction: column; gap: 10px; min-height: 128px;
}
.kpi--dark { background: var(--ink); border-color: var(--ink); color: var(--side-hi); }
.kpi-label { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.kpi--dark .kpi-label, .kpi--dark .kpi-sub { color: #A9B0A3; }
.kpi-value { font-family: var(--mono); font-size: 27px; font-weight: 550; letter-spacing: -.03em; line-height: 1; }
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin-top: auto; flex-wrap: wrap; }
.kpi-sub { color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 7px; border-radius: 999px; font-weight: 600; background: var(--ok-bg); color: var(--ok-fg); }
.delta--down { background: var(--warn-bg-2); color: var(--warn-fg); }
.kpi--dark .delta { background: var(--side-track); color: var(--lime); }
.kpi--dark .delta--down { color: var(--peach); }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab {
  height: 56px; padding: 0 12px; border: none; background: transparent; font-weight: 600; color: var(--muted);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.report-head { padding: 0 20px; border-bottom: 1px solid var(--line-2); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.report-switches { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 10px 0; }

.fin-head, .fin-row { display: grid; }
.fin-head { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.fin-head > div { padding: 12px 14px; text-align: right; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.fin-head > .fin-label { position: sticky; left: 0; z-index: 2; background: var(--surface-2); padding: 14px 20px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; }
.fin-col-label { font-weight: 650; font-size: 13px; }
.fin-col-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fin-section { padding: 20px 20px 6px; font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fin-section > span { position: sticky; left: 20px; }
.fin-row { background: var(--surface); border-top: 1px solid transparent; }
.fin-row > div { padding: 8px 14px; text-align: right; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.fin-row > .fin-label {
  position: sticky; left: 0; z-index: 1; background: inherit; padding: 8px 20px 8px 32px; text-align: left;
  font-family: var(--font); font-size: 14px; display: flex; align-items: center; gap: 8px; min-width: 0;
}
.fin-row.is-s { font-weight: 600; border-top-color: #DDE0D6; }
.fin-row.is-s > div { padding-top: 10px; padding-bottom: 10px; }
.fin-row.is-s > .fin-label, .fin-row.is-t > .fin-label { padding-left: 20px; }
.fin-row.is-t { background: var(--surface-4); font-weight: 650; border-top-color: #CFD3C6; }
.fin-row.is-t > div { padding-top: 10px; padding-bottom: 10px; }
.fin-row.is-g { background: var(--ink); color: var(--side-hi); font-weight: 650; }
.fin-row.is-g > div { padding: 14px; }
.fin-row.is-g > .fin-label { padding: 14px 20px; }
.fin-row.is-sh > .fin-label { font-weight: 600; padding-top: 12px; }
.fin-row.is-l.is-in > .fin-label { padding-left: 48px; }
.fin-row.is-ss { font-weight: 600; border-top-color: var(--line-2); }
.c-cons { background: var(--cons-bg); }
.fin-head .c-cons { background: var(--cons-head); }
.fin-row.is-t .c-cons { background: var(--cons-total); }
.fin-row.is-g .c-cons { background: transparent; color: var(--lime); }
.c-elim { background: #FCF6EF; color: var(--warn-cell); }
.fin-head .c-elim { background: var(--warn-bg); color: var(--warn-fg); }
.c-var { color: var(--muted-2); }
.fin-row.is-g .c-elim, .fin-row.is-g .c-var { background: transparent; color: var(--side-hi); }

.aging-summary { padding: 22px 20px 8px; display: flex; flex-direction: column; gap: 16px; }
.aging-total { font-family: var(--mono); font-size: 26px; font-weight: 550; letter-spacing: -.03em; }
.bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--bg); }
.bar--sm { height: 8px; gap: 1px; background: transparent; }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.legend-item { display: flex; gap: 10px; align-items: flex-start; }
.swatch { width: 10px; height: 10px; border-radius: 3px; margin-top: 4px; flex: none; }
.age-0 { background: #DCE5C6; }
.age-1 { background: #AFC57F; }
.age-2 { background: #7A9644; }
.age-3 { background: #4A6324; }
.age-4 { background: #C2541B; }
.aging-row { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.aging-row > div:first-child { font-family: var(--font); font-size: 14px; display: flex; align-items: center; gap: 10px; position: sticky; left: 0; background: inherit; }
.aging-total-row { background: var(--ink); color: var(--side-hi); font-weight: 600; }
.aging-total-row:hover { background: var(--ink); }
.cell-late { color: var(--warn-cell); }
.aging-total-row .cell-late { color: var(--peach); }
.aging-total-row .cell-grand { color: var(--lime); }

/* ------------------------------------------------------------ connections -- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat-mark { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.stat-mark .dot { width: 10px; height: 10px; }
.stat-value { font-family: var(--mono); font-size: 22px; font-weight: 600; line-height: 1.1; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; }
.status--attention { color: var(--warn-fg); }
.reason { font-size: 12px; color: var(--warn-fg); }

/* --------------------------------------------------------- consolidations -- */

.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split-side { flex: 1 1 280px; max-width: 100%; display: flex; flex-direction: column; gap: 10px; }
.split-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.group-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-lg);
  border: 1.5px solid var(--line); background: var(--surface-3); text-align: left; color: var(--ink); width: 100%;
}
.group-card:hover { border-color: var(--field-hover); }
.group-card[aria-pressed="true"] { border-color: var(--ink); background: var(--surface); box-shadow: 0 10px 24px -14px rgba(16, 20, 15, .35); }
.group-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.group-card-name { font-weight: 650; font-size: 15px; }
.group-card-top .mono { white-space: nowrap; flex: none; }
.code-chips { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.code-chip { height: 22px; min-width: 34px; padding: 0 5px; border-radius: 6px; font-family: var(--mono); font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.row-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.row-form .field { flex: 1 1 260px; }
.row-form .field--wide { flex: 2 1 300px; }
.name-input { font-size: 18px !important; font-weight: 600 !important; letter-spacing: -.01em; }
.between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.member-row { display: flex; align-items: center; gap: 10px 12px; padding: 10px 18px; border-bottom: 1px solid var(--line-3); }
.member-row .stack { flex: 1 1 auto; }
@media (max-width: 480px) { .member-row { flex-wrap: wrap; } .member-row .stack { flex-basis: 160px; } }
.add-panel .search { flex: none; }
.own { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid var(--field); background: var(--surface); }
.own input { width: 48px; border: none; outline: none; text-align: right; font-family: var(--mono); background: transparent; }
.add-panel { flex: 2 1 300px; min-width: 0; background: var(--surface-3); border: 1px dashed #CDD1C4; border-radius: var(--r-xl); overflow: hidden; }
.add-list { max-height: 460px; overflow-y: auto; padding: 0 8px 8px; }
.add-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r); }
.members-card { flex: 3 1 420px; min-width: 0; }

/* --------------------------------------------------------------- mappings -- */

.map-hero { background: var(--ink); color: var(--side-hi); border-radius: var(--r-xl); padding: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.map-hero-main { flex: 1 1 260px; display: flex; flex-direction: column; gap: 12px; }
.map-pct { font-family: var(--mono); font-size: 38px; font-weight: 550; letter-spacing: -.04em; color: var(--lime); line-height: 1; }
.map-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--side-track); gap: 2px; }
.map-bar .is-mapped { background: var(--lime); }
.map-bar .is-suggested { background: #7E9447; }
.map-figs { display: flex; flex-wrap: wrap; gap: 28px; }
.map-fig { display: flex; flex-direction: column; }
.map-fig .mono { font-size: 22px; font-weight: 600; }
.map-fig span:last-child { font-size: 12.5px; color: #A9B0A3; }
.map-ents { flex: 1 1 260px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 8px; display: flex; flex-direction: column; gap: 2px; max-height: 760px; overflow-y: auto; }
.map-ent { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: none; border-radius: var(--r); background: transparent; text-align: left; color: var(--ink); width: 100%; }
.map-ent:hover, .map-ent[aria-pressed="true"] { background: var(--chip); }
.map-ent[aria-pressed="true"] .ellipsis { font-weight: 650; }
.map-ent-top { display: flex; justify-content: space-between; gap: 8px; width: 100%; }
.mini-track { display: block; width: 100%; height: 4px; border-radius: 99px; background: var(--seg); overflow: hidden; }
.mini-track > span { display: block; height: 4px; background: var(--ink); }
.mini-track.is-done > span { background: var(--olive); }
.map-select { width: 100%; }

/* Mapping rows: a table across a wide card; on a narrow one (a phone, or beside
   the entity list on a small laptop) each row stacks, name and type above the
   account picker, with its actions under that. Sized by the card, not the window. */
.map-list { container-type: inline-size; }
.map-row { grid-template-columns: minmax(0, 1.6fr) 92px 28px minmax(0, 1.6fr) 160px; padding: 0 8px; }
.map-type { font-size: 12.5px; color: var(--chip-fg); }
.map-row > .map-arrow { display: flex; justify-content: center; padding: 0; }
.map-status { display: flex; align-items: center; gap: 4px; }
@container (max-width: 760px) {
  .grid-head.map-row { display: none; }
  .map-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'acct type' 'target target' 'status status';
    padding: 6px 4px;
  }
  .map-acct { grid-area: acct; }
  .map-type { grid-area: type; align-self: start; }
  .map-row > .map-arrow { display: none; }
  .map-row > .map-target { grid-area: target; padding-top: 0; padding-bottom: 4px; }
  .map-row > .map-status { grid-area: status; padding-top: 0; }
}
.map-select.is-unmapped { border-color: #E3BFA2; background: #FFFAF5; }
.map-select.is-suggested { border-color: #C9D69E; }
.suggest-note { font-size: 12px; color: #4C5F1A; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill--ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill--warn { background: var(--warn-bg-2); color: var(--warn-fg); }

/* One column, in report order. Sub-category rows are tinted; their accounts sit beneath on white. */
.chart-cols { display: flex; flex-direction: column; gap: 16px; }
/* The page's 22px gap sits between these: more room above each statement, less below. */
.chart-statement { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin: 18px 0 -10px; }
.chart-cat { background: var(--ink); border-bottom-color: var(--ink); color: var(--side-hi); }
.chart-cat strong { font-size: 15.5px; }
.chart-cat .sub { color: #A9B0A3; }
.chart-sub { border-bottom: 1px solid var(--line-2); }
.chart-sub-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 6px; padding: 6px 10px 6px 18px; background: var(--chip); border-bottom: 1px solid var(--line-2); }
.chart-sub-name { flex: 1 1 180px; min-width: 0; max-width: 520px; margin-right: auto; }
.chart-sub-name input { width: 100%; font-weight: 600; background: var(--surface); }
.chart-acct { display: flex; align-items: center; gap: 4px 6px; min-height: 48px; padding: 2px 10px 2px 40px; border-top: 1px solid var(--line-3); }
.chart-sub-head + .chart-acct { border-top: none; }
.chart-acct-name { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; }
.chart-count { flex: none; padding: 0 6px; }
/* Same-width buttons and counts keep each row's actions in columns. */
.chart-sub-head .chart-count, .chart-acct .chart-count { min-width: 96px; text-align: right; }
.chart-sub-head .btn--sm, .chart-acct .btn--sm { min-width: 128px; justify-content: center; }
.chart-hint { font-size: 13px; }
.chart-empty { padding: 14px 18px; border-bottom: 1px solid var(--line-3); }
.chart-add { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; background: var(--surface-3); }
.chart-add .chart-sub-name { margin-right: 0; }
/* Which Xero names an account was renamed from. */
.chart-was { font-size: 12px; min-width: 0; }
.chart-intro { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.chart-intro > p { flex: 1 1 420px; max-width: 760px; margin: 0; }

/* The AI helper: the draft's banner and rows, and the not-mapped list. */
.ai-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding: 16px 18px; border-color: var(--lime); box-shadow: inset 4px 0 0 var(--lime); }
.ai-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-name { flex: 0 1 340px; flex-direction: column; align-items: stretch; gap: 2px; }
.ai-acct { flex-wrap: wrap; }
.ai-move { flex: none; width: 190px; }
.ai-acct .chart-count { min-width: 128px; }
.ai-move .select { width: 100%; }
.ai-acct .chart-was { flex: 1 1 0; }
.ai-ic.is-hidden { visibility: hidden; }
.ai-picks .picks { max-height: 40vh; overflow-y: auto; }
.ai-picks .pick { min-height: 44px; padding-top: 6px; padding-bottom: 6px; }
.ai-ic { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 6px; font-size: 12px; font-weight: 650; color: var(--warn-fg); }
.ai-ic input { width: 16px; height: 16px; accent-color: var(--ink); }
.ai-leftover { list-style: none; margin: 0; padding: 8px 18px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 4px 16px; }
.ai-leftover li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-3); font-size: 13.5px; }
.ai-leftover label { flex: 0 1 200px; min-width: 0; }
.ai-leftover .select { width: 100%; }
.ai-picks { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ai-picks legend { padding: 0; margin-bottom: 8px; }
.np-list { list-style: none; margin: 8px 0 0; padding: 0; }
.np-row { padding: 8px 18px; border-top: 1px solid var(--line-3); }
.np-main { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 44px; }
.np-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-place { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 6px 0 4px; padding: 12px; border-radius: var(--r-sm); background: var(--surface-3); }
.ai-place { border: none; min-width: 0; }
.ai-place-top, .ai-place-wide { flex-basis: 100%; }
.ai-place-top .seg { width: fit-content; max-width: 100%; }
.ai-place[disabled] .btn--ink { opacity: 1; }
.ai-place-failed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-place-field { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; min-width: 0; }
.ai-place-field > .sub { flex: none; }
.ai-place-actions { display: flex; gap: 8px; margin-left: auto; }
.ai-place-field .input, .ai-place-field .select { flex: 1 1 auto; min-width: 0; width: 100%; }

/* Draft rows have more columns, so they stack sooner: name, original, then the controls. */
@media (max-width: 720px) {
  .ai-acct { padding-left: 20px; }
  .ai-name { flex-basis: 100%; }
  .ai-acct .chart-was { flex-basis: 100%; }
  .ai-acct .chart-was:empty { display: none; }
  .ai-move { flex: 1 1 120px; width: auto; }
  .ai-acct .chart-count { min-width: 0; }
}
@media (max-width: 480px) {
  .ai-acct .chart-count { display: none; }
}
/* Phones: two lines per row — the name, then its details and actions. */
@media (max-width: 480px) {
  .chart-sub-head { padding-left: 12px; }
  .chart-sub-head .chart-sub-name { flex-basis: 100%; max-width: none; }
  .chart-sub-head .chart-count { display: none; }
  .chart-acct { flex-wrap: wrap; padding: 6px 6px 6px 20px; }
  .chart-acct-name { flex-basis: 100%; }
  .chart-acct .chart-count { margin-right: auto; padding-left: 0; min-width: 0; text-align: left; }
  .chart-sub-head .btn--sm, .chart-acct .btn--sm { min-width: 0; }
}

/* ------------------------------------------------------------- settings -- */

.set-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-3); }
.set-row > .stack { flex: 1 1 260px; }
.set-row .sub { font-size: 13px; }
.set-title { font-weight: 650; font-size: 16px; padding-bottom: 10px; }
.card-pad.is-rows { gap: 4px; }
.fx { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--field); background: var(--surface); font-size: 13px; color: var(--muted); }
.fx input { width: 84px; border: none; outline: none; background: transparent; font-family: var(--mono); text-align: right; color: var(--ink); }
.danger { border: 1px solid var(--warn-line); background: #FDF8F3; border-radius: var(--r-xl); padding: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.danger strong { color: var(--warn-fg); }
.is-disabled { opacity: .45; pointer-events: none; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.role-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.role-card span:last-child { color: var(--muted); font-size: 13px; }

/* --------------------------------------------------------------- sign-in -- */

.is-signin { min-height: 100vh; display: flex; }
.signin { margin: auto; padding: 24px 16px; width: 100%; max-width: 440px; }
.signin-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; display: flex; flex-direction: column; gap: 16px; }
.signin-card .brand { padding: 0; margin-bottom: 8px; }
.signin-card .brand-name { color: var(--ink); }
.signin-card .brand-sub { color: var(--muted); }
.signin-card h1 { font-size: 28px; font-weight: 650; letter-spacing: -.03em; }
.signin-foot { font-size: 12.5px; color: var(--muted); }
.errcode { font-family: var(--mono); font-size: 13px; color: var(--muted); }
