/* ProveTheBuy playground
   Layout: fixed left rail, one working column. The proof strip (verification receipt) is the one
   expressive element; everything else is quiet tables and forms. */
:root {
  --ink: #13202b;
  --ink-2: #3b4a54;
  --muted: #5d6c74;
  --paper: #f3f6f6;
  --surface: #ffffff;
  --sunk: #eaeff0;
  --rule: #d6dee0;
  --teal: #0f766e;
  --teal-soft: #e3f1ef;
  --allow: #18794e;
  --allow-soft: #e4f3ea;
  --step: #a35c00;
  --step-soft: #fbf0df;
  --block: #b42318;
  --block-soft: #fbe9e7;
  --neutral-soft: #edf0f2;
  --focus: #0f766e;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
code, pre, .mono { font-family: var(--mono); font-size: 0.86em; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 22px 16px; border-right: 1px solid var(--rule); background: var(--surface); }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; padding: 0 6px; }
.brand .mark { width: 30px; height: 30px; color: var(--ink); flex: none; }
.brand strong { display: block; font: 600 17px/1.1 var(--serif); letter-spacing: -0.01em; }
.brand small { display: block; color: var(--muted); font-size: 12.5px; }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
nav a:hover { background: var(--sunk); color: var(--ink); }
nav a[aria-current="page"] { background: var(--teal-soft); color: var(--teal); }
nav .count { margin-left: auto; background: var(--block); color: #fff; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 0 7px; line-height: 18px; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 6px; font-size: 13px; color: var(--muted); }
.rail-foot .merchant { color: var(--ink-2); font-family: var(--mono); font-size: 12px; word-break: break-all; }
.mode { display: inline-flex; align-items: center; gap: 7px; }
.mode::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--step); }
.mode.enforce::before { background: var(--allow); }
.ledger.ok { color: var(--allow); }
.ledger.bad { color: var(--block); }
.link { background: none; border: 0; padding: 0; color: var(--teal); cursor: pointer; text-align: left; font-size: 13px; }
.link:hover { text-decoration: underline; }

main { padding: 30px clamp(18px, 4vw, 48px) 64px; max-width: 1240px; width: 100%; outline: none; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.page-head h1 { margin: 0 0 4px; font: 600 28px/1.2 var(--serif); letter-spacing: -0.015em; }
.page-head p { margin: 0; color: var(--muted); max-width: 68ch; }
h2 { font: 600 16px/1.3 var(--sans); margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 13.5px; }

/* ---------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--rule); background: var(--surface); padding: 8px 14px; border-radius: 7px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--block); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--rule); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
textarea.code { width: 100%; min-height: 320px; resize: vertical; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); padding: 12px 14px; font: 12.5px/1.55 var(--mono); color: var(--ink); tab-size: 2; }
.field-error { color: var(--block); font-size: 13.5px; margin-top: 8px; }

/* ---------------------------------------------------------- decision chips */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 999px; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.allow { color: var(--allow); background: var(--allow-soft); }
.chip.step_up { color: var(--step); background: var(--step-soft); }
.chip.block { color: var(--block); background: var(--block-soft); }
.chip.not_agent, .chip.neutral { color: var(--muted); background: var(--neutral-soft); }
.chip.won { color: var(--allow); background: var(--allow-soft); }
.chip.lost { color: var(--block); background: var(--block-soft); }
.chip.evidence_submitted { color: var(--teal); background: var(--teal-soft); }
.chip.opened { color: var(--step); background: var(--step-soft); }

/* ---------------------------------------------------------- playground */
.pg { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 1fr); gap: 24px; align-items: start; }
.scenarios { display: flex; flex-direction: column; gap: 2px; }
.scenarios button { text-align: left; border: 1px solid transparent; background: none; border-radius: 8px; padding: 9px 12px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.scenarios button:hover { background: var(--surface); border-color: var(--rule); }
.scenarios button[aria-pressed="true"] { background: var(--surface); border-color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.scenarios .name { font-weight: 500; }
.scenarios .exp { font-size: 12px; color: var(--muted); align-self: center; }
.group-label { font-size: 13px; color: var(--muted); margin: 14px 12px 4px; }
.group-label:first-child { margin-top: 0; }
.pg-work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.pg-work > * { min-width: 0; }
.scenario-desc { margin: 0 0 12px; color: var(--ink-2); max-width: 60ch; }
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }

/* The proof strip: a verification receipt */
.proof { position: relative; margin-top: 10px; background: var(--surface); padding: 24px 24px 22px; border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 10px 10px; }
.proof::before { content: ""; position: absolute; top: -9px; left: -1px; right: -1px; height: 10px;
  background: linear-gradient(-45deg, var(--surface) 7px, transparent 0) 0 100% / 14px 10px repeat-x, linear-gradient(45deg, var(--surface) 7px, transparent 0) 0 100% / 14px 10px repeat-x; }
.proof.empty { color: var(--muted); text-align: center; padding: 60px 24px; }
.proof .verdict { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 2px solid currentColor; margin-bottom: 14px; }
.proof .verdict b { font: 600 34px/1 var(--serif); letter-spacing: -0.02em; }
.proof .verdict span { font-size: 13px; color: var(--muted); text-align: right; }
.proof.allow .verdict { color: var(--allow); }
.proof.step_up .verdict { color: var(--step); }
.proof.block .verdict { color: var(--block); }
.proof.not_agent .verdict { color: var(--muted); }
.proof .why { margin: 0 0 16px; color: var(--ink); font-size: 15px; }
.proof .meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; margin: 0 0 16px; }
.proof .meta dt { color: var(--muted); }
.proof .meta dd { margin: 0; overflow-wrap: anywhere; }
.lines { list-style: none; margin: 0; padding: 0; border-top: 1px dashed var(--rule); }
.lines li { padding: 9px 0; border-bottom: 1px dashed var(--rule); display: grid; grid-template-columns: 22px 1fr; gap: 0 8px; }
.lines .ic { width: 18px; height: 18px; margin-top: 2px; }
.lines .t { display: flex; align-items: baseline; gap: 8px; }
.lines .t strong { font-weight: 500; font-size: 14px; }
.lines .t::after { content: ""; flex: 1; border-bottom: 1px dotted var(--rule); transform: translateY(-4px); order: 1; }
.lines .t em { order: 2; font-style: normal; font-size: 12.5px; font-weight: 600; }
.lines .d { grid-column: 2; color: var(--muted); font-size: 13.5px; }
.lines .pass em { color: var(--allow); }
.lines .fail em { color: var(--block); }
.lines .warn em { color: var(--step); }
.lines .skip em { color: var(--muted); }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; color: var(--teal); font-size: 13.5px; }
pre.block { background: var(--sunk); border-radius: 7px; padding: 12px 14px; overflow-x: auto; font-size: 12px; line-height: 1.55; margin: 8px 0 0; white-space: pre; }
.proof-foot { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------- stats and charts */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); margin-bottom: 24px; overflow: hidden; }
.stat { padding: 16px 18px; border-right: 1px solid var(--rule); }
.stat:last-child { border-right: 0; }
.stat .v { font: 600 26px/1.15 var(--serif); font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 18px 20px; min-width: 0; }
.grid-2 { display: grid; align-items: start; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12.5px; padding: 7px 10px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity 0.08s; z-index: 3; }
.tip.on { opacity: 1; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 40%) 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.bar-row .track { height: 10px; background: var(--sunk); border-radius: 5px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--teal); border-radius: 5px; }
.bar-row .n { font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 2ch; text-align: right; }

/* ---------------------------------------------------------- tables */
.table-wrap { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); font-size: 13px; background: var(--sunk); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--sunk); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .reason { color: var(--muted); font-size: 13px; }
.empty-state { padding: 40px; text-align: center; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* ---------------------------------------------------------- policy */
.policy { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.diff-counts { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 4px 0 14px; font-size: 14px; }
.diff-counts b { font-variant-numeric: tabular-nums; }
.arrow { color: var(--muted); margin: 0 6px; }

/* ---------------------------------------------------------- disputes */
.pack section { margin-bottom: 18px; }
.pack h3 { font-size: 14px; margin: 0 0 6px; }
.pack p, .pack pre { margin: 0; }
.pack pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; background: var(--sunk); padding: 10px 12px; border-radius: 7px; }
.notice { border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.notice.ok { background: var(--allow-soft); color: var(--allow); }
.notice.bad { background: var(--block-soft); color: var(--block); }

/* ---------------------------------------------------------- drawer & toast */
.drawer { position: fixed; inset: 0; z-index: 20; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(10, 20, 24, 0.35); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(680px, 100%); background: var(--paper); border-left: 1px solid var(--rule); display: flex; flex-direction: column; }
.drawer-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--rule); background: var(--surface); }
.drawer-panel h2 { margin: 0; font: 600 19px/1.25 var(--serif); }
.drawer-body { padding: 20px 22px 40px; overflow-y: auto; }
.icon { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 8px; border-radius: 6px; }
.icon:hover { background: var(--sunk); color: var(--ink); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; z-index: 30; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.upload { border: 1.5px dashed var(--rule); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); background: var(--surface); }
.upload.drag { border-color: var(--teal); color: var(--teal); }

/* ---------------------------------------------------------- pricing */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; align-items: start; }
.plan-card { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 28px 26px 24px; display: flex; flex-direction: column; gap: 0; }
.plan-highlighted { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.plan-badge { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--teal); color: #fff; font-size: 11.5px; font-weight: 600; padding: 2px 12px; border-radius: 999px; white-space: nowrap; }
.plan-name { font: 600 15px/1 var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.plan-price { font: 600 36px/1.1 var(--serif); letter-spacing: -0.02em; color: var(--ink); margin-bottom: 8px; }
.plan-desc { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.plan-features { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-features li { font-size: 14px; padding-left: 20px; position: relative; }
.plan-features li::before { content: "✓"; position: absolute; left: 0; color: var(--teal); font-weight: 700; }
.plan-cta { width: 100%; justify-content: center; margin-top: auto; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1100px) { .pg-work, .policy, .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--rule); }
  nav { flex-direction: row; flex-wrap: wrap; }
  .rail-foot { margin-top: 0; flex-direction: row; flex-wrap: wrap; gap: 4px 14px; width: 100%; }
  .pg { grid-template-columns: minmax(0, 1fr); }
  main { padding: 20px 16px 48px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.upload .link { font-size: inherit; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
@media (max-width: 820px) {
  .scenarios { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .scenarios .group-label { flex-basis: 100%; }
  .scenarios button { width: auto; border: 1px solid var(--rule); }
}

/* ---------------------------------------------------------- cloud additions */
.rail-group { color: var(--muted); font-size: 12.5px; padding: 14px 10px 4px; }
.who { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-2); }
.who img, .who .initial { width: 28px; height: 28px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; font-weight: 600; flex: none; }
.plan-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; border-radius: 10px; padding: 12px 16px; margin-bottom: 20px; background: var(--step-soft); color: var(--ink); font-size: 14px; }
.banner.info { background: var(--teal-soft); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); font-weight: 600; font-size: 13px; }
.steps li.done::before { content: "✓"; background: var(--allow-soft); color: var(--allow); }
.steps h3 { margin: 2px 0 4px; font-size: 15px; }
.steps p { margin: 0; color: var(--muted); font-size: 14px; }
.form { display: grid; gap: 14px; max-width: 520px; }
.form label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.form input, .form select { border: 1px solid var(--rule); border-radius: 7px; padding: 8px 10px; background: var(--surface); }
.form .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.inline { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.inline input, .inline select { border: 1px solid var(--rule); border-radius: 7px; padding: 8px 10px; background: var(--surface); }
.secret { display: flex; gap: 8px; align-items: center; background: var(--sunk); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 13px; word-break: break-all; }
.verdict-card { border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; border: 1px solid var(--rule); background: var(--surface); }
.verdict-card.strong { border-color: var(--allow); background: var(--allow-soft); }
.verdict-card.moderate { border-color: var(--step); background: var(--step-soft); }
.verdict-card.weak, .verdict-card.none { border-color: var(--rule); background: var(--neutral-soft); }
.verdict-card h3 { margin: 0 0 6px; font: 600 20px/1.2 var(--serif); }
.verdict-card p { margin: 0; }
.reasons { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; font-size: 14px; }
.reasons li { padding-left: 22px; position: relative; }
.reasons li::before { position: absolute; left: 0; font-weight: 700; }
.reasons li.good::before { content: "+"; color: var(--allow); }
.reasons li.bad::before { content: "−"; color: var(--block); }
.locked { border: 1px dashed var(--rule); border-radius: 10px; padding: 18px; text-align: center; color: var(--ink-2); background: var(--surface); }
.meter { height: 8px; border-radius: 999px; background: var(--sunk); overflow: hidden; margin: 8px 0 4px; }
.meter > i { display: block; height: 100%; background: var(--teal); }
.meter.over > i { background: var(--step); }
.chip.needs_response, .chip.warning_needs_response { color: var(--step); background: var(--step-soft); }
.chip.under_review { color: var(--teal); background: var(--teal-soft); }
.chip.strong { color: var(--allow); background: var(--allow-soft); }
.chip.moderate { color: var(--step); background: var(--step-soft); }
.chip.weak { color: var(--muted); background: var(--neutral-soft); }
.auth { max-width: 400px; margin: 10vh auto; padding: 0 16px; }
.auth .panel { padding: 28px; }
.auth h1 { font: 600 26px/1.2 var(--serif); margin: 16px 0 6px; }
.auth .btn { width: 100%; justify-content: center; margin-top: 10px; }
.auth input { width: 100%; border: 1px solid var(--rule); border-radius: 7px; padding: 9px 10px; margin-top: 10px; }
.public-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; max-width: 1180px; margin: 0 auto; }
.public-main { max-width: 1180px; margin: 0 auto; padding: 10px 24px 60px; }
.public-main h1 { font: 600 38px/1.15 var(--serif); letter-spacing: -0.02em; margin: 20px 0 10px; max-width: 760px; }
.public-main .lede { color: var(--ink-2); font-size: 17px; max-width: 680px; margin: 0 0 36px; }
