/* ============================================================
   DTOH Billing Automation — SPA styles
   Clean, professional SaaS look: cool light surfaces, slate text,
   a calm blue accent, and a neutral dark console. Single Inter
   type family. Restrained — trustworthy AP tooling, not decorative.
   ============================================================ */

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

:root {
  --font-sans:    'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;

  /* Cool light surfaces + slate ink */
  --paper:        #eef3f9;
  --paper-2:      #e4ecf5;
  --card:         #ffffff;
  --ink:          #16233a;
  --ink-soft:     #46536b;
  --ink-faint:    #8592a6;
  --hair:         #dbe4ef;
  --hair-strong:  #c4d1e0;

  /* Accent — calm blue */
  --accent:       #2f7dea;
  --accent-deep:  #1c5fd0;
  --accent-tint:  #e6f0fd;

  /* Signal colors (badge system per contract) */
  --ok:           #2f855a;
  --ok-tint:      #e4f2ea;
  --ok-ink:       #1f5138;
  --warn:         #b8791a;
  --warn-tint:    #fbeed6;
  --warn-ink:     #7a4e0b;
  --bad:          #c53b3b;
  --bad-tint:     #f8e0e0;
  --bad-ink:      #872626;

  /* Console — neutral slate with a sky accent */
  --term-bg:      #0f172a;
  --term-bg-2:    #0b1120;
  --term-hair:    #24304a;
  --term-info:    #8ecbff;
  --term-warn:    #fbbf5a;
  --term-err:     #f79389;
  --term-dim:     #66748f;
  --term-fg:      #c8d4e6;

  --shadow-sm: 0 1px 2px rgba(22,35,58,.05), 0 2px 6px rgba(22,35,58,.05);
  --shadow-md: 0 4px 14px rgba(22,35,58,.07), 0 12px 30px rgba(22,35,58,.06);
  --shadow-lg: 0 18px 50px rgba(22,35,58,.13);

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;

  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-soft: cubic-bezier(.4,.14,.3,1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 82% -8%, rgba(47,125,234,.06), transparent 60%),
    radial-gradient(900px 500px at 0% 4%, rgba(47,125,234,.05), transparent 55%);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }

/* ---------- layout shell ---------- */
.shell { max-width: 1240px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 44px); }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(1.3) blur(8px);
  background: color-mix(in oklab, var(--paper) 82%, transparent);
  border-bottom: 1px solid var(--hair);
}
.topbar__inner {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 0 15px;
}
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand__glyph {
  width: 42px; height: 42px; flex: none;
  border-radius: 10px;
  background:
    linear-gradient(150deg, var(--accent), var(--accent-deep));
  color: #fff; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 21px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), var(--shadow-sm);
  position: relative;
}
.brand__glyph::after{
  content:""; position:absolute; inset:0; border-radius:inherit;
  border:1px solid rgba(255,255,255,.14);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand__name {
  font-family: var(--font-display); font-weight: 600;
  font-size: 20px; letter-spacing: -.01em;
}
.brand__sub {
  font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 500;
}
.topbar__spacer { flex: 1; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 11px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--hair-strong);
  font-size: 12.5px; font-weight: 500; color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
.status-pill__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
}
.status-pill[data-state="idle"] .status-pill__dot { background: var(--ink-faint); }
.status-pill[data-state="running"] { border-color: color-mix(in oklab, var(--accent) 50%, var(--hair)); color: var(--accent-deep); }
.status-pill[data-state="running"] .status-pill__dot { background: var(--accent); animation: pulse 1.4s var(--ease) infinite; }
.status-pill[data-state="done"] { border-color: color-mix(in oklab, var(--ok) 45%, var(--hair)); color: var(--ok-ink); }
.status-pill[data-state="done"] .status-pill__dot { background: var(--ok); }
.status-pill[data-state="error"] { border-color: color-mix(in oklab, var(--bad) 45%, var(--hair)); color: var(--bad-ink); }
.status-pill[data-state="error"] .status-pill__dot { background: var(--bad); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px rgba(47,125,234,0); }
  100% { box-shadow: 0 0 0 0 rgba(47,125,234,0); }
}

/* ---------- section rhythm ---------- */
main { padding: clamp(26px, 5vw, 52px) 0 120px; }
.section { margin-top: clamp(28px, 5vw, 56px); }
.section:first-child { margin-top: 0; }

.eyebrow {
  font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent-deep); font-weight: 600; margin: 0 0 6px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: ""; width: 22px; height: 1.5px; background: var(--accent); display: inline-block;
}
.section__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(24px, 3.2vw, 34px); letter-spacing: -.015em;
  margin: 0 0 4px;
}
.section__lede { color: var(--ink-soft); margin: 0; max-width: 62ch; font-size: 15px; }

/* ============================================================
   1. HERO + DROPZONE
   ============================================================ */
.hero {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(24px, 4vw, 60px);
  align-items: center;
}
.hero__copy h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(34px, 5.4vw, 60px); line-height: 1.02;
  letter-spacing: -.02em; margin: 14px 0 16px;
}
.hero__copy h1 em {
  font-style: normal; font-weight: 600;
  color: var(--accent-deep);
}
.hero__copy p { font-size: 16.5px; color: var(--ink-soft); max-width: 46ch; margin: 0 0 24px; }
.hero__flow {
  display: flex; flex-wrap: wrap; gap: 8px 6px; align-items: center;
  font-size: 12.5px; color: var(--ink-faint);
}
.hero__flow span { display: inline-flex; align-items: center; gap: 7px; }
.hero__flow b { color: var(--ink); font-weight: 600; }
.hero__flow .arrow { color: var(--hair-strong); }

/* dropzone */
.dropzone {
  position: relative; display: block; width: 100%;
  border: 1.5px dashed var(--hair-strong);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, var(--card), color-mix(in oklab, var(--card) 60%, var(--paper-2)));
  padding: clamp(34px, 4vw, 52px) 34px;
  text-align: center; cursor: pointer;
  transition: border-color .28s var(--ease), background .28s var(--ease),
              transform .28s var(--ease), box-shadow .28s var(--ease);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.dropzone::before {
  content: ""; position: absolute; inset: 6px; border-radius: 13px;
  border: 1px solid var(--hair); pointer-events: none; opacity: .6;
}
.dropzone:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dropzone.is-drag {
  border-color: var(--accent); border-style: solid;
  background: var(--accent-tint);
  transform: translateY(-3px) scale(1.006);
  box-shadow: var(--shadow-lg);
}
.dropzone__icon {
  width: 60px; height: 60px; margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--paper); border: 1px solid var(--hair);
  color: var(--accent-deep);
  transition: transform .4s var(--ease);
}
.dropzone.is-drag .dropzone__icon { transform: translateY(-4px) rotate(-4deg); }
.dropzone__icon svg { width: 28px; height: 28px; }
.dropzone__title { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin: 0 0 5px; }
.dropzone__hint { color: var(--ink-faint); font-size: 14px; margin: 0; }
.dropzone__hint b { color: var(--accent-deep); font-weight: 600; }
.dropzone__formats {
  margin-top: 20px; display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}
.chip {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--hair);
}
.dropzone input[type=file] { display: none; }

.dropzone.is-uploading { pointer-events: none; }
.dropzone__file {
  display: none; align-items: center; gap: 12px; justify-content: center;
  font-size: 14px; color: var(--ink-soft);
}
.dropzone.is-uploading .dropzone__file { display: flex; }
.dropzone.is-uploading .dropzone__prompt { display: none; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--hair-strong); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   2. WIZARD / STEPPER
   ============================================================ */
.wizard { }
.wizard__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.progress {
  display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-soft);
}
.progress__track {
  width: 160px; height: 7px; border-radius: 999px; background: var(--hair);
  overflow: hidden; box-shadow: inset 0 1px 2px rgba(28,37,48,.1);
}
.progress__fill {
  height: 100%; width: 0%; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  transition: width .7s var(--ease);
}
.progress__pct { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); min-width: 3ch; }

.stepper {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 0;
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r-lg); padding: 8px; box-shadow: var(--shadow-sm);
  position: relative;
}
.step {
  position: relative; padding: 16px 14px 15px; border-radius: var(--r);
  display: flex; flex-direction: column; gap: 9px;
  transition: background .35s var(--ease);
}
.step + .step::before {
  content: ""; position: absolute; left: -1px; top: 26px;
  width: 2px; height: 20px; background: var(--hair); border-radius: 2px;
  display: none;
}
.step__marker {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--hair-strong); background: var(--paper);
  color: var(--ink-faint); font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: all .4s var(--ease);
  position: relative;
}
.step__marker svg { width: 15px; height: 15px; }
.step__label {
  font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; color: var(--ink-soft);
  transition: color .35s var(--ease);
}
.step__meta { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .1em; }

/* connector line behind markers */
.stepper::after {
  content: ""; position: absolute; left: calc(8px + 22px); right: calc(8px + 22px);
  top: 39px; height: 2px; background: var(--hair); z-index: 0; border-radius: 2px;
}
.step { z-index: 1; }

.step[data-state="active"] { background: var(--accent-tint); }
.step[data-state="active"] .step__marker {
  border-color: var(--accent); color: #fff;
  background: linear-gradient(150deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 0 5px color-mix(in oklab, var(--accent) 20%, transparent);
  animation: markerPulse 1.6s var(--ease) infinite;
}
.step[data-state="active"] .step__label { color: var(--accent-deep); }
.step[data-state="active"] .step__meta { color: var(--accent-deep); }
@keyframes markerPulse {
  0%,100% { box-shadow: 0 0 0 5px color-mix(in oklab, var(--accent) 20%, transparent); }
  50%     { box-shadow: 0 0 0 8px color-mix(in oklab, var(--accent) 8%, transparent); }
}
.step[data-state="done"] .step__marker {
  border-color: var(--ok); background: var(--ok); color: #fff;
  box-shadow: none;
}
.step[data-state="done"] .step__label { color: var(--ink); }
.step[data-state="done"] .step__meta { color: var(--ok); }
.step[data-state="done"] .step__marker .step__num { display: none; }
.step[data-state="active"] .step__marker .step__check,
.step[data-state="pending"] .step__marker .step__check { display: none; }
.step[data-state="done"] .step__marker .step__num { display: none; }
.step__check { display: none; }
.step[data-state="done"] .step__check { display: block; }
.step[data-state="done"] .step__num { display: none; }

/* ============================================================
   3. CONSOLE
   ============================================================ */
.console {
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--term-bg); border: 1px solid var(--term-hair);
  box-shadow: var(--shadow-md);
}
.console__bar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; background: var(--term-bg-2);
  border-bottom: 1px solid var(--term-hair);
}
.console__lights { display: flex; gap: 7px; }
.console__lights i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.console__lights i:nth-child(1){ background:#e0685f; }
.console__lights i:nth-child(2){ background:#e6b34d; }
.console__lights i:nth-child(3){ background:#63b47e; }
.console__title {
  color: var(--term-dim); font-size: 12.5px; letter-spacing: .04em;
  font-family: var(--font-mono);
}
.console__title b { color: var(--term-fg); font-weight: 600; }
.console__meta { margin-left: auto; color: var(--term-dim); font-size: 11.5px; display: flex; align-items: center; gap: 8px; }
.console__live {
  display: inline-flex; align-items: center; gap: 6px; color: var(--term-info);
}
.console__live i { width: 7px; height: 7px; border-radius: 50%; background: var(--term-info); animation: pulse2 1.3s infinite; }
@keyframes pulse2 { 0%,100%{opacity:1;} 50%{opacity:.3;} }

.console__body {
  height: 320px; overflow-y: auto; padding: 14px 16px 16px;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
  font-size: 12.8px; line-height: 1.62;
  color: var(--term-fg);
  scroll-behavior: smooth;
}
.console__body::-webkit-scrollbar { width: 10px; }
.console__body::-webkit-scrollbar-thumb { background: #2b3733; border-radius: 6px; border: 2px solid var(--term-bg); }
.console__body::-webkit-scrollbar-track { background: transparent; }

.logline {
  display: grid; grid-template-columns: auto auto 1fr; gap: 12px;
  padding: 1px 0; align-items: baseline;
  animation: logIn .34s var(--ease) both;
}
@keyframes logIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.logline__ts { color: var(--term-dim); font-variant-numeric: tabular-nums; }
.logline__tag {
  color: var(--term-dim); text-transform: uppercase; font-size: 10.5px; letter-spacing: .06em;
  min-width: 66px; padding-top: 1px;
}
.logline__msg { color: var(--term-fg); word-break: break-word; }
.logline--warn .logline__msg { color: var(--term-warn); }
.logline--error .logline__msg { color: var(--term-err); }
.logline--warn .logline__tag { color: color-mix(in oklab, var(--term-warn) 70%, var(--term-dim)); }
.logline--error .logline__tag { color: color-mix(in oklab, var(--term-err) 70%, var(--term-dim)); }
.logline__msg::before { content: "› "; color: var(--term-dim); }
.logline--error .logline__msg::before { content: "✕ "; color: var(--term-err); }
.logline--warn .logline__msg::before { content: "! "; color: var(--term-warn); }

.console__empty {
  color: var(--term-dim); font-family: ui-monospace, monospace; font-size: 12.8px;
}
.console__empty .cursor { display: inline-block; width: 8px; height: 15px; background: var(--term-info); vertical-align: text-bottom; animation: blink 1.1s step-end infinite; margin-left: 3px; }
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   ERROR BANNER
   ============================================================ */
.banner {
  display: none; align-items: flex-start; gap: 13px;
  padding: 15px 18px; border-radius: var(--r);
  background: var(--bad-tint); border: 1px solid color-mix(in oklab, var(--bad) 40%, var(--hair));
  color: var(--bad-ink); box-shadow: var(--shadow-sm);
  animation: logIn .3s var(--ease) both;
}
.banner.is-shown { display: flex; }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner b { display: block; font-size: 14.5px; }
.banner span { font-size: 13.5px; }

/* ============================================================
   4. RESULTS
   ============================================================ */
.results { display: none; }
.results.is-shown { display: block; }

/* summary card */
.summary {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 0;
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.summary__main { padding: clamp(22px, 3vw, 30px); }
.summary__vendor { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.summary__seal {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 19px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.summary__vendor h3 { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.summary__vendor p { margin: 2px 0 0; color: var(--ink-faint); font-size: 13px; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 24px; }
.fact { display: flex; flex-direction: column; gap: 3px; }
.fact__k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.fact__v { font-size: 18px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.fact__v.money { font-family: var(--font-display); }
.fact__v small { font-size: 12px; color: var(--ink-faint); font-weight: 400; font-family: var(--font-sans); }

.summary__side {
  padding: clamp(22px, 3vw, 30px);
  background: linear-gradient(160deg, color-mix(in oklab, var(--paper-2) 70%, var(--card)), var(--paper-2));
  border-left: 1px solid var(--hair);
  display: flex; flex-direction: column; gap: 16px; justify-content: center;
}
.confmeter { }
.confmeter__row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.confmeter__k { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.confmeter__v { font-family: var(--font-display); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.confmeter__track { height: 8px; border-radius: 999px; background: var(--hair); overflow: hidden; }
.confmeter__fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ok), color-mix(in oklab, var(--ok) 60%, var(--warn))); transition: width 1s var(--ease); }

.splitcounts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.count {
  border-radius: var(--r); padding: 14px 16px; border: 1px solid var(--hair); background: var(--card);
}
.count--ok { background: var(--ok-tint); border-color: color-mix(in oklab, var(--ok) 30%, var(--hair)); }
.count--flag { background: var(--warn-tint); border-color: color-mix(in oklab, var(--warn) 35%, var(--hair)); }
.count__n { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.count--ok .count__n { color: var(--ok-ink); }
.count--flag .count__n { color: var(--warn-ink); }
.count__l { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; margin-top: 6px; }
.count--ok .count__l { color: var(--ok-ink); }
.count--flag .count__l { color: var(--warn-ink); }

/* results: the annotated PDF is the hero — full width and large — with the
   line-items table stacked beneath it. */
.results__grid { display: grid; grid-template-columns: 1fr; gap: 22px; margin-top: 22px; align-items: start; }

.panel {
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--hair); background: color-mix(in oklab, var(--paper-2) 40%, var(--card));
}
.panel__head h4 { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 0; }
.panel__head .panel__badge { margin-left: auto; font-size: 11px; color: var(--ink-faint); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }

.pdfwrap { position: relative; background: var(--paper-2); }
.pdfframe { width: 100%; height: min(90vh, 1100px); border: 0; display: block; background: var(--paper-2); }
.pdf-fallback {
  height: min(90vh, 1100px); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 30px; color: var(--ink-soft);
}
.pdf-fallback svg { width: 46px; height: 46px; color: var(--accent-deep); margin-bottom: 6px; }
.pdf-fallback p { margin: 0; }
.pdf-fallback b { font-family: var(--font-display); font-size: 17px; color: var(--ink); }
.pdf-fallback__hint { font-size: 13px; color: var(--ink-faint); margin-bottom: 12px !important; }
.pdf-open { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 12.5px; color: var(--accent-deep); text-decoration: none; font-weight: 600; }
.pdf-open:hover { text-decoration: underline; }
.pdf-open svg { width: 14px; height: 14px; }

/* line-items table */
.lines { overflow-x: auto; }
table.lines__table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.lines__table thead th {
  text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--hair-strong);
  background: color-mix(in oklab, var(--paper-2) 40%, var(--card));
  position: sticky; top: 0;
}
.lines__table thead th.num, .lines__table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.lines__table tbody tr { border-bottom: 1px solid var(--hair); transition: background .2s var(--ease); }
.lines__table tbody tr:hover { background: color-mix(in oklab, var(--accent-tint) 40%, transparent); }
.lines__table tbody tr.is-flagged { background: color-mix(in oklab, var(--warn-tint) 55%, transparent); }
.lines__table tbody tr.is-flagged:hover { background: color-mix(in oklab, var(--warn-tint) 80%, transparent); }
.lines__table tbody tr.is-dispute { background: color-mix(in oklab, var(--bad-tint) 45%, transparent); }
.lines__table td { padding: 13px 14px; vertical-align: middle; }
.patient__name { font-weight: 600; color: var(--ink); }
.patient__first { color: var(--ink-faint); font-weight: 400; }
.svc { color: var(--ink-soft); max-width: 200px; }
.ordernum { font-family: ui-monospace, monospace; font-size: 12.5px; color: var(--ink); }
.ordernum.empty { color: var(--ink-faint); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.badge--green { background: var(--ok-tint); color: var(--ok-ink); }
.badge--amber { background: var(--warn-tint); color: var(--warn-ink); }
.badge--red   { background: var(--bad-tint); color: var(--bad-ink); }
.badge__dot { width: 7px; height: 7px; border-radius: 50%; }
.badge--green .badge__dot { background: var(--ok); }
.badge--amber .badge__dot { background: var(--warn); }
.badge--red .badge__dot { background: var(--bad); }

.ai-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em;
  padding: 2px 6px; border-radius: 5px; margin-left: 6px;
  background: var(--ink); color: var(--paper); cursor: help;
  vertical-align: middle;
}

.state-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--ink-faint); }
.state-tag.ok { color: var(--ok); }
.state-tag.flag { color: var(--warn); }
.state-tag.dispute { color: var(--bad); }
.dispute-note { display: block; margin-top: 4px; font-size: 12px; color: var(--bad-ink); font-style: italic; }

/* ============================================================
   6. HITL REVIEW
   ============================================================ */
.review { }
.review__empty {
  text-align: center; padding: 50px 20px; color: var(--ink-soft);
  background: var(--ok-tint); border: 1px solid color-mix(in oklab, var(--ok) 25%, var(--hair));
  border-radius: var(--r-lg);
}
.review__empty svg { width: 40px; height: 40px; color: var(--ok); margin-bottom: 12px; }
.review__empty h4 { font-family: var(--font-display); font-size: 20px; margin: 0 0 4px; color: var(--ok-ink); }
.review__empty p { margin: 0; }

.review__list { display: flex; flex-direction: column; gap: 16px; }
.rcard {
  background: var(--card); border: 1px solid color-mix(in oklab, var(--warn) 35%, var(--hair));
  border-left: 4px solid var(--warn);
  border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden;
  transition: opacity .4s var(--ease), transform .4s var(--ease), border-color .4s var(--ease);
}
.rcard.is-dispute { border-left-color: var(--bad); border-color: color-mix(in oklab, var(--bad) 35%, var(--hair)); }
.rcard.is-resolved { opacity: .58; border-left-color: var(--ok); }
.rcard__top { display: flex; align-items: flex-start; gap: 16px; padding: 18px 20px 14px; flex-wrap: wrap; }
.rcard__id {
  font-family: ui-monospace, monospace; font-size: 11px; color: var(--ink-faint);
  background: var(--paper-2); border: 1px solid var(--hair); border-radius: 6px; padding: 2px 7px;
}
.rcard__patient { flex: 1; min-width: 200px; }
.rcard__patient h4 { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0 0 2px; letter-spacing: -.01em; }
.rcard__patient p { margin: 0; color: var(--ink-soft); font-size: 13.5px; }
.rcard__patient p b { color: var(--ink); font-variant-numeric: tabular-nums; }
.rcard__resolved {
  display: none; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ok-ink);
}
.rcard.is-resolved .rcard__resolved { display: inline-flex; }
.rcard__resolved svg { width: 16px; height: 16px; }

.whys { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 8px; }
.why {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px;
  background: var(--warn-tint); border-radius: var(--r-sm); font-size: 13.5px; color: var(--warn-ink);
}
.rcard.is-dispute .why { background: var(--bad-tint); color: var(--bad-ink); }
.why svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.why code { font-family: ui-monospace, monospace; font-size: 11px; opacity: .8; text-transform: uppercase; letter-spacing: .04em; margin-right: 4px; }

.rcard__actions {
  display: flex; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--hair);
  background: color-mix(in oklab, var(--paper-2) 30%, var(--card)); flex-wrap: wrap;
}
.rcard.is-resolved .rcard__actions { display: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 9px; border: 1px solid transparent;
  cursor: pointer; transition: transform .12s var(--ease), background .2s var(--ease),
    box-shadow .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
  background: none;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }
.btn--ghost { border-color: var(--hair-strong); color: var(--ink-soft); background: var(--card); }
.btn--ghost:hover { border-color: var(--ink-faint); color: var(--ink); }
.btn--approve { background: var(--ok); color: #fff; box-shadow: var(--shadow-sm); }
.btn--approve:hover { background: var(--ok-ink); }
.btn--correct { border-color: var(--hair-strong); color: var(--ink); background: var(--card); }
.btn--correct:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn--dispute { border-color: color-mix(in oklab, var(--bad) 40%, var(--hair)); color: var(--bad-ink); background: var(--bad-tint); }
.btn--dispute:hover { background: color-mix(in oklab, var(--bad-tint) 70%, var(--bad)); border-color: var(--bad); }
.btn--reject { color: var(--ink-faint); background: none; }
.btn--reject:hover { color: var(--bad-ink); background: var(--bad-tint); }

/* CTA / NetSuite */
.cta-row {
  margin-top: 26px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 22px 24px; border-radius: var(--r-lg);
  background: linear-gradient(150deg, var(--ink), color-mix(in oklab, var(--ink) 80%, #2e3a2c));
  box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.cta-row::after {
  content:""; position:absolute; right:-40px; top:-40px; width:180px; height:180px;
  border-radius:50%; background: radial-gradient(circle, rgba(47,125,234,.28), transparent 70%);
}
.cta-row__text { flex: 1; min-width: 220px; position: relative; }
.cta-row__text h4 { font-family: var(--font-display); color: var(--paper); font-size: 19px; margin: 0 0 3px; font-weight: 600; }
.cta-row__text p { margin: 0; color: color-mix(in oklab, var(--paper) 70%, var(--ink-faint)); font-size: 13.5px; }
.btn--netsuite {
  background: linear-gradient(150deg, var(--accent), var(--accent-deep)); color: #fff;
  padding: 13px 24px; font-size: 15px; border-radius: 11px; position: relative;
  box-shadow: 0 6px 18px rgba(47,125,234,.4), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn--netsuite:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(47,125,234,.5), inset 0 1px 0 rgba(255,255,255,.25); }
.btn--netsuite:active { transform: translateY(0); }
.btn--netsuite svg { width: 17px; height: 17px; }

/* ============================================================
   TOOLTIP / INFO ICON
   ============================================================ */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; cursor: help;
  color: var(--ink-faint); position: relative; vertical-align: middle;
}
.info svg { width: 14px; height: 14px; }
.info:hover { color: var(--accent-deep); }
.info__pop {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 400;
  padding: 9px 12px; border-radius: 8px; width: max-content; max-width: 240px;
  line-height: 1.45; text-transform: none; letter-spacing: 0;
  box-shadow: var(--shadow-md); opacity: 0; visibility: hidden;
  transition: opacity .18s var(--ease), transform .18s var(--ease); z-index: 50; pointer-events: none;
  text-align: left;
}
.info__pop::after {
  content:""; position:absolute; top:100%; left:50%; transform:translateX(-50%);
  border:6px solid transparent; border-top-color: var(--ink);
}
.info:hover .info__pop { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ============================================================
   TOAST
   ============================================================ */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--ink); color: var(--paper); padding: 15px 18px; border-radius: var(--r);
  box-shadow: var(--shadow-lg); max-width: 360px;
  animation: toastIn .4s var(--ease) both;
}
.toast.is-out { animation: toastOut .3s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }
.toast__icon { width: 32px; height: 32px; flex: none; border-radius: 9px; background: color-mix(in oklab, var(--accent) 30%, var(--ink)); display: grid; place-items: center; color: var(--paper); }
.toast__icon svg { width: 18px; height: 18px; }
.toast b { display: block; font-size: 14px; margin-bottom: 2px; }
.toast span { font-size: 13px; color: color-mix(in oklab, var(--paper) 78%, var(--ink-faint)); }

/* reveal animation for results sections */
.reveal { animation: reveal .6s var(--ease) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.reveal.d1 { animation-delay: .06s; }
.reveal.d2 { animation-delay: .14s; }
.reveal.d3 { animation-delay: .22s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; gap: 30px; }
  .results__grid { grid-template-columns: 1fr; }
  .pdfframe { height: 520px; }
}
@media (max-width: 820px) {
  .stepper { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stepper::after { display: none; }
  .summary { grid-template-columns: 1fr; }
  .summary__side { border-left: 0; border-top: 1px solid var(--hair); }
  .facts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .stepper { grid-template-columns: repeat(2, 1fr); }
  .facts { grid-template-columns: 1fr; }
  .splitcounts { grid-template-columns: 1fr; }
  .wizard__head { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ============================================================
   TOP NAV (shared across pages)
   ============================================================ */
.topnav { display: flex; align-items: center; gap: 4px; margin-left: 14px; }
.topnav__link {
  position: relative; text-decoration: none;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  padding: 7px 13px; border-radius: 8px;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.topnav__link:hover { color: var(--ink); background: color-mix(in oklab, var(--accent-tint) 55%, transparent); }
.topnav__link.is-active { color: var(--accent-deep); background: var(--accent-tint); }
.topnav__link.is-active::after {
  content: ""; position: absolute; left: 13px; right: 13px; bottom: -2px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
@media (max-width: 720px) {
  .topnav { margin-left: 6px; gap: 2px; }
  .topnav__link { padding: 6px 9px; font-size: 12.5px; }
  .brand__sub { display: none; }
}

/* ============================================================
   PAGE HEAD (dashboard / invoices)
   ============================================================ */
.pagehead { margin-bottom: 6px; }
.pagehead h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(26px, 3.6vw, 38px); letter-spacing: -.02em; margin: 8px 0 6px;
}
.pagehead p { color: var(--ink-soft); margin: 0; max-width: 60ch; font-size: 15px; }
.pagehead__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* generic empty state */
.emptystate {
  text-align: center; padding: 60px 24px; color: var(--ink-soft);
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.emptystate svg { width: 46px; height: 46px; color: var(--accent-deep); margin-bottom: 14px; opacity: .85; }
.emptystate h3 { font-family: var(--font-display); font-size: 20px; margin: 0 0 6px; color: var(--ink); font-weight: 600; }
.emptystate p { margin: 0 auto; max-width: 42ch; }
.emptystate .btn { margin-top: 18px; }

/* skeleton shimmer for loading */
.skel { position: relative; overflow: hidden; background: var(--hair); border-radius: var(--r-sm); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--card) 70%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ============================================================
   STAT CARDS (dashboard)
   ============================================================ */
.statgrid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 4px;
}
.statcard {
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.statcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--hair-strong); }
.statcard__head { display: flex; align-items: center; gap: 9px; }
.statcard__ico {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center; background: var(--accent-tint); color: var(--accent-deep);
}
.statcard__ico svg { width: 18px; height: 18px; }
.statcard__ico.is-ok { background: var(--ok-tint); color: var(--ok-ink); }
.statcard__ico.is-warn { background: var(--warn-tint); color: var(--warn-ink); }
.statcard__ico.is-bad { background: var(--bad-tint); color: var(--bad-ink); }
.statcard__k {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; display: flex; align-items: center; gap: 5px;
}
.statcard__v {
  font-family: var(--font-display); font-weight: 600; font-size: 30px; line-height: 1;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.statcard__sub { font-size: 12.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.statcard__split { display: flex; gap: 14px; align-items: baseline; }
.statcard__split b { font-size: 30px; font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; }
.statcard__split .is-ok { color: var(--ok-ink); }
.statcard__split .is-warn { color: var(--warn-ink); }
.statcard__split small { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 600; display: block; margin-top: 3px; }
.statcard--money .statcard__v { color: var(--ink); }

/* ============================================================
   DASHBOARD BREAKDOWN PANELS
   ============================================================ */
.dash-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; margin-top: 22px; align-items: start; }
.dash-grid--recent { grid-template-columns: 1fr; }

.breakdown { padding: 4px 0 8px; }
.brow {
  display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid var(--hair);
}
.brow:last-child { border-bottom: 0; }
.brow__label { font-weight: 600; font-size: 13.5px; color: var(--ink); min-width: 0; }
.brow__label span { color: var(--ink-faint); font-weight: 400; font-size: 12px; }
.brow__val { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13.5px; text-align: right; }
.brow__bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--hair); overflow: hidden; }
.brow__fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); transition: width .8s var(--ease); }
.brow__fill.is-warn { background: linear-gradient(90deg, var(--warn), color-mix(in oklab, var(--warn) 70%, var(--accent))); }
.brow__meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* stage badge (color-coded by pipeline stage) */
.stage-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap; letter-spacing: .01em;
  background: var(--paper-2); color: var(--ink-soft); border: 1px solid var(--hair);
}
.stage-badge__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.stage-badge[data-stage="Done"] { background: var(--ok-tint); color: var(--ok-ink); border-color: color-mix(in oklab, var(--ok) 30%, var(--hair)); }
.stage-badge[data-stage="Done"] .stage-badge__dot { background: var(--ok); }
.stage-badge[data-stage="Review"] { background: var(--warn-tint); color: var(--warn-ink); border-color: color-mix(in oklab, var(--warn) 35%, var(--hair)); }
.stage-badge[data-stage="Review"] .stage-badge__dot { background: var(--warn); }
.stage-badge[data-stage="Annotate"],
.stage-badge[data-stage="Price"],
.stage-badge[data-stage="Orbit"],
.stage-badge[data-stage="Portal7"],
.stage-badge[data-stage="Extract"] { background: var(--accent-tint); color: var(--accent-deep); border-color: color-mix(in oklab, var(--accent) 30%, var(--hair)); }
.stage-badge[data-stage="Annotate"] .stage-badge__dot,
.stage-badge[data-stage="Price"] .stage-badge__dot,
.stage-badge[data-stage="Orbit"] .stage-badge__dot,
.stage-badge[data-stage="Portal7"] .stage-badge__dot,
.stage-badge[data-stage="Extract"] .stage-badge__dot { background: var(--accent); }

/* recent invoices list */
.recentlist { display: flex; flex-direction: column; }
.recent {
  display: grid; grid-template-columns: 40px 1fr auto auto; gap: 14px; align-items: center;
  padding: 13px 18px; border-bottom: 1px solid var(--hair); text-decoration: none; color: inherit;
  transition: background .18s var(--ease);
}
.recent:last-child { border-bottom: 0; }
.recent:hover { background: color-mix(in oklab, var(--accent-tint) 40%, transparent); }
.recent__seal {
  width: 36px; height: 36px; border-radius: 10px; flex: none; background: var(--ink); color: var(--paper);
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 13px;
}
.recent__main { min-width: 0; }
.recent__vendor { font-weight: 600; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent__sub { font-size: 12.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.recent__hcount { font-size: 12px; font-weight: 600; color: var(--warn-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.recent__hcount.is-clear { color: var(--ok); }
.recent__chev { color: var(--ink-faint); display: flex; }
.recent__chev svg { width: 16px; height: 16px; }

/* ============================================================
   FILTER BAR (invoices)
   ============================================================ */
.filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  background: var(--card); border: 1px solid var(--hair); border-radius: var(--r-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm); margin-top: 4px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.field--grow { flex: 1; min-width: 180px; }
.input, .select {
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  padding: 9px 12px; border-radius: 9px; border: 1px solid var(--hair-strong);
  background: var(--card); transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  min-width: 150px;
}
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent); }
.input--search { min-width: 220px; background-image: none; }
.field__search { position: relative; }
.field__search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-faint); pointer-events: none; }
.field__search .input { padding-left: 34px; width: 100%; }
.filters__clear {
  border: 0; background: none; color: var(--accent-deep); font-family: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 9px 6px;
}
.filters__clear:hover { text-decoration: underline; }
.dates { display: flex; align-items: center; gap: 7px; }
.dates span { color: var(--ink-faint); font-size: 12px; }
.dates .input { min-width: 130px; }

/* result count line */
.resultbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 2px 10px; flex-wrap: wrap; }
.resultbar__count { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.resultbar__count b { color: var(--ink); }

/* invoices table */
.invtable-wrap { overflow-x: auto; }
table.invtable { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 940px; }
.invtable thead th {
  text-align: left; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--hair-strong);
  background: color-mix(in oklab, var(--paper-2) 40%, var(--card));
  position: sticky; top: 0; white-space: nowrap;
}
.invtable thead th.num, .invtable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.invtable th.sortable { cursor: pointer; user-select: none; }
.invtable th.sortable:hover { color: var(--accent-deep); }
.invtable th .sort-caret { display: inline-block; margin-left: 4px; opacity: 0; transition: opacity .15s; }
.invtable th.is-sorted .sort-caret { opacity: 1; }
.invtable tbody tr { border-bottom: 1px solid var(--hair); transition: background .16s var(--ease); cursor: pointer; }
.invtable tbody tr:hover { background: color-mix(in oklab, var(--accent-tint) 42%, transparent); }
.invtable td { padding: 13px 14px; vertical-align: middle; }
.invtable .vendor-cell { font-weight: 600; color: var(--ink); }
.invtable .mono { font-family: ui-monospace, monospace; font-size: 12.5px; }
.invtable .muted { color: var(--ink-faint); }
.hcount-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--warn-tint); color: var(--warn-ink);
}
.hcount-pill.is-clear { background: var(--ok-tint); color: var(--ok-ink); }
.invtable .btn--view {
  padding: 5px 12px; font-size: 12.5px; border-color: var(--hair-strong); color: var(--ink-soft); background: var(--card);
}
.invtable .btn--view:hover { border-color: var(--accent); color: var(--accent-deep); }
.src-tag { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--ink-faint); }

/* ============================================================
   INVOICE DETAIL VIEW (invoices?id=)
   ============================================================ */
.detail-back {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  font-size: 13px; font-weight: 600; color: var(--accent-deep); margin-bottom: 14px;
}
.detail-back:hover { text-decoration: underline; }
.detail-back svg { width: 15px; height: 15px; }

@media (max-width: 1080px) {
  .statgrid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .statgrid { grid-template-columns: 1fr; }
  .recent { grid-template-columns: 36px 1fr auto; }
  .recent__chev { display: none; }
}
