/* Main Revenue design system — financial-controls aesthetic.
   One UI typeface (system stack, no web-font request: fastest LCP) with tabular
   figures for money. Neutral palette, ONE accent. Red/amber/green are reserved
   for evidence confidence and status. Nothing under 12px. WCAG AA in both themes. */
:root {
  --bg: #f7f7f5; --surface: #ffffff; --surface-2: #f0f0ed; --line: #dcdcd6; --line-strong: #b9b9b1;
  --ink: #16181d; --ink-2: #3d424b; --ink-3: #5c626d;            /* ink-3 on bg ≥ 5.4:1 */
  --accent: #1f4fd1; --accent-ink: #ffffff; --accent-soft: #e6ecfb;  /* accent on bg 6.3:1 */
  --strong: #a3241b; --strong-soft: #fbe9e7;    /* red  — Strong evidence / verified revenue exception */
  --probable: #8a5a00; --probable-soft: #fbf1dc;/* amber — Probable match / commercial exposure */
  --ambiguous: #4b5563; --ambiguous-soft: #eceef1;
  --ok: #1d6b3a; --ok-soft: #e4f3e9;            /* green — resolved / verified */
  --focus: #1f4fd1;
  --radius: 6px; --shadow: 0 1px 2px rgba(16, 18, 24, .06);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317; --surface: #181b21; --surface-2: #1f232a; --line: #2c313a; --line-strong: #444b57;
    --ink: #eceef2; --ink-2: #c3c8d1; --ink-3: #9aa1ad;
    --accent: #8fb0ff; --accent-ink: #0d1530; --accent-soft: #1d2a4d;
    --strong: #ff9a8f; --strong-soft: #3a1d1b; --probable: #f2c26b; --probable-soft: #362a12;
    --ambiguous: #b4bcc8; --ambiguous-soft: #262b33; --ok: #7fd49c; --ok-soft: #16301f; --focus: #8fb0ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111317; --surface: #181b21; --surface-2: #1f232a; --line: #2c313a; --line-strong: #444b57;
  --ink: #eceef2; --ink-2: #c3c8d1; --ink-3: #9aa1ad;
  --accent: #8fb0ff; --accent-ink: #0d1530; --accent-soft: #1d2a4d;
  --strong: #ff9a8f; --strong-soft: #3a1d1b; --probable: #f2c26b; --probable-soft: #362a12;
  --ambiguous: #b4bcc8; --ambiguous-soft: #262b33; --ok: #7fd49c; --ok-soft: #16301f; --focus: #8fb0ff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); }
img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(30px, 4.2vw, 46px); font-weight: 650; }
h2 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 620; }
h3 { font-size: 18px; font-weight: 620; }
p { margin: 0 0 1em; color: var(--ink-2); }
small, .small { font-size: 13px; }
.muted { color: var(--ink-3); }
.skip, .mai-skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus, .mai-skip-link:focus { left: 8px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }

/* header */
.mr-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.mr-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.mr-brand { font-weight: 680; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; font-size: 17px; }
.mr-brand span { color: var(--ink-3); font-weight: 500; }
.mr-nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.mr-nav a { color: var(--ink-2); text-decoration: none; padding: 8px 10px; border-radius: var(--radius); font-size: 15px; }
.mr-nav a:hover, .mr-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.mr-nav .btn { margin-left: 6px; }
.mr-nav a.btn-primary, .mr-nav a.btn-primary:hover { color: var(--accent-ink); background: var(--accent); }
@media (max-width: 760px) { .mr-nav a:not(.btn) { display: none; } .mr-nav .mr-menu { display: inline-flex; } }
.mr-menu { display: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }

/* sections */
section { padding: 56px 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: 0; }
@media (min-width: 1024px) { section { padding: 80px 0; } }
.eyebrow { font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.lede { font-size: 19px; color: var(--ink-2); max-width: 46em; }
.grid-2 { display: grid; gap: 28px; }
.grid-3 { display: grid; gap: 20px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; gap: 48px; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.list { padding-left: 1.1em; margin: 0 0 1em; color: var(--ink-2); }
.list li { margin: .35em 0; }

/* money and tables */
.money, td.num, th.num { font-variant-numeric: tabular-nums lining-nums; text-align: right; white-space: nowrap; }
.money-xl { font-size: clamp(26px, 3.2vw, 34px); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: var(--surface-2); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
td.cell-flag { background: var(--strong-soft); outline: 1px solid var(--strong); outline-offset: -1px; }

/* the three buckets — shown side by side, never summed */
.buckets { display: grid; gap: 14px; }
@media (min-width: 768px) { .buckets { grid-template-columns: repeat(3, 1fr); } }
.bucket { border: 1px solid var(--line); border-top: 4px solid var(--ink-3); background: var(--surface); border-radius: var(--radius); padding: 16px 18px; }
.bucket.verified { border-top-color: var(--strong); }
.bucket.exposure { border-top-color: var(--probable); }
.bucket.delayed { border-top-color: var(--ambiguous); }
.bucket h3 { font-size: 15px; margin-bottom: 4px; }
.bucket .count { font-size: 13px; color: var(--ink-3); }
.bucket p { font-size: 14px; margin: 8px 0 0; }

/* dual-axis status chips */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; padding: 3px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.chip.strong { color: var(--strong); background: var(--strong-soft); border-color: currentColor; }
.chip.probable { color: var(--probable); background: var(--probable-soft); border-color: currentColor; }
.chip.ambiguous { color: var(--ambiguous); background: var(--ambiguous-soft); border-color: currentColor; }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: currentColor; }
.chip.neutral { color: var(--ink-2); background: var(--surface-2); border-color: var(--line-strong); }
.sample-badge { display: inline-block; font: 700 12px/1 var(--font); letter-spacing: .08em; padding: 5px 8px; border-radius: 4px;
  background: var(--probable-soft); color: var(--probable); border: 1px solid currentColor; text-transform: uppercase; }

/* finding card (rendered from SAMPLE data) */
.finding { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.finding-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.finding-body { padding: 16px 18px; }
.lineage { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 10px 0; }
.lineage li { font-size: 13px; padding: 4px 8px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); }
.lineage li.missing { background: var(--strong-soft); color: var(--strong); font-weight: 650; }
.evidence-row { font: 13px/1.45 var(--mono); background: var(--surface-2); padding: 10px 12px; border-radius: 4px; overflow-x: auto; color: var(--ink-2); }

/* forms */
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; color: var(--ink); }
input, select, textarea { width: 100%; font: 15px/1.4 var(--font); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); min-height: 44px; }
textarea { min-height: 120px; resize: vertical; }
.hint { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.notice { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 12px 14px; border-radius: 4px; color: var(--ink); font-size: 14px; }
.notice.warn { border-left-color: var(--probable); background: var(--probable-soft); }
.error-text { color: var(--strong); font-size: 14px; }

/* footer */
.mr-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 36px 0 44px; font-size: 14px; }
.mr-footer .cols { display: grid; gap: 20px; }
@media (min-width: 768px) { .mr-footer .cols { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.mr-footer a { color: var(--ink-2); text-decoration: none; display: block; padding: 3px 0; }
.mr-footer a:hover { color: var(--ink); text-decoration: underline; }
.mr-footer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 8px; }
.theme-toggle { background: none; border: 1px solid var(--line-strong); color: var(--ink-2); border-radius: var(--radius); padding: 6px 10px; font: 13px var(--font); cursor: pointer; min-height: 36px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .mr-header nav, .mr-footer, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  section { padding: 16px 0; border: 0; }
  .card, .bucket, .finding { box-shadow: none; break-inside: avoid; }
}

/* ═══ Motion layer (2026-10-02). Rules: content is visible without JS (no CSS hides anything until a
   script runs); transforms/opacity only (no layout shift); every motion is off under
   prefers-reduced-motion; the JS libraries load after first paint (assets/motion.js). ═══ */

/* hover & press micro-interactions */
.btn { transition: transform .16s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, filter .2s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16, 18, 24, .12); }
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; transition-duration: .06s; }
.card, .bucket, .finding { transition: transform .22s cubic-bezier(.2,.7,.2,1), box-shadow .22s ease, border-color .22s ease; }
a.card:hover, .bucket:hover, .grid-3 > .card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(16, 18, 24, .10); border-color: var(--line-strong); }
a.card:active, .bucket:active { transform: translateY(-1px) scale(.995); }
main p a, .mr-footer a { background-image: linear-gradient(currentColor, currentColor); background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .25s ease; }
main p a:hover, .mr-footer a:hover { background-size: 100% 1px; }
.mr-nav a:not(.btn) { transition: background-color .15s ease, color .15s ease; }

/* evidence chains: connector lines between lineage stages draw in when the list is in view */
.lineage li { position: relative; }
.lineage li + li::before { content: ""; position: absolute; left: -7px; top: 50%; width: 8px; height: 1px; background: var(--line-strong); transform-origin: left; }
.mr-motion .lineage:not(.is-in) li + li::before { transform: scaleX(0); }
.mr-motion .lineage li + li::before { transition: transform .35s ease; }
.mr-motion .lineage.is-in li + li:nth-child(2)::before { transition-delay: .1s; } .mr-motion .lineage.is-in li + li:nth-child(3)::before { transition-delay: .2s; }
.mr-motion .lineage.is-in li + li:nth-child(4)::before { transition-delay: .3s; } .mr-motion .lineage.is-in li + li:nth-child(5)::before { transition-delay: .4s; }
.lineage li.missing { animation: none; }
.mr-motion .lineage.is-in li.missing { animation: mrPulse 1.6s ease-in-out .6s 2; }
@keyframes mrPulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 4px var(--strong-soft); } }

/* status lifecycle (sample report): Unreviewed → Customer confirmed → Verified resolved */
.lifecycle { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; list-style: none; padding: 0; margin: 10px 0 0; }
.lifecycle li { font-size: 12px; font-weight: 650; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-3); transition: background-color .3s ease, color .3s ease, border-color .3s ease; }
.lifecycle li.on { color: var(--ink); background: var(--surface-2); border-color: var(--ink-3); }
.lifecycle li.on.done { color: var(--ok); background: var(--ok-soft); border-color: currentColor; }
.lifecycle .arrow { border: 0; padding: 0; color: var(--ink-3); }

/* tools marquee (homepage) */
.marquee { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); padding: 12px 0; }
.marquee-track { display: flex; gap: 40px; width: max-content; animation: mrMarquee 38s linear infinite; }
.marquee-track span { font-size: 14px; font-weight: 600; color: var(--ink-3); white-space: nowrap; letter-spacing: .02em; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes mrMarquee { to { transform: translateX(-50%); } }

/* hero layout */
.hero-grid { display: grid; gap: 28px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.05fr .95fr; gap: 44px; } }
.hero-anim { width: 100%; max-width: 460px; justify-self: center; aspect-ratio: 400 / 360; }
.hero-anim svg { display: block; width: 100%; height: auto; overflow: visible; }

/* ═══ hero animation: one 9 s story, CSS only (runs even if scripts are blocked). Final readable state
   (card + evidence) is reached by 1.9 s; the loop is subtle. Static final frame under reduced motion. ═══ */
.ha-node rect { fill: var(--surface); stroke: var(--line-strong); }
.ha-node text, .ha-card text { fill: var(--ink); font-family: var(--font); }
.ha-node text { font-size: 14px; font-weight: 650; }
.ha-flow { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 6 9; animation: haFlow 1.2s linear infinite; }
.ha-glow { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; opacity: .14; }
.ha-break-gap { fill: none; stroke: var(--strong); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 3 7; opacity: 0; animation: haBreak 9s ease infinite; }
.ha-flow.ha-broken, .ha-glow.ha-broken { animation: haFlow 1.2s linear infinite, haBrokenLink 9s ease infinite; }
.ha-fixed { fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; opacity: 0; animation: haFixed 9s ease infinite; }
.ha-scan { fill: url(#haScanGrad); animation: haScan 9s ease-in-out infinite; }
.ha-card { animation: haCard 9s cubic-bezier(.2,.7,.2,1) infinite; }
.ha-card rect.bg { fill: var(--surface); stroke: var(--line-strong); }
.ha-amount { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ha-chip rect { stroke-width: 1; }
.ha-chip text { font-size: 12.5px; font-weight: 700; }
.ha-chip.strong rect { fill: var(--strong-soft); stroke: var(--strong); } .ha-chip.strong text { fill: var(--strong); }
.ha-chip.req rect { fill: var(--surface-2); stroke: var(--line-strong); } .ha-chip.req text { fill: var(--ink-2); }
.ha-chip.ok rect { fill: var(--ok-soft); stroke: var(--ok); } .ha-chip.ok text { fill: var(--ok); }
.ha-chip.req, .ha-chip.strong { animation: haChipOut 9s ease infinite; }
.ha-chip.ok { animation: haChipIn 9s ease infinite; }
.ha-row rect { fill: var(--surface-2); }
.ha-row text { font-size: 12.5px; fill: var(--ink-2); font-family: var(--mono); }
.ha-row line { stroke: var(--accent); stroke-width: 1.5; }
.ha-row { animation: haRow 9s ease infinite; }
.ha-row.r2 { animation-name: haRow2; } .ha-row.r3 { animation-name: haRow3; }
.ha-caption { font-size: 12px; fill: var(--ink-3); font-family: var(--font); }

@keyframes haFlow { to { stroke-dashoffset: -30; } }
@keyframes haBrokenLink { 0%, 10% { opacity: 1; } 13%, 48% { opacity: .08; } 52%, 100% { opacity: 1; } }
@keyframes haBreak { 0%, 10% { opacity: 0; } 13%, 46% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes haFixed { 0%, 47% { opacity: 0; } 52%, 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
@keyframes haScan { 0%, 11% { transform: translateY(-30px); opacity: 0; } 12% { opacity: .9; } 19% { transform: translateY(160px); opacity: .9; } 21%, 100% { transform: translateY(160px); opacity: 0; } }
@keyframes haCard { 0%, 14% { opacity: 0; transform: translateY(10px) scale(.98); } 21%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(6px); } }
@keyframes haRow { 0%, 22% { opacity: .25; } 25%, 94% { opacity: 1; } 100% { opacity: .25; } }
@keyframes haRow2 { 0%, 26% { opacity: .25; } 29%, 94% { opacity: 1; } 100% { opacity: .25; } }
@keyframes haRow3 { 0%, 30% { opacity: .25; } 33%, 94% { opacity: 1; } 100% { opacity: .25; } }
@keyframes haChipOut { 0%, 50% { opacity: 1; } 54%, 96% { opacity: 0; } 100% { opacity: 1; } }
@keyframes haChipIn { 0%, 50% { opacity: 0; } 54%, 94% { opacity: 1; } 100% { opacity: 0; } }

/* app & console: subtle, fast, never blocking input */
.app-main > * { animation: mrViewIn .18s ease-out both; }
@keyframes mrViewIn { from { opacity: .001; transform: translateY(4px); } }
.chip { transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.row-link td { transition: background-color .15s ease; }

/* reduced motion: everything static, fully visible, final states */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .ha-break-gap, .ha-scan, .ha-chip.req, .ha-chip.strong { opacity: 0 !important; }
  .ha-fixed, .ha-chip.ok, .ha-card, .ha-row { opacity: 1 !important; transform: none !important; }
  .ha-flow.ha-broken, .ha-glow.ha-broken { opacity: 1 !important; }
  .lineage li + li::before { transform: none !important; }
  .marquee-track { transform: none !important; flex-wrap: wrap; width: auto; }
}

/* /demo: transitions between views, filters and drill-downs (only after demo.js takes over) */
#demo.demo-live .demo-view { animation: mrViewIn .22s ease-out both; }
#demo.demo-live .demo-detail > td > div { animation: mrExpand .26s cubic-bezier(.2,.7,.2,1) both; transform-origin: top; }
@keyframes mrExpand { from { opacity: 0; transform: translateY(-6px) scaleY(.98); } }
#demo tr[data-o] td { transition: background-color .15s ease; }
#demo tr[data-o]:hover td { background: var(--surface-2); }
