/* Staff dashboard: a quiet graphite work tool. Colour only where it carries meaning. */
:root {
  color-scheme: dark;
  --ground: #15171B;
  --surface: #1C1F24;
  --surface-2: #23272D;
  --surface-3: #2A2F36;
  --line: #2C3138;
  --ink: #ECEEF1;
  --ink-2: #A2A8B3;
  --ink-3: #8A919C;
  --good: #2EBD7A;
  --warn: #E9A23B;
  --warn-soft: rgba(233, 162, 59, .13);
  --bad: #F0605A;
  --bad-soft: rgba(240, 96, 90, .13);
  --frozen: #6FC3E8;
  --frozen-soft: rgba(111, 195, 232, .12);
  --live: #8FB4FF;
  --c-ltc: #BFC3C9;
  --c-bnb: #F0B90B;
  --c-sol: #9945FF;
  --c-eth: #7B8FF0;
  --c-usdt: #26A17B;
  --r: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(46, 189, 122, .35); color: #fff; }
:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-color: var(--surface-3) transparent; scrollbar-width: thin; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3, p, dl, dd, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
.muted { color: var(--ink-3); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

/* ── Top bar ─────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(21, 23, 27, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1440px; margin: 0 auto; height: 60px; padding: 0 28px; display: flex; align-items: center; gap: 24px; }
.server { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.server-mark {
  flex: none; width: 30px; height: 30px; border-radius: 9px; overflow: hidden;
  display: grid; place-items: center; background: var(--surface-3); color: var(--ink); font-weight: 700; font-size: 14px;
}
.server-mark img { width: 100%; height: 100%; object-fit: cover; }
.server-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.tabs { display: flex; gap: 2px; }
.tab {
  position: relative; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 12px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; transition: color .15s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }
.tab-count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }
.quick-search {
  margin-left: auto; display: flex; align-items: center; gap: 8px; width: min(380px, 30vw); height: 36px; padding: 0 10px;
  border-radius: 8px; background: var(--surface); border: 1px solid transparent; color: var(--ink-3);
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.quick-search:focus-within { border-color: var(--line); background: var(--surface-2); }
.quick-search svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.quick-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--ink); font: inherit; outline: none; box-shadow: none; padding: 0; }
.quick-search input::placeholder { color: var(--ink-3); }
kbd { padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink-3); font: 500 12px/18px var(--font); }
.account { display: flex; align-items: center; gap: 14px; }
.me .person { color: var(--ink-2); }
.text-button { padding: 0; border: 0; background: none; color: var(--ink-3); font: inherit; cursor: pointer; }
.text-button:hover { color: var(--ink); text-decoration: underline; }

.banner { max-width: 1440px; margin: 16px auto 0; padding: 10px 28px; font-weight: 500; }
.banner-warn { color: var(--warn); }
.banner-bad { color: var(--bad); }

/* ── Page frame ──────────────────────────── */
.page { max-width: 1440px; margin: 0 auto; padding: 32px 28px 72px; }
.view { animation: enter .22s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
.lede { color: var(--ink-2); font-size: 15px; margin-top: 6px; max-width: 70ch; }
.lede strong { color: var(--ink); font-weight: 600; }
.live { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.live.is-stale .live-dot { background: var(--warn); }

.overview { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "chart finished" "deals side"; }
.ov-chart { grid-area: chart; } .ov-finished { grid-area: finished; } .ov-deals { grid-area: deals; }
.ov-side { grid-area: side; display: grid; gap: 20px; align-content: start; min-width: 0; }
.attention { margin-bottom: 20px; }
.controls { align-items: center; }

.card { background: var(--surface); border-radius: var(--r); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; margin-bottom: 14px; flex-wrap: wrap; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.card-meta { color: var(--ink-3); font-size: 13px; }
.card-link { color: var(--ink-2); font-size: 13px; text-decoration: none; }
.card-link:hover { color: var(--ink); text-decoration: underline; }

/* ── Tones ───────────────────────────────── */
.tone-good { --tone: var(--good); }
.tone-warn { --tone: var(--warn); }
.tone-bad { --tone: var(--bad); }
.tone-live { --tone: var(--live); }
.tone-wait, .tone-done { --tone: var(--ink-3); }
.tone-frozen { --tone: var(--frozen); }
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); flex: none; }
.tone-frozen .status::before, .status.tone-frozen::before { border-radius: 1px; transform: rotate(45deg); }
.tone-good .status, .status.tone-good { color: var(--good); }
.tone-bad .status, .status.tone-bad { color: var(--bad); }
.tone-warn .status, .status.tone-warn { color: var(--warn); }
.tone-frozen .status, .status.tone-frozen { color: var(--frozen); }

/* ── Needs you ───────────────────────────── */
.issue {
  display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 14px 12px 0; border-radius: 10px; background: var(--surface-2);
  text-decoration: none; transition: background-color .15s var(--ease);
}
.issue + .issue { margin-top: 8px; }
.issue:hover { background: var(--surface-3); }
.issue-bar { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--tone, var(--warn)); }
.issue-title { display: flex; align-items: baseline; gap: 10px; font-weight: 600; }
.issue-title .deal-no { font-size: 15px; }
.issue p { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.issue-side { display: grid; justify-items: end; gap: 2px; font-size: 13px; }
.issue-side .value { font-weight: 600; font-size: 14px; }
.all-clear { display: flex; align-items: center; gap: 12px; color: var(--ink-2); }
.all-clear svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--good); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.all-clear strong { color: var(--ink); font-weight: 600; }

/* ── In escrow ───────────────────────────── */
.split { display: flex; gap: 3px; height: 8px; margin: 16px 0 6px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.split span { min-width: 4px; }
.coins li { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.coins li:last-child { border-bottom: 0; padding-bottom: 0; }
.coins .amount { color: var(--ink-3); font-size: 13px; margin-left: 6px; }
.coins .usd { font-weight: 500; }
.coin-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--coin, var(--ink-3)); flex: none; }
[data-coin="LTC"] { --coin: var(--c-ltc); }
[data-coin="BNB"] { --coin: var(--c-bnb); }
[data-coin="SOL"] { --coin: var(--c-sol); }
[data-coin="ETH"] { --coin: var(--c-eth); }
[data-coin="USDT"] { --coin: var(--c-usdt); }
.empty-note { color: var(--ink-3); font-size: 13px; padding-top: 6px; }

/* ── USDT fee wallet ─────────────────────── */
.treasury-note { color: var(--ink-2); font-size: 13px; margin-top: 8px; }
.treasury-note.warn { color: var(--warn); }
.treasury-address { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }

/* ── Controls ────────────────────────────── */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 8px; background: var(--ground); }
.segmented button {
  height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: none;
  color: var(--ink-3); font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }
.segmented button span { color: var(--ink-3); margin-left: 2px; }
.segmented.compact button { padding: 0 9px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Open deals: cards on a quiet day, a table when busy ── */
.deal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.deal-card {
  display: grid; gap: 16px; padding: 16px; border-radius: 10px; background: var(--surface-2);
  text-decoration: none; transition: background-color .15s var(--ease);
}
.deal-card:hover { background: var(--surface-3); }
.deal-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.deal-card .deal-no { font-size: 20px; }
.deal-card-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }

.table { margin: 0 -20px -8px; }
.thead, .deal-row {
  display: grid; align-items: center; column-gap: 16px; padding: 0 20px;
  grid-template-columns: 64px minmax(170px, 1.2fr) minmax(150px, 1fr) 132px minmax(130px, .9fr) 92px;
}
.thead { height: 34px; color: var(--ink-3); font-size: 12px; font-weight: 500; border-bottom: 1px solid var(--line); }
.deal-row {
  min-height: 58px; padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid var(--line);
  text-decoration: none; transition: background-color .15s var(--ease);
}
.deal-row:last-child { border-bottom: 0; }
.deal-row:hover { background: var(--surface-2); }
.deal-row:focus-visible { outline-offset: -2px; border-radius: 0; }
.deal-no { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.people { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatars { display: flex; flex: none; }
.avatars img, .avatars i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); background: var(--surface-3); display: block; }
.deal-card .avatars img, .deal-card .avatars i { border-color: var(--surface-2); }
.avatars > * + * { margin-left: -8px; }
.names { min-width: 0; line-height: 1.3; }
.names b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.names small { display: block; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amount-cell { display: flex; align-items: center; gap: 9px; min-width: 0; line-height: 1.3; }
.amount-cell b { display: block; font-weight: 500; white-space: nowrap; }
.amount-cell small { display: block; color: var(--ink-3); font-size: 12px; }
.age { color: var(--ink-3); font-size: 13px; text-align: right; white-space: nowrap; }

.track { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.track i { height: 4px; border-radius: 2px; background: var(--surface-3); }
.track i.done { background: #4A525C; }
.track i.now { background: var(--tone); }
.track-labeled { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.track-labeled div { display: grid; gap: 7px; min-width: 0; }
.track-labeled i { height: 5px; border-radius: 3px; background: var(--surface-3); }
.track-labeled span { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-labeled .done i { background: #4A525C; }
.track-labeled .done span { color: var(--ink-2); }
.track-labeled .now i { background: var(--tone); }
.track-labeled .now span { color: var(--ink); font-weight: 600; }

.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk-block { height: 64px; }
.sk-tall { height: 240px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.empty-state { display: grid; justify-items: start; gap: 6px; padding: 20px 4px 8px; max-width: 60ch; }
.empty-state strong { font-size: 16px; font-weight: 600; }
.empty-state p { color: var(--ink-2); }

.mini-row {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover .deal-no { text-decoration: underline; text-underline-offset: 3px; }
.mini-row .deal-no { color: var(--ink-2); font-size: 14px; }
.mini-row .names b { font-weight: 400; color: var(--ink-2); }
.mini-row .value { color: var(--ink-2); text-align: right; }
.mini-row.tone-frozen .deal-no { color: var(--frozen); }

/* ── Charts ──────────────────────────────── */
.chart { position: relative; height: 190px; margin: 0 -4px; }
.chart.tall { height: 280px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .ylabel, .chart .xlabel { fill: var(--ink-3); font: 500 12px var(--font); }
.chart .bar { fill: var(--good); transition: opacity .15s var(--ease); }
.chart .bar.zero { fill: var(--surface-3); }
.chart.is-hovering .bar { opacity: .4; }
.chart.is-hovering .bar.hot { opacity: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tooltip {
  position: absolute; top: 0; z-index: 2; pointer-events: none; min-width: 130px; padding: 8px 10px; border-radius: 8px;
  background: var(--surface-3); box-shadow: 0 8px 20px -6px rgba(0, 0, 0, .5); font-size: 13px; transform: translateX(-50%);
}
.tooltip b { display: block; font-weight: 600; }
.tooltip span { color: var(--ink-2); }

/* ── Analytics ───────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 20px; background: var(--surface); border-radius: var(--r); }
.kpis div { padding: 18px 20px; min-width: 0; }
.kpis div + div { border-left: 1px solid var(--line); }
.kpis dt { color: var(--ink-3); font-size: 13px; }
.kpis dd { font-size: 24px; font-weight: 600; letter-spacing: -0.025em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.kpis .is-alert dd { color: var(--warn); }
.kpis .skeleton { grid-column: 1 / -1; margin: 18px 20px; padding: 0; }
.analytics {
  display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 380px; align-items: start;
  grid-template-areas: "volume coins" "heat top" "outcomes top";
}
.a-volume { grid-area: volume; } .a-coins { grid-area: coins; align-self: stretch; } .a-heat { grid-area: heat; }
.a-outcomes { grid-area: outcomes; } .a-top { grid-area: top; }

.bars-list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 7px; }
.bars-list li:last-child { border-bottom: 0; }
.bars-list .row { display: flex; align-items: baseline; gap: 10px; }
.bars-list .row b { font-weight: 500; }
.bars-list .row .muted { font-size: 13px; }
.bars-list .row .usd { margin-left: auto; font-weight: 600; }
.bars-list .meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bars-list .meter span { display: block; height: 100%; border-radius: 3px; background: var(--coin, var(--good)); }

.heatmap { display: grid; grid-template-columns: 36px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; }
.heatmap .day { color: var(--ink-3); font-size: 12px; }
.heatmap .cell { aspect-ratio: 1; min-height: 10px; border-radius: 3px; background: var(--surface-2); }
:is(.heatmap, .heat-scale) [data-level="1"] { background: rgba(46, 189, 122, .22); }
:is(.heatmap, .heat-scale) [data-level="2"] { background: rgba(46, 189, 122, .42); }
:is(.heatmap, .heat-scale) [data-level="3"] { background: rgba(46, 189, 122, .68); }
:is(.heatmap, .heat-scale) [data-level="4"] { background: var(--good); }
.heatmap .hour { color: var(--ink-3); font-size: 12px; }
.heat-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; color: var(--ink-2); font-size: 13px; flex-wrap: wrap; }
.heat-scale { display: flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 12px; }
.heat-scale i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-2); }

.stack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; margin-bottom: 14px; background: var(--surface-2); }
.stack span { min-width: 3px; background: var(--tone); }
.legend-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.legend-list .n { margin-left: auto; font-weight: 600; }
.legend-list .pct { color: var(--ink-3); width: 44px; text-align: right; font-size: 13px; }

.ranking li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ranking li:last-child { border-bottom: 0; }
.ranking .rank { color: var(--ink-3); font-size: 13px; }
.ranking .who { min-width: 0; }
.ranking .who small { display: block; color: var(--ink-3); font-size: 12px; margin-left: 30px; }
.ranking .usd { font-weight: 600; }

/* ── Deal page ───────────────────────────── */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; margin-bottom: 18px; font-weight: 500; }
.back:hover { color: var(--ink); }
.back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.deal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.deal-head h1 { font-size: 36px; letter-spacing: -0.035em; }
.deal-head .lede { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.deal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.frozen-bar {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 20px; border-radius: var(--r);
  background: var(--frozen-soft); color: #A9DDF3;
}
.frozen-bar svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--frozen); stroke-width: 1.6; stroke-linecap: round; }
.frozen-bar strong { color: var(--ink); font-weight: 600; }
.deal-track { margin-bottom: 24px; }
.deal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.deal-main { display: grid; gap: 20px; min-width: 0; }
.deal-side { display: grid; gap: 20px; position: sticky; top: 84px; }
.callout { padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: #F3BE6B; margin-bottom: 20px; }
.callout.bad { background: var(--bad-soft); color: #F68A85; }
.facts { display: grid; grid-template-columns: 130px minmax(0, 1fr); }
.facts dt, .facts dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts > :nth-last-child(-n+2) { border-bottom: 0; }
.facts dt { color: var(--ink-2); }
.facts dd { min-width: 0; overflow-wrap: anywhere; }
.facts .person { color: var(--ink); }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.timeline li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 12px; padding: 9px 0; position: relative; }
.timeline li::before { content: ""; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--dot, #4A525C); }
.timeline li + li::after { content: ""; position: absolute; left: 3.5px; top: -9px; height: 15px; width: 1px; background: var(--line); }
.timeline time { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.person img, .person i { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); flex: none; }
.person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.payout { display: grid; gap: 16px; }
.payout .segmented { justify-self: start; }
.payout input { width: 100%; }
.side-note { color: var(--ink-2); }
.side-note strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.hint { color: var(--ink-3); font-size: 13px; }
.form-error { color: var(--bad); font-weight: 500; }
.form-error:empty { display: none; }

/* ── Forms and buttons ───────────────────── */
.filters { display: flex; align-items: end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; }
.field.grow { flex: 1 1 320px; }
.field-label { color: var(--ink-2); font-size: 13px; font-weight: 500; }
input, select {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--ground); color: var(--ink); font: inherit; caret-color: var(--good);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder { color: var(--ink-3); }
input:hover, select:hover { border-color: #3A4048; }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--live); box-shadow: 0 0 0 3px rgba(143, 180, 255, .2); }
.button {
  height: 38px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--surface-3); color: var(--ink);
  font: 600 14px/1 var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; white-space: nowrap; transition: background-color .15s var(--ease), opacity .15s var(--ease), transform .1s var(--ease);
}
.button:hover { background: #343A42; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.button.primary { background: var(--good); color: #05150D; }
.button.primary:hover { background: #3ACB87; }
.button.danger { background: var(--bad); color: #1E0504; }
.button.danger:hover { background: #F4746F; }
.button.freeze { background: var(--frozen-soft); color: #A9DDF3; }
.button.freeze:hover { background: rgba(111, 195, 232, .2); }
.button.freeze.confirming { background: var(--frozen); color: #062030; }
.button.small { height: 30px; padding: 0 10px; font-size: 13px; font-weight: 500; }
.button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.button.is-busy { pointer-events: none; opacity: .65; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 20; transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--ground); font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6); animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

/* ── Saved chat ──────────────────────────── */
.chat { padding: 8px 0; }
.chat-log { display: grid; }
.chat-day { display: flex; align-items: center; gap: 12px; padding: 14px 20px 6px; color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chat-msg { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 10px 20px 4px; }
.chat-msg.cont { padding-top: 2px; }
.chat-msg:hover { background: rgba(255, 255, 255, .018); }
.chat-avatar img, .chat-avatar i { display: block; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); }
.chat-gutter { color: transparent; font-size: 11px; text-align: right; padding-top: 3px; white-space: nowrap; }
.chat-msg.cont:hover .chat-gutter { color: var(--ink-3); }
.chat-main { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.chat-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-meta strong { font-weight: 600; }
.chat-meta time { color: var(--ink-3); font-size: 12.5px; }
.chat-role { font-size: 11.5px; font-weight: 600; line-height: 18px; padding: 0 7px; border-radius: 5px; background: var(--surface-3); color: var(--ink-2); }
.chat-role.role-sender, .chat-role.role-receiver { color: var(--ink); }
.chat-role.role-staff { background: rgba(143, 180, 255, .14); color: var(--live); }
.chat-role.role-bot { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); }
.chat-text, .chat-embed-desc, .chat-fields dd { white-space: pre-line; overflow-wrap: anywhere; }
.chat-edited { color: var(--ink-3); font-size: 12px; }
.chat-used { color: var(--ink-3); font-size: 13px; }
.chat-main code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; padding: 1px 5px; border-radius: 4px; background: var(--ground); }
.chat-main pre { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--ground); white-space: pre-wrap; }
.chat-main pre code { padding: 0; background: none; }
.chat-main blockquote { margin: 0; padding-left: 10px; border-left: 3px solid var(--surface-3); color: var(--ink-2); }
.chat-main a { color: var(--live); }
.mention { color: #C9D7FF; background: rgba(143, 180, 255, .14); border-radius: 4px; padding: 0 3px; font-weight: 500; }
img.emoji { width: 1.25em; height: 1.25em; vertical-align: -0.25em; }
.chat-embed {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; max-width: 540px; width: 100%;
  padding: 12px 14px 12px 16px; border-radius: 8px; background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--bar, var(--surface-3));
}
.chat-embed-text { display: grid; gap: 6px; min-width: 0; align-content: start; }
.chat-embed-author { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.chat-embed-title { font-weight: 600; }
.chat-embed-desc { color: var(--ink-2); }
.chat-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; margin-top: 2px; }
.chat-fields .wide { grid-column: 1 / -1; }
.chat-fields dt { font-size: 12.5px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.chat-fields dd { color: var(--ink-2); }
.chat-embed-thumb { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; }
.chat-embed-image { max-width: 100%; border-radius: 6px; margin-top: 4px; }
.chat-embed-footer { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.chat-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-button { font-size: 12.5px; font-weight: 500; line-height: 26px; padding: 0 10px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); }
.chat-button.tone-success { background: rgba(46, 189, 122, .14); color: #6FD9A6; }
.chat-button.tone-danger { background: var(--bad-soft); color: #F68A85; }
.chat-button.tone-primary { background: rgba(143, 180, 255, .14); color: var(--live); }
.chat-file a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.chat-file svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.chat-people ul { display: grid; }
.chat-people li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.chat-people li .muted { min-width: 80px; text-align: right; }
.chat-note { margin-top: 14px; color: var(--ink-3); font-size: 13px; }

/* ── Authenticator setup and Settings ────── */
.setup { max-width: 520px; margin: 24px auto; padding: 28px; display: grid; gap: 18px; justify-items: start; }
.steps { counter-reset: step; display: grid; gap: 22px; width: 100%; }
.steps > li { position: relative; padding-left: 38px; counter-increment: step; display: grid; gap: 6px; justify-items: start; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; background: var(--surface-3); font-size: 13px; font-weight: 600;
}
.steps strong { font-weight: 600; }
.steps p { color: var(--ink-2); }
.qr { display: block; margin: 8px 0 4px; padding: 8px; width: 176px; height: 176px; border-radius: 10px; background: #fff; }
.setup-key { color: var(--ink-3); overflow-wrap: anywhere; }
.code-form { display: grid; gap: 10px; width: 100%; max-width: 280px; }
.code-form .form-error:empty { display: none; }
.code-form input { letter-spacing: .12em; }
.settings { display: grid; gap: 20px; max-width: 760px; }
.settings .button + .hint { margin-top: 12px; }
.settings .text-button { margin-top: 12px; }
.muted-text { color: var(--ink-2); margin-bottom: 14px; max-width: 62ch; }
.staff-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(150px, auto); align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.staff-list li:last-child { border-bottom: 0; }
.staff-list .inline-actions { justify-content: flex-end; margin: 0; }
.staff-confirm { grid-column: 1 / -1; padding: 4px 0 6px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── Narrow screens ──────────────────────── */
@media (max-width: 1200px) {
  .overview { grid-template-columns: minmax(0, 1fr) 340px; }
  .thead, .deal-row { grid-template-columns: 56px minmax(150px, 1.2fr) minmax(130px, 1fr) 92px minmax(110px, .9fr) 80px; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis div:nth-child(4) { border-left: 0; }
  .kpis div:nth-child(n+4) { border-top: 1px solid var(--line); }
  .analytics { grid-template-columns: minmax(0, 1fr) 340px; }
  .deal-grid { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 980px) {
  .overview, .deal-grid { grid-template-columns: minmax(0, 1fr); }
  .overview { grid-template-areas: "deals" "side" "chart" "finished"; }
  .deal-side { position: static; }
  .analytics { grid-template-columns: minmax(0, 1fr); grid-template-areas: "volume" "coins" "outcomes" "heat" "top"; }
  .quick-search { display: none; }
}
@media (max-width: 720px) {
  .topbar-inner { padding: 0 16px; gap: 10px; }
  .account { display: none; }
  .tabs { margin-left: auto; }
  .tab { padding: 0 8px; }
  .page { padding: 22px 16px 56px; }
  h1 { font-size: 24px; }
  .deal-head h1 { font-size: 30px; }
  .card { padding: 16px; }
  .setup { margin: 0; padding: 20px 16px; }
  .staff-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .staff-list .inline-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .table { margin: 0 -16px -6px; }
  .thead { display: none; }
  .deal-row {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "no age" "people people" "amount status" "track track";
    row-gap: 10px; padding: 14px 16px;
  }
  .deal-row > .deal-no { grid-area: no; }
  .deal-row > .people { grid-area: people; }
  .deal-row > .amount-cell { grid-area: amount; }
  .deal-row > .track { grid-area: track; }
  .deal-row > .status { grid-area: status; justify-self: end; }
  .deal-row > .age { grid-area: age; }
  .issue { grid-template-columns: 4px minmax(0, 1fr); row-gap: 8px; }
  .issue-side { grid-column: 2; display: flex; align-items: center; gap: 12px; }
  .mini-row { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .mini-row .age { display: none; }
  .facts { grid-template-columns: 104px minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis div:nth-child(n) { border-left: 0; border-top: 0; }
  .kpis div:nth-child(even) { border-left: 1px solid var(--line); }
  .kpis div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .kpis dd { font-size: 20px; }
  .heatmap { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 2px; }
  .heatmap .cell { border-radius: 2px; min-height: 8px; }
  .deal-actions { width: 100%; }
  .deal-actions .button { flex: 1; }
  .chat-msg { grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding-left: 14px; padding-right: 14px; }
  .chat-avatar img, .chat-avatar i { width: 30px; height: 30px; }
  .chat-gutter { visibility: hidden; }
  .chat-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-embed-thumb { width: 48px; height: 48px; }
}
