/* =========================================================
   Business Passport · professional design system
   Neutral surfaces, one brand colour (ink navy), green = verified.
   ========================================================= */
:root {
  --sans: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --r-lg: 12px; --r-md: 10px; --r-sm: 8px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
[data-theme="light"] {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f9fafb; --hover: #f2f4f7;
  --border: #e4e7ec; --border-strong: #d0d5dd;
  --text: #101828; --muted: #475467; --dim: #98a2b3;
  --brand: #0f2a44; --brand-hover: #173a5c; --brand-soft: #eef2f7; --brand-text: #0f2a44; --on-brand: #ffffff;
  --link: #1f4e8c;
  --ok: #067647; --ok-bg: #ecfdf3; --ok-border: #abefc6;
  --ref: #175cd3; --ref-bg: #eff8ff; --ref-border: #b2ddff;
  --warn: #b54708; --warn-bg: #fffaeb; --warn-border: #fedf89;
  --bad: #b42318; --bad-bg: #fef3f2; --bad-border: #fecdca;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .18);
  --focus: 0 0 0 4px rgba(15, 42, 68, .14);
}
[data-theme="dark"] {
  --bg: #0d1117; --surface: #151a22; --surface-2: #11161d; --hover: #1c222c;
  --border: #252c37; --border-strong: #333c4a;
  --text: #e6e8eb; --muted: #a2abb8; --dim: #6b7584;
  --brand: #e6e8eb; --brand-hover: #ffffff; --brand-soft: #1c2532; --brand-text: #c9d6e6; --on-brand: #0d1117;
  --link: #8cb4e6;
  --ok: #47cd89; --ok-bg: rgba(71, 205, 137, .1); --ok-border: rgba(71, 205, 137, .3);
  --ref: #84caff; --ref-bg: rgba(132, 202, 255, .1); --ref-border: rgba(132, 202, 255, .3);
  --warn: #fdb022; --warn-bg: rgba(253, 176, 34, .1); --warn-border: rgba(253, 176, 34, .3);
  --bad: #f97066; --bad-bg: rgba(249, 112, 102, .1); --bad-border: rgba(249, 112, 102, .3);
  --shadow-sm: none; --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
  --focus: 0 0 0 4px rgba(140, 180, 230, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14.5px/1.55 var(--sans); min-height: 100dvh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.015em; margin: 0 0 .35em; line-height: 1.25; color: var(--text); }
h1 { font-size: 26px; letter-spacing: -.02em; }
h2 { font-size: 18px; }
h3 { font-size: 15.5px; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.small { font-size: 13px; } .tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-size: .95em; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mt { margin-top: 14px; } .mtx { margin-top: 8px; }
.narrow { max-width: 660px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
:focus-visible { outline: none; box-shadow: var(--focus); }
main:focus, main:focus-visible { outline: none; box-shadow: none; }
svg { width: 16px; height: 16px; flex: none; }
svg.ic-inline { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.card.tight { padding: 14px; }
.card.hover { transition: border-color .15s, box-shadow .15s; color: inherit; }
.card.hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow); text-decoration: none; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
hr.sep { border: 0; height: 1px; background: var(--border); margin: 20px 0; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1200px; margin: 0 auto; height: 60px; display: flex; align-items: center; gap: 28px; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 600; margin-left: 4px; color: var(--muted); }
.emblem { width: 26px; height: 26px; color: var(--brand); }
#nav { display: flex; gap: 2px; flex: 1; height: 100%; overflow-x: auto; scrollbar-width: none; }
#nav a { position: relative; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); padding: 0 12px; font-size: 14px; font-weight: 500; white-space: nowrap; height: 100%; }
#nav a:hover { color: var(--text); text-decoration: none; }
#nav a.active { color: var(--text); }
#nav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px 2px 0 0; }
#nav svg { width: 16px; height: 16px; opacity: .8; }
.count { min-width: 18px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--brand); color: var(--on-brand); font: 600 11px/18px var(--sans); text-align: center; }
#who { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; cursor: pointer; color: var(--muted); background: transparent; border: 1px solid transparent; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: var(--r-sm); color: var(--text); font: 500 13.5px var(--sans); }
.me-chip:hover { background: var(--hover); text-decoration: none; }
.me-chip .av { width: 28px; height: 28px; font-size: 11px; border-radius: 50%; }
#tabbar { display: none; }

main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 100px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 24px; flex-wrap: wrap; }
.page-head p { max-width: 680px; margin: 4px 0 0; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.section { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 14px; flex-wrap: wrap; }
.section h2, .section h3 { margin: 0; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; white-space: nowrap;
  font: 600 14px var(--sans); padding: 9px 14px; border-radius: var(--r-sm); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.xs { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.block { width: 100%; }

.lbl { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin: 14px 0 6px; }
input, select, textarea { width: 100%; font: 14.5px var(--sans); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 9px 12px; outline: none; box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s; }
input::placeholder, textarea::placeholder { color: var(--dim); }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-text); box-shadow: var(--focus); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
textarea { min-height: 90px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--brand); box-shadow: none; flex: none; margin-top: 2px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; margin: 10px 0; cursor: pointer; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.actions.end { justify-content: flex-end; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain:disabled { opacity: .6; }
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-sm); gap: 2px; background: var(--hover); border: 1px solid var(--border); }
.seg button { border: 0; background: none; color: var(--muted); font: 500 13.5px var(--sans); padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.search { display: flex; gap: 8px; flex-wrap: wrap; }
.search input, .search select { flex: 1; min-width: 160px; }

/* ---------- badges & chips ---------- */
.pill, .status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); line-height: 1.6; }
.pill svg, .status svg { width: 12px; height: 12px; }
.pill.gold { color: var(--brand-text); background: var(--brand-soft); border-color: transparent; }
.pill.teal, .status.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.pill.blue, .status.ref { color: var(--ref); background: var(--ref-bg); border-color: var(--ref-border); }
.pill.warn, .status.pend { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.pill.bad, .status.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-border); }
.status.self { color: var(--muted); background: transparent; border-style: dashed; }
.pill.on { color: var(--on-brand); background: var(--brand); border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; padding: 2px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.chip.v { color: var(--ok); border-color: var(--ok-border); background: var(--ok-bg); }
.chip.a { color: var(--ref); border-color: var(--ref-border); background: var(--ref-bg); }
.chip.v::before, .chip.a::before { content: "✓ "; font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.legend .lv::before { background: var(--ok); } .legend .la::before { background: var(--ref); } .legend .ls::before { background: var(--border-strong); }
.count { display: inline-block; }

/* ---------- avatars & logos ---------- */
.av { display: grid; place-items: center; flex: none; overflow: hidden; width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-text); font: 600 14px var(--sans); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 56px; height: 56px; font-size: 18px; }
.logo { width: 40px; height: 40px; border-radius: var(--r-sm); flex: none; display: grid; place-items: center; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border); font: 600 14px var(--sans); color: var(--muted); }
.logo img { width: 100%; height: 100%; object-fit: cover; }
.logo.lg { width: 64px; height: 64px; border-radius: var(--r-md); font-size: 22px; }

/* ---------- landing ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 420px); gap: 64px; align-items: center; padding: 40px 0; }
.hero h1 { font-size: clamp(32px, 4.4vw, 48px); line-height: 1.1; letter-spacing: -.03em; }
.hero h1 em { font-style: normal; color: var(--ok); }
.lede { font-size: 17px; color: var(--muted); max-width: 560px; }
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 32px; max-width: 640px; }
.pillars .card { padding: 16px; }
.pillars b { display: block; font-size: 14.5px; margin: 10px 0 2px; }
.pillars svg { width: 20px; height: 20px; color: var(--brand-text); }
.auth-card { padding: 24px; box-shadow: var(--shadow-lg); }
.demo-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.demo-list button { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); padding: 8px 10px; cursor: pointer; font: 13px var(--sans); }
.demo-list button:hover { border-color: var(--border-strong); background: var(--hover); }
.demo-list small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }

/* ---------- passport (ID card) ---------- */
.passport { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.passport .hdr { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; background: #0f2a44; color: #fff; font-size: 12.5px; }
.hdr-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 12px; }
.hdr-brand svg { width: 18px; height: 18px; }
.hdr-meta { color: rgba(255, 255, 255, .72); }
.passport .body { display: grid; grid-template-columns: 120px 1fr; gap: 22px; padding: 22px 20px; }
.portrait { width: 120px; height: 150px; border-radius: var(--r-md); overflow: hidden; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-text); font: 600 36px var(--sans); border: 1px solid var(--border); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.pname { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pname h2 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.phead { color: var(--muted); font-size: 15px; margin-top: 2px; }
.pfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.pf span { display: block; font-size: 12px; color: var(--muted); }
.pf b { font-weight: 600; font-size: 14px; word-break: break-word; }
.pbio { margin: 14px 0 0; color: var(--muted); font-size: 14px; }
.mrz { padding: 10px 20px 12px; font: 500 12.5px/1.6 var(--mono); letter-spacing: .12em; color: var(--dim); background: var(--surface-2); border-top: 1px solid var(--border); white-space: pre; overflow: hidden; }

/* trust ring */
.ring { --v: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; flex: none; position: relative;
  background: conic-gradient(var(--ok) calc(var(--v) * 1%), var(--hover) 0); }
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.ring small { position: relative; display: block; font-size: 11px; color: var(--muted); margin-top: -3px; text-align: center; }
.bar { height: 6px; background: var(--hover); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--ok); }

/* ---------- pages (claims) ---------- */
.pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.page { display: flex; flex-direction: column; min-height: 190px; }
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.page .kind { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.page .kind svg { width: 14px; height: 14px; }
.page h3 { margin: 10px 0 2px; font-size: 16px; }
.page .org { color: var(--text); font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page .dates { font-size: 13px; color: var(--muted); margin-top: 2px; }
.page p.desc { font-size: 13.5px; margin: 10px 0 0; color: var(--muted); }
.page .chips { margin-top: 12px; }
.page .foot { margin-top: auto; padding-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border); margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; margin-bottom: -6px; }
.page .foot:empty { display: none; }
.page .chips + .foot, .page .links + .foot, .page .quote + .foot, .page .invites + .foot, .page .dates + .foot, .page .desc + .foot { margin-top: 16px; }
.links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.links a { font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.links svg { width: 13px; height: 13px; }
.quote { margin-top: 12px; padding: 10px 14px; border-left: 3px solid var(--ref); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 13.5px; }
.quote p { margin: 0 0 4px; color: var(--text); }
.quote .by { color: var(--muted); font-size: 12.5px; }
.invites { margin-top: 10px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.invites svg { width: 13px; height: 13px; vertical-align: -2px; }
.vr:empty { display: none; }
.verdict { margin-top: 12px; font-size: 13px; padding: 10px 12px; border-radius: var(--r-sm); display: flex; gap: 8px; align-items: flex-start; border: 1px solid; }
.verdict svg { margin-top: 2px; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.verdict.no { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 14px; align-items: center; padding: 14px 16px; }
.item .t { font-weight: 600; color: var(--text); }
.item .s { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 32px 20px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); text-align: center; background: var(--surface); }
.linkbox { font: 12.5px var(--mono); color: var(--text); background: var(--surface-2); border: 1px solid var(--border); padding: 5px 10px; border-radius: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; display: inline-block; }
.kpi { padding: 16px 18px; }
.kpi b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.kpi span { color: var(--muted); font-size: 13px; }

/* ---------- jobs ---------- */
.job { display: flex; flex-direction: column; gap: 12px; }
.job h3 { margin: 0; }
.job .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.fit { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.fit .bar { flex: 1; }
.fit b { color: var(--text); font-size: 13.5px; }
.job-hero { display: flex; gap: 16px; align-items: center; }
.prose { white-space: pre-wrap; color: var(--muted); }
.score-big { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }

/* ---------- pipeline ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px; min-height: 320px; transition: border-color .12s, background .12s; box-shadow: none; }
.col.drop { border-color: var(--brand-text); background: var(--brand-soft); }
.col-h { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-size: 13px; font-weight: 600; color: var(--text); }
.col-h .n { font-weight: 500; color: var(--muted); background: var(--hover); padding: 0 8px; border-radius: 999px; font-size: 12px; }
.ticket { border-radius: var(--r-md); padding: 12px; cursor: grab; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.ticket:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.ticket + .ticket { margin-top: 8px; }
.ticket.dragging { opacity: .4; }
.ticket .top { display: flex; gap: 10px; align-items: center; }
.ticket .av { width: 32px; height: 32px; font-size: 12px; }
.ticket .sc { margin-left: auto; font-weight: 700; font-size: 15px; }

/* ---------- messages ---------- */
.chat { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 0; height: calc(100dvh - 210px); min-height: 460px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.threads { overflow-y: auto; padding: 8px; border: 0; border-right: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.thread { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--text); }
.thread:hover { background: var(--hover); text-decoration: none; }
.thread.on { background: var(--brand-soft); }
.thread .last { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo { display: flex; flex-direction: column; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
.convo > .empty { margin: 20px; }
.convo-h { padding: 12px 18px; border-bottom: 1px solid var(--border); }
.msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.msg { max-width: 70%; padding: 9px 13px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; background: var(--surface); border: 1px solid var(--border); }
.msg.mine { align-self: flex-end; color: var(--on-brand); background: var(--brand); border-color: var(--brand); border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg time { display: block; font-size: 11px; opacity: .65; margin-top: 2px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.composer textarea { min-height: 40px; max-height: 160px; padding: 9px 12px; }

/* ---------- modal, toast, misc ---------- */
dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(560px, 94vw); color: var(--text); background: var(--surface); box-shadow: var(--shadow-lg); }
dialog.wide { width: min(980px, 96vw); }
dialog[open] { animation: pop .18s var(--ease); }
dialog::backdrop { background: rgba(16, 24, 40, .45); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
#modal-body { padding: 24px; max-height: 88dvh; overflow: auto; position: relative; }
.modal-x { position: absolute; right: 12px; top: 12px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; padding: 10px 16px; border-radius: var(--r-sm); transition: .2s var(--ease);
  pointer-events: none; z-index: 60; font-size: 14px; font-weight: 500; background: #101828; color: #fff; box-shadow: var(--shadow-lg); }
[data-theme="dark"] #toast { background: #e6e8eb; color: #101828; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--bad); color: #fff; }
pre.json { font: 12px/1.5 var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; overflow: auto; max-height: 340px; color: var(--muted); }
.qr { background: #fff; padding: 8px; border-radius: var(--r-md); border: 1px solid var(--border); width: 218px; }
.qr img { display: block; width: 200px; height: 200px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font: 600 14px var(--mono); }
.codes span { padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); text-align: center; letter-spacing: .08em; }
.doc-view img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--border); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 2px 0 14px 36px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font: 600 12px var(--sans); color: var(--brand-text); background: var(--brand-soft); }
.timeline { display: flex; gap: 6px; flex-wrap: wrap; }
.skeleton { height: 120px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface), var(--hover), var(--surface)); background-size: 200% 100%; animation: sk 1.2s infinite; border: 1px solid var(--border); }
@keyframes sk { to { background-position: -200% 0; } }
.row > select { width: auto; min-width: 200px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .grid.two, .hero { grid-template-columns: 1fr; }
  .hero { gap: 28px; padding: 10px 0; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .threads { border-right: 0; }
  .chat.has-thread .threads { display: none; }
  .chat:not(.has-thread) .convo { display: none; }
  .convo { height: calc(100dvh - 240px); }
}
@media (max-width: 760px) {
  .topbar-inner { padding: 0 14px; height: 54px; gap: 12px; }
  .brand-text { display: none; }
  #nav { display: none; }
  #who { margin-left: auto; }
  .me-chip span:not(.av) { display: none; }
  .me-chip { padding: 3px; }
  #tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; justify-content: space-around; background: var(--surface);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  #tabbar a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); padding: 4px 2px; }
  #tabbar a:hover { text-decoration: none; }
  #tabbar a.active { color: var(--text); }
  #tabbar svg { width: 20px; height: 20px; }
  #tabbar .count { position: absolute; top: 0; right: calc(50% - 22px); }
  main { padding: 18px 14px 100px; }
  h1 { font-size: 22px; }
  .pages, .cols, .pillars, .grid.cards { grid-template-columns: 1fr; }
  .passport .body { grid-template-columns: 76px 1fr; gap: 14px; padding: 16px; }
  .portrait { width: 76px; height: 96px; font-size: 24px; }
  .pname h2 { font-size: 19px; }
  .mrz { padding: 8px 16px 10px; font-size: 10px; letter-spacing: .06em; }
  .passport .hdr { padding: 10px 16px; }
  .card { padding: 16px; }
  .page .foot { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  #modal-body { max-height: 90dvh; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .item { flex-wrap: wrap; }
  .linkbox { max-width: 100%; }
  .msg { max-width: 86%; }
  #toast { bottom: 84px; }
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
@media (min-width: 1021px) { .convo-h .icon-btn { display: none; } }
@media (max-width: 760px) { .pfields { grid-template-columns: 1fr 1fr; } }
