/* Vipra Reach — brand: black, white, purple · type: Hanken Grotesk
   Light ("paper") is the default; dark ("night", true black) follows the system or the toggle. */
:root {
  --bg: #f4f3f7; --side: #fbfafd; --panel: #ffffff; --panel2: #f6f5fa; --line: #e6e3ed; --line2: #d8d4e2; --track: #ebe8f1;
  --text: #16131d; --strong: #08060c; --muted: #575269; --dim: #8a8599;
  --accent: #6d28d9; --accent-hi: #5b21b6; --accent-soft: #f1ebff; --accent-text: #5b21b6; --accent-line: #c9b5f5;
  --ok: #10a35a; --ok-soft: #e5f6ed; --ok-text: #0a7a42;
  --warn: #d48806; --warn-soft: #fdf3df; --warn-text: #8f5600;
  --bad: #d63b3b; --bad-soft: #fdeceb; --bad-text: #b42323;
  --info: #0284c7; --info-soft: #e5f3fb; --info-text: #036399;
  --input: #ffffff; --rowhover: #faf9fc; --overlay: rgba(22, 19, 29, .42);
  --win: #efe8ff; --bubble-in: #f1f0f5; --bubble-out: #ece3ff; --bubble-fu: #f4efff; --bubble-meta: #6c6189;
  --code-bg: #f7f5fc; --code-text: #4c1d95;
  --shadow: 0 1px 2px rgba(22, 19, 29, .05);
  --shadow-pop: 0 18px 50px rgba(22, 19, 29, .18);
  --r: 14px;
  --font: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000; --side: #07060a; --panel: #111018; --panel2: #1a1823; --line: #24212f; --line2: #353046; --track: #221f2d;
  --text: #f1eff6; --strong: #ffffff; --muted: #a6a1b5; --dim: #716b84;
  --accent: #7c3aed; --accent-hi: #8b5cf6; --accent-soft: rgba(124, 58, 237, .18); --accent-text: #c4b5fd; --accent-line: rgba(139, 92, 246, .5);
  --ok: #22c55e; --ok-soft: rgba(34, 197, 94, .14); --ok-text: #86efac;
  --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .14); --warn-text: #fcd34d;
  --bad: #ef4444; --bad-soft: rgba(239, 68, 68, .14); --bad-text: #fca5a5;
  --info: #38bdf8; --info-soft: rgba(56, 189, 248, .14); --info-text: #7dd3fc;
  --input: #0b0a10; --rowhover: rgba(255, 255, 255, .02); --overlay: rgba(0, 0, 0, .72); --win: rgba(124, 58, 237, .11);
  --bubble-in: #1a1823; --bubble-out: #2b1c50; --bubble-fu: #221a35; --bubble-meta: #a497c4;
  --code-bg: #0b0a10; --code-text: #ddd6fe;
  --shadow: none; --shadow-pop: 0 24px 80px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --side: #07060a; --panel: #111018; --panel2: #1a1823; --line: #24212f; --line2: #353046; --track: #221f2d;
    --text: #f1eff6; --strong: #ffffff; --muted: #a6a1b5; --dim: #716b84;
    --accent: #7c3aed; --accent-hi: #8b5cf6; --accent-soft: rgba(124, 58, 237, .18); --accent-text: #c4b5fd; --accent-line: rgba(139, 92, 246, .5);
    --ok: #22c55e; --ok-soft: rgba(34, 197, 94, .14); --ok-text: #86efac;
    --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .14); --warn-text: #fcd34d;
    --bad: #ef4444; --bad-soft: rgba(239, 68, 68, .14); --bad-text: #fca5a5;
    --info: #38bdf8; --info-soft: rgba(56, 189, 248, .14); --info-text: #7dd3fc;
    --input: #0b0a10; --rowhover: rgba(255, 255, 255, .02); --overlay: rgba(0, 0, 0, .72); --win: rgba(124, 58, 237, .11);
    --bubble-in: #1a1823; --bubble-out: #2b1c50; --bubble-fu: #221a35; --bubble-meta: #a497c4;
    --code-bg: #0b0a10; --code-text: #ddd6fe;
    --shadow: none; --shadow-pop: 0 24px 80px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--strong); }
.ic { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ layout */
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); padding: 18px 12px 14px; display: flex;
  flex-direction: column; gap: 2px; background: var(--side); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 18px; font-weight: 750; font-size: 16px; letter-spacing: -.015em; color: var(--strong); }
.brand:hover { color: var(--strong); }
.mark { width: 30px; height: 30px; border-radius: 9px; background: var(--strong); color: var(--bg); display: grid; place-items: center;
  font-size: 12px; font-weight: 800; letter-spacing: .01em; flex: none; position: relative; }
.mark::after { content: ''; position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--side); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 560; }
.nav a:hover { background: var(--panel2); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--strong); }
.nav a.on svg { color: var(--accent-text); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; padding: 0 7px; border-radius: 99px; font-weight: 700; line-height: 18px; }
.side .foot { margin-top: auto; padding: 10px 6px 0; font-size: 12.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.main { min-width: 0; padding: 28px 36px 72px; max-width: 1340px; width: 100%; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
h1 { font-size: 27px; letter-spacing: -.03em; margin: 0; font-weight: 750; line-height: 1.15; color: var(--strong); }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 680; letter-spacing: -.01em; color: var(--strong); }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 650; color: var(--muted); }
.sub { color: var(--muted); margin-top: 5px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; box-shadow: var(--shadow); }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 16px; }
.grid > .card, .grid > div > .card:first-child, .grid > details { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

/* ------------------------------------------------------------------ kpis */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 27px; font-weight: 750; letter-spacing: -.03em; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.15; color: var(--strong); }
.kpi .s { font-size: 12.5px; color: var(--dim); margin-top: 2px; }
.kpi.hl { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), var(--panel) 70%); }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line2); background: var(--panel);
  color: var(--text); padding: 8px 14px; border-radius: 10px; font: 650 13px var(--font); cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { border-color: var(--dim); color: var(--strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: #fff; }
.btn.danger { color: var(--bad-text); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ok { color: var(--ok-text); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn svg { width: 15px; height: 15px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; color: var(--accent-text); cursor: pointer; font: inherit; padding: 0; }

/* ------------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 99px;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line2); white-space: nowrap; line-height: 1.5; }
.badge.ok { background: var(--ok-soft); color: var(--ok-text); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad-text); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info-text); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.badge.won { background: linear-gradient(90deg, var(--ok-soft), var(--accent-soft)); color: var(--strong); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.dot.live { box-shadow: 0 0 0 0 currentColor; animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); } 70% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

/* ------------------------------------------------------------------ tables */
.tablewrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; color: var(--dim); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--rowhover); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; } .b { font-weight: 650; } .nowrap { white-space: nowrap; }
.green { color: var(--ok-text); } .red { color: var(--bad-text); } .amber { color: var(--warn-text); } .violet { color: var(--accent-text); }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; } .mt0 { margin-top: 0; }
.stack > * + * { margin-top: 10px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.num-t { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ forms */
input, select, textarea { width: 100%; background: var(--input); border: 1px solid var(--line2); color: var(--text); border-radius: 10px;
  padding: 9px 11px; font: 14px var(--font); }
input::placeholder, textarea::placeholder { color: var(--dim); }
input[type=file] { padding: 7px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: 13px; min-height: 220px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 5px; }
.field { margin-bottom: 14px; min-width: 0; }
.hint { font-size: 12px; color: var(--dim); margin-top: 5px; line-height: 1.45; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 550; font-size: 14px; cursor: pointer; margin: 0; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; padding: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.row > .fit { flex: 0 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 600 12px var(--mono); background: var(--panel2); border: 1px solid var(--line2); color: var(--accent-text); padding: 3px 8px;
  border-radius: 7px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { margin: 0; }
.days input { display: none; }
.days span { display: inline-block; padding: 6px 11px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2);
  color: var(--muted); font-weight: 650; font-size: 12.5px; cursor: pointer; }
.days input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--strong); }
details.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
details.box > summary { padding: 14px 18px; font-weight: 650; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary::before { content: '+'; color: var(--accent-text); font-weight: 800; width: 14px; }
details.box[open] > summary::before { content: '–'; }
details.box > .inner { padding: 0 18px 18px; }

/* ------------------------------------------------------------------ flash + notes */
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-weight: 560; }
.flash.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok-text); }
.flash.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad-text); }
.flash.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-text); }
.note { padding: 12px 14px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); font-size: 13px; }
.note.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-text); }
.note.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }

/* ------------------------------------------------------------------ progress + chart */
.progress { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; min-width: 80px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.progress.ok i { background: var(--ok); } .progress.warn i { background: var(--warn); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.chart .bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; }
.chart .b { width: 42%; max-width: 12px; border-radius: 4px 4px 1px 1px; background: var(--accent); min-height: 2px; }
.chart .b.r { background: var(--ok); }
.chart .col.today .x { color: var(--strong); font-weight: 700; }
.chart .x { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ------------------------------------------------------------------ list items */
.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
a.li { color: inherit; }
a.li:hover .b { color: var(--accent-text); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ modal */
.modal { position: fixed; inset: 0; background: var(--overlay); display: none; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(3px); }
.modal.open { display: grid; }
.modal .box { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; padding: 22px; width: min(430px, 100%); box-shadow: var(--shadow-pop); }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 264px; height: 264px; margin: 14px auto; display: grid; place-items: center; color: #555;
  text-align: center; font-size: 13px; border: 1px solid var(--line); }
.qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.pair { font: 700 28px var(--mono); letter-spacing: .18em; text-align: center; padding: 14px; background: var(--panel2); border-radius: 12px; margin: 12px 0; color: var(--strong); }

/* ------------------------------------------------------------------ sender cards */
.senders { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.senders > .card { margin-top: 0; display: flex; flex-direction: column; }
.senders > .card details { margin-top: auto; padding-top: 12px; }
.senders + .card, .senders + form { margin-top: 16px; }
.sender .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.sender .top > div:first-child { min-width: 0; }
.sender .top .mono { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dim); font-size: 11.5px; }
.sender .name { font-size: 16px; font-weight: 720; letter-spacing: -.015em; color: var(--strong); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 12px; }
.stats3 > div { background: var(--panel2); border-radius: 10px; padding: 9px 10px; }
.stats3 .v { font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--strong); }
.stats3 .l { font-size: 11.5px; color: var(--dim); font-weight: 600; line-height: 1.3; }
.botpick { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.botpick label { margin: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.botpick select { padding: 6px 30px 6px 10px; font-size: 13px; }
.botrow { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.bhead2 { display: flex; align-items: center; gap: 12px; }
.bhead2 .grow { flex: 1; }
.botadd { border: 1px dashed var(--line2); border-radius: 12px; padding: 12px 14px; }
.botadd > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; color: var(--accent-text); }
.botadd > summary::-webkit-details-marker { display: none; }
.howto { margin: 0 0 12px; padding-left: 18px; }
.howto li + li { margin-top: 3px; }
.health { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: -2px 0 10px; }
.health b { color: var(--strong); font-weight: 700; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-size: 17px; color: var(--strong); font-weight: 680; margin-bottom: 6px; }
.steps { counter-reset: s; display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.steps a { counter-increment: s; display: block; padding: 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); }
.steps a::before { content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; margin-bottom: 10px; }
.steps a:hover { border-color: var(--accent); }

.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); padding: 4px; border-radius: 11px; width: max-content; max-width: 100%; overflow-x: auto; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 620; font-size: 13px; white-space: nowrap; }
.tabs a.on { background: var(--accent-soft); color: var(--strong); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 14px; }

/* ------------------------------------------------------------------ inbox */
.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }
.convs { padding: 6px; max-height: calc(100vh - 170px); overflow-y: auto; }
.conv { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); position: relative; }
.conv:hover { background: var(--panel2); color: var(--text); }
.conv.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.conv .t1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 680; color: var(--strong); }
.conv .t2 { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.conv.unread .t1 > span:first-child::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  margin-right: 7px; vertical-align: 2px; }
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; padding: 6px 2px 10px; }
.msg { max-width: 80%; padding: 9px 12px; border-radius: 14px; overflow-wrap: anywhere; }
.msg .body { white-space: pre-wrap; }
.msg.in { background: var(--bubble-in); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: var(--bubble-out); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg .meta { font-size: 11px; color: var(--dim); margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.msg.out .meta { color: var(--bubble-meta); justify-content: flex-end; }
.ticks.read { color: var(--info); }
.bubble { background: var(--bubble-out); padding: 10px 12px; border-radius: 14px; border-bottom-right-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.fu { background: var(--bubble-fu); }
.sticky { position: sticky; top: 20px; }
.mback { display: none; }
.kbdhint { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--dim); margin-top: 10px; }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(60% 50% at 50% 0%, var(--accent-soft), transparent 70%), var(--bg); }
.login .card { width: min(380px, 100%); padding: 28px; }

/* ------------------------------------------------------------------ navigation extras, palette, toasts */
.searchbtn { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--panel); color: var(--dim); font: 500 13px var(--font); cursor: pointer; text-align: left; }
.searchbtn:hover { color: var(--text); border-color: var(--dim); }
.searchbtn span { flex: 1; }
kbd { font: 600 10.5px var(--mono); background: var(--panel2); border: 1px solid var(--line2); border-radius: 5px; padding: 1px 5px; color: var(--muted); }
.navgroup { font-size: 12px; color: var(--dim); font-weight: 650; padding: 14px 10px 4px; }
.livedot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.pill { background: var(--accent); color: #fff; font-size: 10.5px; padding: 0 6px; border-radius: 99px; margin-left: 3px; }
.themebtn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel);
  color: var(--muted); cursor: pointer; padding: 0; }
.themebtn:hover { color: var(--strong); border-color: var(--dim); }
.themebtn svg { width: 16px; height: 16px; }
.themebtn .moon { display: none; }
:root[data-theme="dark"] .themebtn .sun { display: none; }
:root[data-theme="dark"] .themebtn .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .themebtn .sun { display: none; }
  :root:not([data-theme="light"]) .themebtn .moon { display: block; }
}

.palette { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); z-index: 60; display: none; justify-content: center; padding: 12vh 16px 16px; }
.palette.open { display: flex; }
.pbox { width: min(620px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; overflow: hidden; height: max-content;
  box-shadow: var(--shadow-pop); }
.pbox > input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px 18px; font-size: 16px; background: transparent; }
.pbox > input:focus { box-shadow: none; }
.plist { max-height: 52vh; overflow-y: auto; padding: 6px; }
.pitem { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text); cursor: pointer; }
.pitem.sel, .pitem:hover { background: var(--accent-soft); color: var(--strong); }
.pitem .k { margin-left: auto; font-size: 11.5px; color: var(--dim); }
.psec { font-size: 12px; color: var(--dim); font-weight: 650; padding: 8px 12px 4px; }
.phint { border-top: 1px solid var(--line); padding: 8px 14px; font-size: 11.5px; color: var(--dim); }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 70; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 36px)); }
.toast { background: var(--panel); border: 1px solid var(--line2); border-left: 3px solid var(--accent); border-radius: 12px; padding: 12px 14px;
  box-shadow: var(--shadow-pop); color: var(--text); animation: tin .25s ease-out; display: block; }
.toast:hover { color: var(--text); border-color: var(--dim); }
.toast .tt { font-weight: 700; font-size: 13px; color: var(--strong); }
.toast .tb { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ dashboard */
.today { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.tcard { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; color: var(--text); }
.tcard:hover { border-color: var(--dim); color: var(--text); }
.tcard.hot { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), var(--panel) 75%); }
.tcard .tl { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tcard .tv { font-size: 26px; font-weight: 750; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tcard .ts { font-size: 12px; color: var(--dim); }
.tick { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); color: var(--dim); display: grid;
  place-items: center; cursor: pointer; padding: 0; flex: none; }
.tick:hover { color: var(--ok-text); border-color: var(--ok); }

/* attention bar: one strip, four reasons to act */
.attn { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.attn a { display: block; padding: 14px 18px; color: var(--text); border-left: 1px solid var(--line); position: relative; }
.attn a:first-child { border-left: 0; }
.attn a:hover { background: var(--rowhover); color: var(--text); }
.attn .al { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.attn .av { font-size: 30px; font-weight: 780; letter-spacing: -.035em; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--strong); }
.attn .as { font-size: 12px; color: var(--dim); margin-top: 1px; }
.attn a.zero .av { color: var(--dim); font-weight: 600; }
.attn a.act::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--accent); }
.attn a.alarm::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--bad); }
.attn a.alarm .av { color: var(--bad-text); }

/* setup checklist */
.setup { border-color: var(--accent-line); }
.setup .bar { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; margin: 2px 0 14px; }
.setup .bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.setup ol { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.setup li a { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); height: 100%; }
.setup li a:hover { border-color: var(--accent); color: var(--text); }
.setup .sq { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line2); flex: none; display: grid; place-items: center; margin-top: 1px;
  font-size: 11px; font-weight: 800; color: var(--dim); font-variant-numeric: tabular-nums; }
.setup li.done .sq { background: var(--ok); border-color: var(--ok); color: #fff; }
.setup li.done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line2); }
.setup .t { font-weight: 680; color: var(--strong); }
.setup .d { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

/* today's run — one lane per number across the day */
.run { padding-bottom: 12px; }
.run .lanes { display: grid; grid-template-columns: 168px minmax(0, 1fr) 76px; row-gap: 0; align-items: center; }
.run .who { padding: 9px 12px 9px 0; min-width: 0; }
.run .who .n { font-weight: 680; color: var(--strong); font-size: 13px; }
.run .who .p { font-size: 11.5px; color: var(--dim); }
.run .lane { position: relative; height: 34px; border-radius: 8px; background: var(--panel2); overflow: hidden; }
.run .win { position: absolute; top: 0; bottom: 0; background: var(--win); border-left: 1px dashed var(--accent-line); border-right: 1px dashed var(--accent-line); }
.run .lane.off { background: repeating-linear-gradient(-45deg, var(--panel2) 0 6px, var(--track) 6px 12px); }
.run .lane.off .win { background: transparent; }
.run .s { position: absolute; top: 9px; bottom: 9px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--accent); }
.run .s.f { background: var(--bad); }
.run .rp { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 2px var(--panel2); }
.run .now { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--strong); z-index: 2; }
.run .cnt { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; color: var(--strong); padding-left: 10px; }
.run .cnt small { display: block; font-weight: 500; font-size: 11px; color: var(--dim); }
.run .lanes > div:nth-last-child(-n+3) { }
.run .axis { position: relative; height: 18px; font-size: 10.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.run .axis span { position: absolute; transform: translateX(-50%); top: 3px; }
.run .rowgap { grid-column: 1 / -1; height: 6px; }
.run .foot { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.run .foot i { display: inline-block; vertical-align: -1px; margin-right: 6px; }
.run .foot .k1 { width: 3px; height: 11px; background: var(--accent); border-radius: 2px; }
.run .foot .k2 { width: 9px; height: 9px; background: var(--ok); border-radius: 50%; }
.run .foot .k3 { width: 14px; height: 10px; background: var(--win); border: 1px dashed var(--accent-line); border-radius: 3px; }
.run .foot .k4 { width: 2px; height: 12px; background: var(--strong); }
.perf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: -4px 0 14px; }
.perf > div { padding: 0 14px; border-left: 1px solid var(--line); }
.perf > div:first-child { padding-left: 0; border-left: 0; }
.perf .v { font-size: 22px; font-weight: 760; letter-spacing: -.03em; color: var(--strong); font-variant-numeric: tabular-nums; line-height: 1.2; }
.perf .l { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ leads: quick views */
.views { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.views a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line2);
  background: var(--panel); color: var(--muted); font-weight: 620; font-size: 13px; }
.views a:hover { color: var(--strong); border-color: var(--dim); }
.views a.on { background: var(--strong); border-color: var(--strong); color: var(--bg); }
.views a b { font-weight: 700; font-variant-numeric: tabular-nums; opacity: .7; }
details.filters > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 650; color: var(--strong); }
details.filters > summary::-webkit-details-marker { display: none; }
details.filters > summary .ic { transition: transform .15s; }
details.filters[open] > summary .ic { transform: rotate(90deg); }
details.filters[open] > summary { margin-bottom: 12px; }
.wa { font-size: 11px; font-weight: 700; margin-left: 4px; }

/* ------------------------------------------------------------------ inbox extras */
.srcb { color: var(--accent-text); }
.draftbox { border: 1px dashed var(--accent-line); background: var(--accent-soft); border-radius: 12px; padding: 12px; }
.chip.snip { font-family: var(--font); color: var(--text); }

/* ------------------------------------------------------------------ pipeline board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.bcol { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.bhead { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bdrop { padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 120px; flex: 1; border-radius: 0 0 var(--r) var(--r); transition: background .15s; }
.bdrop.over { background: var(--accent-soft); }
.bcard { display: block; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 11px; color: var(--text); cursor: grab; }
.bcard:hover { border-color: var(--dim); color: var(--text); }
.bcard.dragging { opacity: .4; }
.bcard .clamp { margin-top: 5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bmeta { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.bempty { border: 1px dashed var(--line2); border-radius: 10px; padding: 18px; text-align: center; color: var(--dim); font-size: 12.5px; }

/* ------------------------------------------------------------------ agent page */
pre.code { background: var(--code-bg); border: 1px solid var(--line2); border-radius: 10px; padding: 12px 14px; font: 12.5px/1.55 var(--mono); color: var(--code-text);
  overflow-x: auto; margin: 6px 0 0; white-space: pre; }
pre.code.tiny { font-size: 11.5px; white-space: pre-wrap; word-break: break-word; }
.copyrow { display: flex; gap: 6px; }
.copyrow input { font-family: var(--mono); font-size: 12.5px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line2); border-radius: 10px; margin: 0 0 8px;
  color: var(--muted); font-weight: 500; cursor: pointer; }
.radio input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.radio b { color: var(--strong); }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.recipes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.recipe { background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.snipcard { background: var(--panel2); border: 1px solid var(--line2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.snipcard.new { border-style: dashed; }
code { font-family: var(--mono); font-size: .92em; color: var(--accent-text); }
.toolgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

/* ------------------------------------------------------------------ mobile: top bar + bottom tabs */
.mtop, .tabbar, .sheet { display: none; }

@media (max-width: 1100px) {
  .setup ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run .lanes { grid-template-columns: 128px minmax(0, 1fr) 64px; }
}
@media (max-width: 1000px) {
  .g-wide { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .today { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recipes { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { display: block; }
  .side { display: none; }
  .mtop { display: flex; position: sticky; top: 0; z-index: 30; align-items: center; gap: 8px; padding: 10px 16px; background: var(--side);
    border-bottom: 1px solid var(--line); }
  .mtop .brand { padding: 0; margin-right: auto; font-size: 15px; }
  .mtop .iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line2);
    background: var(--panel); color: var(--muted); padding: 0; cursor: pointer; }
  .mtop .iconbtn svg { width: 17px; height: 17px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--side);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font: 600 10.5px var(--font); color: var(--dim);
    background: none; border: 0; padding: 4px 0; cursor: pointer; position: relative; }
  .tabbar svg { width: 21px; height: 21px; }
  .tabbar .on { color: var(--accent-text); }
  .tabbar .count { position: absolute; top: 0; left: calc(50% + 6px); background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
    line-height: 16px; min-width: 16px; padding: 0 4px; border-radius: 99px; }
  .sheet { position: fixed; inset: 0; z-index: 45; background: var(--overlay); align-items: flex-end; }
  .sheet.open { display: flex; }
  .sheet .panel { width: 100%; background: var(--panel); border-radius: 18px 18px 0 0; padding: 10px 12px calc(76px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-pop); }
  .sheet .grab { width: 40px; height: 4px; border-radius: 99px; background: var(--line2); margin: 2px auto 10px; }
  .sheet nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .sheet nav a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 12px; background: var(--panel2);
    color: var(--text); font-weight: 620; font-size: 12.5px; text-align: center; }
  .sheet nav a.on { background: var(--accent-soft); color: var(--strong); }
  .sheet nav svg { width: 20px; height: 20px; color: var(--accent-text); }
  .sheet .row2 { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px 0; font-size: 13px; }
  .main { padding: 18px 16px calc(88px + env(safe-area-inset-bottom)); }
  .g2, .g3, .steps { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .convs { max-height: 260px; }
  h1 { font-size: 23px; }
  .head { margin-bottom: 16px; }
  .board { grid-auto-columns: 82vw; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .attn { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attn a:nth-child(3) { border-left: 0; }
  .attn a:nth-child(n+3) { border-top: 1px solid var(--line); }
  .attn .av { font-size: 26px; }
  .setup ol { grid-template-columns: 1fr; }
  .run .lanes { grid-template-columns: 92px minmax(0, 1fr) 46px; }
  .run .who .p { display: none; }
  .run .cnt small { display: none; }
  .perf { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .perf > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .senders { grid-template-columns: 1fr; }
  .run .axis span:nth-child(even) { display: none; }
  .chart .col:not(.today):nth-child(even) .x { visibility: hidden; }
  .setup li.done { display: none; }
  .kbdhint { display: none; }
  .inbox.has-lead .convs { display: none; }
  .mback { display: inline-block; margin: 0 0 10px; font-weight: 650; }
  .views { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 2px; scrollbar-width: none; }
  .views a { flex: none; }
}
