:root {
  --bg: #f5f7fb; --card: #fff; --ink: #1a2233; --muted: #667085; --line: #e3e8f0;
  --blue: #0b5fff; --navy: #0a2540; --ok: #0f7b3f; --ok-bg: #e7f6ee; --bad: #b42318; --bad-bg: #fdecea;
  --warn: #9a6700; --warn-bg: #fff6db; --mock: #7a3cc4; --mock-bg: #f3ebfc;
  --agent: #0b5470; --agent-bg: #e3f3f9;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "PingFang TC", "Hiragino Sans", "Microsoft JhengHei", "Noto Sans CJK TC", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--blue); }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: #eef1f6; padding: 1px 4px; border-radius: 4px; }
.muted code, .small code { color: #475467; }  /* muted grey on the code tint is 4.39:1; this is about 7:1 */
pre { white-space: pre-wrap; background: #f6f8fb; border: 1px solid var(--line); padding: 10px; border-radius: 6px; font-size: 12.5px; }
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 14px 28px; background: var(--navy); color: #fff; }
.demo-ribbon { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; padding: 6px 12px;
  background: #06233d; color: #dcecff; font-size: 12px; letter-spacing: .35px; text-transform: uppercase; }
.demo-ribbon strong { color: #fff; } .demo-ribbon span + span { position: relative; }
.demo-ribbon span + span::before { content: "•"; position: absolute; left: -12px; color: #6ea8dc; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: .3px; margin-right: 12px; }
.tagline { opacity: .85; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; font-weight: 600; }
.badge.ok { background: #d1fadf; color: #05603a; } .badge.bad { background: #fee4e2; color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.neutral { background: rgba(255,255,255,.15); color: #fff; }
body[data-busy] { cursor: progress; }
body[data-busy] main { opacity: .72; pointer-events: none; }
form.js-busy.busy-now { outline: 2px solid var(--blue); outline-offset: 2px; }
main { max-width: 1320px; margin: 0 auto; padding: 22px 28px 40px; }
h1 { margin: 0 0 4px; font-size: 22px; } h2 { margin: 0 0 12px; font-size: 17px; } h3 { font-size: 15px; margin: 4px 0 10px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.controls { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.controls p { margin: 0; }
.buttons, .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.demo-guide { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin: 0 0 16px;
  padding: 16px 18px; border: 1px solid #b8d0f4; border-left: 5px solid var(--blue); border-radius: 12px;
  background: linear-gradient(100deg, #eef5ff, #fff); }
.guide-copy { min-width: 0; } .eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.demo-guide h2 { margin: 2px 0 8px; font-size: 18px; } .guide-steps { display: flex; gap: 18px; flex-wrap: wrap; padding: 0; margin: 0; list-style: none; counter-reset: guide; }
.guide-steps li { display: grid; grid-template-columns: 22px auto; column-gap: 6px; align-items: baseline; }
.guide-steps li::before { counter-increment: guide; content: counter(guide); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; font-weight: 800; }
.guide-steps strong { font-size: 13px; } .guide-steps span { grid-column: 2; color: var(--muted); font-size: 12px; }
.sandbox-note { margin: 9px 0 0; padding: 6px 10px; color: #5a4300; background: var(--warn-bg); border-radius: 8px; font-size: 12.5px; overflow-wrap: anywhere; }
.guide-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; min-width: 245px; }
.row.between { justify-content: space-between; } .gap { gap: 8px; }
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 14px; border-radius: 8px;
  font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; font-size: 14px; }
.btn:hover { border-color: #b8c2d3; } .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.ghost { background: transparent; } .btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .6; cursor: progress; }
form.inline { display: inline; }
.grid-top { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; margin-bottom: 18px; }
.grid-mid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; margin-bottom: 18px; }
.grid-bottom { display: grid; grid-template-columns: .8fr 1.6fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .grid-top, .grid-mid, .grid-bottom { grid-template-columns: 1fr; } }
.block, .panel, .evidence { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--navy);
  color: #fff; font-size: 12px; margin-right: 6px; }
.chip { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; letter-spacing: .2px; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.neutral { background: #eef1f6; color: #475467; }
.chip.mock { background: var(--mock-bg); color: var(--mock); }
.chip.agent { background: var(--agent-bg); color: var(--agent); }
.pending-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; background: #fcfdff; }
.quote { font-style: italic; margin: 8px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.error { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 13.5px; }
.flash { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.flash.bad { background: var(--bad-bg); color: var(--bad); }
.flash.warn { background: var(--warn-bg); color: #5a4300; }
.flash a { font-weight: 700; }
.result { border-radius: 8px; padding: 10px 12px; margin-top: 10px; font-size: 14px; }
.result.ok { background: var(--ok-bg); color: var(--ok); } .result.warn { background: var(--warn-bg); color: var(--warn); }
.note { border-left: 3px solid var(--blue); background: #eef4ff; padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 13.5px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tab { font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); }
.tab.active { border-color: var(--blue); box-shadow: 0 0 0 2px #d6e4ff; }
.case-head { margin-bottom: 8px; font-size: 14px; }
.seeded { background: var(--warn-bg); color: #6b4a00; border-radius: 8px; padding: 6px 10px; margin-top: 6px; font-size: 13px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.ev { position: relative; padding: 6px 0 10px 16px; }
.ev::before { content: ""; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: #98a2b3; }
.ev.stage-payment::before { background: #0b5fff; } .ev.stage-intent::before { background: #7a3cc4; }
.ev.stage-policy::before { background: #0a2540; } .ev.stage-supplier::before { background: #c4320a; }
.ev.stage-human::before { background: #9a6700; } .ev.stage-paypal::before { background: #0f7b3f; }
.ev-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.stage { text-transform: uppercase; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .5px; min-width: 62px; }
.ev-title { font-weight: 600; } .ev time { margin-left: auto; color: var(--muted); font-size: 12px; }
.checks { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; }
.checks .pass { color: var(--ok); } .checks .fail { color: var(--bad); font-weight: 600; }
.label-illustrative { display: inline-block; background: var(--warn-bg); color: #6b4a00; font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 6px; }
.econ, .evtable, .layers { width: 100%; border-collapse: collapse; font-size: 14px; }
.econ th, .econ td, .evtable th, .evtable td, .layers th, .layers td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.econ td { text-align: right; } .econ tr.total th, .econ tr.total td { font-weight: 700; }
.evidence h2 { margin-bottom: 10px; }
.evidence-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .evidence-grid { grid-template-columns: 1fr; } }
.evtable th { width: 40%; color: var(--muted); font-weight: 600; }
.evtable td.ok { color: var(--ok); font-weight: 700; } .evtable td.pending { color: var(--warn); font-weight: 600; }
.layers th { background: #f6f8fb; }
.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 20px; }

/* --- pipeline ------------------------------------------------------------ */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pipeline { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; padding: 0; margin: 0 0 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.step { position: relative; padding: 12px 14px 12px 50px; min-height: 64px; border-right: 1px solid var(--line); }
.step:last-child { border-right: 0; }
.step-n { position: absolute; left: 12px; top: 14px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; background: #eef1f6; color: var(--muted); border: 2px solid #d5dbe5; }
.step-label { display: block; font-weight: 700; font-size: 14px; }
.step-detail { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.step.done { background: #f3fbf6; } .step.done .step-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done .step-detail { color: var(--ok); }
.step.waiting { background: var(--warn-bg); } .step.waiting .step-n { background: #f5b800; border-color: #f5b800; color: #fff; }
.step.waiting .step-detail { color: var(--warn); font-weight: 600; }
.step.blocked, .step.failed { background: var(--bad-bg); } .step.blocked .step-n, .step.failed .step-n { background: var(--bad); border-color: var(--bad); color: #fff; }
.step.blocked .step-detail, .step.failed .step-detail { color: var(--bad); font-weight: 600; }
.step.skipped { background: #f7f8fa; } .step.skipped .step-label { color: var(--muted); }
.step.skipped .step-n { border-style: dashed; }
@media (max-width: 900px) { .pipeline { grid-template-columns: repeat(2, 1fr); } }

/* --- result card --------------------------------------------------------- */
.result-card { border-radius: 12px; padding: 16px 18px; border: 2px solid var(--line); background: #fcfdff; }
.result-card.ok { border-color: #8ad1a8; background: var(--ok-bg); }
.result-card.bad { border-color: #f1a39b; background: var(--bad-bg); }
.result-card.warn { border-color: #f0d27a; background: var(--warn-bg); }
.rc-head { display: flex; gap: 14px; align-items: center; }
.rc-icon { font-size: 30px; font-weight: 800; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #fff; }
.ok .rc-icon, .ok .rc-title { color: var(--ok); } .bad .rc-icon, .bad .rc-title { color: var(--bad); }
.warn .rc-icon, .warn .rc-title { color: var(--warn); }
.rc-title { font-size: 26px; font-weight: 800; line-height: 1.15; }
.rc-sub { color: var(--ink); opacity: .8; font-size: 14px; }
.rc-reason { margin: 12px 0 0; font-size: 16px; font-weight: 600; background: #fff; border-radius: 8px; padding: 8px 12px; word-break: break-word; }
.rc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin: 12px 0 0; }
.rc-grid div { background: #fff; border-radius: 8px; padding: 6px 10px; }
.rc-grid dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.rc-grid dd { margin: 0; font-weight: 700; font-size: 16px; word-break: break-word; }
.confirm { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions { margin-top: 12px; }
.dup { margin-top: 10px; background: #fff; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }
.small-h { font-size: 13px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.pending-list { list-style: none; padding: 0; margin: 0; font-size: 14px; } .pending-list li { padding: 3px 0; }

/* --- free text ----------------------------------------------------------- */
.free textarea { width: 100%; font: inherit; padding: 10px; border: 1px solid #c9d2e0; border-radius: 8px; margin: 8px 0 6px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid #c9d2e0; background: #fff; border-radius: 999px; padding: 4px 11px; font-size: 13.5px; cursor: pointer; }
.chip-btn:hover, .chip-btn.on { border-color: var(--blue); background: #eef4ff; }
.chip-btn.attack { border-color: #f1a39b; color: var(--bad); } .chip-btn.attack.on { background: var(--bad-bg); }
.toggle { font-size: 14px; } .btn.wide { width: 100%; margin-top: 8px; }

/* --- admin token (Unlock admin in the header buttons) --------------------- */
.admin-auth input[type="password"] { font: inherit; padding: 8px 10px; border: 1px solid #c9d2e0;
  border-radius: 8px; width: 150px; }

/* --- AI panel / misc ----------------------------------------------------- */
.inject { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; margin-bottom: 8px; }
.custnote { border: 1px dashed #b8c2d3; border-radius: 8px; padding: 8px 12px; margin: 10px 0; background: #fbfcfe; }
.custnote p { margin: 4px 0; }
.ctl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ctl th, .ctl td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ctl th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.ev-text { font-weight: 500; flex: 1; min-width: 60%; }
details.raw summary { font-size: 11.5px; color: var(--muted); cursor: pointer; }
details.raw pre { font-size: 11.5px; max-height: 260px; overflow: auto; }
.failures { margin-bottom: 18px; }
.fm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 1000px) { .fm-grid { grid-template-columns: 1fr 1fr; } }
.fm { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fcfdff; }
.fm.ok { border-color: #8ad1a8; background: #f3fbf6; } .fm p { margin: 6px 0 0; }
#economics .econ { font-size: 13px; } #economics .econ th, #economics .econ td { padding: 4px 6px; }
.tabs { align-items: center; margin-bottom: 12px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.tab { font-size: 12.5px; background: #fff; white-space: nowrap; flex: none; }
.confirm .chip { background: #fff; font-size: 12.5px; padding: 4px 10px; }
.custnote.final { border: 1px solid #8ad1a8; background: #f3fbf6; }
.custnote.payer { border-style: solid; }

/* PayPal evidence */
.mock-tag{font-size:11px;background:#fde68a;color:#78350f;border-radius:6px;padding:1px 6px;vertical-align:middle}
dl.ev-summary{display:grid;grid-template-columns:max-content 1fr;gap:4px 12px;margin:6px 0 8px;font-size:14px}
dl.ev-summary dt{font-weight:600;color:#374151}
dl.ev-summary dd{margin:0;overflow-wrap:anywhere}
dl.ev-summary dd.ok::before{content:"✓ ";color:#15803d}
dl.ev-summary dd.bad{color:#b91c1c}
details.ev-log summary{cursor:pointer;font-size:13px;color:#1d4ed8}
.ev-scroll{overflow-x:auto;max-width:100%}
table.evidence{border-collapse:collapse;font-size:12px;white-space:nowrap}
table.evidence th,table.evidence td{border-bottom:1px solid #e5e7eb;padding:3px 8px;text-align:left}
table.evidence code{font-size:11px}
table.evidence tr.bad td{background:#fef2f2}
.ev-caption{font-size:13px;color:#4b5563;margin:2px 0 8px}
.evidence-highlights { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 12px; }
.evidence-highlight { min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.evidence-highlight.good { border-color: #8ad1a8; background: #f3fbf6; }
.evidence-highlight.bad { border-color: #f1a39b; background: #fff7f6; }
.evidence-highlight.pending { border-color: #f0d27a; background: #fffaf0; }
.highlight-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .35px; }
.evidence-highlight strong { display: block; overflow-wrap: anywhere; font-size: 13px; line-height: 1.3; }
#evidence{min-width:0;overflow:hidden}

.chain-row{display:flex;gap:.6rem;align-items:center;flex-wrap:wrap;margin-top:.4rem}
.chain-badge{font-size:.85rem;padding:.2rem .55rem;border-radius:999px;border:1px solid}
.chain-badge.ok{color:#14532d;background:#ecfdf3;border-color:#86efac}
.chain-badge.bad{color:#7f1d1d;background:#fef2f2;border-color:#fca5a5;font-weight:600}
.error-page{max-width:560px;margin:15vh auto;padding:0 1rem;text-align:center}
@media (max-width: 640px) {
  .demo-ribbon { gap: 10px; font-size: 10px; }
  .demo-guide { align-items: stretch; flex-direction: column; }
  .guide-links { justify-content: flex-start; min-width: 0; }
  .guide-steps { flex-direction: column; gap: 8px; }
  .evidence-highlights { grid-template-columns: 1fr; }
  .tabs { flex-wrap: wrap; }
  .tabs .tab { white-space: normal; }
  .fm-grid { grid-template-columns: 1fr; }
  .tabs .tab { max-width: 100%; overflow-wrap: anywhere; }
  .grid-top > *, .grid-mid > *, .grid-bottom > * { min-width: 0; }
  table:not(.evidence) { table-layout: fixed; width: 100%; }
  table:not(.evidence) td, table:not(.evidence) th { overflow-wrap: anywhere; }
  code, pre { overflow-wrap: anywhere; white-space: pre-wrap; }
  .confirm { display: flex; flex-wrap: wrap; gap: 6px; }
  .confirm .chip { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }
  details.ev-log { min-width: 0; max-width: 100%; }
}

/* --- "PayPal proves" panel ---------------------------------------------- */
.proves { margin: 10px 0 12px; }
.proves-title { margin: 0 0 8px; font-size: 16px; }
.proves-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.proves-item { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 13px; overflow-wrap: anywhere; }
.proves-item.good { border-color: #8ad1a8; background: #f3fbf6; }
.proves-item.bad { border-color: #f1a39b; background: #fff7f6; }
.proves-item.pending { border-color: #f0d27a; background: #fffaf0; }
.proves-label { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.proves-item strong { font-size: 14px; }
.proves-ids { margin: 0; padding: 0; list-style: none; }
.proves-ids li { margin: 2px 0; }
@media (max-width: 640px) { .proves-grid { grid-template-columns: 1fr; } }

/* Main navigation + Disputes page + Queue page (demo data) */
.mainnav { display: flex; gap: 14px; } .mainnav a { color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; opacity: .9; }
.mainnav a:hover { opacity: 1; text-decoration: underline; }
.dispute { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; background: #fff; }
.dispute dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 8px 0; }
.dispute dt { color: var(--muted); font-size: 12.5px; } .dispute dd { margin: 0; overflow-wrap: anywhere; }
.recommend { background: #f5f8ff; border-left: 4px solid var(--blue); padding: 8px 12px; border-radius: 6px; margin-top: 8px; }
.recommend .rlabel { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 9px 12px; margin: 10px 0; }
.dispute .dhead { margin: 0; overflow-wrap: anywhere; word-break: break-word; }
.dispute code, .dispute dd, .dispute .recommend { overflow-wrap: anywhere; }
.dispute .dform { margin-top: 8px; }
.dispute .chip { white-space: normal; }
.demo-banner { background: #fff4d6; border: 1px solid #f2c94c; color: #6b4e00; border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-weight: 600; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.qcard { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; position: relative; display: flex; flex-direction: column; gap: 8px; }
.qcard .qhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.demo-badge { background: #fff4d6; color: #6b4e00; border: 1px dashed #c99a00; font-size: 11px; font-weight: 800; letter-spacing: .6px; padding: 2px 8px; border-radius: 999px; }
.qmsg { background: #f6f8fb; border-radius: 8px; padding: 8px 10px; overflow-wrap: anywhere; }
.qroute { border-left: 4px solid var(--line); padding: 4px 10px; }
.qroute.ok { border-color: var(--ok); } .qroute.warn { border-color: var(--warn); } .qroute.bad { border-color: var(--bad); }
.qchecks { margin: 0; padding-left: 18px; font-size: 12.5px; } .qchecks .no { color: var(--bad); }
.qsummary { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
@media (max-width: 640px) { .mainnav { width: 100%; } .dispute dl { grid-template-columns: 1fr; } .qgrid { grid-template-columns: 1fr; } }

/* Mixed order (partial refund) approval screen */
.mixed .mx-table { margin: 10px 0 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mx-row { display: grid; grid-template-columns: 28px 1.4fr 1.6fr 1.1fr; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--line); align-items: start; }
.mx-row.mx-head { background: #f6f8fb; font-size: 12px; color: var(--muted); font-weight: 700; border-top: 0; }
.mx-row .mx-num { text-align: right; } .mx-n { font-weight: 700; color: var(--muted); }
.mx-dec { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.mx-resolve { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 8px 12px; background: var(--warn-bg); border-top: 1px solid var(--line); }
.mx-approve { border: 1px solid #b8d0f4; border-left: 4px solid var(--blue); border-radius: 8px; padding: 10px 14px; background: #f7fbff; }
.mx-sum { font-size: 17px; font-weight: 800; margin-bottom: 6px; overflow-wrap: anywhere; }
.mx-batches { list-style: none; padding: 0; margin: 0 0 8px; } .mx-batches li { padding: 7px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
form.inline { display: inline-block; margin-left: 6px; }
@media (max-width: 640px) {
  .mx-row { grid-template-columns: 24px 1fr; } .mx-row.mx-head { display: none; }
  .mx-row .mx-dec, .mx-row .mx-amt { grid-column: 2; } .mx-row .mx-num { text-align: left; }
  .mx-sum { font-size: 15px; }
}

/* Touch targets: at phone width every button, preset chip, nav/tab link and form control is at least 44px tall
   (WCAG 2.5.5 / Apple HIG). Layout is kept by wrapping, not by shrinking. */
.api-back { margin: 8px 16px; font-size: 14px; }
@media (max-width: 640px) {
  .btn, .btn.small, .chip-btn, .tab, .mainnav a, .footer a { min-height: 44px; }
  .btn, .btn.small, .chip-btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; padding: 8px 14px; font-size: 14px; }
  .btn.small { font-size: 13.5px; }
  .chip-btn { padding: 8px 16px; }
  .tab { display: inline-flex; align-items: center; padding: 6px 12px; }
  .mainnav { gap: 6px; } .mainnav a { display: inline-flex; align-items: center; padding: 0 10px; }
  .footer a { display: inline-flex; align-items: center; padding: 0 10px; }
  .toggle { display: flex; align-items: center; gap: 8px; min-height: 44px; }
  .toggle input[type="checkbox"] { width: 24px; height: 24px; flex: none; margin: 0; }
  select, .mx-resolve select, .admin-auth input[type="password"] { min-height: 44px; }
  .actions form, .actions .btn { max-width: 100%; }
  form.inline { display: block; margin: 6px 0 0; }
}

/* Accessibility: keyboard focus, skip link, reduced motion */
.skip-link { position: absolute; left: 8px; top: -48px; z-index: 100; background: var(--navy); color: #fff;
  padding: 8px 14px; border-radius: 6px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 8px; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible { outline: 3px solid #0b5fff; outline-offset: 2px; }
main:focus { outline: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

.safety-review { display: flex; flex-direction: column; gap: .4rem; max-width: 40rem; }
.safety-review textarea { width: 100%; box-sizing: border-box; font: inherit; padding: .5rem; }

/* AI agents (MCP gateway) */
.agent-card { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--agent); background: var(--agent-bg); border-radius: 8px; font-size: 13.5px; overflow-wrap: anywhere; }
.agent-card .chip { margin-right: 4px; }
.case-next-step { margin: 0 0 12px; padding: 8px 12px; border-left: 3px solid var(--ok); background: var(--ok-bg); border-radius: 8px; font-size: 13.5px; overflow-wrap: anywhere; }
.intake-hint { margin: 0 0 10px; }
.agents-run { gap: 12px; align-items: center; margin: 4px 0 10px; }
.agents-run p { margin: 0; flex: 1; }
.agents-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1000px) { .agents-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .agents-run { flex-direction: column; align-items: flex-start; } }

/* Live AI agent */
.live-agent { margin: 6px 0 14px; padding: 10px 12px; border: 1px dashed var(--agent); border-radius: 10px; background: #fbfeff; }
.live-agent h3, .live-run h3 { margin: 0 0 6px; font-size: 15px; }
.live-agent p { margin: 0 0 8px; }
.live-results { margin: 8px 0 0; padding-left: 18px; }
.btn.danger-outline { border-color: #f1a39b; color: var(--bad); }
.live-run { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fcfdff; overflow-wrap: anywhere; }
.live-run ol { margin: 6px 0; padding-left: 20px; }
.live-run li { margin: 3px 0; }
.bad-text { color: var(--bad); }
.live-run-page h1 { font-size: 22px; margin: 4px 0 6px; }
.run-status { margin: 10px 0; }
.run-steps { margin: 8px 0; padding-left: 22px; overflow-wrap: anywhere; }
.run-steps li { margin: 4px 0; }

/* Returns inbox (/inbox) ---------------------------------------------------------------------------------------- */
.inbox-head p { margin: 4px 0 14px; max-width: 860px; }
.inbox-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat strong { display: block; font-size: 26px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.needs { border-color: #f5d27a; background: var(--warn-bg); } .stat.needs strong { color: var(--warn); }
.stat.agent strong { color: var(--agent); }
.stat.proof { border-color: #a6e3bf; background: var(--ok-bg); } .stat.proof strong { color: var(--ok); } .stat.proof span { color: #475467; }
.inbox-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.inbox-global-search { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.inbox-global-search input { min-width: min(340px, 100%); box-sizing: border-box; padding: 7px 10px; border: 1px solid #c9d2e0; border-radius: 8px; font: inherit; }
.inbox-tools[hidden] { display: none; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn[aria-pressed="true"] { border-color: var(--blue); background: #eef4ff; font-weight: 600; }
.inbox-search input { margin-left: 6px; padding: 6px 10px; border: 1px solid #c9d2e0; border-radius: 8px; font: inherit; min-width: 220px; }
.inbox-grid { width: 100%; --ag-font-family: inherit; --ag-font-size: 13.5px; --ag-active-color: var(--blue);
  --ag-header-background-color: #f6f8fb; --ag-row-hover-color: #f2f6ff; --ag-wrapper-border-radius: 10px; }
.inbox-grid .ag-row { cursor: pointer; }
.inbox-grid .ag-row.row-safety { box-shadow: inset 4px 0 0 var(--bad); }
.inbox-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inbox-grid.ag-theme-quartz { --ag-value-change-value-highlight-background-color: #fff1b8; }
.inbox-grid .clamp2 { line-height: 19px; margin-top: 9px; white-space: normal; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.inbox-grid .ell { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-grid .cell-chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; line-height: 1.7; }
.inbox-grid .cell-chip.needs_you { background: var(--warn-bg); color: var(--warn); }
.inbox-grid .cell-chip.waiting { background: #eef1f6; color: #344054; }
.inbox-grid .cell-chip.closed { background: var(--ok-bg); color: var(--ok); }
.inbox-grid .cell-chip.agent { background: var(--agent-bg); color: var(--agent); margin-right: 6px; }
.inbox-grid .cell-sub { color: var(--muted); font-size: 12px; margin-left: 6px; }
.inbox-grid .cell-sub.verified { color: var(--ok); }
.inbox-grid .cell-bad { color: var(--bad); font-weight: 600; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.table-wrap[hidden] { display: none; }
.inbox-table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.inbox-table th, .inbox-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.inbox-table th { background: #f6f8fb; font-size: 12.5px; color: #344054; white-space: nowrap; }
.inbox-table tr.bucket-needs_you td:first-child { box-shadow: inset 3px 0 0 #f5b300; }
.inbox-pages { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.ok-text { color: var(--ok); }
.inbox-empty { background: var(--card); border: 1px dashed #c9d2e0; border-radius: 10px; padding: 22px 24px; }
.inbox-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid #f5b300; border-radius: 10px;
  padding: 10px 14px; margin: 0 0 14px; }
.inbox-strip p { margin: 0; }
@media (max-width: 900px) { .inbox-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .inbox-search input { min-width: 0; width: 100%; } .inbox-search, .inbox-actions { width: 100%; } }
.fill-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 10px; }
.fill-form .muted { max-width: 620px; }
