/* Bookkeeping Autopilot design system.
   One stylesheet, no build step. Tokens first, then base, layout, components, pages.
   Light + dark via prefers-color-scheme. Money uses tabular numbers everywhere. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --border: #e3e6ec;
  --border-strong: #cfd4dd;
  --text: #151a24;
  --text-2: #4a5465;
  --text-3: #6b7486;
  --accent: #3553d6;
  --accent-hover: #2a45bd;
  --accent-soft: #eaeefe;
  --accent-ink: #ffffff;
  --ok: #157f3c;      --ok-bg: #e8f6ed;   --ok-border: #bfe5cc;
  --warn: #9a5b00;    --warn-bg: #fdf4e3; --warn-border: #f3d9a4;
  --bad: #c0271b;     --bad-bg: #fdeceb;  --bad-border: #f6c7c3;
  --info: #1d5fa8;    --info-bg: #e9f2fc; --info-border: #c3dbf5;
  --muted-bg: #f0f1f4;
  --focus: #3553d6;
  --bubble-in: #eef0f4;
  --bubble-out: #3553d6;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-7: 32px; --space-8: 40px; --space-9: 56px;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px; --radius-xl: 20px; --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .16), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --fs-xs: 12px; --fs-sm: 13px; --fs: 14.5px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px; --fs-3xl: 36px;
  --sidebar: 248px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1116;
    --surface: #161a22;
    --surface-2: #1a1f29;
    --surface-3: #222836;
    --border: #2a3140;
    --border-strong: #3a4356;
    --text: #e8ebf1;
    --text-2: #b3bbca;
    --text-3: #8b94a6;
    --accent: #8fa2ff;
    --accent-hover: #a9b8ff;
    --accent-soft: #232b4d;
    --accent-ink: #0e1116;
    --ok: #5fd28a;   --ok-bg: #14281c;   --ok-border: #24503a;
    --warn: #f2bd55; --warn-bg: #2b2311; --warn-border: #5a4718;
    --bad: #ff8b80;  --bad-bg: #321715;  --bad-border: #62302b;
    --info: #7cc0ff; --info-bg: #13253a; --info-border: #24476b;
    --muted-bg: #20252f;
    --focus: #a9b8ff;
    --bubble-in: #232936;
    --bubble-out: #3a4fb8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 3px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.5 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: var(--fs-xl); font-weight: 650; }
h2 { font-size: var(--fs-lg); font-weight: 600; }
h3 { font-size: var(--fs-md); font-weight: 600; }
p { margin: 0 0 var(--space-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num, .money, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.money { text-align: inherit; }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); } .bad-text { color: var(--bad); } .info-text { color: var(--info); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.sm { width: 15px; height: 15px; vertical-align: -2px; }
.icon.lg { width: 22px; height: 22px; }
.icon.xl { width: 32px; height: 32px; }

/* ------------------------------------------------------------------ app shell */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--surface) calc(var(--sidebar) - 1px), var(--border) calc(var(--sidebar) - 1px), var(--border) var(--sidebar), transparent var(--sidebar)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-5);
  padding: var(--space-5) var(--space-4); background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 15px; padding: 0 var(--space-2); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #4a67ea, #2b44b8); box-shadow: inset 0 -1px 0 rgba(0,0,0,.15); }
.brand-mark .icon { width: 17px; height: 17px; }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--text-3); letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 0 var(--space-3); margin: var(--space-2) 0 var(--space-1); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px var(--space-3); border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav a .count { margin-left: auto; font-size: 11.5px; font-weight: 600; min-width: 20px; padding: 1px 7px; text-align: center;
  border-radius: var(--radius-pill); background: var(--bad-bg); color: var(--bad); }
.nav .client-link { font-weight: 450; font-size: 13.5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); padding-top: var(--space-3); }
.sidebar-foot .who { font-size: 12.5px; color: var(--text-3); padding: 0 var(--space-3) var(--space-2); }

.switcher { position: relative; }
.switcher > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 500; font-size: 13.5px; }
.switcher > summary::-webkit-details-marker { display: none; }
.switcher > summary .icon:last-child { margin-left: auto; color: var(--text-3); }
.switcher > summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); padding: 6px; max-height: 60vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.switcher-menu a { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px; }
.switcher-menu a:hover { background: var(--surface-3); text-decoration: none; }

.topbar { display: none; }
.main { min-width: 0; padding: var(--space-6) var(--space-7) var(--space-9); }
.container { max-width: 1180px; margin: 0 auto; }

@media (max-width: 900px) {
  .shell { display: block; background: none; }
  .sidebar { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: 10px var(--space-4); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border); }
  .topbar details > summary { list-style: none; cursor: pointer; padding: 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: flex; }
  .topbar details > summary::-webkit-details-marker { display: none; }
  .topbar .menu { position: absolute; right: var(--space-3); left: var(--space-3); top: 58px; padding: var(--space-3);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: 80vh; overflow: auto; }
  .main { padding: var(--space-5) var(--space-4) var(--space-8); }
}

/* ------------------------------------------------------------------ page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.page-head h1 { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.page-head .sub { color: var(--text-3); margin-top: 4px; font-size: var(--fs-sm); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 4px; }
.crumbs { font-size: var(--fs-sm); color: var(--text-3); margin-bottom: 6px; }
.crumbs a { color: var(--text-3); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 var(--space-6); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: flex; align-items: center; gap: 6px; padding: 10px 10px; margin-bottom: -1px; color: var(--text-3); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--text-2); }
.tabs .count.bad { background: var(--bad-bg); color: var(--bad); }
.tabs .count.warn { background: var(--warn-bg); color: var(--warn); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--radius); flex-wrap: wrap; }
.segmented a { padding: 5px 12px; border-radius: 7px; color: var(--text-2); font-weight: 500; font-size: var(--fs-sm); white-space: nowrap; }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented .count { color: var(--text-3); font-weight: 500; margin-left: 4px; }

/* ------------------------------------------------------------------ cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-body { padding: var(--space-5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head .hint { color: var(--text-3); font-size: var(--fs-sm); font-weight: 400; }
.card-foot { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: var(--space-5); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-3); }
.row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin: var(--space-2) 0 var(--space-3); flex-wrap: wrap; }
.section-title h2 { font-size: var(--fs-md); }
.section-title p { margin: 0; color: var(--text-3); font-size: var(--fs-sm); }

/* stat cards */
.stat { padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--text-3); font-size: var(--fs-sm); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; display: flex; align-items: center; gap: 8px; }
.stat-value.md { font-size: var(--fs-xl); }
.stat-note { color: var(--text-2); font-size: var(--fs-sm); }
.stat a.stat-link { font-size: var(--fs-sm); font-weight: 500; margin-top: auto; }
.stat.ok { border-top: 3px solid var(--ok); } .stat.bad { border-top: 3px solid var(--bad); } .stat.warn { border-top: 3px solid var(--warn); }
.tick { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; }
.tick.ok { background: var(--ok-bg); color: var(--ok); } .tick.bad { background: var(--bad-bg); color: var(--bad); }
.tick.warn { background: var(--warn-bg); color: var(--warn); } .tick.muted { background: var(--surface-3); color: var(--text-3); }
.tick .icon { width: 15px; height: 15px; stroke-width: 2.6; }

/* ------------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 550;
  line-height: 18px; border: 1px solid var(--border); background: var(--muted-bg); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge.muted { color: var(--text-3); }
.tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 5px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }

/* ------------------------------------------------------------------ buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid transparent; font: 550 var(--fs-sm)/1 var(--font); cursor: pointer; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { background: var(--surface-3); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--bad-border); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { min-height: 48px; padding: 0 22px; font-size: var(--fs-md); border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn .spinner { display: none; }
.btn[aria-busy="true"], .htmx-request .btn[data-loading], .btn.htmx-request { pointer-events: none; opacity: .8; }
.btn[aria-busy="true"] .spinner, .htmx-request .btn[data-loading] .spinner { display: inline-block; }
.btn[aria-busy="true"] .icon, .htmx-request .btn[data-loading] .icon { display: none; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
form.inline { display: inline; margin: 0; }
form { margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 550; font-size: var(--fs-sm); color: var(--text); }
.help { color: var(--text-3); font-size: 12.5px; line-height: 1.45; }
.input, input[type=text], input[type=password], input[type=email], input[type=date], input[type=search], input[type=tel],
input[type=number], input:not([type]), select, textarea {
  font: 400 var(--fs)/1.3 var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 8px; min-height: 38px; padding: 8px 11px; width: 100%; min-width: 0; transition: border-color .12s, box-shadow .12s; }
input[type=file] { font: inherit; font-size: var(--fs-sm); color: var(--text-2); max-width: 100%; }
input[type=file]::file-selector-button { font: 550 12.5px var(--font); padding: 7px 12px; margin-right: 10px; border-radius: 7px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; }
textarea { min-height: 80px; resize: vertical; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.sm, select.sm { min-height: 30px; padding: 4px 9px; font-size: var(--fs-sm); border-radius: 7px; }
select.sm { padding-right: 30px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.form-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-top: var(--space-4); }
.input-group { display: flex; gap: var(--space-2); align-items: stretch; }
.input-group > input, .input-group > select { flex: 1 1 auto; }

/* confirm-in-place (works without JS) */
details.confirm { display: inline-block; position: relative; }
details.confirm > summary { list-style: none; }
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm .confirm-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 260px; padding: var(--space-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); }
details.confirm .confirm-pop p { margin-bottom: var(--space-3); color: var(--text-2); }

/* tooltips / help */
.tip { position: relative; display: inline-flex; align-items: center; color: var(--text-3); cursor: help; vertical-align: middle; }
.tip .icon { width: 15px; height: 15px; }
.tip .tip-body { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 280px;
  padding: 9px 11px; border-radius: 8px; background: #1b2130; color: #eef1f6; font-size: 12.5px; font-weight: 400; line-height: 1.45;
  text-transform: none; letter-spacing: 0; box-shadow: var(--shadow-lg); display: none; z-index: 50; pointer-events: none; text-align: left; white-space: normal; max-width: min(280px, 78vw); }
.tip:hover .tip-body, .tip:focus .tip-body, .tip:focus-within .tip-body { display: block; }
.card-head > .tip .tip-body, .stat-label .tip .tip-body { left: auto; right: -10px; transform: none; }
.stat-label .tip .tip-body { left: -10px; right: auto; }
.explain { display: flex; gap: 10px; padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: var(--info-bg);
  color: var(--text-2); border: 1px solid var(--info-border); font-size: var(--fs-sm); }
.explain .icon { color: var(--info); margin-top: 1px; }
.explain p:last-child { margin: 0; }

/* ------------------------------------------------------------------ flash / notices */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius); margin-bottom: var(--space-5);
  border: 1px solid; font-weight: 500; box-shadow: var(--shadow-sm); animation: flash-in .25s ease-out; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.flash.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.flash.info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.flash .grow { color: var(--text); font-weight: 450; }
.flash a.close { color: inherit; opacity: .7; margin-left: auto; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: var(--space-4); border-radius: var(--radius); border: 1px solid; }
.notice.bad { background: var(--bad-bg); border-color: var(--bad-border); }
.notice.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.notice.ok { background: var(--ok-bg); border-color: var(--ok-border); }
.notice.info { background: var(--info-bg); border-color: var(--info-border); }
.notice .notice-icon { flex: none; margin-top: 1px; }
.notice.bad .notice-icon { color: var(--bad); } .notice.warn .notice-icon { color: var(--warn); } .notice.ok .notice-icon { color: var(--ok); } .notice.info .notice-icon { color: var(--info); }
.notice h3 { font-size: var(--fs); margin-bottom: 2px; }
.notice p { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ tables */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-3); font-weight: 550; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td .sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
td.actions { text-align: right; white-space: nowrap; min-width: 240px; }
tr.is-muted td { color: var(--text-3); }
.amount-in { color: var(--ok); }
.table-card { overflow: hidden; }
.table-card .table-wrap { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* key/value (form-like) lists */
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.kv > div { padding: 10px 0; border-bottom: 1px dashed var(--border); display: contents; }
.kv dt, .kv dd { padding: 9px 0; border-bottom: 1px solid var(--border); margin: 0; }
.kv dt { color: var(--text-2); display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.kv dd { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; padding-left: var(--space-4); white-space: nowrap; }
.kv dt .line-no { font-size: 11.5px; color: var(--text-3); font-weight: 600; min-width: 22px; }
.kv .total dt, .kv .total dd { font-weight: 650; color: var(--text); border-bottom: 0; border-top: 2px solid var(--text); font-size: var(--fs-md); }
.kv dt:nth-last-of-type(1), .kv dd:nth-last-of-type(1) { border-bottom: 0; }

/* ------------------------------------------------------------------ empty states */
.empty { text-align: center; padding: var(--space-8) var(--space-5); color: var(--text-2); }
.empty .empty-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin: 0 auto var(--space-3);
  background: var(--surface-3); color: var(--text-3); }
.empty.ok .empty-icon { background: var(--ok-bg); color: var(--ok); }
.empty h3 { margin-bottom: 4px; color: var(--text); }
.empty p { max-width: 420px; margin: 0 auto var(--space-4); color: var(--text-3); font-size: var(--fs-sm); }
.empty.compact { padding: var(--space-5); }

/* ------------------------------------------------------------------ inbox (Today) */
.inbox { display: flex; flex-direction: column; }
.inbox-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: var(--space-3) var(--space-4); align-items: start;
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); }
.inbox-item:last-child { border-bottom: 0; }
.inbox-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.inbox-icon.bad { background: var(--bad-bg); color: var(--bad); } .inbox-icon.warn { background: var(--warn-bg); color: var(--warn); }
.inbox-icon.info { background: var(--info-bg); color: var(--info); }
.inbox-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); margin-bottom: 3px; }
.inbox-meta .kind { font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }
.inbox-meta .kind.bad { color: var(--bad); } .inbox-meta .kind.warn { color: var(--warn); } .inbox-meta .kind.info { color: var(--info); }
.inbox-title { font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.inbox-detail { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; overflow-wrap: anywhere; }
.inbox-actions { display: flex; gap: var(--space-2); align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.inbox-reply { grid-column: 2 / -1; display: flex; gap: var(--space-2); }
@media (max-width: 720px) {
  .inbox-item { grid-template-columns: 32px minmax(0, 1fr); padding: var(--space-4); }
  .inbox-icon { width: 32px; height: 32px; }
  .inbox-actions { grid-column: 2; justify-content: flex-start; }
  .inbox-reply { flex-direction: column; }
}

/* client list rows */
.client-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) auto; gap: var(--space-4); align-items: center;
  padding: 14px var(--space-5); border-bottom: 1px solid var(--border); color: var(--text); }
.client-row:last-child { border-bottom: 0; }
a.client-row:hover { background: var(--surface-2); text-decoration: none; }
.client-row .name { font-weight: 600; display: flex; align-items: center; gap: 10px; min-width: 0; }
.client-row .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-row .reason { color: var(--text-2); font-size: var(--fs-sm); }
.client-row .meta { color: var(--text-3); font-size: 12.5px; }
@media (max-width: 720px) { .client-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
.health { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); font-weight: 550; }
.health.ok { color: var(--ok); } .health.warn { color: var(--warn); } .health.bad { color: var(--bad); }
.health-ring { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }

/* ------------------------------------------------------------------ transactions */
.filters { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.filters .field { flex-direction: row; align-items: center; }
.filters input[type=search] { width: 220px; }
.filters select { width: auto; }
.line-desc { font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.line-why { color: var(--text-3); font-size: 12.5px; margin-top: 3px; display: flex; gap: 6px; align-items: flex-start; }
.line-why .icon { width: 13px; height: 13px; margin-top: 2px; flex: none; }
.book-form { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.book-form { flex-wrap: wrap; max-width: 220px; margin-left: auto; }
.book-form input[name=account_code] { width: 110px; flex: 0 0 110px; }
.group-head td { background: var(--surface-3) !important; font-weight: 600; font-size: var(--fs-sm); color: var(--text); padding-top: 9px; padding-bottom: 9px; }
.group-head .help { font-weight: 400; margin-left: 8px; }
tr.flash-row td { animation: row-flash 1.6s ease-out; }
@keyframes row-flash { from { background: var(--accent-soft); } to { background: transparent; } }

/* status breakdown bar */
.bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.bar span { display: block; height: 100%; }
.bar .ok { background: var(--ok); } .bar .warn { background: var(--warn); } .bar .bad { background: var(--bad); } .bar .info { background: var(--info); } .bar .muted { background: var(--border-strong); }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------------ stepper (close checklist) */
.stepper { list-style: none; margin: 0; padding: 0; }
.step { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--space-4); padding: 0 0 var(--space-5); }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.step:last-child::before { display: none; }
.step .tick { width: 32px; height: 32px; }
.step .tick .icon { width: 17px; height: 17px; }
.step-title { font-weight: 600; margin-top: 5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.step-detail { color: var(--text-2); font-size: var(--fs-sm); margin-top: 3px; overflow-wrap: anywhere; }
.step-next { margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border);
  display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: var(--fs-sm); }
.step-next strong { color: var(--text); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

.status-track { display: flex; align-items: center; gap: 0; flex-wrap: wrap; row-gap: 8px; }
.status-track .st { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--text-3); font-weight: 500; }
.status-track .st .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); font-size: 11.5px; font-weight: 650; background: var(--surface); }
.status-track .st.done { color: var(--text); } .status-track .st.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.status-track .st.current { color: var(--text); } .status-track .st.current .n { border-color: var(--accent); color: var(--accent); }
.status-track .st.blocked .n { border-color: var(--bad); background: var(--bad); color: #fff; } .status-track .st.blocked { color: var(--bad); }
.status-track .sep { width: 36px; height: 2px; background: var(--border); margin: 0 10px; }
@media (max-width: 720px) { .status-track .sep { width: 14px; margin: 0 6px; } }

/* ------------------------------------------------------------------ chat thread */
.thread { display: flex; flex-direction: column; gap: 6px; padding: var(--space-5); }
.day-sep { text-align: center; font-size: 12px; color: var(--text-3); margin: var(--space-3) 0 var(--space-2); font-weight: 500; }
.msg { display: flex; flex-direction: column; max-width: min(560px, 85%); }
.msg.in { align-self: flex-start; } .msg.out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.msg.in .bubble { background: var(--bubble-in); color: var(--text); border-bottom-left-radius: 6px; }
.msg.out .bubble { background: var(--bubble-out); color: #fff; border-bottom-right-radius: 6px; }
.msg.out .bubble a { color: #fff; text-decoration: underline; }
.msg-meta { font-size: 11.5px; color: var(--text-3); margin: 3px 6px 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.composer { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
@media (max-width: 800px) { .composer { grid-template-columns: minmax(0, 1fr); } }
.composer .label { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }

/* ------------------------------------------------------------------ questions */
.q-card { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-3); }
.q-card:last-child { border-bottom: 0; }
.q-code { font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; margin-right: 6px; }
.options { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--space-2); }
.option { font-size: 12.5px; padding: 3px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border); color: var(--text-2); background: var(--surface); }
.option.guess { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 550; }
.option.chosen { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); font-weight: 600; }

/* ------------------------------------------------------------------ setup checklist */
.check-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--space-4); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); align-items: start; }
.check-row:last-child { border-bottom: 0; }
.check-row .tick { width: 32px; height: 32px; }
.check-row h3 { font-size: var(--fs); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check-row .envs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.env { font-family: var(--mono); font-size: 11.5px; padding: 2px 7px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); display: inline-flex; gap: 5px; align-items: center; }
.env.set { color: var(--ok); border-color: var(--ok-border); background: var(--ok-bg); }
.env.unset { color: var(--text-3); }
@media (max-width: 720px) { .check-row { grid-template-columns: 32px minmax(0, 1fr); } .check-row > :last-child { grid-column: 2; } }

/* connections */
.conn { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: var(--space-4); align-items: center; }
.conn-logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; }
.conn-logo.xero { background: #13b5ea; } .conn-logo.qbo { background: #2ca01c; } .conn-logo.stripe { background: #635bff; }
.conn-logo.square { background: #1a1a1a; } .conn-logo.plaid { background: #111; } .conn-logo.csv { background: #64748b; } .conn-logo.fake { background: #94a3b8; }
@media (max-width: 720px) { .conn { grid-template-columns: 44px minmax(0, 1fr); } .conn > :last-child { grid-column: 1 / -1; } }
.choice { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.choice label { display: flex; gap: 10px; align-items: flex-start; padding: var(--space-3) var(--space-4); border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.choice strong { display: block; font-size: var(--fs-sm); }
.choice span.help { display: block; }

/* ------------------------------------------------------------------ report */
.report-hero { padding: var(--space-6); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border: 1px solid var(--border); }
.report-hero .figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin: var(--space-4) 0; }
.figure { padding: var(--space-4); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.figure .k { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.figure .v { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.figure.accent .v { color: var(--accent); } .figure.ok .v { color: var(--ok); }
.narrative { font-size: var(--fs-md); color: var(--text-2); line-height: 1.6; margin: 0; }
.list-rows { display: flex; flex-direction: column; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-3); padding: 11px 0; border-bottom: 1px solid var(--border); align-items: center; }
.list-row:last-child { border-bottom: 0; }
.list-row .t { font-weight: 550; overflow-wrap: anywhere; }
.list-row .s { font-size: 12.5px; color: var(--text-3); }
.list-row .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.compare { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); font-size: var(--fs-sm); }
.compare > div { padding: 9px 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.compare > div:nth-child(3n+2), .compare > div:nth-child(3n) { text-align: right; }
.compare .h { color: var(--text-3); font-weight: 550; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.compare .em { font-weight: 650; }
.meter { position: relative; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }
.look-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.look-item:last-child { border-bottom: 0; }
.look-item .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.look-item .ic.warn { background: var(--warn-bg); color: var(--warn); } .look-item .ic.bad { background: var(--bad-bg); color: var(--bad); } .look-item .ic.info { background: var(--info-bg); color: var(--info); }
details.raw { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
details.raw > summary { cursor: pointer; padding: 10px 14px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
details.raw pre { margin: 0; padding: 14px; max-height: 420px; overflow: auto; font-size: 12px; border-top: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
details.more > summary { cursor: pointer; color: var(--accent); font-weight: 550; font-size: var(--fs-sm); padding: 10px 0 0; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { display: none; }

/* ------------------------------------------------------------------ login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-5); background:
  radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; padding: var(--space-7); }
.auth-card .brand { justify-content: center; margin-bottom: var(--space-6); padding: 0; }
.auth-card h1 { text-align: center; font-size: var(--fs-xl); margin-bottom: 4px; }
.auth-card .lede { text-align: center; color: var(--text-3); margin-bottom: var(--space-6); font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ owner (consumer) pages */
.owner-body { background: var(--bg); min-height: 100vh; }
.owner-top { display: flex; align-items: center; gap: 10px; padding: 14px var(--space-4); max-width: 560px; margin: 0 auto; }
.owner-top .avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #4a67ea, #2b44b8); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.owner-top .who { font-weight: 600; font-size: 15px; line-height: 1.2; }
.owner-top .who small { display: block; font-weight: 450; font-size: 12px; color: var(--text-3); }
.owner-main { max-width: 560px; margin: 0 auto; padding: var(--space-2) var(--space-4) var(--space-9); }
.owner-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: var(--space-6) var(--space-5); }
.owner-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 99px; margin-bottom: var(--space-4); }
.txn { text-align: center; padding: var(--space-2) 0 var(--space-5); border-bottom: 1px solid var(--border); margin-bottom: var(--space-5); }
.txn .merchant { font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.txn .amount { font-size: 44px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 6px 0; }
.txn .amount.in { color: var(--ok); }
.txn .when { color: var(--text-3); font-size: var(--fs-sm); }
.ask { font-size: var(--fs-lg); font-weight: 600; margin-bottom: var(--space-4); text-align: center; line-height: 1.35; }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice-btn { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 12px 16px; border-radius: 14px;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); font: 550 var(--fs-md)/1.3 var(--font); text-align: left; cursor: pointer;
  transition: border-color .12s, background .12s, transform .06s; }
.choice-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice-btn:active { transform: scale(.99); }
.choice-btn .key { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-weight: 700; font-size: 14px; flex: none; }
.choice-btn.guess { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.choice-btn.guess .key { background: var(--accent); color: var(--accent-ink); }
.choice-btn .choice-text { display: flex; flex-direction: column; gap: 3px; }
.choice-btn .guess-tag { font-size: 11.5px; font-weight: 650; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.note-toggle { margin-top: var(--space-4); }
.note-toggle summary { cursor: pointer; color: var(--text-3); font-size: var(--fs-sm); text-align: center; list-style: none; padding: 6px; }
.note-toggle summary::-webkit-details-marker { display: none; }
.owner-foot { text-align: center; color: var(--text-3); font-size: 12.5px; margin-top: var(--space-5); display: flex; justify-content: center; gap: 6px; align-items: center; }
.done { text-align: center; padding: var(--space-8) var(--space-5); }
.done .big-check { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto var(--space-5); display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
.done .big-check.muted { background: var(--surface-3); color: var(--text-2); }
.done .big-check .icon { width: 38px; height: 38px; stroke-width: 2.6; }
.done h1 { font-size: var(--fs-xl); margin-bottom: 8px; }
.done p { color: var(--text-2); margin: 0 auto var(--space-2); max-width: 360px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.approve-summary { font-size: var(--fs-md); line-height: 1.55; color: var(--text); margin-bottom: var(--space-5); overflow-wrap: anywhere; }
.approve-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: var(--space-5); }
.approve-actions .btn.lg { min-height: 56px; font-size: 17px; }
.item-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.item-list .list-row { padding: 12px 14px; }
.item-list .list-row:nth-child(even) { background: var(--surface-2); }
.item-list-more { padding: 10px 14px; font-size: var(--fs-sm); color: var(--text-3); border-top: 1px solid var(--border); }
.owner-section { margin-top: var(--space-5); }
.owner-section h2 { font-size: var(--fs-md); margin-bottom: var(--space-3); display: flex; gap: 8px; align-items: center; }
/* owner portal (signed in) */
.owner-top .avatar { text-decoration: none; }
.owner-nav { display: flex; gap: 4px; max-width: 560px; margin: 0 auto var(--space-3); padding: 0 var(--space-4); overflow-x: auto; scrollbar-width: none; }
.owner-nav::-webkit-scrollbar { display: none; }
.owner-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 550; white-space: nowrap; }
.owner-nav a:hover { background: var(--surface-3); text-decoration: none; }
.owner-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.owner-nav .count { font-size: 11px; background: var(--warn-bg); color: var(--warn); border-radius: 99px; padding: 0 6px; margin-left: 2px; }
.owner-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.owner-card h1 { font-size: var(--fs-xl); margin-bottom: 6px; }
.owner-card .lede { color: var(--text-2); margin: 0 0 var(--space-4); }
.owner-card > h2 { font-size: var(--fs-md); margin-bottom: var(--space-3); display: flex; align-items: center; gap: 8px; }
.owner-card.compact { padding: var(--space-4) var(--space-5); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist a, .checklist .item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); }
.checklist a:hover { border-color: var(--accent); text-decoration: none; }
.checklist .t { font-weight: 600; }
.checklist .s { font-size: 12.5px; color: var(--text-3); }
.checklist .is-done .t { color: var(--text-2); }
.checklist .tick { width: 32px; height: 32px; }
.checklist .chev { color: var(--text-3); }
.progress-line { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: var(--space-2) 0 var(--space-4); }
.progress-line span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.howto { margin: 0 0 var(--space-4); padding-left: 0; list-style: none; counter-reset: howto; display: flex; flex-direction: column; gap: 10px; }
.howto li { counter-increment: howto; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; line-height: 1.45; }
.howto li::before { content: counter(howto); width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.copy-box { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--surface-2); font-weight: 600; overflow-wrap: anywhere; margin: 0 0 var(--space-4); }
.copy-box .grow { font-family: var(--mono); font-size: 14px; }
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { display: block; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); }
.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile .k { font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.tile .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .s { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tile.warn .v { color: var(--warn); } .tile.ok .v { color: var(--ok); }
.owner-thread { padding: 0; }
.owner-thread .msg { max-width: 88%; }
.owner-compose { display: flex; gap: 8px; margin-top: var(--space-4); }
.owner-compose textarea { flex: 1; min-height: 46px; resize: vertical; }
.big-input { font-size: 17px !important; min-height: 50px; }
@media (max-width: 480px) {
  .owner-nav { gap: 0; padding: 0 var(--space-3); }
  .owner-nav a { padding: 7px 9px; gap: 4px; }
  .owner-nav a .icon { display: none; }
  .tile-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .owner-card { padding: var(--space-5) var(--space-4); border-radius: 18px; }
  .report-hero { padding: var(--space-5) var(--space-4); }
  .report-hero .figures { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .figure .v { font-size: 26px; }
}

/* ------------------------------------------------------------------ misc */
.pill-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-nav a { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; background: var(--surface); display: inline-flex; gap: 6px; align-items: center; }
.pill-nav a[aria-current="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.pill-nav a:hover { text-decoration: none; border-color: var(--border-strong); }
.deadline { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: var(--space-3); align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.deadline:last-child { border-bottom: 0; }
a.deadline:hover { text-decoration: none; }
a.deadline:hover .what { color: var(--accent); }
.cal { text-align: center; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); }
.cal .m { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-3); color: var(--text-2); padding: 2px 0; }
.cal .d { font-size: 18px; font-weight: 700; padding: 1px 0 3px; font-variant-numeric: tabular-nums; }
.cal.late .m { background: var(--bad); color: #fff; }
.deadline .what { font-weight: 550; font-size: var(--fs-sm); }
.deadline .when { font-size: 12px; color: var(--text-3); }
.divider-v { width: 1px; align-self: stretch; background: var(--border); }
.footer-note { color: var(--text-3); font-size: 12.5px; margin-top: var(--space-6); text-align: center; }
.hidden { display: none !important; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); }
.mb-0 { margin-bottom: 0; } .mb-3 { margin-bottom: var(--space-3); }
