/* PocketInvoice v2 — design system
   Type: Instrument Sans (UI), Instrument Serif (display + hero figures), IBM Plex Mono (tails, routes, numbers).
   Palette: warm paper + deep navy ink, one accent: signal orange. Dark mode = night cockpit. */

@font-face { font-family: 'Instrument Sans'; src: url('../fonts/instrument-sans-var.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Sans'; src: url('../fonts/instrument-sans-var-italic.woff2') format('woff2'); font-weight: 400 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('../fonts/instrument-serif.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('../fonts/instrument-serif-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/ibm-plex-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/ibm-plex-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --font-ui: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --bg: #f4f1ea;
  --bg-tint: #efebe2;
  --surface: #fffefb;
  --surface-2: #f9f7f2;
  --surface-3: #f1ede4;
  --ink: #0e1b2e;
  --ink-2: #33415a;
  --muted: #5f6878;
  --faint: #98a1b0;
  --line: #e4dfd4;
  --line-strong: #d3ccbe;
  --accent: #c94c19; /* white text on it = 4.6:1 (AA) */
  --accent-ink: #b0410e;
  --accent-soft: #fbe7dc;
  --on-accent: #ffffff;
  --navy: #0e1b2e;
  --good: #1f7a55;
  --good-soft: #e1f2e9;
  --warn: #94560a;
  --warn-soft: #fbefd9;
  --bad: #b42331;
  --bad-soft: #f9e1e3;
  --info: #2f64a8;
  --info-soft: #e3ecf8;
  --series-1: #2f64a8;
  --series-2: #d9541e;
  --focus: #2f64a8;
  --shadow-1: 0 1px 2px rgba(14, 27, 46, 0.06), 0 1px 1px rgba(14, 27, 46, 0.04);
  --shadow-2: 0 10px 30px -12px rgba(14, 27, 46, 0.25), 0 2px 6px rgba(14, 27, 46, 0.06);
  --shadow-3: 0 30px 60px -20px rgba(14, 27, 46, 0.35);
  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 22px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 220ms;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0a111d;
  --bg-tint: #0d1626;
  --surface: #111a2b;
  --surface-2: #142035;
  --surface-3: #1a2740;
  --ink: #edf1f7;
  --ink-2: #c3ccda;
  --muted: #8f9bb0;
  --faint: #66738a;
  --line: #213049;
  --line-strong: #2c3d5b;
  --accent: #ee6a33;
  --accent-ink: #ff8a57;
  --accent-soft: #3a1f15;
  --on-accent: #1a0d07;
  --good: #46c08b;
  --good-soft: #10291f;
  --warn: #e4a446;
  --warn-soft: #2e2210;
  --bad: #f06a74;
  --bad-soft: #3a161b;
  --info: #7aa5e4;
  --info-soft: #14243d;
  --series-1: #5b8fd6;
  --series-2: #e0652f;
  --focus: #7aa5e4;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 14px 34px -14px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-3: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
  min-height: 100dvh;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

.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; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.skip-link:focus { top: 12px; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-s { width: 16px; height: 16px; }
.icon-l { width: 24px; height: 24px; }

.mono { font-family: var(--font-mono); font-feature-settings: normal; letter-spacing: 0; }
.num { font-variant-numeric: tabular-nums; }
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.faint { color: var(--muted); } /* --faint is for strokes only; text stays AA */
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.eyebrow { font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row-flex { display: flex; align-items: center; gap: 12px; }
.stack { display: grid; gap: 16px; }
.stack-s { display: grid; gap: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- app shell */
.app { min-height: 100dvh; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .brand-mini { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar .title { font-weight: 600; font-size: 17px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; }
.main { padding: 4px 16px calc(var(--nav-h) + var(--safe-b) + 28px); max-width: 1180px; margin: 0 auto; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.5) blur(18px);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  border-top: 1px solid var(--line);
}
.bottom-nav a, .bottom-nav button.nav-add-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: 100%; min-height: 48px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  background: none; border: 0; position: relative;
}
.bottom-nav a[aria-current='page'] { color: var(--ink); }
.bottom-nav a[aria-current='page'] .icon { color: var(--accent); }
.bottom-nav .badge { position: absolute; top: 9px; left: calc(50% + 6px); }
.nav-add {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 22px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  transform: translateY(-14px); transition: transform var(--dur) var(--ease);
}
.nav-add .icon { width: 26px; height: 26px; }
.bottom-nav button.nav-add-wrap:active .nav-add { transform: translateY(-12px) scale(0.96); }

.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 1;
}

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 260px 1fr; }
  .bottom-nav, .topbar .brand-mini { display: none; }
  .topbar { padding: 18px 36px 14px; background: color-mix(in srgb, var(--bg) 90%, transparent); }
  .main { padding: 8px 36px 56px; width: 100%; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px;
    position: sticky; top: 0; height: 100dvh; padding: 22px 16px 18px;
    background: var(--navy); color: #e8edf5;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
  }
  :root[data-theme='dark'] .sidebar { background: #070c16; }
  .sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; text-decoration: none; }
  .sidebar .brand-name { font-family: var(--font-display); font-size: 25px; line-height: 1; color: #fff; }
  .sidebar .brand-sub { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #8d9ab1; margin-top: 4px; }
  .sidebar .add-btn { margin: 4px 4px 14px; justify-content: center; }
  .sidebar nav { display: grid; gap: 2px; }
  .sidebar nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none;
    color: #b7c2d4; font-weight: 500; font-size: 15px; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .sidebar nav a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
  .sidebar nav a[aria-current='page'] { background: rgba(255, 255, 255, 0.09); color: #fff; }
  .sidebar nav a[aria-current='page'] .icon { color: #ff8a57; }
  .sidebar nav .badge { margin-left: auto; }
  .sidebar .nav-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: #7c8aa3; padding: 16px 12px 6px; }
  .sidebar .side-foot { margin-top: auto; display: grid; gap: 8px; padding: 12px 8px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
  .sidebar .side-foot .who { font-size: 13px; color: #8d9ab1; overflow: hidden; text-overflow: ellipsis; }
  .sidebar .side-foot button { color: #b7c2d4; }
  .sidebar .side-foot button:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
  .sidebar .kbd-hint { font-size: 12px; color: #7c8aa3; }
  .sidebar .kbd { border-color: rgba(255, 255, 255, 0.15); color: #b7c2d4; background: transparent; }
}

/* ---------------------------------------------------------------- page heads */
.page { animation: page-in 320ms var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; gap: 16px; padding: 10px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-weight: 400; font-size: 38px; letter-spacing: -0.015em; line-height: 1.05; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 960px) { .page-head h1 { font-size: 46px; } }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 12px; }
.section-title h2 { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.section-title .link { margin-left: auto; font-size: 14px; color: var(--accent-ink); text-decoration: none; font-weight: 600; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 120ms var(--ease), box-shadow var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-primary:hover { background: var(--accent-ink); }
:root[data-theme='dark'] .btn-primary:hover { background: #ff7c44; }
.btn-ink { background: var(--ink); color: var(--surface); }
.btn-ink:hover { background: var(--ink-2); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--faint); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-block { width: 100%; }
.btn-l { min-height: 54px; font-size: 17px; border-radius: 14px; padding: 0 22px; }
.btn-s { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.icon-btn { width: 44px; height: 44px; padding: 0; border-radius: 12px; background: transparent; border: 0; display: inline-grid; place-items: center; color: var(--ink-2); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .badge { position: absolute; top: 4px; right: 2px; }
.sidebar .add-btn.btn-primary { background: var(--accent); color: #fff; }

.kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; font-family: var(--font-mono); font-size: 12px; text-align: center; color: var(--ink-2); background: var(--surface); }

/* ---------------------------------------------------------------- cards + stats */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 18px; }
@media (min-width: 960px) { .card-pad { padding: 22px; } }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-head h3 { font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 960px) { .stats { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 16px; } }
.stat { padding: 16px 16px 14px; display: grid; gap: 6px; text-decoration: none; position: relative; overflow: hidden; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat .label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .value { font-family: var(--font-display); font-size: 34px; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: lining-nums; }
.stat .value .cents { font-size: 0.55em; color: var(--muted); }
.stat .meta { font-size: 12.5px; color: var(--muted); }
.stat.hero { grid-column: 1 / -1; background: var(--navy); color: #f3f5f9; border-color: transparent; padding: 22px 20px; }
.stat.hero .label, .stat.hero .meta { color: #a9b5c8; }
.stat.hero .value { font-size: 52px; color: #fff; }
.stat.hero .value .cents { color: #8d9ab1; }
.stat.hero::after {
  content: ''; position: absolute; right: -40px; bottom: -60px; width: 260px; height: 160px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 45%, transparent), transparent);
  opacity: 0.55; pointer-events: none;
}
.stat.hero .horizon { position: absolute; left: 20px; right: 20px; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--accent), transparent 70%); opacity: 0.9; }
@media (min-width: 960px) { .stat.hero { grid-column: auto; } .stat.hero .value { font-size: 48px; } }
@media (max-width: 959px) { .stat.wide { grid-column: 1 / -1; } .desk-only { display: none !important; } }
:root[data-theme='dark'] .stat.hero { background: linear-gradient(160deg, #13213a, #0c1526); border: 1px solid var(--line); }
.stat.alert .value { color: var(--bad); }
.stat .cta { font-size: 13px; font-weight: 600; color: var(--accent-ink); display: inline-flex; align-items: center; gap: 4px; }

.grid-2 { display: grid; gap: 16px; }
@media (min-width: 960px) { .grid-2 { grid-template-columns: 1.4fr 1fr; gap: 20px; } }

/* ---------------------------------------------------------------- pills + chips */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill-draft { background: var(--surface-3); color: var(--muted); }
.pill-ready { background: var(--info-soft); color: var(--info); }
.pill-sent { background: var(--info-soft); color: var(--info); }
.pill-partial { background: var(--warn-soft); color: var(--warn); }
.pill-paid { background: var(--good-soft); color: var(--good); }
.pill-overdue { background: var(--bad-soft); color: var(--bad); }
.pill-void, .pill-archived { background: var(--surface-3); color: var(--muted); text-decoration: line-through; }
.pill-invoiced { background: var(--accent-soft); color: var(--accent-ink); }
.tag-cyd { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; color: #6d3bd1; background: #efe7fd; }
:root[data-theme='dark'] .tag-cyd { color: #c4a6ff; background: #261a40; }
.tail { font-family: var(--font-mono); font-size: 12.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); letter-spacing: 0.02em; }
.route { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); letter-spacing: 0.02em; }
.invno { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.01em; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 500; cursor: pointer; scroll-snap-align: start;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chip:hover { border-color: var(--faint); }
.chip[aria-pressed='true'], .chip[aria-checked='true'], .chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip .count { font-size: 12px; opacity: 0.7; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; }
.field > label, .field .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .err { font-size: 13px; color: var(--bad); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 16px; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
.select { background-image: url('../assets/chevron.svg'); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--focus) 22%, transparent); }
.input[aria-invalid='true'] { border-color: var(--bad); }
.input.mono { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; }
.input.money { font-variant-numeric: tabular-nums; }
.input-wrap { position: relative; }
.input-wrap .prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 14px; }
.input-wrap .prefix + .input { padding-left: 28px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (min-width: 960px) { .form-grid.md-cols-2 { grid-template-columns: 1fr 1fr; } .form-grid.md-cols-3 { grid-template-columns: repeat(3, 1fr); } }
.form-error { padding: 12px 14px; border-radius: 12px; background: var(--bad-soft); color: var(--bad); font-weight: 500; font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }

.switch { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--line-strong); position: relative; flex: none; cursor: pointer; transition: background var(--dur) var(--ease); margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform var(--dur) var(--ease); }
.switch input:checked { background: var(--good); }
.switch input:checked::after { transform: translateX(18px); }
.switch .txt { display: grid; }
.switch .txt small { color: var(--muted); font-size: 12.5px; }

.check-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; cursor: pointer; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row input[type='checkbox'] { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--line-strong); flex: none; display: grid; place-items: center; margin: 0; background: var(--surface); transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.check-row input[type='checkbox']:checked { background: var(--accent); border-color: var(--accent); }
.check-row input[type='checkbox']:checked::after { content: ''; width: 6px; height: 11px; border: solid var(--on-accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check-row:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------- lists + tables */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 68px;
  border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; transition: background var(--dur) var(--ease);
}
.list > li:last-child .list-item, .list > .list-item:last-child { border-bottom: 0; }
a.list-item:hover, button.list-item:hover { background: var(--surface-2); }
a.list-item[aria-current='true'] { background: var(--surface-3); box-shadow: inset 3px 0 0 var(--accent); }
button.list-item { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.list-item .lead { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.list-item .lead.accent { background: var(--accent-soft); color: var(--accent-ink); }
.list-item .lead.cyd { background: #efe7fd; color: #6d3bd1; }
:root[data-theme='dark'] .list-item .lead.cyd { background: #261a40; color: #c4a6ff; }
.list-item .main-col { flex: 1; min-width: 0; display: grid; gap: 3px; }
.list-item .t1 { font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-item .t2 { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-item .end { text-align: right; display: grid; gap: 4px; justify-items: end; flex: none; }
.list-item .amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.date-tile { width: 46px; flex: none; text-align: center; border-radius: 12px; background: var(--surface-3); padding: 6px 0 5px; line-height: 1; }
.date-tile .m { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-ink); font-weight: 700; }
.date-tile .d { font-family: var(--font-display); font-size: 22px; margin-top: 3px; }
.list-group-label { padding: 18px 4px 8px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; }
.list-group-label span:last-child { margin-left: auto; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num, .table td.right, .table th.right { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------------- two-pane */
.split { display: grid; gap: 16px; }
@media (min-width: 1100px) {
  .split { grid-template-columns: minmax(340px, 400px) 1fr; gap: 22px; align-items: start; }
  .split .pane-list { position: sticky; top: 84px; max-height: calc(100dvh - 104px); overflow: auto; }
  .split.has-detail .pane-detail-empty { display: none; }
}
@media (max-width: 1099px) { .split.has-detail .pane-list { display: none; } .split:not(.has-detail) .pane-detail { display: none; } }
.pane-detail-empty { display: grid; place-items: center; min-height: 420px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- sheet (add flight etc.) */
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 26, 0.45); z-index: 60; opacity: 0; transition: opacity var(--dur) var(--ease); }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-height: 94dvh;
  display: flex; flex-direction: column; background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-3);
  transform: translateY(100%); transition: transform 320ms var(--ease);
}
.sheet.open { transform: none; }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px 10px 20px; flex: none; }
.sheet-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 28px; flex: 1; }
.sheet-body { overflow-y: auto; padding: 6px 20px 20px; flex: 1; overscroll-behavior: contain; }
.sheet-foot { flex: none; padding: 12px 20px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; gap: 14px; }
.sheet-foot .total { flex: 1; min-width: 0; }
.sheet-foot .total .v { font-family: var(--font-display); font-size: 30px; line-height: 1; }
.sheet-foot .total .l { font-size: 12px; color: var(--muted); }
@media (min-width: 960px) {
  .sheet { left: auto; top: 0; bottom: 0; width: 520px; max-height: none; border-radius: 0; transform: translateX(100%); }
  .sheet .grabber { display: none; }
  .sheet-head { padding: 22px 16px 10px 28px; }
  .sheet-body { padding: 6px 28px 24px; }
  .sheet-foot { padding: 16px 28px; }
}

.dialog { border: 0; padding: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(8, 14, 26, 0.5); }
.dialog[open] { animation: pop 220ms var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: none; } }
.dialog .d-body { padding: 22px 22px 8px; display: grid; gap: 10px; }
.dialog h2 { font-size: 19px; }
.dialog .d-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- toast, banners, empty, skeleton */
.toasts { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 960px) { .toasts { bottom: 24px; left: auto; right: 24px; transform: none; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 14px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-2); font-weight: 500; font-size: 14.5px; animation: toast-in 260ms var(--ease); }
.toast.bad { background: var(--bad); color: #fff; }
.toast .icon { color: #7ee0ae; }
.toast.bad .icon { color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); text-decoration: none; }
.banner.cyd { background: linear-gradient(110deg, #efe7fd, var(--surface) 80%); border: 1px solid #ddd0fb; }
:root[data-theme='dark'] .banner.cyd { background: linear-gradient(110deg, #261a40, var(--surface) 80%); border-color: #3a2a62; }
.banner.cyd .lead { color: #6d3bd1; }
:root[data-theme='dark'] .banner.cyd .lead { color: #c4a6ff; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.info { background: var(--info-soft); color: var(--info); }
.banner .grow b { display: block; color: var(--ink); }

.empty { text-align: center; padding: 44px 24px; display: grid; justify-items: center; gap: 10px; }
.empty .art { width: 120px; height: 84px; margin-bottom: 6px; color: var(--faint); }
.empty h3 { font-family: var(--font-display); font-weight: 400; font-size: 26px; }
.empty p { color: var(--muted); max-width: 34ch; }
.empty .btn { margin-top: 8px; }

.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 10px; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 14px; margin: 8px 0; }
.sk-stat { height: 108px; border-radius: var(--radius); }
.sk-row { height: 68px; border-radius: 0; margin: 0; border-bottom: 1px solid var(--line); }

.error-state { text-align: center; padding: 56px 24px; display: grid; justify-items: center; gap: 12px; }
.error-state .ring { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--bad-soft); color: var(--bad); }
.error-state h3 { font-family: var(--font-display); font-weight: 400; font-size: 28px; }
.error-state p { color: var(--muted); max-width: 40ch; }

/* ---------------------------------------------------------------- chart */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font-ui); }
.chart .bar-1 { fill: var(--series-1); }
.chart .bar-2 { fill: var(--series-2); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .hover-band, .chart .col:hover .hover-band { opacity: 1; }
.chart .hover-band { fill: var(--surface-3); opacity: 0; transition: opacity 120ms; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.legend .sw.s1 { background: var(--series-1); }
.legend .sw.s2 { background: var(--series-2); }
.tooltip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--surface); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow-2); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.tooltip .sw { width: 8px; height: 8px; border-radius: 2px; }
.tooltip .sw.s1 { background: var(--series-1); }
.tooltip .sw.s2 { background: var(--series-2); }

/* ---------------------------------------------------------------- invoice detail */
.inv-head { display: grid; gap: 14px; }
.inv-amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.inv-amounts > div { background: var(--surface); padding: 14px 16px; }
.inv-amounts .v { font-family: var(--font-display); font-size: 28px; line-height: 1.05; font-variant-numeric: lining-nums; }
.inv-amounts .l { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.inv-amounts .balance .v { color: var(--accent-ink); }
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.line-edit { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.line-edit .row-flex { gap: 8px; }
.line-edit .qty { width: 92px; }
.line-edit .price { width: 120px; }
.line-edit .amt { width: 110px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.lock-note { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }

.totals-bar { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 18px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-3); margin-top: 16px; }
.totals-bar .v { font-family: var(--font-display); font-size: 28px; line-height: 1; }
.totals-bar .l { font-size: 12px; opacity: 0.7; }
.totals-bar .btn-primary { margin-left: auto; }
@media (min-width: 960px) { .totals-bar { bottom: 18px; } }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 9px 0; font-size: 14px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 10px; top: 28px; bottom: -4px; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.timeline .dot .icon { width: 12px; height: 12px; }
.timeline .when { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100dvh; display: grid; }
@media (min-width: 960px) { .login { grid-template-columns: 1.05fr 1fr; } }
.login-art { display: none; position: relative; overflow: hidden; background: var(--navy); color: #eef2f8; padding: 56px; }
@media (min-width: 960px) { .login-art { display: flex; flex-direction: column; } }
.login-art .quote { margin-top: auto; font-family: var(--font-display); font-size: 46px; line-height: 1.08; max-width: 14ch; }
.login-art .quote em { color: #ff8a57; }
.login-art .foot { margin-top: 26px; color: #8d9ab1; font-size: 14px; }
.login-art .horizon-art { position: absolute; inset: auto -10% 26% -10%; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent); }
.login-art .rings { position: absolute; right: -180px; top: -180px; width: 620px; height: 620px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.06); box-shadow: 0 0 0 70px rgba(255, 255, 255, 0.015), 0 0 0 140px rgba(255, 255, 255, 0.012); }
.login-form { display: grid; place-items: center; padding: 32px 22px; }
.login-card { width: min(400px, 100%); display: grid; gap: 18px; }
.login-card .brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-card .brand-row .name { font-family: var(--font-display); font-size: 28px; }
.login-card h1 { font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1.05; }
.otp-input { font-family: var(--font-mono); font-size: 28px; letter-spacing: 0.5em; text-align: center; padding-left: 0.5em; }

/* ---------------------------------------------------------------- misc */
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.receipt-thumb { width: 100%; max-height: 360px; object-fit: contain; border-radius: 12px; background: var(--surface-3); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; min-height: 36px; padding: 0 14px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.search { position: relative; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 42px; }
.qr { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 12px; }
.secret { font-family: var(--font-mono); font-size: 14px; word-break: break-all; padding: 10px 12px; background: var(--surface-3); border-radius: 10px; }
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 95; background: var(--warn); color: #fff; text-align: center; font-size: 13px; font-weight: 600; padding: calc(4px + var(--safe-t)) 8px 4px; }
.more-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.more-grid a { display: grid; gap: 10px; padding: 18px; text-decoration: none; }
.more-grid a .icon { color: var(--accent); width: 24px; height: 24px; }
.more-grid a b { font-weight: 600; }
.more-grid a span { font-size: 13px; color: var(--muted); }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell .bar { height: 6px; border-radius: 3px; background: var(--series-1); min-width: 2px; }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- invoice document (screen + print) */
.doc-toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 0 18px; flex-wrap: wrap; }
.doc-wrap { background: var(--bg-tint); border-radius: var(--radius-l); padding: 18px 0; }
.doc {
  --d-ink: #0e1b2e; --d-muted: #5d6879; --d-line: #e3ded3; --d-accent: #d9541e;
  width: min(816px, 100%); margin: 0 auto; background: #fff; color: var(--d-ink); box-shadow: var(--shadow-2);
  padding: 44px 40px 40px; border-radius: 6px; font-size: 14px; line-height: 1.5; position: relative; overflow: hidden;
  font-family: var(--font-ui);
}
@media (min-width: 700px) { .doc { padding: 64px 64px 56px; } }
.doc .lh { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.doc .lh-name { font-family: var(--font-display); font-size: 34px; line-height: 1.05; letter-spacing: -0.01em; }
.doc .lh-tag { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--d-muted); margin-top: 6px; }
.doc .lh-contact { text-align: right; font-size: 12.5px; color: var(--d-muted); white-space: pre-line; }
.doc .rule { height: 2px; background: linear-gradient(90deg, var(--d-accent) 0 64px, var(--d-line) 64px); margin: 26px 0 30px; }
.doc .meta { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.doc .title { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--d-muted); font-weight: 600; }
.doc .invno-big { font-family: var(--font-mono); font-size: 22px; font-weight: 500; margin-top: 4px; }
.doc .billto { margin-top: 18px; white-space: pre-line; }
.doc .billto b { font-size: 15px; }
.doc .dates { display: grid; grid-template-columns: auto auto; gap: 6px 18px; justify-content: end; align-content: start; font-size: 13px; }
.doc .dates dt { color: var(--d-muted); text-align: right; }
.doc .dates dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; font-weight: 500; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 34px; }
.doc th { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--d-muted); font-weight: 600; text-align: left; padding: 0 8px 10px; border-bottom: 1.5px solid var(--d-ink); }
.doc td { padding: 12px 8px; border-bottom: 1px solid var(--d-line); vertical-align: top; }
.doc .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc td.date { white-space: nowrap; color: var(--d-muted); font-variant-numeric: tabular-nums; width: 1%; }
.doc .ltype { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--d-muted); }
.doc .totals { margin-left: auto; margin-top: 18px; width: min(300px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 7px 18px; font-variant-numeric: tabular-nums; }
.doc .totals dt { color: var(--d-muted); }
.doc .totals dd { margin: 0; text-align: right; }
.doc .totals .grand { border-top: 1.5px solid var(--d-ink); padding-top: 10px; margin-top: 4px; font-weight: 600; color: var(--d-ink); }
.doc .totals .due { font-family: var(--font-display); font-size: 28px; font-weight: 400; color: var(--d-ink); }
.doc .notes { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 40px; font-size: 13px; color: #33415a; white-space: pre-line; }
.doc .notes h4 { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--d-muted); margin-bottom: 6px; font-weight: 600; }
.doc .foot { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--d-line); display: flex; justify-content: space-between; font-size: 12px; color: var(--d-muted); }
.doc .stamp { position: absolute; top: 150px; right: -50px; transform: rotate(28deg); padding: 6px 70px; font-weight: 700; letter-spacing: 0.3em; font-size: 15px; color: #fff; }
.doc .stamp.paid { background: #1f7a55; }
.doc .stamp.void { background: #8a94a3; }

@media print {
  @page { size: letter; margin: 0.55in; }
  html, body { background: #fff !important; }
  .sidebar, .bottom-nav, .topbar, .doc-toolbar, .toasts, .doc-tip, .skip-link, .offline-bar { display: none !important; }
  .app { display: block !important; }
  .main { padding: 0 !important; max-width: none !important; }
  .page { animation: none !important; }
  .doc-wrap { background: none; padding: 0; border-radius: 0; }
  .doc { width: 100%; max-width: none; box-shadow: none; padding: 0; border-radius: 0; }
  .doc tr { break-inside: avoid; }
  .doc .stamp, .doc .rule { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.empty .art .fill { fill: var(--surface); }
.login-art .art-name { font-family: var(--font-display); font-size: 26px; color: #fff; }
.banner + .stats { margin-top: 14px; }
.card-head .legend { margin-left: auto; }
.sk-title { height: 44px; width: 260px; border-radius: 10px; }
.detail-title { font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1.1; margin-top: 4px; }
.totals-kv { grid-template-columns: 1fr auto; padding: 12px 14px 16px; border-top: 1px solid var(--line); max-width: 360px; margin-left: auto; }
.totals-kv dt { text-align: right; }
.pre { white-space: pre-line; }
.due-overdue { color: var(--bad); }
@media (min-width: 960px) { .md-span-2 { grid-column: 1 / -1; } }
.cust-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cust-card { display: grid; gap: 6px; padding: 18px; text-align: left; cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.cust-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.cust-card .v { font-family: var(--font-display); font-size: 28px; line-height: 1; }
.steps { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.steps .on { color: var(--ink); font-weight: 600; }
.inbox-list { display: grid; gap: 14px; }
@media (min-width: 1100px) { .inbox-list { grid-template-columns: 1fr 1fr; } }
.inbox-card { padding: 16px 18px; display: grid; gap: 12px; border-left: 3px solid #8b5cf6; animation: page-in 300ms var(--ease) both; }
.inbox-top { display: flex; align-items: center; gap: 10px; }
.inbox-main { display: flex; gap: 14px; align-items: flex-start; }
.inbox-main h3 { font-size: 17px; margin-bottom: 4px; }
.inbox-amt { font-family: var(--font-display); font-size: 28px; line-height: 1; }
.needs { margin-top: 8px; display: flex; gap: 6px; align-items: center; color: var(--warn); font-size: 13.5px; font-weight: 500; }
.mini-lines { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 13.5px; }
.mini-lines li { display: flex; gap: 12px; justify-content: space-between; color: var(--ink-2); border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.inbox-foot { display: flex; align-items: center; gap: 6px; margin-top: 18px; }
.inv-amounts .v.small-v { font-family: var(--font-ui); font-size: 18px; font-weight: 600; padding-top: 6px; }
.report-stats { margin: 16px 0 20px; }
.total-row td { border-top: 1.5px solid var(--line-strong); }
.due-strong { color: var(--accent-ink); font-weight: 600; }
.more-foot { margin-top: 16px; }
.settings-nav { display: flex; gap: 8px; margin-bottom: 16px; }
.settings-section { display: grid; gap: 14px; }
.settings-section + .settings-section { margin-top: 18px; }
.settings-section h2 { font-size: 16px; }
.preview-mini { transform-origin: top left; }
.card-pad-x { padding: 0 18px 14px; }
.inbox-card .action-bar .btn { flex: 1 1 auto; }
.list-item .t2.t2-nowrap { flex-wrap: nowrap; }
.list-item .t2.t2-nowrap > span:last-child { flex: none; }
@media (min-width: 960px) { .topbar .title { font-size: 14px; color: var(--muted); font-weight: 500; } }
@media (max-width: 959px) { .page-head h1 { font-size: 36px; } .page-head .actions .btn { min-height: 40px; } }
.doc .totals { column-gap: 0; } .doc .totals dd { padding-left: 18px; }
.form-grid > * { min-width: 0; }

/* ---------------------------------------------------------------- v2.1: Cyd token details */
.token-row .t1 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.token-scopes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.scope { padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.token-hint { color: var(--warn); padding-bottom: 14px; }
.banner.warn .grow b { color: var(--warn); }

/* ---------------------------------------------------------------- v2.2: import old app backup */
.import-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.import-page .page-head { padding-bottom: 4px; }
.h-small { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.inline-ic { display: inline-block; vertical-align: -3px; margin-right: 2px; }
.ok-text { color: var(--good); font-weight: 600; white-space: nowrap; }
.bad-text { color: var(--bad); font-weight: 600; }
.warn-text { color: var(--warn); }
.wrap { word-break: break-all; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.steps li { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface-3); }
.steps li .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; background: var(--surface); color: var(--muted); border: 1px solid var(--line-strong); }
.steps li.on { background: var(--accent-soft); color: var(--accent-ink); }
.steps li.on .n { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.steps li.done { color: var(--good); background: var(--good-soft); }
.steps li.done .n { background: var(--good); border-color: var(--good); color: var(--surface); }
.import-grid { align-items: stretch; }
.import-drop { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 36px 22px 30px; border: 1.5px dashed var(--line-strong); background:
  radial-gradient(120% 80% at 50% 0%, var(--accent-soft), transparent 60%), var(--surface); transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.import-drop.over { border-color: var(--accent); transform: scale(1.01); }
.import-drop h2 { font-size: 30px; }
.import-drop p { max-width: 38ch; }
.drop-art { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); color: var(--accent); }
.drop-art .icon { width: 34px; height: 34px; stroke-width: 1.5; }
.import-drop .form-error { width: 100%; text-align: left; }
@media (max-width: 959px) { .desk-hint { display: none; } }
.privacy-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.privacy-list li { display: grid; grid-template-columns: 22px 1fr; gap: 12px; font-size: 14.5px; color: var(--ink-2); }
.privacy-list li .icon { color: var(--accent-ink); margin-top: 1px; }
.privacy-list b { color: var(--ink); }
.checking { display: grid; gap: 12px; }
.file-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.file-row .lead { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.file-row .t1 { font-weight: 600; }
.verdict { display: flex; gap: 16px; align-items: flex-start; padding: 20px; border-radius: var(--radius-l); border: 1px solid transparent; }
.verdict h2 { font-size: 28px; line-height: 1.1; margin-bottom: 6px; }
.verdict p { color: var(--ink-2); max-width: 70ch; }
.verdict .ring, .ring { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface); }
.verdict.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.verdict.good .ring, .ring.good { color: var(--good); }
.verdict.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.verdict.bad .ring { color: var(--bad); }
.verdict.bad h2 { color: var(--bad); }
.verdict.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.verdict.warn .ring { color: var(--warn); }
.verdict-list { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; color: var(--ink); }
.recon-stats .stat.hero .meta { color: #cfe9dc; }
.recon-stats .stat.hero .meta.bad-text { color: #ffb3b9; }
.count-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); margin-top: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
@media (min-width: 960px) { .count-grid { grid-template-columns: repeat(4, 1fr); } }
.count { background: var(--surface); padding: 12px 16px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 8px; }
.count .ic { color: var(--muted); grid-row: span 2; }
.count .l { font-size: 13px; color: var(--muted); font-weight: 500; }
.count .v { font-family: var(--font-display); font-size: 24px; line-height: 1; grid-row: span 2; }
.status-strip { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 12px 16px 16px; }
.status-strip .st { display: inline-flex; align-items: center; gap: 8px; }
.recon-table { font-size: 14px; }
.recon-table td { padding: 11px 14px; }
.recon-table tr.row-bad td { background: var(--bad-soft); }
.recon-table tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.recon-table tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.recon-table .check-col { min-width: 160px; }
.recon-table .check-col .pill { margin: 0 4px 4px 0; }
.diff-chip { display: inline-block; font-family: var(--font-mono); font-size: 12px; padding: 2px 8px; border-radius: 8px; background: var(--surface); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); margin: 0 4px 4px 0; white-space: nowrap; }
.row-notes { margin: 4px 0 0; padding-left: 16px; font-size: 12.5px; display: grid; gap: 2px; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.note-list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.note-list li:last-child { border-bottom: 0; }
@media (max-width: 959px) {
  /* the tables become one card per row on the phone */
  .recon-table thead { display: none; }
  .recon-table, .recon-table tbody, .recon-table tr, .recon-table td { display: block; width: 100%; }
  .recon-table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
  .recon-table tr.row-bad { background: var(--bad-soft); box-shadow: inset 3px 0 0 var(--bad); }
  .recon-table tr.row-warn { box-shadow: inset 3px 0 0 var(--warn); }
  .recon-table td { border: 0; padding: 4px 0; background: transparent !important; box-shadow: none !important; text-align: left !important; }
  .recon-table td::before { content: attr(data-label); display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
  .recon-table td.check-col, .recon-table td[data-label='Customer'] { grid-column: 1 / -1; }
  .recon-table td.ellipsis { white-space: normal; }
}
.confirm-card { display: grid; gap: 16px; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: var(--shadow-2); }
.confirm-card h2 { font-size: 28px; }
.confirm-card .ring { background: var(--good-soft); }
.phrase { background: var(--accent-soft); color: var(--accent-ink); padding: 1px 8px; border-radius: 6px; }
.import-bar { position: static; }
.result-hero { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 34px 22px; background: radial-gradient(120% 70% at 50% 0%, var(--good-soft), transparent 65%), var(--surface); }
.result-hero h2 { font-size: 40px; }
.result-hero .ring { width: 64px; height: 64px; box-shadow: var(--shadow-2); }
.made-list { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.made-list li { display: grid; gap: 2px; padding: 10px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); min-width: 96px; font-size: 13px; color: var(--muted); }
.made-list .v { font-family: var(--font-display); font-size: 26px; color: var(--ink); line-height: 1; }
.result-kv { text-align: left; max-width: 620px; width: 100%; margin-top: 6px; }
.result-actions { justify-content: center; flex-wrap: wrap; margin-top: 8px; }
