:root {
  --navy: #0f1b2d;
  --navy-deep: #09111f;
  --surface: #162436;
  --panel: #1e3a5f;
  --panel-soft: rgba(30, 58, 95, 0.54);
  --line: rgba(248, 250, 252, 0.13);
  --line-strong: rgba(248, 250, 252, 0.23);
  --white: #f8fafc;
  --muted: #96a9bf;
  --soft: #d8e3ef;
  --safe: #00c896;
  --review: #f59e0b;
  --block: #ef4444;
  --ink: #07111f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --bg-body: var(--navy);
  --bg-grid: rgba(248, 250, 252, 0.03);
  --bg-grid-alt: rgba(248, 250, 252, 0.026);
  --bg-glow: rgba(0, 200, 150, 0.08);
  --bg-panel: rgba(22, 36, 54, 0.78);
  --bg-panel-deep: rgba(9, 17, 31, 0.44);
  --bg-panel-muted: rgba(9, 17, 31, 0.38);
  --bg-header: rgba(9, 17, 31, 0.9);
  --bg-sidebar: rgba(12, 22, 36, 0.78);
  --bg-control: rgba(248, 250, 252, 0.08);
  --bg-control-soft: rgba(248, 250, 252, 0.06);
  --bg-control-faint: rgba(248, 250, 252, 0.05);
  --bg-segmented: rgba(9, 17, 31, 0.52);
  --bg-drop: rgba(9, 17, 31, 0.38);
  --bg-auth-brand: linear-gradient(180deg, rgba(30, 58, 95, 0.74), rgba(9, 17, 31, 0.94));
  --bg-modal: rgba(2, 8, 23, 0.58);
  --bg-toast: #f8fafc;
  --text-toast: #0f1b2d;
  --text-segment-active: #0f1b2d;
  --text-danger: #fecaca;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="light"] {
  --navy: #f1f5f9;
  --navy-deep: #e2e8f0;
  --surface: #ffffff;
  --panel: #dbe7f3;
  --panel-soft: rgba(219, 231, 243, 0.72);
  --line: rgba(15, 27, 45, 0.12);
  --line-strong: rgba(15, 27, 45, 0.2);
  --white: #0f1b2d;
  --muted: #64748b;
  --soft: #334155;
  --ink: #07111f;
  --shadow: 0 24px 70px rgba(15, 27, 45, 0.12);
  --bg-body: #f1f5f9;
  --bg-grid: rgba(15, 27, 45, 0.04);
  --bg-grid-alt: rgba(15, 27, 45, 0.03);
  --bg-glow: rgba(0, 200, 150, 0.12);
  --bg-panel: rgba(255, 255, 255, 0.92);
  --bg-panel-deep: rgba(255, 255, 255, 0.88);
  --bg-panel-muted: rgba(248, 250, 252, 0.96);
  --bg-header: rgba(255, 255, 255, 0.92);
  --bg-sidebar: rgba(248, 250, 252, 0.96);
  --bg-control: rgba(15, 27, 45, 0.06);
  --bg-control-soft: rgba(15, 27, 45, 0.05);
  --bg-control-faint: rgba(15, 27, 45, 0.04);
  --bg-segmented: rgba(226, 232, 240, 0.92);
  --bg-drop: rgba(255, 255, 255, 0.92);
  --bg-auth-brand: linear-gradient(180deg, rgba(219, 231, 243, 0.92), rgba(241, 245, 249, 0.98));
  --bg-modal: rgba(15, 27, 45, 0.28);
  --bg-toast: #0f1b2d;
  --text-toast: #f8fafc;
  --text-segment-active: #0f1b2d;
  --text-danger: #b91c1c;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-body); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--white);
  font-family: var(--ui);
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid-alt) 1px, transparent 1px),
    radial-gradient(circle at top right, var(--bg-glow), transparent 38%),
    var(--bg-body);
  background-size: 28px 28px, 28px 28px, auto, auto;
}
button, input { font: inherit; }
button { border: 0; }
button:not(:disabled), .plan-card, .drop-zone { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
#app, .auth-page, .public-plans, .app-shell { min-height: 100vh; }

.eyebrow {
  color: var(--safe);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(0, 200, 150, 0.55);
  border-radius: 11px;
  background: rgba(0, 200, 150, 0.09);
  color: var(--safe);
  font-family: var(--mono);
  font-weight: 900;
}
.brand-text { display: grid; gap: 2px; min-width: 0; }
.brand-text strong {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-text span { color: var(--muted); font-size: 12px; }
.brand-lockup.compact .brand-mark { width: 38px; height: 38px; border-radius: 10px; }

.primary-button, .secondary-button, .ghost-button, .danger-button, .file-button, .segment-button, .toggle-button, .auth-tab, .icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 9px;
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.primary-button { background: var(--safe); color: #04130f; }
.secondary-button, .file-button { border: 1px solid var(--line-strong); background: var(--bg-control); color: var(--white); }
.ghost-button { border: 1px solid transparent; background: transparent; color: var(--soft); }
.danger-button { border: 1px solid rgba(239, 68, 68, 0.38); background: rgba(239, 68, 68, 0.1); color: var(--text-danger); }
.icon-button { width: 40px; padding: 0; border: 1px solid var(--line); background: var(--bg-control-soft); color: var(--white); }
.primary-button:hover, .secondary-button:hover, .ghost-button:hover, .danger-button:hover, .file-button:hover, .segment-button:hover, .toggle-button:hover, .auth-tab:hover, .icon-button:hover { transform: translateY(-1px); }
.wide { width: 100%; }

.auth-page {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(360px, 1.05fr);
}
.auth-brand {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 5vw, 64px);
  border-right: 1px solid var(--line);
  background: var(--bg-auth-brand);
}
.auth-copy { max-width: 660px; padding: 56px 0; }
.auth-copy h1, .public-plan-copy h1, .route-header h1 {
  margin: 8px 0 0;
  font-family: var(--ui);
  font-size: clamp(36px, 5vw, 70px);
  line-height: 1;
  letter-spacing: 0;
}
.auth-copy p, .public-plan-copy p, .route-header p {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--soft);
  font-size: 16px;
  line-height: 1.65;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.stat-grid div, .feature-checks, .auth-card, .summary-tile, .upload-panel, .results-panel, .plan-card, .profile-card, .usage-banner, .selection-bar, .confirm-modal {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-panel);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.16);
}
.stat-grid div { padding: 15px; }
.stat-grid strong { display: block; color: var(--safe); font-family: var(--mono); font-size: 28px; }
.stat-grid span { color: var(--muted); font-size: 12px; }
.feature-checks { display: grid; gap: 10px; margin: 18px 0 0; padding: 18px; list-style: none; }
.feature-checks li { color: var(--soft); line-height: 1.45; }
.feature-checks li:before { margin-right: 10px; color: var(--safe); content: "OK"; font-family: var(--mono); font-size: 10px; font-weight: 900; }
.auth-panel-wrap { display: grid; place-items: center; padding: clamp(20px, 5vw, 64px); }
.auth-card { width: min(100%, 500px); padding: 26px; background: rgba(248, 250, 252, 0.98); color: var(--ink); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; border: 1px solid #d7e0ec; border-radius: 12px; background: #edf3f9; }
.auth-tab { background: transparent; color: #51647c; }
.auth-tab.active { background: #ffffff; color: #0f1b2d; box-shadow: 0 8px 24px rgba(15, 27, 45, 0.12); }
.auth-card-head { margin: 24px 0 20px; }
.auth-card h2 { margin: 0; font-size: 28px; letter-spacing: 0; }
.auth-card p { margin: 8px 0 0; color: #5c6e83; line-height: 1.5; }
.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field span { color: #31445e; font-family: var(--mono); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.field input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #c8d4e2; border-radius: 9px; outline: none; background: #fff; color: #0b1220; }
.field input:focus { border-color: #1e3a5f; box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.12); }
.field small { color: #b91c1c; font-size: 12px; }
.field.has-error input { border-color: #ef4444; }
.strength { height: 6px; margin: -2px 0 18px; overflow: hidden; border-radius: 999px; background: #dce6f1; }
.strength span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--review), var(--safe)); transition: width 180ms ease; }
.auth-card .primary-button { min-height: 48px; }
.auth-card a.primary-button { text-decoration: none; }
.auth-back { margin-bottom: 8px; justify-content: flex-start; padding-left: 0; }
.auth-secondary { margin-top: 10px; }
.auth-notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 200, 150, 0.35);
  border-radius: 10px;
  background: rgba(0, 200, 150, 0.08);
  color: #0f1b2d;
  font-size: 13px;
  line-height: 1.5;
}
.plan-contact { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.plan-contact a { color: var(--safe); font-weight: 700; text-decoration: none; }
.plan-card a.primary-button, .selection-bar a.primary-button {
  display: inline-flex;
  text-decoration: none;
}
.consent-block { display: grid; gap: 10px; margin: 4px 0 18px; }
.consent-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  color: #31445e;
  font-size: 13px;
  line-height: 1.45;
}
.consent-row label { cursor: pointer; }
.consent-row input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: #00c896;
}
.consent-row a { color: #0f1b2d; font-weight: 700; text-decoration: underline; }
.consent-row a:hover { color: #00a67d; }
.consent-block small { color: #b91c1c; font-size: 12px; }
.consent-block.has-error .consent-row { color: #7f1d1d; }
.legal-panel a { color: var(--safe); }

.public-plans { padding: clamp(22px, 4vw, 56px); }
.public-plan-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; margin-bottom: 22px; }
.public-plan-brand-row { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.public-plan-copy { margin-top: 8px; }
.header-signout { flex-shrink: 0; min-height: 34px; padding: 0 12px; }

.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: 68px 1fr; }
.app-shell.collapsed { grid-template-columns: 76px minmax(0, 1fr); }
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-header);
  backdrop-filter: blur(18px);
}
.top-spacer { flex: 1; }
.header-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  max-width: 220px;
  overflow: hidden;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-control-soft);
  color: var(--soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-chip.mono { font-family: var(--mono); }
.help-menu { position: relative; }
.help-menu-toggle { min-height: 34px; padding: 0 12px; }
.help-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 240px;
  display: grid;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-panel);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}
.help-menu-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--soft);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
}
.help-menu-item:hover {
  background: rgba(0, 200, 150, 0.1);
  color: var(--white);
}
.sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--bg-sidebar);
}
.side-nav { display: grid; gap: 8px; }
.nav-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.nav-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-control-faint);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
}
.nav-item strong { font-size: 13px; }
.nav-item.active, .nav-item:hover { border-color: rgba(0, 200, 150, 0.28); background: rgba(0, 200, 150, 0.09); color: var(--white); }
.nav-item.active .nav-icon { color: var(--safe); border-color: rgba(0, 200, 150, 0.46); }
.app-shell.collapsed .sidebar { padding: 16px 10px; }
.app-shell.collapsed .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 0; }
.app-shell.collapsed .nav-item strong, .app-shell.collapsed .signout { display: none; }
.route-surface { min-width: 0; padding: clamp(18px, 3vw, 34px); }
.route-header { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 20px; }
.route-header h1 { font-size: clamp(30px, 4vw, 52px); }

.summary-bar { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-tile { appearance: none; width: 100%; height: 74px; display: grid; align-content: center; gap: 4px; padding: 12px 14px; color: inherit; text-align: left; cursor: pointer; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.summary-tile:hover { border-color: rgba(248, 250, 252, 0.2); transform: translateY(-1px); }
.summary-tile span { color: var(--muted); font-size: 11px; font-weight: 900; }
.summary-tile strong { font-size: 26px; line-height: 1; }
.summary-tile.safe strong { color: var(--safe); }
.summary-tile.review strong { color: var(--review); }
.summary-tile.block strong { color: var(--block); }
.summary-tile.processing strong { color: var(--soft); }
.summary-tile.active {
  border-color: rgba(0, 200, 150, 0.62);
  background: rgba(0, 200, 150, 0.1);
  box-shadow: 0 0 0 1px rgba(0, 200, 150, 0.14);
}
.summary-tile:focus-visible {
  outline: 2px solid var(--safe);
  outline-offset: 2px;
}
.checker-layout { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: 16px; align-items: start; }
.upload-panel, .results-panel { padding: 18px; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 16px; }
.panel-head.simple { margin-bottom: 0; }
.panel-head h2 { margin: 0; font-family: var(--mono); font-size: 18px; letter-spacing: 0; }
.panel-head p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; }
.panel-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.segmented, .billing-toggle { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-segmented); }
.segment-button, .toggle-button { min-height: 34px; background: transparent; color: var(--muted); }
.segment-button.active, .toggle-button.active { background: var(--surface); color: var(--text-segment-active); }
.toggle-button span { color: var(--safe); font-size: 10px; text-transform: uppercase; }
.drop-zone { display: grid; gap: 10px; place-items: center; min-height: 210px; margin-top: 16px; padding: 20px; border: 1px dashed var(--line-strong); border-radius: 14px; background: var(--bg-drop); text-align: center; transition: background 160ms ease, border-color 160ms ease; }
.drop-zone.dragover { border-color: var(--safe); background: rgba(0, 200, 150, 0.08); }
.drop-zone strong { font-family: var(--mono); font-size: 18px; }
.drop-zone span, .muted { color: var(--muted); }
.drop-zone div { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.queue-block, .checks-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.queue-block h3, .checks-block h3 { margin: 0 0 10px; font-family: var(--mono); font-size: 13px; }
.checks-block ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.checks-block li, .file-queue div { color: var(--soft); font-size: 13px; line-height: 1.45; }
.checks-block li:before { margin-right: 8px; color: var(--safe); content: "OK"; font-family: var(--mono); font-size: 10px; font-weight: 900; }
.file-queue { display: grid; gap: 8px; }
.file-queue div { display: flex; justify-content: space-between; gap: 10px; }
.file-queue span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-queue strong { font-family: var(--mono); font-size: 11px; }
.invoice-stack { display: grid; gap: 10px; max-height: calc(100vh - 296px); min-height: 430px; overflow: auto; padding-right: 3px; }
.empty-state { display: grid; min-height: 430px; place-items: center; color: var(--muted); text-align: center; }
.empty-state strong { display: block; color: var(--white); font-family: var(--mono); font-size: 18px; }
.invoice-card { border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 12px; background: var(--bg-panel-deep); overflow: hidden; }
.invoice-card.safe { border-left-color: var(--safe); }
.invoice-card.review { border-left-color: var(--review); }
.invoice-card.block { border-left-color: var(--block); }
.invoice-toggle { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) 110px 88px 28px; gap: 12px; align-items: center; min-height: 72px; padding: 14px 16px; background: transparent; color: var(--white); text-align: left; }
.invoice-title { min-width: 0; }
.invoice-title strong { display: block; overflow: hidden; font-family: var(--mono); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.invoice-title small { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.reason-chip, .status-badge, .mini-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; font-family: var(--mono); font-size: 11px; font-weight: 900; text-transform: uppercase; white-space: nowrap; }
.reason-chip { height: 32px; border: 1px solid var(--line); color: var(--soft); }
.status-badge { width: 82px; height: 34px; border: 2px solid currentColor; background: rgba(248, 250, 252, 0.04); }
.status-badge.safe, .reason-chip.safe, .mini-badge.safe, .safe-text { color: var(--safe); }
.status-badge.review, .reason-chip.review, .mini-badge.review, .review-text { color: var(--review); }
.status-badge.block, .reason-chip.block, .mini-badge.block, .block-text { color: var(--block); }
.status-badge.processing, .reason-chip.processing, .processing-text { color: var(--muted); }
.stamp { animation: stampIn 240ms ease both; transform-origin: center; }
.chevron { color: var(--muted); font-family: var(--mono); font-size: 18px; text-align: right; }
.inline-progress { height: 4px; background: rgba(248, 250, 252, 0.1); }
.inline-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--safe), #8df4d8); transition: width 120ms linear; }
.invoice-details { display: grid; gap: 14px; padding: 0 16px 16px; }
.data-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.data-cell { min-height: 72px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(248, 250, 252, 0.045); font-family: var(--mono); }
.data-cell span { display: block; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.data-cell strong { display: block; margin-top: 8px; overflow-wrap: anywhere; font-size: 13px; }
.issue-callout { display: grid; gap: 8px; padding: 12px; border: 1px solid rgba(245, 158, 11, 0.36); border-radius: 12px; background: rgba(245, 158, 11, 0.08); }
.issue-callout.safe { border-color: rgba(0, 200, 150, 0.34); background: rgba(0, 200, 150, 0.07); }
.issue-callout h3 { margin: 0; font-family: var(--mono); font-size: 13px; }
.issue-callout p, .issue-item p { margin: 0; color: var(--soft); line-height: 1.45; }
.issue-item { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-panel-muted); }
.issue-item.block { border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.09); }
.issue-item.review { border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.09); }
.issue-item strong { display: block; margin-bottom: 5px; font-family: var(--mono); font-size: 13px; }
.checklist { display: grid; gap: 8px; }
.check-row { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.mini-badge { min-height: 28px; border: 1px solid currentColor; }
.check-row strong { font-family: var(--mono); font-size: 13px; }
.check-row p { margin: 4px 0 0; color: var(--muted); line-height: 1.45; }

.pricing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-bottom: 110px; }
.plan-card { display: grid; min-height: 560px; grid-template-rows: auto auto auto auto 1fr auto; gap: 16px; padding: 20px; transition: border-color 160ms ease, transform 160ms ease, background 160ms ease; }
.plan-card:hover, .plan-card.selected { border-color: rgba(0, 200, 150, 0.5); transform: translateY(-2px); }
.plan-card.current { box-shadow: 0 0 0 1px rgba(0, 200, 150, 0.14), var(--shadow); }
.plan-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.plan-kicker { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.relation-tag { padding: 5px 8px; border-radius: 999px; font-family: var(--mono); font-size: 10px; font-style: normal; font-weight: 900; text-transform: uppercase; }
.relation-tag.current { color: var(--safe); background: rgba(0, 200, 150, 0.1); }
.relation-tag.upgrade { color: var(--safe); background: rgba(0, 200, 150, 0.1); }
.relation-tag.downgrade { color: var(--review); background: rgba(245, 158, 11, 0.1); }
.plan-card h2 { margin: 0; font-size: 27px; }
.plan-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.plan-price { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-family: var(--mono); }
.plan-price strong { font-size: 31px; }
.plan-price span { color: var(--muted); }
.quota-box { display: grid; gap: 5px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-panel-muted); font-family: var(--mono); }
.quota-box span { color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.quota-box strong { color: var(--safe); font-size: 18px; }
.plan-features { display: grid; align-content: start; gap: 10px; margin: 0; padding: 0; list-style: none; }
.plan-features li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; color: var(--soft); line-height: 1.35; }
.plan-features li:before { color: var(--safe); content: "OK"; font-family: var(--mono); font-size: 10px; font-weight: 900; }
.plan-features li.locked { color: rgba(216, 227, 239, 0.44); }
.plan-features li.locked:before { color: rgba(216, 227, 239, 0.32); content: "--"; }
.usage-banner { display: grid; gap: 12px; margin-bottom: 16px; padding: 18px; }
.usage-banner span { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.usage-banner strong { display: block; margin-top: 4px; font-family: var(--mono); font-size: 24px; }
.usage-banner p { margin: 6px 0 0; color: var(--soft); }
.usage-meter { height: 9px; overflow: hidden; border-radius: 999px; background: rgba(248, 250, 252, 0.11); }
.usage-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--safe), #8ff7da); }
.proration { margin: -86px 0 110px; color: var(--muted); line-height: 1.5; }
.selection-bar { position: fixed; right: 22px; bottom: 22px; left: 22px; z-index: 20; display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 16px; backdrop-filter: blur(16px); }
.app-shell .selection-bar { left: 242px; }
.app-shell.collapsed .selection-bar { left: 98px; }
.selection-bar span { color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.selection-bar strong { display: block; margin-top: 4px; font-family: var(--mono); }
.selection-bar p { margin: 3px 0 0; color: var(--muted); }
.selection-bar-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.profile-card { padding: 20px; }
.profile-card.wide { grid-column: 1 / -1; }
.profile-card h2 { margin: 0 0 14px; font-family: var(--mono); font-size: 18px; }
dl { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; margin: 0; }
dt { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 900; text-transform: uppercase; }
dd { margin: 0; color: var(--soft); }
.profile-card p { color: var(--soft); line-height: 1.55; }
.modal-backdrop { position: fixed; inset: 0; z-index: 40; background: var(--bg-modal); backdrop-filter: blur(8px); }
.confirm-modal { position: fixed; z-index: 41; top: 50%; left: 50%; width: min(460px, calc(100vw - 34px)); padding: 22px; transform: translate(-50%, -50%); animation: modalIn 180ms ease both; }
.confirm-modal h2 { margin: 8px 0 8px; }
.confirm-modal p { color: var(--soft); line-height: 1.5; }
.modal-ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-panel-muted); font-family: var(--mono); }
.modal-ledger span { color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 80; max-width: min(420px, calc(100vw - 36px)); padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg-toast); color: var(--text-toast); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.26); font-weight: 850; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@keyframes stampIn { 0% { opacity: 0; transform: scale(1.12) rotate(-4deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes modalIn { 0% { opacity: 0; transform: translate(-50%, -48%) scale(0.97); } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

@media (max-width: 1180px) {
  .auth-page, .checker-layout, .pricing-grid { grid-template-columns: 1fr; }
  .invoice-stack { max-height: none; }
  .proration { margin-top: 0; }
}
@media (max-width: 860px) {
  .app-shell, .app-shell.collapsed { grid-template-columns: 1fr; grid-template-rows: 68px auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { display: flex; gap: 8px; }
  .nav-item { grid-template-columns: 34px; padding: 0 8px; }
  .nav-item strong, .signout { display: none; }
  .route-surface { padding: 18px; }
  .summary-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-grid, .profile-grid { grid-template-columns: 1fr; }
  .selection-bar, .app-shell .selection-bar, .app-shell.collapsed .selection-bar { left: 14px; right: 14px; bottom: 14px; }
  .top-header .brand-text, .header-chip:nth-of-type(3) { display: none; }
}
@media (max-width: 620px) {
  .legal-links.public { margin: 14px 0 96px; }
  .legal-page { width: min(100vw - 28px, 960px); padding-top: 20px; }
  .auth-brand, .auth-panel-wrap, .public-plans { padding: 16px; }
  .auth-copy h1, .public-plan-copy h1, .route-header h1 { font-size: 34px; }
  .stat-grid, .public-plan-header, .route-header, .panel-head, .invoice-toggle, .modal-ledger, dl { grid-template-columns: 1fr; }
  .invoice-toggle { gap: 8px; }
  .reason-chip, .chevron { justify-self: start; }
  .selection-bar { align-items: stretch; flex-direction: column; }
  .billing-toggle, .segmented { width: 100%; }
  .toggle-button, .segment-button { flex: 1; }
}

[data-theme="light"] .auth-card {
  border-color: #d7e0ec;
  box-shadow: 0 18px 52px rgba(15, 27, 45, 0.08);
}
[data-theme="light"] .data-cell {
  background: rgba(15, 27, 45, 0.04);
}
[data-theme="light"] .status-badge {
  background: rgba(15, 27, 45, 0.03);
}
[data-theme="light"] .summary-tile:hover {
  border-color: var(--line-strong);
}
[data-theme="light"] .plan-features li.locked {
  color: rgba(51, 65, 85, 0.44);
}
[data-theme="light"] .plan-features li.locked:before {
  color: rgba(51, 65, 85, 0.32);
}

.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 16px; color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 900; }
.legal-links.sidebar { justify-content: flex-start; margin-top: auto; padding-top: 18px; }
.legal-links.public { margin: -88px 0 98px; }
.legal-links a { color: var(--muted); text-decoration: none; }
.legal-links a:hover { color: var(--safe); }
.legal-page { width: min(960px, calc(100vw - 32px)); margin: 0 auto; padding: 36px 0 72px; }
.legal-hero { display: grid; gap: 18px; padding: 26px 0 20px; }
.legal-brand { color: var(--white); text-decoration: none; }
.legal-hero h1 { max-width: 820px; margin: 0; font-size: clamp(34px, 5vw, 62px); line-height: 0.98; }
.legal-hero p { max-width: 760px; margin: 0; color: var(--soft); font-size: 16px; line-height: 1.65; }
.legal-panel { margin-top: 16px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-panel); box-shadow: 0 18px 52px rgba(0, 0, 0, 0.16); }
.theme-toggle-fixed { position: fixed; top: 16px; right: 16px; z-index: 50; }
.theme-toggle { font-size: 16px; line-height: 1; }
.legal-panel h2 { margin: 0 0 10px; font-family: var(--mono); font-size: 18px; }
.legal-panel p { margin: 10px 0 0; color: var(--soft); line-height: 1.65; }
.about-close { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; }
.find-out-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 44px;
  padding: 0 18px;
  text-decoration: none;
  box-sizing: border-box;
  font-weight: 800;
}
.auth-title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}
.contact-us-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 44px;
  padding: 0 18px;
  text-decoration: none;
  box-sizing: border-box;
  font-weight: 800;
}
.plan-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}
.how-to-use-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 44px;
  padding: 0 18px;
  text-decoration: none;
  box-sizing: border-box;
  font-weight: 800;
}
.route-header .how-to-use-button { margin-top: 14px; }
.taster-note { margin-top: 12px; }
.legal-hero .primary-button { width: fit-content; margin-top: 4px; text-decoration: none; }
.guide-steps { counter-reset: guide-step; margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.guide-steps strong { font-size: 15px; }
.guide-steps span { color: var(--soft); line-height: 1.55; }
.guide-outcomes { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.guide-outcomes li { display: grid; grid-template-columns: 82px 1fr; gap: 14px; align-items: center; }
.guide-outcomes span:last-child { color: var(--soft); line-height: 1.55; }
.guide-checks { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.guide-checks li { padding-left: 16px; position: relative; color: var(--soft); }
.guide-checks li::before { content: ""; position: absolute; left: 0; top: 8px; width: 7px; height: 7px; border-radius: 99px; background: var(--safe); }
.taster-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(0, 200, 150, 0.28);
  border-radius: 14px;
  background: rgba(0, 200, 150, 0.08);
}
.taster-banner strong { display: block; font-family: var(--mono); font-size: 14px; }
.taster-banner p { margin: 4px 0 0; color: var(--soft); font-size: 13px; line-height: 1.5; }

.client-picker { display: grid; gap: 8px; margin-bottom: 14px; }
.client-picker label { font-family: var(--mono); font-size: 12px; color: var(--soft); }
.client-picker select,
.history-tools select,
#retention-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input[type="text"],
.inline-form input[type="email"] {
  flex: 1;
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}
.muted.tiny { font-size: 12px; color: var(--soft); margin: 0; }
.toggle-row { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; cursor: pointer; }
.invite-link-box { display: grid; gap: 8px; margin-top: 14px; }
.invite-link-box label { font-family: var(--mono); font-size: 12px; color: var(--soft); }
.invite-link-box input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { font-family: var(--mono); font-size: 12px; color: var(--soft); font-weight: 600; }
.history-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.history-tools select { min-width: 180px; width: auto; }
code { font-family: var(--mono); font-size: 0.92em; }
