:root {
  --navy: #0b2253;
  --navy-2: #13306b;
  --blue: #0a66d6;
  --blue-hover: #0852ad;
  --blue-soft: #e8f1fd;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --line: #dde3ec;
  --line-strong: #c4cdda;
  --text: #17202f;
  --text-2: #4a5568;
  --text-3: #6b7587;
  --ok: #157347;
  --ok-soft: #e7f5ee;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11, 34, 83, .06), 0 2px 8px rgba(11, 34, 83, .05);
  --font: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid #5b9cf0; outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.notice {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  padding: 7px 16px; font-size: 13px; color: var(--warn);
  background: var(--warn-soft); border-bottom: 1px solid #f1dfb4; text-align: center;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--navy); color: #fff;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 28px; height: 28px; color: #8ec2ff; }
.brand-name { font-weight: 600; font-size: 17px; letter-spacing: .1px; }
.brand-sub { font-size: 12.5px; color: #b9c8e6; }
.env-chip {
  font-size: 12px; font-weight: 600; letter-spacing: .3px;
  padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.12); color: #dbe7fb;
}

.layout {
  display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px;
  max-width: 1360px; margin: 0 auto; padding: 20px 24px 40px;
}

/* ---------- queue ---------- */
.queue { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat { padding: 12px 14px; display: flex; flex-direction: column; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-n { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--navy); }
.stat-l { font-size: 12.5px; color: var(--text-3); }

.tabs { display: flex; gap: 4px; padding: 4px; background: #e6eaf1; border-radius: 10px; }
.tab {
  flex: 1; border: 0; background: transparent; padding: 7px 0; border-radius: 7px;
  font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--navy); box-shadow: var(--shadow); }

.case-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.case-item {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.case-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.case-item[aria-current="true"] { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.case-id { font-family: var(--mono); font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.case-amount { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.case-reason { font-weight: 500; }
.case-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.empty-list { padding: 18px; text-align: center; color: var(--text-3); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.skeleton { height: 74px; border-radius: var(--radius-sm); background: linear-gradient(90deg, #e9edf3 25%, #f4f6fa 50%, #e9edf3 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: #edf0f5; color: var(--text-2); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ready { background: var(--blue-soft); color: var(--blue); }
.badge.waiting { background: var(--warn-soft); color: var(--warn); }
.badge.won-seller { background: var(--ok-soft); color: var(--ok); }
.badge.won-buyer { background: #eef1ff; color: #3d4db7; }

.add-case { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.add-case label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.add-row { display: flex; gap: 8px; }
.add-row input {
  flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  font-family: var(--mono); font-size: 13.5px; background: #fff;
}
.add-row input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(10,102,214,.18); }
.help { margin: 8px 0 0; font-size: 12.5px; color: var(--text-3); }
.field-error { margin: 8px 0 0; font-size: 13px; color: var(--bad); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; transition: background .18s var(--ease), border-color .18s var(--ease), opacity .18s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover:not(:disabled) { background: #f0f4fb; }
.btn-quiet { min-height: 40px; padding: 0 16px; background: var(--navy); color: #fff; border-radius: 8px; }
.btn-quiet:hover { background: var(--navy-2); }

/* ---------- detail ---------- */
.detail { min-width: 0; outline: none; }
.empty {
  display: grid; place-items: center; gap: 10px; text-align: center; color: var(--text-3);
  min-height: 420px; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.empty svg { width: 40px; height: 40px; color: var(--line-strong); }
.empty p { max-width: 36ch; margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.case-head { padding: 20px 24px; display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; }
.case-head h1 { margin: 0; font-size: 22px; line-height: 1.3; color: var(--navy); }
.case-head .sub { color: var(--text-3); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.case-head .sub .mono { font-family: var(--mono); }
.head-amount { text-align: right; }
.head-amount .amt { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--navy); }
.head-amount .lbl { font-size: 12.5px; color: var(--text-3); }

.sections { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.section { padding: 18px 24px 22px; }
.section h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.section h2 .step { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--blue-soft); color: var(--blue); }
.section .lead { margin: 0 0 12px; color: var(--text-2); max-width: 70ch; }

.quote { margin: 0; padding: 14px 16px; background: #f5f7fb; border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
.quote cite { display: block; margin-top: 6px; font-style: normal; font-size: 13px; color: var(--text-3); }

.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f0f2f6; cursor: zoom-in; width: 132px; }
.thumb img { width: 132px; height: 99px; object-fit: cover; }
.thumb span { display: block; padding: 5px 8px; font-size: 12px; color: var(--text-2); text-align: left; overflow-wrap: anywhere; }

.verdict { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--blue-soft); color: #0b3d80; margin-bottom: 14px; }
.verdict svg { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.pairs { display: flex; flex-direction: column; gap: 14px; }
.pair { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pair-head { padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); background: #f7f9fc; border-bottom: 1px solid var(--line); }
.pair-body { display: grid; grid-template-columns: 1fr 1fr; }
.pair-body figure { margin: 0; cursor: zoom-in; background: #0e1424; }
.pair-body figure + figure { border-left: 1px solid var(--line); }
.pair-body img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
.pair-body figcaption { padding: 6px 10px; font-size: 12.5px; color: var(--text-2); background: #fff; border-top: 1px solid var(--line); }
.missing { padding: 14px; border: 1px dashed var(--line-strong); border-radius: 10px; color: var(--text-3); font-size: 14px; }
.missing code { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 16px 36px; }
.tl:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--line-strong); }
.tl.actor-BUYER .tl-dot { border-color: #3d4db7; }
.tl.actor-SELLER .tl-dot { border-color: var(--blue); }
.tl.actor-PAYPAL .tl-dot { border-color: var(--navy); background: var(--navy); }
.tl-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.tl-actor { font-size: 12.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: #eef1f6; color: var(--text-2); }
.tl.actor-BUYER .tl-actor { background: #eef0ff; color: #3d4db7; }
.tl.actor-SELLER .tl-actor { background: var(--blue-soft); color: #0b4fa8; }
.tl.actor-PAYPAL .tl-actor { background: var(--navy); color: #fff; }
.tl-what { font-weight: 500; }
.tl-time { margin-left: auto; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-text { margin: 4px 0 0; color: var(--text-2); }
.tl-tracking { display: inline-block; margin-top: 6px; font-family: var(--mono); font-size: 12.5px; padding: 2px 8px; border-radius: 6px; background: #f0f3f8; }

.decide { padding: 18px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; border-color: var(--line-strong); }
.decide.actionable { position: sticky; bottom: 12px; box-shadow: 0 -2px 18px rgba(11,34,83,.12); }
.decide-text { flex: 1 1 260px; }
.decide-text strong { display: block; color: var(--navy); }
.decide-text span { font-size: 13.5px; color: var(--text-2); }
.decide-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.result { display: flex; gap: 12px; align-items: flex-start; }
.result svg { flex: none; width: 24px; height: 24px; color: var(--ok); }
.result .mono { font-family: var(--mono); font-size: 12.5px; }
.confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.confirm p { margin: 0; font-weight: 500; }

.error-box { padding: 16px 18px; border: 1px solid #f3c7c2; background: var(--bad-soft); color: var(--bad); border-radius: var(--radius); }
.error-box button { margin-top: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: var(--navy); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 14px; z-index: 50; }

.viewer { border: 0; padding: 0; max-width: min(1100px, 94vw); border-radius: 12px; background: #0e1424; color: #dbe3f1; }
.viewer::backdrop { background: rgba(8, 14, 30, .72); }
.viewer img { max-height: 80vh; width: auto; margin: 0 auto; }
.viewer p { margin: 0; padding: 10px 16px; font-size: 13.5px; }
.viewer-close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 22px; cursor: pointer; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .topbar { padding: 12px 16px; }
  .case-head { grid-template-columns: 1fr; }
  .head-amount { text-align: left; }
  .pair-body { grid-template-columns: 1fr; }
  .pair-body figure + figure { border-left: 0; border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 600px) { .notice-sep { display: none; } .notice { flex-direction: column; gap: 2px; } }

/* demo cases, AI comparison, way back to the role picker */
.topbar-end { display: flex; align-items: center; gap: 14px; }
.switch-role { color: #fff; font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.switch-role:hover { color: #d6e4ff; }
.src-tag { font-size: 11.5px; font-weight: 600; color: var(--text-3); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 7px; }
.src-tag.live { color: var(--blue); border-color: #b9d3f5; }
.list-note { padding: 10px 12px; font-size: 13px; color: var(--text-3); }
.sub-h { margin: 16px 0 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.ai-verdict { padding: 12px 14px; border-radius: 10px; background: var(--blue-soft); margin-bottom: 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ai-verdict strong { font-size: 17px; color: #0b3d80; }
.ai-verdict span { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ai-verdict p { flex-basis: 100%; margin: 2px 0 0; color: var(--text-2); }
.ai-verdict.bad { background: var(--bad-soft); }
.ai-verdict.bad strong { color: var(--bad); }
.ai-verdict.ok { background: var(--ok-soft); }
.ai-verdict.ok strong { color: var(--ok); }
.pair-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.region-tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.region-tag.ok { background: var(--ok-soft); color: var(--ok); }
.region-tag.bad { background: var(--bad-soft); color: var(--bad); }
.region-tag.warn { background: var(--warn-soft); color: var(--warn); }
.region-tag.muted { background: #f0f2f6; color: var(--text-3); }
.not-found { aspect-ratio: 4 / 3; display: grid; place-items: center; color: #c9d1e0; font-size: 13px; }
.pair-note { margin: 0; padding: 8px 12px; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--line); }

/* questions for the seller */
.review-messages { display: grid; gap: 10px; margin-bottom: 14px; }
.review-messages .lead { margin: 0; }
.review-message { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; max-width: 70ch; }
.review-message.from-reviewer { background: var(--blue-soft); border-color: #cfe0f8; justify-self: end; }
.review-message > div { display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--text-3); }
.review-message b { color: var(--navy); font-weight: 600; }
.review-message p { margin: 4px 0 0; white-space: pre-wrap; }
.question-form { display: grid; gap: 10px; justify-items: end; }
.question-form textarea {
  width: 100%; min-height: 84px; resize: vertical; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff;
  font: inherit; color: inherit;
}
.question-form textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(10,102,214,.18); }
