:root {
  --ink: #102a2a;
  --muted: #61706e;
  --paper: #f3f0e7;
  --surface: #fffdf8;
  --line: #d9d8cc;
  --green: #0d6b57;
  --lime: #c7f36b;
  --orange: #dc6f35;
  --red: #a4392e;
  --shadow: 0 18px 50px rgba(16, 42, 42, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 3%, rgba(199, 243, 107, .24), transparent 24rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button { font: inherit; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(16, 42, 42, .12);
}
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; font-size: 19px; font-weight: 780; }
.brand em { color: var(--green); font-style: normal; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; background: var(--ink); color: var(--lime); border-radius: 10px; font-size: 12px; letter-spacing: .06em; }
.integration-state { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.unlock-button { padding: 8px 11px; border: 1px solid #aeb9b4; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 750; }
.unlock-button.unlocked { border-color: #aad5c1; background: #dff0e7; color: var(--green); }

main { max-width: 1180px; margin: 0 auto; padding: 72px 24px 80px; }
.hero { display: grid; grid-template-columns: 1.5fr .8fr; gap: 64px; align-items: end; margin-bottom: 64px; }
.eyebrow { margin: 0 0 16px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .15em; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 7vw, 82px); line-height: .98; font-weight: 500; letter-spacing: -.045em; }
h1 span { color: var(--green); }
.hero-copy { max-width: 690px; margin: 28px 0 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.hero-proof { background: var(--ink); color: white; border-radius: 22px; padding: 28px; box-shadow: var(--shadow); }
.hero-proof > div { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 0 18px; border-bottom: 1px solid rgba(255,255,255,.14); }
.hero-proof strong { color: var(--lime); font: 48px/1 Georgia, serif; }
.hero-proof span, .hero-proof p { color: #b7c7c3; font-size: 13px; }
.hero-proof p { margin: 20px 0 0; }

.notice { margin: -28px 0 32px; padding: 16px 18px; border: 1px solid #e0a67e; border-radius: 12px; background: #fff3e8; color: #713819; line-height: 1.5; }
.guided-entry { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 28px; margin-bottom: 24px; padding: 24px 28px; border: 1px solid #b9d4c7; border-radius: 18px; background: linear-gradient(120deg, #f6fbf7, #edf4dc); box-shadow: 0 10px 30px rgba(16, 42, 42, .06); }
.guided-entry .eyebrow { margin-bottom: 7px; }
.guided-entry h2 { font-size: 26px; }
.guided-entry p:last-child { max-width: 720px; margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.guided-start { min-width: 164px; background: var(--green); }
.workspace { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.section-heading { display: flex; align-items: end; justify-content: space-between; padding: 30px 32px; }
.section-heading .eyebrow { margin-bottom: 7px; }
h2 { margin: 0; font: 32px/1.1 Georgia, serif; }
.secondary, .action-button { border: 0; border-radius: 9px; cursor: pointer; font-weight: 750; }
.secondary { padding: 10px 14px; color: var(--ink); background: #e9ece3; }
.secondary:hover { background: #dfe5d6; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 0; }
th:nth-child(1) { width: 20%; }
th:nth-child(2) { width: 17%; }
th:nth-child(3) { width: 22%; }
th:nth-child(4) { width: 26%; }
th:nth-child(5) { width: 15%; }
th { padding: 13px 20px; color: var(--muted); background: #eeece4; font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .09em; }
td { padding: 22px 20px; border-top: 1px solid var(--line); vertical-align: top; }
.order-id { font-weight: 820; }
.customer-name { display: block; margin-top: 7px; font-size: 13px; font-weight: 720; }
.subtext { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.money { font: 21px Georgia, serif; }
.metric-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.attention-metric { display: inline-flex; margin-top: 11px; padding: 5px 8px; border-radius: 6px; background: #f7dfdc; color: var(--red); font-size: 11px; font-weight: 820; }
.evidence-list { display: grid; gap: 5px; }
.evidence-list > div { display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: center; gap: 6px; }
.evidence-list span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.evidence-list code { max-width: 170px; overflow: hidden; color: var(--green); font: 11px ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.evidence-totals { display: grid; gap: 4px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.evidence-totals span { display: flex; justify-content: space-between; gap: 10px; }
.evidence-totals strong { color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 850; letter-spacing: .03em; }
.pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.pill.high { color: var(--red); background: #f7dfdc; }
.pill.medium { color: #8c531d; background: #f8e9ce; }
.pill.matched { color: var(--green); background: #dff0e7; }
.investigation-inline { display: block; margin-top: 8px; color: var(--ink); font-size: 10px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.evidence-changed { display: inline-flex; margin-top: 8px; padding: 5px 8px; border-radius: 6px; background: #fff0cf; color: #7d4b12; font-size: 11px; font-weight: 800; }
.evidence-changed.inline { display: inline-flex; }
.finding { max-width: 270px; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.row-next-step { margin-top: 10px; padding-top: 9px; border-top: 1px solid #e5e2d8; color: var(--ink); font-size: 11px; line-height: 1.45; }
.row-next-step span { display: block; margin-bottom: 3px; color: var(--green); font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.actions { display: flex; min-width: 0; flex-direction: column; align-items: stretch; gap: 8px; }
.action-button { padding: 10px 12px; background: var(--ink); color: white; font-size: 12px; }
.actions .action-button, .actions paypal-button { width: 100%; min-width: 0; white-space: normal; }
.action-button:hover { background: var(--green); }
.action-button.refund { background: var(--orange); }
.action-button.explain { background: transparent; color: var(--ink); border: 1px solid #aeb9b4; }
.action-button:disabled { cursor: wait; opacity: .55; }
.loading { padding: 48px; color: var(--muted); text-align: center; }
.error-state { color: var(--red); background: #fff4f1; }

.principle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.principle-grid article { padding: 24px; border: 1px solid var(--line); border-radius: 16px; }
.principle-grid span { color: var(--green); font: 15px Georgia, serif; }
.principle-grid h3 { margin: 26px 0 8px; }
.principle-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 34px; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(8, 29, 28, .62); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 18px; right: 20px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 28px; }
.dialog-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-right: 34px; }
.dialog-heading .eyebrow { margin-bottom: 8px; }
.print-report { flex: none; }
.guided-bar { display: grid; grid-template-columns: 1fr auto; gap: 18px; margin: -10px 34px 24px -10px; padding: 16px 18px; border-radius: 13px; background: var(--ink); color: white; }
.guided-bar span { display: block; color: var(--lime); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.guided-bar strong { display: block; margin-top: 4px; font-size: 14px; }
.guided-bar p { margin: 6px 0 0; color: #c7d4d1; font-size: 12px; line-height: 1.45; }
.guided-actions { display: grid; align-content: center; gap: 7px; }
.guided-actions .secondary { background: white; font-size: 11px; }
.ai-label { display: inline-block; margin: 18px 0 5px; padding: 5px 8px; border-radius: 5px; color: var(--green); background: #e3f0e9; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.explanation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.explanation-card { min-height: 120px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #f8f6ef; }
.explanation-card h3 { margin: 0 0 9px; color: var(--green); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.explanation-card p, .explanation-card ul { margin: 0; overflow-wrap: anywhere; color: #344a47; font-size: 13px; line-height: 1.55; }
.explanation-card ul { padding-left: 17px; }
.explanation-card li + li { margin-top: 5px; }
.explanation-card.finding { max-width: none; margin-top: 0; border-color: #bfd8cc; background: #f1f8f4; }
.explanation-card.next-step { border-color: #c9d9a2; background: #f4f8e9; }
.explanation-card.uncertainty { background: #f4f2eb; }
.verified-facts { margin-top: 22px; padding: 18px; border: 1px solid #c9ded3; border-radius: 12px; background: #f1f8f4; }
.verified-facts h3 { display: flex; justify-content: space-between; margin: 0 0 12px; font-size: 14px; }
.verified-facts h3 span { color: var(--green); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.verified-facts dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin: 0; }
.verified-facts dl div { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid #d8e8df; padding-top: 8px; }
.verified-facts dt { color: var(--muted); font-size: 11px; }
.verified-facts dd { margin: 0; font-size: 12px; font-weight: 800; text-align: right; }
.ai-section { margin-top: 12px; }
.case-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.case-section-title { margin: 0 0 12px; color: var(--ink); font-size: 14px; }
.case-section-title span { float: right; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.paypal-evidence { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px; margin: 0; }
.paypal-evidence div { min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8f6ef; }
.paypal-evidence dt { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.paypal-evidence dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.draft-note { margin-top: 12px; }
.status-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.investigation-pill { display: inline-flex; padding: 7px 10px; border-radius: 999px; background: var(--ink); color: white; font-size: 11px; font-weight: 850; letter-spacing: .05em; }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.status-button { font-size: 12px; }
#note-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
#investigation-note { width: 100%; resize: vertical; padding: 11px 12px; border: 1px solid #aeb9b4; border-radius: 9px; background: white; color: var(--ink); font: inherit; font-size: 13px; line-height: 1.5; }
.read-only-note { margin: 0; color: var(--muted); font-size: 13px; }
.timeline { position: relative; display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding-left: 22px; }
.timeline li::before { position: absolute; top: 5px; left: 2px; width: 8px; height: 8px; border: 2px solid var(--surface); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px var(--green); content: ""; }
.timeline li:not(:last-child)::after { position: absolute; top: 16px; bottom: -17px; left: 6px; width: 1px; background: #bad0c6; content: ""; }
.timeline-copy { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; }
.timeline-copy strong { font-size: 13px; }
.timeline-copy span { color: var(--muted); font-size: 11px; }
.timeline p { margin: 6px 0 0; overflow-wrap: anywhere; color: #344a47; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.evidence-box { margin-top: 24px; padding: 18px; border-radius: 12px; background: #edece5; }
.evidence-box summary { cursor: pointer; font-size: 13px; font-weight: 800; }
.evidence-box[open] summary { margin-bottom: 12px; }
pre { margin: 0; overflow: auto; overflow-wrap: anywhere; color: #38504d; font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.access-dialog { width: min(480px, calc(100vw - 32px)); }
.access-copy { color: var(--muted); line-height: 1.55; }
.access-dialog label { display: block; margin: 22px 0 7px; font-size: 12px; font-weight: 800; }
.access-dialog input { width: 100%; padding: 12px 13px; border: 1px solid #aeb9b4; border-radius: 8px; background: white; color: var(--ink); font: 14px ui-monospace, SFMono-Regular, Consolas, monospace; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 390px; padding: 14px 18px; border-radius: 10px; background: var(--ink); color: white; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.secondary:focus-visible, .action-button:focus-visible, .unlock-button:focus-visible, .dialog-close:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(13, 107, 87, .35); outline-offset: 2px; }

@media (max-width: 960px) {
  main { padding-top: 42px; }
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .guided-entry { grid-template-columns: 1fr; }
  .guided-start { width: 100%; }
  .principle-grid { grid-template-columns: 1fr; }
  .integration-state { display: none; }
  .section-heading { align-items: start; gap: 20px; }
  .verified-facts dl { grid-template-columns: 1fr; }
  .paypal-evidence { grid-template-columns: 1fr; }
  .explanation-grid { grid-template-columns: 1fr; }
  .guided-bar { grid-template-columns: 1fr; margin-right: 34px; }
  .guided-actions { grid-template-columns: 1fr 1fr; }
  dialog { padding: 28px 20px; }
  .section-heading { padding: 24px 20px; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; table-layout: auto; }
  thead { display: none; }
  tbody { display: grid; gap: 14px; padding: 0 14px 16px; }
  tr { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
  td { display: block; padding: 16px; border-top: 1px solid var(--line); }
  td:first-child { grid-column: 1 / -1; border-top: 0; background: #f8f6ef; }
  td:nth-child(4), td:nth-child(5) { grid-column: 1 / -1; }
  td::before { display: block; margin-bottom: 8px; color: var(--muted); content: attr(data-label); font-size: 9px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
  .metric-label { display: none; }
  .actions { min-width: 0; }
}

@media (max-width: 440px) {
  main { padding-right: 12px; padding-left: 12px; }
  h1 { font-size: 43px; }
  tr { grid-template-columns: 1fr; }
  td, td:first-child, td:nth-child(4), td:nth-child(5) { grid-column: 1; }
  .topbar { padding: 0 14px; }
  .toast { right: 12px; bottom: 12px; left: 12px; max-width: none; }
  #note-form { grid-template-columns: 1fr; }
  .dialog-heading { align-items: start; flex-direction: column; }
  .print-report { width: 100%; }
  .guided-actions { grid-template-columns: 1fr; }
  .case-section-title span { display: block; float: none; margin-top: 4px; }
}

@media print {
  body { background: white; }
  body > header, body > main, #access-dialog, .toast, .dialog-close, .guided-bar, .print-report, .draft-note, .status-actions, #note-form { display: none !important; }
  #explanation-dialog { position: static; display: block; width: auto; max-height: none; margin: 0; padding: 0; overflow: visible; border-radius: 0; box-shadow: none; }
  #explanation-dialog::backdrop { display: none; }
  .explanation-card, .verified-facts, .paypal-evidence div, .evidence-box { break-inside: avoid; }
  .explanation-grid { grid-template-columns: 1fr 1fr; }
  .read-only-note { display: block !important; }
}
