/* Zaya Platform Admin. Built on the Zaya Business (light) tokens in assets/tokens.css. */

:root {
  --sb-w: 228px;
  --top-h: 52px;
  --row-h: 40px;
  --r: 8px;
  --r-card: 12px;
  --ink: var(--z-text);
  --muted: var(--z-text-muted);
  --faint: var(--z-icon-subtle);
  --line: var(--z-line);
  --line-2: #E2DDD6;
  --paper: var(--z-surface);
  --white: #fff;
  --hover: #F6F3EF;
  --sel: #FFF6EE;
  --pos-bg: #ECF7EF; --neg-bg: #FCEEF4; --warn-bg: #FEF5E7; --info-bg: #F0F2F5;
  --shadow-pop: 0 2px 6px rgba(22,19,15,.06), 0 18px 48px -12px rgba(22,19,15,.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 400 13px/1.45 var(--z-font-body);
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--z-accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--z-focus); outline-offset: 2px; border-radius: 4px; }
.num, td.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--z-font-mono); font-size: 12px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.pos { color: var(--z-positive); }
.neg { color: var(--z-negative); }
.warn { color: var(--z-warning); }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
svg.i.sm { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: var(--sb-w) 1fr; grid-template-rows: var(--top-h) 1fr; height: 100vh; }
.sidebar { grid-row: 1 / 3; background: var(--white); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.brand img { height: 22px; width: auto; display: block; }
.brand .env { margin-left: auto; font: 500 10px/1 var(--z-font-mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 3px 5px; letter-spacing: .04em; }
.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav h6 { margin: 14px 10px 4px; font: 500 11px/1 var(--z-font-mono); color: var(--faint); letter-spacing: .04em; }
.nav h6:first-child { margin-top: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 7px; color: var(--muted); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a.on { background: var(--z-accent-tint); color: var(--z-accent-text); }
.nav a.on svg { stroke: var(--z-brand); }
.nav a .ct { margin-left: auto; font: 500 11px/18px var(--z-font-body); min-width: 20px; text-align: center; padding: 0 6px; border-radius: 9px; background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.nav a .ct.hot { background: var(--z-accent); color: #fff; border-color: transparent; }
.nav a .kbd { margin-left: auto; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 8px; flex: none; }
.side-foot a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 7px; color: var(--ink); font-weight: 500; text-decoration: none; }
.side-foot a:hover { background: var(--hover); }
.side-foot small { display: block; color: var(--faint); font-size: 11px; font-weight: 400; margin-top: -2px; }

.topbar { grid-column: 2; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--white); border-bottom: 1px solid var(--line); min-width: 0; }
.topbar .menu-btn { display: none; }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); color: var(--faint); cursor: text; }
.search:hover { border-color: var(--line-2); }
.search span { flex: 1; text-align: left; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.kbd { font: 500 11px/1 var(--z-font-mono); padding: 3px 5px; border-radius: 4px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--white); color: var(--muted); }

select.ctl, .ctl { height: 32px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); padding: 0 10px; font-weight: 500; }
select.ctl { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235C5650' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; cursor: pointer; }
select.ctl:hover, .ctl:hover { border-color: var(--line-2); }

.me { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 4px; border-radius: var(--r); border: 1px solid transparent; background: none; cursor: pointer; }
.me:hover { background: var(--hover); }
.me b { font-weight: 600; display: block; line-height: 1.1; text-align: left; }
.me small { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; text-align: left; }

.av { width: 28px; height: 28px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; font: 600 11px/1 var(--z-font-body); color: var(--ink); background: var(--z-sand); overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.sm { width: 22px; height: 22px; font-size: 10px; }
.av.lg { width: 44px; height: 44px; font-size: 15px; }
.av.biz { border-radius: 8px; background: var(--z-accent-tint); color: var(--z-accent-text); }
.av.staff { background: var(--ink); color: #fff; }

.main { grid-column: 2; overflow-y: auto; min-width: 0; }
.page { padding: 20px 24px 48px; max-width: 1480px; }
.ph { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.ph h1 { margin: 0; font: var(--z-weight-display) 24px/1.15 var(--z-font-display); letter-spacing: -.02em; }
.ph p { margin: 4px 0 0; color: var(--muted); }
.ph .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--white); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink); transition: background var(--z-dur-instant), border-color var(--z-dur-instant); }
.btn:hover { background: var(--hover); border-color: var(--line-2); text-decoration: none; }
.btn.pri { background: var(--z-accent); border-color: var(--z-accent); color: var(--z-on-accent); }
.btn.pri:hover { background: var(--z-accent-hover); border-color: var(--z-accent-hover); }
.btn.ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ink:hover { background: #2C2824; }
.btn.danger { color: var(--z-negative); }
.btn.danger:hover { background: var(--neg-bg); border-color: #F1C4D6; }
.btn.good { color: var(--z-positive); }
.btn.good:hover { background: var(--pos-bg); border-color: #BFE3C9; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.icon { width: 32px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn .kbd { margin-left: 2px; background: transparent; border-color: currentColor; opacity: .55; color: inherit; }

/* ---------- Badges ---------- */
.b { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--info-bg); color: var(--muted); }
.b::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.b.plain::before { display: none; }
.b.pos { background: var(--pos-bg); color: var(--z-positive); }
.b.neg { background: var(--neg-bg); color: var(--z-negative); }
.b.warn { background: var(--warn-bg); color: var(--z-warning); }
.b.acc { background: var(--z-accent-tint); color: var(--z-accent-text); }
.b.ink { background: var(--ink); color: #fff; }
.prod { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); background: var(--white); white-space: nowrap; }
.prod.money { color: var(--ink); border-color: #D9D3CB; }
.prod.money::before { content: ""; width: 6px; height: 6px; background: var(--ink); border-radius: 2px; margin-right: 5px; }
.prod.business::before, .prod.merchants::before, .prod.corporate::before, .prod.marketplace::before { content: ""; width: 6px; height: 6px; border-radius: 2px; margin-right: 5px; background: var(--z-brand); }
.prod.corporate::before { background: var(--z-accent-hover); }
.prod.marketplace::before { background: var(--z-orange-300); }
.risk { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 20px; padding: 0 6px; border-radius: 5px; font: 600 12px/1 var(--z-font-body); font-variant-numeric: tabular-nums; background: var(--info-bg); color: var(--muted); }
.risk.hi { background: var(--z-negative); color: #fff; }
.risk.md { background: var(--warn-bg); color: var(--z-warning); }
.flag { font-size: 14px; line-height: 1; }
.mk { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mk .mono { color: var(--muted); font-size: 11px; }

/* ---------- Cards and stats ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-card); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 48px; }
.card-h h2, .card-h h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-h .r { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--white); border: 1px solid var(--line); border-radius: var(--r-card); margin-bottom: 16px; }
.stats.s4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats.s5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { padding: 14px 16px; border-left: 1px solid var(--line); min-width: 0; text-align: left; background: none; border-top: 0; border-right: 0; border-bottom: 0; }
.stat:first-child { border-left: 0; }
button.stat { cursor: pointer; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; font: inherit; color: inherit; }
button.stat:hover { background: var(--hover); }
.stat .l { color: var(--muted); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.stat .v { font: 600 22px/1.2 var(--z-font-display); letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .d { font-size: 12px; margin-top: 2px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .d b { font-weight: 600; }
.spark { display: block; margin-top: 8px; width: 100%; height: 22px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { height: 36px; padding: 0 12px; border: 0; background: none; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--z-brand); }
.tabs .ct { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--z-sand); border-radius: 9px; padding: 1px 7px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); font-weight: 500; font-size: 12px; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .ct { opacity: .7; }
.filter-in { display: flex; align-items: center; gap: 6px; height: 32px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); padding: 0 10px; min-width: 240px; flex: 0 1 320px; color: var(--faint); }
.filter-in input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--ink); height: 100%; }
.filter-in:focus-within { border-color: var(--z-focus); box-shadow: 0 0 0 3px rgba(234,88,12,.12); }
.toolbar .sp { flex: 1; }
.count { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- Tables ---------- */
.tbl-wrap { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.tbl-scroll { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { position: sticky; top: 0; z-index: 1; height: 34px; padding: 0 12px; text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.t th.sortable { cursor: pointer; }
.t th.sortable:hover { color: var(--ink); }
.t th .arr { opacity: .8; margin-left: 3px; font-size: 10px; }
.t td { height: var(--row-h); padding: 0 12px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { cursor: pointer; }
.t tbody tr:hover td { background: var(--hover); }
.t tbody tr.cur td { background: var(--sel); }
.t tbody tr.cur td:first-child { box-shadow: inset 2px 0 0 var(--z-brand); }
.t .r, .t th.r { text-align: right; }
.t .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.t .who > div { min-width: 0; }
.t .who b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.t .who small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.t .wrap { white-space: normal; line-height: 1.35; padding-top: 8px; padding-bottom: 8px; }
.t td.check, .t th.check { width: 36px; padding-right: 0; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }

/* ---------- Side panel ---------- */
.scrim { position: fixed; inset: 0; background: rgba(22,19,15,.18); z-index: 40; opacity: 0; pointer-events: none; transition: opacity var(--z-dur-quick) var(--z-ease-out); }
.scrim.on { opacity: 1; pointer-events: auto; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); background: var(--white); z-index: 41; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; transform: translateX(104%); transition: transform var(--z-dur-base) var(--z-ease-out); }
.panel.on { transform: none; }
.panel.wide { width: min(760px, 100vw); }
.p-h { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 14px; border-bottom: 1px solid var(--line); flex: none; }
.p-h .t1 { flex: 1; min-width: 0; }
.p-h h2 { margin: 0; font: var(--z-weight-display) 19px/1.2 var(--z-font-display); letter-spacing: -.015em; }
.p-h .sub { color: var(--muted); margin-top: 3px; display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; font-size: 12.5px; }
.p-h .x { margin: -4px -6px 0 0; }
.p-tabs { padding: 0 18px; margin: 0; flex: none; }
.p-b { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.p-f { flex: none; display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--white); flex-wrap: wrap; align-items: center; }
.p-f .sp { flex: 1; }
.sec { margin-bottom: 20px; }
.sec > h4 { margin: 0 0 8px; font: 500 11px/1 var(--z-font-mono); color: var(--faint); letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.sec > h4 .r { margin-left: auto; font-family: var(--z-font-body); letter-spacing: 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kv > div { padding: 8px 12px; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-child(odd) { color: var(--muted); background: var(--paper); }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.li { display: flex; align-items: center; gap: 10px; padding: 0 12px; min-height: 44px; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; padding: 7px 0; }
.li .grow b { font-weight: 600; display: block; line-height: 1.3; }
.li .grow small { color: var(--muted); font-size: 12px; display: block; line-height: 1.3; }
.li .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.li.click { cursor: pointer; }
.li.click:hover { background: var(--hover); }
.bal { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.bal > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.bal .c { color: var(--muted); font-size: 12px; font-weight: 500; }
.bal .a { font: 600 17px/1.3 var(--z-font-display); font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -.01em; }
.callout { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: #6B3A06; margin-bottom: 14px; line-height: 1.45; }
.callout svg { margin-top: 1px; stroke: var(--z-warning); }
.callout.neg { background: var(--neg-bg); color: #7A0F38; }
.callout.neg svg { stroke: var(--z-negative); }
.callout.info { background: var(--info-bg); color: var(--ink); }
.callout.info svg { stroke: var(--muted); }
.callout.pos { background: var(--pos-bg); color: #0F5A2B; }
.callout.pos svg { stroke: var(--z-positive); }
.note { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.note .m { color: var(--muted); font-size: 12px; margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
textarea.in, input.in, select.in { width: 100%; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--white); resize: vertical; }
input.in, select.in { height: 34px; padding: 0 10px; }
textarea.in:focus, input.in:focus, select.in:focus { outline: 0; border-color: var(--z-focus); box-shadow: 0 0 0 3px rgba(234,88,12,.12); }
label.fl { display: block; font-weight: 600; margin: 12px 0 6px; }
label.fl small { font-weight: 400; color: var(--muted); }

/* Checks list (KYC) */
.chk { display: grid; grid-template-columns: 22px 130px 1fr; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: start; }
.chk:last-child { border-bottom: 0; }
.chk .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; margin-top: -1px; }
.chk .ic svg { width: 12px; height: 12px; stroke-width: 2.6; }
.chk .ic.pass { background: var(--pos-bg); color: var(--z-positive); }
.chk .ic.fail { background: var(--neg-bg); color: var(--z-negative); }
.chk .ic.review { background: var(--warn-bg); color: var(--z-warning); }
.chk b { font-weight: 600; }
.faces { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.face { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--paper); }
.face .img { aspect-ratio: 4 / 3; background: var(--z-sand) center / cover no-repeat; position: relative; }
.face .img.idcard { display: flex; align-items: center; gap: 12px; padding: 14px; background: linear-gradient(135deg, #F3EFE9, #E9E3DA); }
.face .img.idcard .ph { width: 34%; aspect-ratio: 3 / 4; background: center / cover no-repeat; border-radius: 4px; margin: 0; display: block; filter: grayscale(.35) contrast(.95); }
.face .img.idcard .lines { flex: 1; display: grid; gap: 6px; }
.face .img.idcard .lines i { display: block; height: 6px; border-radius: 3px; background: rgba(22,19,15,.16); }
.face .img.idcard .lines i:nth-child(1) { width: 70%; background: rgba(22,19,15,.3); }
.face .img.idcard .lines i:nth-child(3) { width: 55%; }
.face .img.idcard .lines i:nth-child(4) { width: 80%; }
.face .img .tag { position: absolute; left: 8px; top: 8px; font: 500 10px/1 var(--z-font-mono); background: rgba(22,19,15,.72); color: #fff; padding: 4px 6px; border-radius: 4px; }
.face .cap { padding: 8px 10px; font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 40px; border-bottom: 1px solid var(--line); }
.doc:last-child { border-bottom: 0; }

/* Timeline */
.tl { position: relative; padding-left: 18px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.tl .ev { position: relative; padding-bottom: 12px; }
.tl .ev::before { content: ""; position: absolute; left: -17px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--white); border: 2px solid var(--faint); }
.tl .ev.sys::before { border-color: var(--z-brand); }
.tl .ev .m { color: var(--muted); font-size: 12px; }

/* Pipeline */
.pipe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; border-radius: 6px; overflow: hidden; height: 8px; background: var(--line); }
.stagebar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); gap: 2px; min-width: 120px; }
.stagebar i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.meter.low i { background: var(--z-negative); }

/* Chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 9px; border-radius: 7px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; opacity: 0; transition: opacity 90ms; z-index: 2; }
.chart .tip b { font-weight: 600; }
.chart .tip.on { opacity: 1; }
.bars-h .row { display: grid; grid-template-columns: 120px 1fr 92px; align-items: center; gap: 10px; height: 30px; }
.bars-h .bar { height: 10px; background: var(--line); border-radius: 0 4px 4px 0; overflow: hidden; }
.bars-h .bar i { display: block; height: 100%; background: var(--z-brand); border-radius: 0 4px 4px 0; }

/* Attention list */
.att { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.att:last-child { border-bottom: 0; }
.att:hover { background: var(--hover); }
.att .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--faint); }
.att .dot.neg { background: var(--z-negative); }
.att .dot.warn { background: var(--z-warning); }
.att .dot.acc { background: var(--z-brand); }
.att b { font-weight: 600; display: block; }
.att small { color: var(--muted); font-size: 12px; display: block; margin-top: 1px; }
.att .when { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; padding-left: 8px; }

/* Support */
.inbox { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - var(--top-h) - 150px); min-height: 480px; }
.inbox .threads { border-right: 1px solid var(--line); overflow-y: auto; }
.thread { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.thread:hover { background: var(--hover); }
.thread.on { background: var(--sel); box-shadow: inset 2px 0 0 var(--z-brand); }
.thread b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread .w { color: var(--faint); font-size: 12px; text-align: right; white-space: nowrap; }
.thread .s { grid-column: 1 / -1; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.thread .s .u { width: 7px; height: 7px; border-radius: 50%; background: var(--z-brand); flex: none; }
.convo { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.convo-h { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.convo-h .grow { flex: 1; min-width: 0; }
.convo-h b { font-weight: 600; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 14px; background: var(--white); border: 1px solid var(--line); line-height: 1.45; }
.msg .m { font-size: 11px; color: var(--faint); margin-top: 3px; }
.msg.out { align-self: flex-end; background: var(--ink); color: #fff; border-color: var(--ink); }
.msg.out .m { color: #BDB6AE; }
.msg.sys { align-self: center; background: none; border: 0; color: var(--muted); font-size: 12px; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; }
.composer .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.composer textarea { min-height: 64px; }

/* Command palette */
.cmdk { position: fixed; inset: 0; z-index: 60; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; background: rgba(22,19,15,.24); }
.cmdk.on { display: flex; }
.cmdk .box { width: min(640px, calc(100vw - 24px)); background: var(--white); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; }
.cmdk .in-row { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 52px; border-bottom: 1px solid var(--line); color: var(--faint); }
.cmdk input { flex: 1; border: 0; outline: 0; font-size: 15px; height: 100%; color: var(--ink); background: none; }
.cmdk .res { max-height: 56vh; overflow-y: auto; padding: 6px; }
.cmdk .grp { padding: 8px 10px 4px; font: 500 11px/1 var(--z-font-mono); color: var(--faint); letter-spacing: .04em; }
.cmdk .it { display: flex; align-items: center; gap: 10px; padding: 0 10px; height: 40px; border-radius: 8px; cursor: pointer; }
.cmdk .it.on { background: var(--sel); }
.cmdk .it .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk .it small { color: var(--muted); margin-left: 6px; }
.cmdk .foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; background: rgba(22,19,15,.3); padding: 16px; }
.modal.on { display: flex; }
.modal .box { width: min(480px, 100%); background: var(--white); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; max-height: 90vh; display: flex; flex-direction: column; }
.modal .m-h { padding: 16px 18px 0; }
.modal .m-h h3 { margin: 0; font: var(--z-weight-display) 18px/1.25 var(--z-font-display); }
.modal .m-h p { margin: 6px 0 0; color: var(--muted); }
.modal .m-b { padding: 4px 18px 16px; overflow-y: auto; }
.modal .m-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.mc-note { display: flex; gap: 8px; align-items: center; margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: var(--paper); color: var(--muted); font-size: 12px; }

/* Menus */
.menu { position: fixed; z-index: 65; min-width: 240px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; display: none; }
.menu.on { display: block; }
.menu .mi { display: flex; align-items: center; gap: 10px; padding: 0 10px; height: 36px; border-radius: 7px; cursor: pointer; width: 100%; border: 0; background: none; text-align: left; }
.menu .mi:hover { background: var(--hover); }
.menu .mi small { margin-left: auto; color: var(--muted); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .mh { padding: 8px 10px 4px; font: 500 11px/1 var(--z-font-mono); color: var(--faint); letter-spacing: .04em; }

/* Toasts */
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-pop); display: flex; gap: 10px; align-items: center; pointer-events: auto; animation: tin var(--z-dur-base) var(--z-ease-out); max-width: calc(100vw - 32px); }
.toast svg { stroke: var(--z-orange-400); }
.toast a { color: var(--z-orange-300); font-weight: 600; margin-left: 4px; cursor: pointer; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* Shortcut sheet */
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; }
.keys div { display: flex; justify-content: space-between; align-items: center; height: 30px; border-bottom: 1px solid var(--line); }
.keys .kbd { margin-left: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats .stat:nth-child(4) { border-left: 0; }
  .stats .stat:nth-child(n+4) { border-top: 1px solid var(--line); }
  .stats.s4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats.s4 .stat:nth-child(3) { border-left: 0; }
  .stats.s4 .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stats.s4 .stat:nth-child(4) { border-left: 1px solid var(--line); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 280px 1fr; }
}
@media (max-width: 760px) {
  :root { --top-h: 52px; }
  body { font-size: 14px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; z-index: 50; transform: translateX(-102%); transition: transform var(--z-dur-base) var(--z-ease-out); box-shadow: var(--shadow-pop); }
  .sidebar.on { transform: none; }
  .nav a { height: 40px; }
  .topbar, .main { grid-column: 1; }
  .topbar { padding: 0 10px; gap: 6px; }
  .topbar .menu-btn { display: inline-flex; }
  .search { height: 36px; }
  .search .kbd, .me div, .top-right .hide-m { display: none; }
  .top-right { gap: 4px; }
  select.ctl.mkt { width: 104px; padding: 0 22px 0 8px; background-position: right 6px center; text-overflow: ellipsis; }
  .page { padding: 14px 12px 40px; }
  .ph { margin-bottom: 12px; }
  .ph h1 { font-size: 22px; }
  .ph .acts { margin-left: 0; width: 100%; }
  .stats, .stats.s4, .stats.s5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .stats .stat:nth-child(odd) { border-left: 0; }
  .stats .stat:nth-child(-n+2) { border-top: 0; }
  .stat .v { font-size: 19px; }
  .filter-in { flex: 1 1 100%; min-width: 0; }
  .toolbar .sp { display: none; }

  /* Tables become two-line rows: title + value, then subline + badge. */
  .t thead { display: none; }
  .t, .t tbody { display: block; }
  .t tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t r" "s b"; gap: 2px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .t tbody tr:last-child { border-bottom: 0; }
  .t td { display: none; height: auto; padding: 0; border: 0; max-width: none; }
  .t td[data-m] { display: block; }
  .t td[data-m="t"] { grid-area: t; }
  .t td[data-m="r"] { grid-area: r; text-align: right; font-weight: 600; }
  .t td[data-m="s"] { grid-area: s; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
  .t td[data-m="b"] { grid-area: b; text-align: right; }
  .t td.check { display: none; }
  .t td.wrap { padding: 0; white-space: nowrap; }
  .t tbody tr:hover td, .t tbody tr.cur td { background: none; }
  .t tbody tr.cur { background: var(--sel); }

  .panel, .panel.wide { width: auto; left: 0; }
  .btn .kbd { display: none; }
  .p-f .sp { display: none; }
  .p-h { padding: 12px 14px; }
  .p-b { padding: 14px; }
  .p-f { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .p-f .btn { flex: 1 1 auto; height: 40px; }
  .kv { grid-template-columns: 120px 1fr; }
  .chk { grid-template-columns: 22px 1fr; }
  .chk .d { grid-column: 2; }
  .inbox { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .inbox .threads { border-right: 0; }
  .inbox.open .threads { display: none; }
  .inbox:not(.open) .convo { display: none; }
  .msgs { min-height: 50vh; }
  .msg { max-width: 88%; }
  .keys { grid-template-columns: 1fr; }
  .bars-h .row { grid-template-columns: 96px 1fr 80px; }
  .btn { height: 36px; }
  .btn.sm { height: 32px; }
  .chip { height: 32px; }
}

/* Phone-only / desktop-only bits, and tables that sit flush inside a card */
.m-only, .m-only-f { display: none; }
@media (max-width: 760px) { .m-only { display: inline; } .m-only-f { display: inline-flex; } }
.card .flush .tbl-wrap, .card > .flush .tbl-wrap { border: 0; border-radius: 0 0 var(--r-card) var(--r-card); }
.hide-d { display: none; }
.cc { display: inline-grid; place-items: center; min-width: 24px; height: 17px; padding: 0 4px; border-radius: 4px; font: 600 10px/1 var(--z-font-mono); letter-spacing: .02em; background: var(--z-sand); color: var(--muted); border: 1px solid var(--line); }
.cc-NG { background: var(--z-accent-tint); color: var(--z-accent-text); border-color: #FBD9BF; }
.mk .cc + .cc { margin-left: -1px; }
.search span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { min-width: 0; }
.topbar { overflow: hidden; }
@media (max-width: 760px) { .me > svg { display: none; } .me { padding: 0 2px; } }
@media (max-width: 760px) { .count { white-space: normal; } }

/* ---------- Experiments ---------- */
.crumb { margin-bottom: 6px; font-size: 12px; }
.crumb a { color: var(--muted); display: inline-flex; align-items: center; gap: 2px; }
.ph h1 .b { vertical-align: middle; margin-left: 6px; }
.xmeta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.flagk { display: inline-flex; align-items: center; gap: 5px; padding: 0 7px; height: 22px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--white); }
.flagk:hover { border-color: var(--z-brand); text-decoration: none; }
.recbar { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--white); cursor: pointer; font: inherit; color: inherit; }
.recbar:hover { border-color: var(--line-2); background: var(--hover); }
.recbar .rt { flex: 1; min-width: 0; }
.recbar .go { color: var(--z-accent-text); font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; }
.vb { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 7px; font-weight: 700; white-space: nowrap; background: var(--info-bg); color: var(--ink); }
.vb.pos { background: var(--z-positive); color: #fff; }
.vb.neg { background: var(--z-negative); color: #fff; }
.vb.warn { background: var(--warn-bg); color: var(--z-warning); }
.vb.acc { background: var(--z-accent-tint); color: var(--z-accent-text); }
.vb.lg { height: 34px; padding: 0 14px; font: 650 17px/1 var(--z-font-display); border-radius: 9px; }
.verdict { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.verdict p { margin: 0; flex: 1; min-width: 200px; font-weight: 500; }
.h4 { margin: 18px 0 8px; font: 500 11px/1 var(--z-font-mono); color: var(--faint); letter-spacing: .04em; }
ul.why { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
ul.why li { position: relative; padding-left: 18px; line-height: 1.45; }
ul.why li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--z-brand); }
ul.why.risk li::before { background: var(--z-warning); }
ul.why li.ok::before { background: var(--z-positive); }
ul.why li.no { color: var(--muted); }
ul.why li.no::before { background: transparent; border: 1.5px solid var(--faint); width: 5px; height: 5px; }
.vk { width: 24px; height: 24px; border-radius: 6px; display: inline-grid; place-items: center; flex: none; font: 600 12px/1 var(--z-font-mono); background: var(--ink); color: #fff; }
.forest { display: inline-block; vertical-align: middle; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.bsum { position: sticky; top: 16px; }
.bsum .big { font: 650 30px/1.1 var(--z-font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stepn { width: 22px; height: 22px; border-radius: 50%; background: var(--z-accent-tint); color: var(--z-accent-text); display: inline-grid; place-items: center; font: 700 12px/1 var(--z-font-body); flex: none; }
.aud .arow { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: start; }
.aud .arow:last-of-type { border-bottom: 0; }
.aud .al { font-weight: 600; padding-top: 5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.vrow { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.vrow .in { flex: 1; }
.vrow .pin { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.vrow .pin .in { width: 70px; text-align: right; }
.chkl { display: flex; gap: 8px; align-items: center; margin-top: 12px; cursor: pointer; }
.chkl input { width: 16px; height: 16px; accent-color: var(--z-accent); }
.frow { display: grid; grid-template-columns: 110px 1fr 40px; gap: 8px; align-items: center; font-size: 12px; height: 24px; }
.frow .num { text-align: right; }
@media (max-width: 1000px) { .builder { grid-template-columns: 1fr; } .bsum { position: static; } }
@media (max-width: 760px) {
  .aud .arow { grid-template-columns: 1fr; gap: 6px; }
  .recbar { flex-wrap: wrap; }
  .recbar .go { width: 100%; }
  .vrow .pin .in { width: 58px; }
}
.vkey { flex: none; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 6px; border-radius: 5px; background: var(--paper); border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.flagsum { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); font-size: 12px; display: grid; gap: 4px; line-height: 1.4; }
.flagsum b { font-weight: 600; font-size: 13px; }
details.json { margin-top: 12px; }
details.json summary { cursor: pointer; font-weight: 600; font-size: 12px; color: var(--z-accent-text); }
details.json pre { margin: 8px 0; padding: 10px 12px; background: var(--ink); color: #F3F0EC; border-radius: 8px; font: 500 11.5px/1.5 var(--z-font-mono); overflow-x: auto; max-height: 280px; }
ul.why li.bad::before { background: var(--z-negative); }
ul.why li.warn::before { background: var(--z-warning); }
ul.why li.bad { color: var(--z-negative); }
@media (max-width: 760px) { .vkey { display: none; } }
