/* BUYSTIX Admin Console. Full redesign (approved mockup). */
/* ============ tokens ============ */
:root {
  --purple-900: #3b1470; --purple-700: #5b21b6; --purple-600: #6d28d9;
  --purple-100: #ede9fe; --purple-50: #f5f3ff;
  --ink: #1f1b2d; --muted: #6b6478; --line: #e7e2f2;
  --amber: #b45309; --amber-bg: #fef3c7;
  --green: #047857; --green-bg: #d1fae5;
  --red: #b91c1c; --red-bg: #fee2e2;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f3fa; color: var(--ink); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.spacer { flex: 1; }
code { background: var(--purple-100); padding: 1px 6px; border-radius: 6px; font-size: 0.85em; }

/* ============ buttons / inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 16px; border-radius: 10px; cursor: pointer;
  font-size: 0.9rem; font-family: inherit; font-weight: 600; min-height: 44px;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.06s ease;
}
.btn:hover { border-color: var(--purple-600); box-shadow: 0 2px 8px rgba(91,33,182,0.12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--purple-600) 0%, var(--purple-900) 100%);
  border-color: var(--purple-700); color: #fff; box-shadow: 0 2px 10px rgba(91,33,182,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 100%);
  border-color: var(--purple-600); box-shadow: 0 4px 14px rgba(91,33,182,0.36);
}
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-block { width: 100%; margin-top: 8px; }
.btn.small { min-height: 0; padding: 6px 12px; font-size: 0.82rem; }
.link { background: none; border: none; padding: 0; cursor: pointer; color: var(--purple-700); font: inherit; text-align: left; }
.link:hover { text-decoration: underline; }
.link.strong { font-weight: 700; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--purple-100); border-color: var(--purple-600); }
label { display: grid; gap: 6px; font-size: 0.88rem; font-weight: 600; }

/* ============ login ============ */
#view-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--purple-900), var(--purple-600)); padding: 24px;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 32px; width: 380px; max-width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25); display: grid; gap: 14px;
}
.brand { display: flex; gap: 10px; align-items: center; }
.brand h1 { font-size: 1.35rem; }
.brand p { margin: 2px 0 0; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--purple-600), var(--purple-900));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; box-shadow: 0 2px 8px rgba(91,33,182,0.3);
}
.brand.small .brand-mark { width: 36px; height: 36px; font-size: 0.95rem; border-radius: 10px; }
.brand-mark-img {
  width: 44px; height: 44px; border-radius: 12px; flex: none; object-fit: cover;
  box-shadow: 0 2px 8px rgba(91,33,182,0.3);
}
.brand.small .brand-mark-img { width: 36px; height: 36px; border-radius: 10px; }
.brand strong { font-size: 1.02rem; }
.error-box {
  background: var(--red-bg); color: var(--red); border: 1px solid #fca5a5;
  padding: 10px 12px; border-radius: 8px; font-size: 0.88rem;
}

/* ============ app shell ============ */
.topbar {
  display: flex; align-items: center; gap: 16px;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 20px; position: sticky; top: 0; z-index: 40;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(180,83,9,0.12); } }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.backend-status { font-size: 0.8rem; color: var(--green); font-weight: 600; white-space: nowrap; }
.backend-status.down { color: var(--red); }
.nav-toggle { display: none; }
.tabs {
  display: flex; gap: 4px; padding: 10px 20px 0;
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 57px; z-index: 39;
  overflow-x: auto;
}
.tab {
  border: none; background: none; padding: 10px 16px; cursor: pointer;
  font-size: 0.92rem; font-weight: 600; color: var(--muted);
  border-bottom: 3px solid transparent;
  flex: none; white-space: nowrap; font-family: inherit; min-height: 48px;
}
.tab.active { color: var(--purple-700); border-bottom-color: var(--purple-700); }
.tab:hover { color: var(--purple-700); }
.nav-badge {
  display: inline-block; min-width: 20px; text-align: center;
  background: var(--red); color: #fff; font-size: 0.72rem; font-weight: 800;
  border-radius: 999px; padding: 1px 6px; margin-left: 6px;
}
.nav-scrim { position: fixed; inset: 0; background: rgba(31,27,45,0.45); z-index: 55; }
.nav-drawer-head { display: none; }
#content { padding: 20px; max-width: 1280px; margin: 0 auto; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar h2 { font-size: 1.25rem; letter-spacing: -0.01em; }
.toolbar h2 .sub { font-size: 0.82rem; color: var(--muted); font-weight: 400; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list { display: grid; gap: 12px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--purple-600); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(91,33,182,0.12); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.card-head strong { font-size: 1rem; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 10px; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* filter bar: label-above-field rows with a bottom-aligned action button */
.filterbar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filterbar .field { display: flex; flex-direction: column; gap: 4px; }
.filterbar .field > span { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.filterbar input, .filterbar select { min-height: 40px; }
.filterbar .btn { min-height: 40px; }
.filterbar .showing { align-self: center; }

/* ============ pills / chips ============ */
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
  background: var(--purple-100); color: var(--purple-700); white-space: nowrap;
}
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.grey { background: #f1f0f4; color: var(--muted); }
.chips { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  font-size: 0.85rem; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  cursor: pointer; font-family: inherit;
}
.chip .n { color: var(--muted); font-weight: 500; margin-left: 4px; }
.chip.active {
  background: linear-gradient(135deg, var(--purple-600), var(--purple-900));
  border-color: var(--purple-700); color: #fff; box-shadow: 0 2px 8px rgba(91,33,182,0.25);
}
.chip.active .n { color: #ddd6fe; }
.showing { margin-left: auto; font-size: 0.8rem; color: var(--muted); }

table.grid { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.grid th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.grid td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.empty {
  padding: 32px 24px; text-align: center; color: var(--muted);
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.empty > * { max-width: 100%; }
.empty svg { color: #b3a9c9; margin-bottom: 6px; }
.empty .empty-title { display: block; font-weight: 700; color: var(--ink); font-size: 0.95rem; }
pre.details { background: #f7f5fd; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 0.78rem; overflow-x: auto; }
.raw-toggle { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.raw-toggle summary { cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.raw-toggle summary:hover { color: var(--ink); }
.raw-toggle pre.details { margin-top: 8px; }

/* ============ dashboard ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.stat-card { padding: 18px; }
.stat-label { font-size: 0.82rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--ink); }
.stat-value.red { color: var(--red); } .stat-value.green { color: var(--green); }
.stat-value.amber { color: var(--amber); } .stat-value.purple { color: var(--purple-700); }
.stat-sub { margin-top: 6px; }
/* Clickable stat cards — deep-link to the filtered list behind the number. */
.stat-link { position: relative; cursor: pointer; font: inherit; color: inherit; text-align: left; width: 100%;
  transition: transform .12s ease, box-shadow .12s ease; }
.stat-link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(76, 29, 149, .10); }
.stat-link:focus-visible { outline: 2px solid var(--purple-700); outline-offset: 2px; }
.stat-go { position: absolute; right: 14px; bottom: 12px; font-size: 1.1rem; color: var(--muted);
  opacity: 0; transform: translateX(-4px); transition: opacity .12s ease, transform .12s ease; pointer-events: none; }
.stat-link:hover .stat-go, .stat-link:focus-visible .stat-go { opacity: 1; transform: none; }
.alert-banner {
  background: var(--red-bg); border: 1px solid #fca5a5; color: var(--red);
  padding: 12px 16px; border-radius: var(--radius); font-size: 0.92rem;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 600;
}
.recon-banner { padding: 11px 16px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 600; }
.recon-banner.ok { background: var(--green-bg); border: 1px solid #a7f3d0; color: var(--green); }
.recon-banner.bad { background: var(--red-bg); border: 1px solid #fca5a5; color: var(--red); }
.dash-note { margin-top: 14px; }

/* ============ needs attention ============ */
.attn-card { border-left: 4px solid #d1d5db; }
.attn-card.red { border-left-color: var(--red); }
.attn-card.amber { border-left-color: var(--amber); }
.attn-row {
  display: grid; gap: 10px 16px; align-items: center;
  grid-template-columns: 110px minmax(0, 1.4fr) 120px auto auto auto auto;
}
.attn-amount { font-weight: 700; text-align: right; }
.attn-parties { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-flag { margin-top: 8px; font-size: 0.82rem; color: var(--muted); font-style: italic; }
.risk-chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}
.risk-chip.red { background: var(--red-bg); color: var(--red); }
.risk-chip.amber { background: var(--amber-bg); color: var(--amber); }
.risk-chip.green { background: var(--green-bg); color: var(--green); }
.sla { display: inline-flex; align-items: center; gap: 7px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.sla.urgent { color: var(--red); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); position: relative; flex: none; }
.pulse-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--red); animation: ping 1.6s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(0.5); opacity: 0.7; } 80%, 100% { transform: scale(1.15); opacity: 0; } }

/* ============ verification tiers ============ */
.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tier-card { position: relative; overflow: hidden; }
.tier-card .tier-num { position: absolute; top: 10px; right: 14px; font-size: 2rem; font-weight: 800; color: var(--purple-100); }
.tier-card h3 { font-size: 1rem; margin-bottom: 4px; }
.tier-card ul { margin: 10px 0 0; padding-left: 18px; font-size: 0.85rem; color: var(--muted); display: grid; gap: 4px; }
.tier-count { font-size: 1.4rem; font-weight: 800; color: var(--purple-700); margin-top: 8px; }
/* ---- buyer verification strip (Verification tiers tab) ---- */
.buyer-strip { display: flex; flex-wrap: wrap; gap: 12px 36px; padding: 12px 18px; margin-bottom: 12px; align-items: center; }
.buyer-stat { display: flex; align-items: baseline; gap: 8px; }
.buyer-stat .num { font-size: 1.2rem; font-weight: 800; color: var(--purple-700); }

/* ---- verification tier request cards ---- */
.req-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.req-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 10px; }
.req-head .avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--purple-600), var(--purple-900)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; flex: none; }
.req-head .who { flex: 1; min-width: 0; }
.req-head .who .name { font-weight: 700; font-size: 0.95rem; }
.req-head .who .handle { color: var(--muted); font-size: 0.8rem; }
.req-body { display: grid; grid-template-columns: 150px 1fr; row-gap: 8px; column-gap: 12px; padding: 6px 18px 12px 70px; margin: 0; }
.req-body dt { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.req-body dd { font-size: 0.88rem; margin: 0; }
.req-body .mono { background: var(--purple-100); padding: 1px 8px; border-radius: 6px; font-size: 0.82em; }
.tier-move { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tier-tag { font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--purple-50); color: var(--purple-700); border: 1px solid var(--line); white-space: nowrap; }
.tier-arrow { color: var(--purple-600); font-weight: 700; }
.req-note { font-size: 0.78rem; color: var(--muted); padding: 0 18px 14px 70px; }
.req-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); background: #faf9fe; }
.btn-danger-ghost { color: #b42318; border-color: #f3c2bd; }
.btn-danger-ghost:hover { background: #fef2f2; border-color: #b42318; }
@media (max-width: 560px) {
  .req-body, .req-note { padding-left: 18px; }
  .req-body { grid-template-columns: 120px 1fr; }
}

/* ============ KYC review ============ */
.kyc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.idoc {
  border-radius: 10px; aspect-ratio: 16/10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: #fff;
  font-weight: 700; font-size: 0.85rem; position: relative; overflow: hidden;
  text-align: center; padding: 12px;
}
.idoc img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.idoc .scrim { position: absolute; inset: 0; background: rgba(0,0,0,0.35); }
.idoc .tag { position: absolute; top: 8px; left: 8px; z-index: 2; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; background: rgba(0,0,0,0.45); padding: 3px 8px; border-radius: 6px; }
.idoc .cap { position: relative; z-index: 2; }
.idoc.nin { background: linear-gradient(135deg, #166534, #052e16); }
.idoc.dl { background: linear-gradient(135deg, #1e40af, #172554); }
.idoc.pp { background: linear-gradient(135deg, #7c2d12, #431407); }
.idoc.other { background: linear-gradient(135deg, #5b21b6, #2e1065); }
.idoc.selfie { background: linear-gradient(135deg, #5b21b6, #2e1065); }
.idoc.missing { background: #f1f0f4; color: var(--muted); border: 2px dashed var(--line); }
.idoc svg { opacity: 0.85; position: relative; z-index: 2; }
.media-cap { font-size: 0.72rem; color: var(--muted); margin-top: 6px; }
.media-cap.warn { color: var(--red); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ev-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }
.evidence-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* ============ case workspace ============ */
.page-overlay { position: fixed; inset: 0; background: #f4f3fa; z-index: 70; overflow-y: auto; animation: fadeIn 0.22s ease; }
.page-overlay .inner { max-width: 1280px; margin: 0 auto; padding: 20px; }
.case-topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.case-ref { font-size: 1.05rem; font-weight: 700; }
.escrow-chip { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px; text-align: right; }
.case-grid { display: grid; grid-template-columns: 5fr 4fr 4fr; gap: 12px; align-items: start; }
.case-panel { margin-bottom: 0; }
.panel-title { margin: 0 0 10px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ph {
  position: relative; border-radius: 10px; aspect-ratio: 4/3; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: #fff;
  text-align: center; padding: 12px; overflow: hidden;
}
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph svg { opacity: 0.9; position: relative; z-index: 2; }
.ph .cap { font-size: 0.78rem; font-weight: 600; position: relative; z-index: 2; }
.ph.buyer { background: linear-gradient(135deg, #7c3aed 0%, #4c1d95 60%, #2e1065 100%); }
.ph.listing { background: linear-gradient(135deg, #57506e 0%, #2a2438 60%, #1f1b2d 100%); }
.ph .tag { position: absolute; top: 8px; left: 8px; z-index: 2; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.05em; background: rgba(0,0,0,0.45); padding: 3px 8px; border-radius: 6px; }
.vid {
  position: relative; border-radius: 10px; aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1f2937, #111827);
  display: flex; align-items: center; justify-content: center; color: #fff;
  overflow: hidden; margin-top: 14px;
}
.vid .play { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.92); display: flex; align-items: center; justify-content: center; }
.vid .dur { position: absolute; bottom: 8px; right: 8px; font-size: 0.72rem; font-weight: 700; background: rgba(0,0,0,0.6); padding: 2px 8px; border-radius: 6px; }
.vid .vlabel { position: absolute; top: 8px; left: 8px; font-size: 0.68rem; font-weight: 700; background: rgba(0,0,0,0.45); padding: 3px 8px; border-radius: 6px; }
.vid video { position: absolute; inset: 0; width: 100%; height: 100%; }
.voice {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fbfaff; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-top: 12px;
}
.voice .mic { width: 32px; height: 32px; border-radius: 50%; background: var(--purple-100); color: var(--purple-700); display: flex; align-items: center; justify-content: center; flex: none; }
.voice .t { font-size: 0.85rem; font-weight: 600; }
.voice .tr { font-size: 0.82rem; color: var(--muted); font-style: italic; margin-top: 2px; }
.evidence-grid {
  margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fbfaff; padding: 12px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px;
}
.evidence-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 8px; align-content: start; }
.case-evidence { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.chat-thumb { max-width: 220px; max-height: 220px; border-radius: 8px; border: 1px solid var(--line); }
.chat-audio { width: 100%; max-width: 320px; }
.chat-video { max-width: 100%; width: 280px; border-radius: 8px; border: 1px solid var(--line); display: block; background: #000; }
.chat-voice-meta { margin-top: 4px; }
.chat-transcript {
  margin-top: 6px; background: var(--purple-50); border-left: 3px solid var(--purple-600);
  padding: 6px 10px; border-radius: 0 8px 8px 0; font-size: 0.85rem;
}
.chat-text { white-space: pre-wrap; word-break: break-word; }
.order-card-mini { background: var(--purple-50); border: 1px solid var(--purple-100); border-radius: 8px; padding: 10px 12px; display: grid; gap: 6px; justify-items: start; }

/* timeline */
.timeline { list-style: none; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 14px 26px; font-size: 0.88rem; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--purple-600); }
.timeline li::after { content: ""; position: absolute; left: 11px; top: 18px; bottom: -2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.green::before { background: var(--green); }
.timeline li.red::before { background: var(--red); }
.timeline li.amber::before { background: var(--amber); }
.timeline .t-time { color: var(--muted); font-size: 0.78rem; }

/* case chat bubbles */
.case-chat { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.bubble-row { display: flex; }
.bubble-row.left { justify-content: flex-start; }
.bubble-row.right { justify-content: flex-end; }
.bubble-row.center { justify-content: center; }
.chat-msg { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; max-width: 92%; font-size: 0.88rem; }
.chat-msg.system { background: var(--purple-50); border: 1px solid var(--purple-100); color: var(--muted); font-size: 0.8rem; text-align: center; }
.bubble-row.left .chat-msg { border-left: 3px solid var(--purple-600); }
.bubble-row.right .chat-msg { border-right: 3px solid var(--green); }
.chat-msg-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; font-size: 0.72rem; color: var(--muted); font-weight: 700; }

/* decide panel */
.party-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.party-mini .pm { display: flex; gap: 10px; align-items: center; }
.party-mini .pavatar { width: 36px; height: 36px; font-size: 0.75rem; }
.suggested-box { background: var(--purple-50); border: 1px solid var(--purple-100); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.signals { margin: 6px 0; padding-left: 18px; font-size: 0.85rem; display: grid; gap: 2px; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 12px; background: #fff; }
.segmented button {
  flex: 1; border: none; background: #fff; padding: 10px 8px; cursor: pointer;
  font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--muted);
  min-height: 48px; transition: background 0.15s ease, color 0.15s ease;
}
.segmented button.active { background: linear-gradient(135deg, var(--purple-600), var(--purple-900)); color: #fff; box-shadow: inset 0 0 0 1px var(--purple-700); }
.dec-read { font-size: 0.9rem; font-weight: 700; text-align: center; margin: 10px 0 6px; padding: 10px 12px; border-radius: 8px; background: var(--purple-50); color: var(--purple-900); border: 1px solid var(--purple-100); }
.frozen-banner, .frozen-strip {
  background: var(--purple-50); border: 1px solid var(--purple-100); color: var(--purple-900);
  padding: 8px 12px; border-radius: 8px; font-size: 0.85rem; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.frozen-strip { margin-bottom: 12px; }
.resolved-banner { margin-bottom: 10px; }

/* internal notes */
.note-item { border-left: 3px solid var(--purple-600); background: #fbfaff; padding: 8px 12px; border-radius: 0 8px 8px 0; margin-bottom: 8px; font-size: 0.88rem; }
.note-meta { margin-bottom: 2px; font-size: 0.75rem; color: var(--muted); }
.note-form { display: grid; gap: 8px; margin-top: 10px; }

/* similar cases + party rows */
.sim-row, .party-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line); font-size: 0.88rem; flex-wrap: wrap;
}
.sim-row:last-child, .party-row:last-child { border-bottom: none; }
.order-item-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; background: #fff; }
.order-item-thumb { width: 52px; height: 52px; border-radius: 8px; flex: none; background: linear-gradient(135deg, #6d28d9, #3b1470); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.7rem; font-weight: 700; overflow: hidden; }
.order-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.order-item-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 0.85rem; }

/* ============ customer 360 ============ */
.party-title { font-size: 1.25rem; font-weight: 800; }
.phead-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pavatar {
  width: 60px; height: 60px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #5b21b6, #6d28d9); color: #fff;
  font-size: 1.2rem; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.pavatar.buyer { background: linear-gradient(135deg, #b45309, #92400e); }
.ppills { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ============ settlements (card rows, phone-first) ============ */
.settle-note { margin: 0 0 12px; font-size: 0.9rem; color: var(--muted); }
.settle-card { padding: 0; overflow: hidden; }
.settle-main {
  display: grid; gap: 8px; width: 100%; text-align: left; background: none; border: none;
  padding: 16px 18px; cursor: pointer; font: inherit; color: inherit; min-height: 44px;
  transition: background 0.15s ease;
}
.settle-main:hover { background: #faf9ff; }
.settle-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settle-amount { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.01em; }
.settle-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.88rem; color: var(--muted); }
.settle-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settle-chevron { color: var(--muted); font-size: 1rem; transition: transform 0.2s ease; flex: none; }
.settle-main[aria-expanded="true"] .settle-chevron { transform: rotate(180deg); }
.settle-detail { border-top: 1px solid var(--line); padding: 6px 18px 16px; background: #fbfaff; }

/* ============ drawer / modal / toast ============ */
.overlay { position: fixed; inset: 0; background: rgba(31,27,45,0.45); z-index: 80; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 94vw;
  background: #fff; z-index: 81; box-shadow: -8px 0 30px rgba(0,0,0,0.15);
  display: flex; flex-direction: column; animation: slideIn 0.3s cubic-bezier(0.32, 0.72, 0.35, 1);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 1.05rem; }
.drawer-body { overflow-y: auto; padding: 18px; display: grid; gap: 16px; align-content: start; }
.drawer-body h4 { margin: 0 0 8px; color: var(--purple-700); }
.readonly-note { background: var(--purple-50); border: 1px solid var(--purple-100); padding: 8px 12px; border-radius: 8px; font-size: 0.8rem; color: var(--purple-700); }
.modal {
  position: fixed; z-index: 90; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 14px; padding: 24px; width: 480px; max-width: 92vw;
  display: grid; gap: 14px; box-shadow: 0 24px 70px rgba(0,0,0,0.3);
  max-height: 90vh; overflow-y: auto;
  animation: pop 0.24s cubic-bezier(0.32, 0.72, 0.35, 1);
}
.modal h3 { margin: 0; }
.consequence { background: var(--amber-bg); border: 1px solid #fcd34d; color: #7c4a03; padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: grid; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px;
  font-size: 0.88rem; max-width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: toastIn 0.25s ease;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ============ motion (subtle, premium) ============ */
.tabpanel { display: none; }
.tabpanel.active { display: block; animation: fadeSlide 0.28s ease; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(48px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(0.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
:focus-visible { outline: 3px solid var(--purple-600); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .tabpanel, .page-overlay, .drawer, .modal, .toast { animation: none; }
}

/* ============ responsive ============ */
@media (max-width: 1100px) { .case-grid { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  #content { padding: 14px; }
  .attn-row { grid-template-columns: 1fr 1fr; row-gap: 8px; }
  .attn-amount { text-align: left; }
  .attn-parties { white-space: normal; }
  .kyc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .card { overflow-x: auto; }
  table.grid { min-width: 620px; }
  .topbar { flex-wrap: wrap; padding: 10px 14px; row-gap: 8px; }
  .nav-toggle { display: inline-flex; align-items: center; font-size: 1.15rem; padding: 6px 12px; }
  .tabs {
    display: none;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: 300px; max-width: 86vw;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 0 0 16px; background: #fff;
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 30px rgba(0,0,0,0.18);
    overflow-y: auto; overflow-x: hidden;
  }
  .tabs.open { display: flex; }
  .nav-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; background: #fff;
  }
  .tab { text-align: left; padding: 13px 20px; border-bottom: none; border-left: 3px solid transparent; border-radius: 0; }
  .tab.active { border-left-color: var(--purple-700); background: var(--purple-50); }
}
@media (max-width: 640px) {
  #content { padding: 12px; }
  /* Small-screen topbar: hide the (long) email, tighten the action cluster so
     nothing dangles or wraps into ragged rows. */
  .topbar { gap: 10px; }
  #admin-email { display: none; }
  .topbar-right { gap: 8px; row-gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .topbar-right .btn { padding: 6px 10px; font-size: 0.82rem; min-height: 0; }
  .attn-row { grid-template-columns: 1fr; }
  .party-mini { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
  .case-topbar { gap: 10px; }
  .escrow-chip { text-align: left; }
  .stat-value { font-size: 1.35rem; }
  .modal { padding: 18px; }
  .toolbar h2 { font-size: 1.05rem; }
  .page-overlay .inner { padding: 12px; }
}

/* Customer 360 two-column panels: two columns on desktop, one on phones */
.case-grid.party-grid { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .case-grid.party-grid { grid-template-columns: 1fr; } }

/* ---- RBAC: staff tab ---- */
.pill.plum { background: var(--purple-100); color: var(--purple-700); }
.pill.blue { background: #e0edff; color: #1d4ed8; }
.table-wrap { overflow-x: auto; }
table.staff-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.staff-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.staff-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.role-select { max-width: 170px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.form-grid input, .form-grid select { width: 100%; min-height: 42px; }
/* Textareas: full-width, vertical resize only — horizontal resizing breaks form layout. */
textarea { width: 100%; resize: vertical; }
/* Action row under a form (e.g. broadcast composer): count left, button right, clear of the fields above. */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.temp-pass { display: flex; align-items: center; gap: 12px; background: var(--purple-50); border: 1px dashed var(--purple-600); border-radius: 10px; padding: 12px 14px; margin: 8px 0 12px; }
.temp-pass code { font-size: 1.1rem; background: none; padding: 0; }

/* ---------- pagination ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0 8px; flex-wrap: wrap; }
.pager-info { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.pager .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- anomaly alerts ---------- */
#alert-panel { margin-bottom: 4px; }
#alert-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.alert-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.alert-main { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.alert-title { font-weight: 600; font-size: 0.92rem; }
.alert-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- support inbox ---------- */
.chat-thread { display: grid; gap: 10px; padding: 12px 0; }
.reply-box { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.reply-box textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font: inherit; resize: vertical; box-sizing: border-box; }
.reply-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
/* Live ticket list: rows are clickable, and briefly glow when new activity lands */
#support-list tbody tr { cursor: pointer; }
#support-list tbody tr:hover { background: var(--purple-50); }
@keyframes rowFlash { 0% { background-color: var(--purple-100); } 100% { background-color: transparent; } }
#support-list tr.row-flash { animation: rowFlash 2.2s ease-out; }
/* Unread tickets: plum dot + bold subject so the triage queue scans fast */
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--purple-600); margin-left: 6px; vertical-align: 1px; }
#support-list tr.unread td:nth-child(2) { font-weight: 600; }
.support-search { min-width: 200px; }
.support-sort { max-width: 150px; }
@media (max-width: 640px) { .support-search { min-width: 0; flex: 1 1 140px; } }

/* Full-screen evidence lightbox (2026-10-05) */
.lightbox { position: fixed; inset: 0; background: rgba(10, 6, 20, 0.92); z-index: 120; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox-fig { margin: 0; max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column; align-items: center; cursor: default; }
.lightbox-fig img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,0.5); }
.lightbox-fig figcaption { color: #fff; opacity: 0.85; font-size: 13px; margin-top: 10px; }
.lightbox-x { position: absolute; top: 16px; right: 20px; background: rgba(255,255,255,0.12); color: #fff; border: none; border-radius: 50%; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }
.lightbox-x:hover { background: rgba(255,255,255,0.25); }
.case-panel img[data-zoom], .evidence-card img[data-zoom], .order-item-thumb img[data-zoom], .chat-msg img[data-zoom], .ph img[data-zoom] { cursor: zoom-in; }
