.trace-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(circle at 8% 12%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 30%), linear-gradient(115deg, #dbe5df 0 58%, #cbd8d2 58% 100%);
  color: #0d181b;
}

:root[data-theme="dark"] .trace-hero {
  background: radial-gradient(circle at 10% 16%, rgba(114, 142, 255, 0.13), transparent 30%), linear-gradient(115deg, #0a1416 0 58%, #101f22 58% 100%);
  color: #f2f6f4;
}

.trace-hero::before {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(15, 35, 38, 0.055) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 35, 38, 0.055) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
  mask-image: linear-gradient(90deg, #000, transparent 76%);
  pointer-events: none;
}

:root[data-theme="dark"] .trace-hero::before {
  background-image: linear-gradient(rgba(159, 179, 174, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(159, 179, 174, 0.07) 1px, transparent 1px);
}

.trace-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: calc(100vh - 72px);
  grid-template-columns: minmax(0, 0.95fr) minmax(550px, 1.05fr);
  align-items: center;
  gap: clamp(42px, 6vw, 88px);
  padding-block: clamp(76px, 9vw, 130px);
}

.trace-hero .eyebrow { color: #1737c5; }
:root[data-theme="dark"] .trace-hero .eyebrow { color: #aab8ff; }

.trace-hero-copy h1 {
  max-width: 760px;
  margin: 24px 0 0;
  font-family: var(--font-display);
  font-size: clamp(64px, 6.4vw, 96px);
  font-weight: 650;
  letter-spacing: -0.078em;
  line-height: 0.8;
}

.trace-hero-copy h1 span {
  position: relative;
  display: inline-block;
  margin-top: 13px;
  color: #1737c5;
}

:root[data-theme="dark"] .trace-hero-copy h1 span { color: #8fa5ff; }

.trace-hero-copy h1 span::after {
  position: absolute;
  right: 0;
  bottom: -12px;
  left: 4px;
  height: 7px;
  border-radius: 10px;
  background: #df4f38;
  content: "";
  transform: skewX(-22deg) rotate(-1deg);
}

.hero-deck {
  max-width: 660px;
  margin: 36px 0 0;
  color: #37484b;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.58;
}

:root[data-theme="dark"] .hero-deck { color: #bdcbc7; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.trace-secondary {
  border-color: rgba(14, 34, 37, 0.3);
  background: rgba(255, 255, 255, 0.28);
  color: #0d181b;
}

:root[data-theme="dark"] .trace-secondary {
  border-color: #405255;
  background: rgba(15, 29, 32, 0.7);
  color: #f2f6f4;
}

.trust-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 34px 0 0;
  padding: 0;
  color: #435558;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

:root[data-theme="dark"] .trust-line { color: #a8b8b4; }

.trust-line li { position: relative; padding-left: 18px; }
.trust-line li::before {
  position: absolute;
  top: 0.58em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #087653;
  content: "";
}

:root[data-theme="dark"] .trust-line li::before { background: #62d5aa; }

.trace-visual { position: relative; padding: 18px 0 18px 30px; }

.trace-wire {
  position: absolute;
  z-index: 2;
  top: 64px;
  bottom: 64px;
  left: 16px;
  width: 3px;
  background: #6f8aff;
  box-shadow: 0 0 0 6px rgba(111, 138, 255, 0.12);
}

.trace-wire i {
  position: absolute;
  left: 50%;
  width: 15px;
  height: 15px;
  border: 3px solid #dbe5df;
  border-radius: 50%;
  background: #1737c5;
  transform: translate(-50%, -50%);
}

:root[data-theme="dark"] .trace-wire i { border-color: #101f22; background: #8fa5ff; }
.trace-wire i:nth-child(1) { top: 8%; }
.trace-wire i:nth-child(2) { top: 29%; }
.trace-wire i:nth-child(3) { top: 50%; }
.trace-wire i:nth-child(4) { top: 71%; }
.trace-wire i:nth-child(5) { top: 92%; }

.ledger-window {
  position: relative;
  overflow: hidden;
  border: 1px solid #405255;
  border-radius: 22px;
  background: #0d191b;
  color: #eff5f2;
  box-shadow: 0 34px 100px rgba(18, 34, 37, 0.28);
}

.ledger-window::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #6f8aff 0 68%, #ff7658 68% 100%);
  content: "";
}

.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid #2a3b3e;
  padding: 24px 24px 19px;
}

.ledger-head > div span,
.ledger-head > div strong { display: block; }

.ledger-head > div span {
  color: #8fa5ff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.ledger-head > div strong { margin-top: 5px; font-size: 15px; }

.preview-label,
.mono-label {
  color: #9badb0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.ledger-list { margin: 0; padding: 8px 18px; list-style: none; }

.ledger-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 36px minmax(132px, 0.9fr) 26px minmax(145px, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #26373a;
  padding: 14px 4px;
}

.ledger-row:last-child { border-bottom: 0; }

.row-number {
  position: relative;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #496064;
  border-radius: 50%;
  background: #0d191b;
  color: #a8b7b4;
  font-family: var(--font-mono);
  font-size: 13px;
}

.row-input,
.row-result { min-width: 0; }
.row-input strong,
.row-input span,
.row-result strong,
.row-result span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-input strong,
.row-result strong { font-size: 14px; }
.row-input strong { font-family: var(--font-mono); font-weight: 600; }
.row-input span,
.row-result span { margin-top: 2px; color: #94a6a8; font-size: 13px; }
.row-arrow { color: #6f8aff; font-family: var(--font-mono); font-size: 17px; }

.status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
}

.found .status { color: #66d9af; }
.blank .status { color: #b9c5c3; }
.ambiguous .status { color: #f1c56d; }
.invalid .status { color: #ff8f77; }

.duplicate .row-number::after {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f1c56d;
  content: "";
}

.ledger-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  border-top: 1px solid #2a3b3e;
  background: #122123;
  padding: 17px 22px;
  color: #a9b8b5;
  font-family: var(--font-mono);
  font-size: 13px;
}

.ledger-summary strong { color: #f2f6f4; }
.reconcile { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: #66d9af; }
.reconcile i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.input-section,
.workflow-section,
.evidence-section,
.workspace-section,
.scope-section,
.closing-section { padding-block: clamp(90px, 11vw, 150px); }

.input-section { background: var(--canvas); }

.input-modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 58px;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: var(--line);
}

.input-mode { min-height: 260px; background: var(--surface); padding: 25px 22px; }
.input-mode.active { background: var(--brand-soft); }
.mode-label { color: var(--brand-strong); font-family: var(--font-mono); font-size: 13px; font-weight: 600; text-transform: uppercase; }
:root[data-theme="dark"] .mode-label { color: var(--brand); }
.input-mode code { display: block; min-height: 82px; margin-top: 32px; color: var(--ink); font-family: var(--font-mono); font-size: 15px; line-height: 1.65; word-break: break-word; }
.input-mode p { margin: 18px 0 0; color: var(--ink-2); font-size: 14px; }

.workflow-section { border-block: 1px solid var(--line); background: var(--surface-2); }

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 60px 0 0;
  padding: 0;
  list-style: none;
}

.workflow-steps li {
  position: relative;
  display: flex;
  min-height: 350px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 23px;
}

.step-number { color: var(--signal); font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.workflow-steps h3 { margin: 22px 0 8px; font-family: var(--font-display); font-size: 30px; letter-spacing: -0.04em; }
.workflow-steps p { margin: 0; color: var(--ink-2); font-size: 14px; }

.step-art { position: relative; display: block; height: 92px; margin-top: auto; border-top: 1px solid var(--line); padding-top: 18px; }
.step-art i { position: absolute; display: block; background: var(--brand); }
.input-art i { left: 0; width: 100%; height: 8px; border-radius: 5px; }
.input-art i:nth-child(1) { top: 22px; }
.input-art i:nth-child(2) { top: 42px; width: 72%; }
.input-art i:nth-child(3) { top: 62px; width: 45%; background: var(--signal); }
.review-art::before { position: absolute; top: 18px; bottom: 4px; left: 12px; width: 2px; background: var(--brand); content: ""; }
.review-art i { left: 6px; width: 14px; height: 14px; border: 3px solid var(--surface); border-radius: 50%; }
.review-art i:nth-child(1) { top: 22px; }
.review-art i:nth-child(2) { top: 44px; background: var(--warning); }
.review-art i:nth-child(3) { top: 66px; background: var(--signal); }
.trace-art i { top: 32px; width: 42px; height: 42px; border: 2px solid var(--brand); border-radius: 50%; background: transparent; }
.trace-art i:nth-child(1) { left: 0; }
.trace-art i:nth-child(2) { left: 34px; }
.trace-art i:nth-child(3) { left: 68px; background: var(--brand-soft); }
.export-art i { height: 48px; bottom: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); }
.export-art i:nth-child(1) { left: 0; width: 34%; }
.export-art i:nth-child(2) { left: 33%; width: 34%; background: var(--brand-soft); }
.export-art i:nth-child(3) { left: 66%; width: 34%; }

.evidence-section { background: var(--canvas); }
.evidence-layout { display: grid; grid-template-columns: minmax(300px, 0.72fr) minmax(620px, 1.28fr); align-items: center; gap: clamp(50px, 8vw, 110px); }
.evidence-copy h2 { margin: 22px 0 0; font-family: var(--font-display); font-size: clamp(46px, 6vw, 78px); letter-spacing: -0.065em; line-height: 0.96; }
.evidence-copy > p:not(.eyebrow) { margin: 28px 0 0; color: var(--ink-2); font-size: 17px; }
.evidence-points { display: grid; gap: 14px; margin: 30px 0 0; padding: 0; list-style: none; }
.evidence-points li { display: grid; grid-template-columns: 12px 1fr; gap: 12px; align-items: start; color: var(--ink-2); font-size: 14px; }
.evidence-points i { width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: var(--brand); }
.evidence-points li:nth-child(2) i { background: var(--warning); }
.evidence-points li:nth-child(3) i { background: var(--signal); }
.evidence-points strong { color: var(--ink); }

.reader-preview { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.reader-preview > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 16px 19px; }
.record-kind { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--ink-2); font-family: var(--font-mono); font-size: 13px; }
.reader-body { display: grid; grid-template-columns: minmax(0, 1fr) 240px; min-height: 470px; }
.claim-sheet { padding: 32px; }
.claim-sheet h3 { margin: 12px 0 0; font-family: var(--font-display); font-size: 36px; letter-spacing: -0.045em; }
.record-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; border-bottom: 1px solid var(--line); margin-top: 22px; padding-bottom: 18px; color: var(--brand-strong); font-size: 13px; font-weight: 750; }
:root[data-theme="dark"] .record-meta { color: var(--brand); }
.claim-block { margin-top: 30px; }
.claim-block > span { color: var(--ink-3); font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; }
.claim-block h4 { margin: 8px 0 10px; font-family: var(--font-display); font-size: 24px; }
.claim-block p { color: var(--ink-2); font-family: Georgia, serif; font-size: 17px; line-height: 1.76; }
.claim-lines { display: grid; gap: 10px; margin-top: 22px; }
.claim-lines i { display: block; width: 100%; height: 7px; border-radius: 6px; background: var(--surface-2); }
.claim-lines i:nth-child(2) { width: 94%; }
.claim-lines i:nth-child(3) { width: 87%; }
.claim-lines i:nth-child(4) { width: 56%; background: var(--brand-soft); }
.receipt-card { border-left: 1px solid var(--line); background: var(--surface-2); padding: 28px 22px; }
.receipt-card dl { display: grid; gap: 0; margin: 22px 0 0; }
.receipt-card dl div { border-top: 1px solid var(--line); padding: 13px 0; }
.receipt-card dt,
.receipt-card dd { margin: 0; }
.receipt-card dt { color: var(--ink-3); font-size: 13px; }
.receipt-card dd { margin-top: 3px; color: var(--ink); font-family: var(--font-mono); font-size: 13px; word-break: break-word; }
.fact-label { display: inline-flex; border: 1px solid currentColor; border-radius: 999px; padding: 3px 8px; font-family: var(--font-body); font-size: 13px; font-weight: 750; }
.fact-label.direct { color: var(--success); }
.fact-label.inferred { color: var(--signal); }

.workspace-section { border-top: 1px solid var(--line); background: var(--surface-2); }
.workspace-panel { display: grid; grid-template-columns: minmax(280px, 0.58fr) minmax(560px, 1.42fr); overflow: hidden; border: 1px solid var(--line-strong); border-radius: 24px; background: var(--surface); }
.workspace-copy { padding: clamp(34px, 5vw, 66px); }
.workspace-copy h2 { margin: 20px 0 0; font-family: var(--font-display); font-size: clamp(42px, 5.2vw, 70px); letter-spacing: -0.06em; line-height: 0.97; }
.workspace-copy > p:not(.eyebrow) { margin: 25px 0 0; color: var(--ink-2); }
.workspace-copy .button { margin-top: 28px; }
.workspace-board { margin: 28px 28px 28px 0; overflow: hidden; border: 1px solid #405255; border-radius: 16px; background: #0f1b1e; color: #eff5f2; }
.workspace-board > header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #2b3d40; padding: 14px 18px; color: #aebdba; font-family: var(--font-mono); font-size: 13px; }
.board-grid { display: grid; grid-template-columns: 43% 57%; min-height: 410px; }
.review-list,
.review-detail { padding: 20px; }
.review-list { border-right: 1px solid #2b3d40; background: #111f21; }
.list-label { color: #8fa5ff; font-family: var(--font-mono); font-size: 13px; text-transform: uppercase; }
.review-item { display: grid; grid-template-columns: 9px 1fr; gap: 10px; align-items: start; border-bottom: 1px solid #2b3d40; padding: 17px 8px; }
.review-item.selected { margin-top: 14px; border: 1px solid #536b71; border-radius: 10px; background: #17282b; padding-inline: 12px; }
.review-item i { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: #66d9af; }
.review-item strong,
.review-item small { display: block; }
.review-item strong { font-family: var(--font-mono); font-size: 13px; }
.review-item small { margin-top: 4px; color: #94a6a8; font-size: 13px; }
.review-detail { position: relative; background-image: linear-gradient(rgba(143, 165, 255, 0.055) 1px, transparent 1px); background-size: 100% 29px; }
.detail-title { width: 72%; height: 24px; margin-top: 38px; border-radius: 6px; background: #eaf1ee; }
.detail-line { width: 94%; height: 8px; margin-top: 25px; border-radius: 5px; background: #5a6e71; }
.detail-line.short { width: 63%; margin-top: 10px; }
.detail-tags { display: flex; gap: 8px; margin-top: 26px; }
.detail-tags i { width: 70px; height: 26px; border: 1px solid #56696d; border-radius: 999px; background: #17282b; }
.detail-tags i:nth-child(2) { width: 92px; border-color: #8fa5ff; }
.detail-tags i:nth-child(3) { width: 58px; }
.detail-card { display: grid; gap: 12px; margin-top: 36px; border: 1px solid #34494c; border-radius: 10px; padding: 19px; }
.detail-card span { height: 7px; border-radius: 5px; background: #5a6e71; }
.detail-card span:nth-child(2) { width: 82%; }
.detail-card span:nth-child(3) { width: 64%; background: #8fa5ff; }

.scope-section { background: var(--canvas); }
.scope-grid { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.72fr); gap: clamp(50px, 9vw, 130px); }
.scope-grid h2 { margin: 20px 0 0; font-family: var(--font-display); font-size: clamp(48px, 6.6vw, 84px); letter-spacing: -0.065em; line-height: 0.94; }
.scope-grid > div:last-child { align-self: end; border-left: 3px solid var(--signal); padding-left: 30px; }
.scope-grid > div:last-child p { margin: 0; color: var(--ink-2); font-size: 17px; }
.scope-grid > div:last-child p + p { margin-top: 20px; }

.closing-section { position: relative; overflow: hidden; background: #1737c5; color: #fff; }
.closing-section::after { position: absolute; right: -100px; bottom: -240px; width: 560px; height: 560px; border: 80px solid rgba(255, 255, 255, 0.08); border-radius: 50%; content: ""; }
.closing-inner { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 40px; }
.closing-section .eyebrow { color: #fff; }
.closing-section .eyebrow::before { background: #ff9b84; }
.closing-section h2 { max-width: 890px; margin: 20px 0 0; font-family: var(--font-display); font-size: clamp(54px, 8vw, 104px); letter-spacing: -0.07em; line-height: 0.88; }
.closing-button { border-color: #fff; background: #fff; color: #11299b; }
.closing-button:hover { border-color: #dfe5ff; background: #dfe5ff; }
:root[data-theme="dark"] .closing-button { color: #11299b; }

@media (max-width: 1120px) {
  .trace-hero-grid { grid-template-columns: 1fr; }
  .trace-hero-copy { max-width: 820px; }
  .trace-visual { width: min(100%, 820px); margin-left: auto; }
  .input-modes,
  .workflow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .evidence-layout { grid-template-columns: 1fr; }
  .evidence-copy { max-width: 760px; }
  .reader-preview { width: min(100%, 860px); margin-left: auto; }
  .workspace-panel { grid-template-columns: 1fr; }
  .workspace-copy { max-width: 760px; }
  .workspace-board { margin: 0 28px 28px; }
}

@media (max-width: 760px) {
  .trace-hero-grid { min-height: auto; padding-block: 64px 76px; }
  .trace-hero-copy h1 { font-size: clamp(62px, 18vw, 102px); line-height: 0.82; }
  .trace-hero-copy h1 span::after { bottom: -9px; height: 5px; }
  .trace-visual { padding-left: 20px; }
  .trace-wire { left: 7px; }
  .ledger-head { align-items: flex-start; flex-direction: column; }
  .ledger-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px 10px; }
  .row-number { grid-row: span 2; }
  .row-arrow { display: none; }
  .row-result { grid-column: 2 / 4; border-left: 2px solid #405255; padding-left: 10px; }
  .status { align-self: start; }
  .row-input strong,
  .row-input span,
  .row-result strong,
  .row-result span { white-space: normal; }
  .ledger-summary { align-items: flex-start; flex-direction: column; }
  .reconcile { margin-left: 0; }
  .input-modes,
  .workflow-steps { grid-template-columns: 1fr; }
  .input-mode { min-height: 0; }
  .input-mode code { min-height: 0; }
  .workflow-steps li { min-height: 290px; }
  .reader-body { grid-template-columns: 1fr; }
  .receipt-card { border-top: 1px solid var(--line); border-left: 0; }
  .scope-grid,
  .closing-inner { grid-template-columns: 1fr; }
  .scope-grid > div:last-child { align-self: start; }
  .closing-button { justify-self: start; }
  .board-grid { grid-template-columns: 1fr; }
  .review-list { border-right: 0; border-bottom: 1px solid #2b3d40; }
  .review-detail { min-height: 340px; }
}

@media (max-width: 520px) {
  .hero-actions .button { width: 100%; }
  .trace-visual { margin-inline: -6px; padding-left: 12px; }
  .trace-wire { left: 1px; }
  .ledger-window { border-radius: 14px; }
  .ledger-list { padding-inline: 10px; }
  .ledger-row {
    grid-template-areas: "number input status" ". result result";
    grid-template-columns: 32px minmax(0, 1fr) auto;
    padding-block: 12px;
  }
  .row-number { width: 28px; height: 28px; grid-area: number; }
  .row-input { grid-area: input; }
  .status { justify-self: end; grid-area: status; }
  .row-result { grid-area: result; }
  .workspace-board { margin: 0 12px 12px; }
  .workspace-board > header { align-items: flex-start; flex-direction: column; gap: 4px; }
  .review-list,
  .review-detail { padding: 16px; }
}
