/* Control Room — the owner's cockpit for a team of AI sales agents.
   One hero: the message waiting for your signature. Everything else is a quiet grouped list.
   Signal colours carry meaning everywhere: cobalt = working, amber = waits for you, moss = done, brick = failed. */

:root {
  --bg: #EEF1F4;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --sunk: #E1E5EA;
  --ink: #121820;
  --ink-2: #49535F;
  --ink-3: #6E7883;
  --line: rgba(18, 24, 32, .1);
  --line-strong: rgba(18, 24, 32, .2);
  --cobalt: #2457E6;
  --cobalt-ink: #1E47BF;
  --cobalt-soft: #E3E9FC;
  --amber: #E8900C;
  --amber-ink: #7A4A00;
  --amber-soft: #FFF1D8;
  --amber-edge: #F3CF8A;
  --moss: #1E7B4C;
  --moss-soft: #DDF3E6;
  --brick: #C8372D;
  --brick-soft: #FBE4E1;
  --on-accent: #FFFFFF;
  --shadow-card: 0 1px 2px rgba(18, 24, 32, .06), 0 8px 24px rgba(18, 24, 32, .08);
  --shadow-float: 0 12px 32px rgba(18, 24, 32, .16), 0 1px 3px rgba(18, 24, 32, .08);
  --display: "Bricolage Grotesque", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r-group: 16px;
  --r-row: 12px;
  --r-card: 20px;
  --tab-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0E12; --surface: #161A20; --surface-2: #1D2229; --sunk: #272D36;
    --ink: #EEF1F5; --ink-2: #B4BCC7; --ink-3: #8B94A0;
    --line: rgba(238, 241, 245, .09); --line-strong: rgba(238, 241, 245, .18);
    --cobalt: #6B8CFF; --cobalt-ink: #8FA9FF; --cobalt-soft: #1B2749;
    --amber: #F0AE3C; --amber-ink: #F5C86E; --amber-soft: #2B2211; --amber-edge: #5A4519;
    --moss: #4CC38A; --moss-soft: #12291D; --brick: #FF7B6E; --brick-soft: #33181A;
    --on-accent: #0B1020;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .45);
    --shadow-float: 0 12px 34px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0E12; --surface: #161A20; --surface-2: #1D2229; --sunk: #272D36;
  --ink: #EEF1F5; --ink-2: #B4BCC7; --ink-3: #8B94A0;
  --line: rgba(238, 241, 245, .09); --line-strong: rgba(238, 241, 245, .18);
  --cobalt: #6B8CFF; --cobalt-ink: #8FA9FF; --cobalt-soft: #1B2749;
  --amber: #F0AE3C; --amber-ink: #F5C86E; --amber-soft: #2B2211; --amber-edge: #5A4519;
  --moss: #4CC38A; --moss-soft: #12291D; --brick: #FF7B6E; --brick-soft: #33181A;
  --on-accent: #0B1020;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .45);
  --shadow-float: 0 12px 34px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 var(--text); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 10px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--surface); padding: 10px 14px; border-radius: 10px; }
.skip:focus { left: 8px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 18px; height: 18px; }
svg.i.fill { fill: currentColor; stroke: none; }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 0 var(--line-strong); font: 600 12px/1 var(--text); color: var(--ink-2); }

/* ------------------------------------------------------------------ shell */
.shell { min-height: 100dvh; }
.view { outline: none; padding: calc(var(--safe-t) + 8px) 16px calc(var(--tab-h) + var(--safe-b) + 14px); max-width: 720px; margin: 0 auto; }
.sidebar { display: none; }
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--ink-3); min-height: 44px; }
.tabbar a[aria-current="page"] { color: var(--cobalt-ink); }
.tabbar a[aria-current="page"] svg.i { stroke-width: 2.1; }
.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--amber); color: #1F1600; font-size: 12px; font-weight: 700; line-height: 1; }
.tabbar .badge { position: absolute; top: 5px; left: calc(50% + 6px); }
.hide-desktop { display: inline-flex; }
@media (min-width: 900px) {
  .tabbar, .hide-desktop { display: none; }
  .shell { display: grid; grid-template-columns: 256px 1fr; }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 18px 12px 16px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); }
  .view { max-width: 1180px; width: 100%; padding: 26px 40px 28px; }
  body { font-size: 15.5px; }
}
.sb-head { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.sb-head img { width: 34px; height: 34px; border-radius: 9px; }
.sb-head b { display: block; font: 600 16px/1.2 var(--display); margin-bottom: 4px; }
.sb-nav { display: grid; gap: 2px; }
.sb-nav a { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: 10px; font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.sb-nav a:hover { background: var(--sunk); color: var(--ink); }
.sb-nav a[aria-current="page"] { background: var(--cobalt-soft); color: var(--cobalt-ink); }
.sb-nav a .badge { margin-left: auto; }
.sb-nav a kbd { margin-left: auto; opacity: 0; }
.sb-nav a:hover kbd { opacity: 1; }
.sb-group { margin: 20px 0 6px; padding: 0 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.sb-agents a { font-weight: 450; }
.sb-agents .av { width: 24px; height: 24px; border-radius: 7px; }
.sb-agents .av svg.i { width: 14px; height: 14px; }
.sb-agents .sig { margin-left: auto; }
.sb-foot { margin-top: auto; padding: 14px 4px 0; display: grid; gap: 8px; }
.sb-foot .hint { font-size: 12.5px; color: var(--ink-3); text-align: center; }

/* ------------------------------------------------------------------ type */
.date { margin: 10px 0 2px; font-size: 15px; font-weight: 500; color: var(--ink-3); }
.large-title { margin: 6px 0 4px; font: 700 32px/1.12 var(--display); letter-spacing: -.02em; }
.lede { margin: 0 0 16px; color: var(--ink-2); font-size: 15.5px; max-width: 62ch; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 2px 10px; }
.sec-h h2 { margin: 0; font: 650 20px/1.2 var(--display); letter-spacing: -.01em; }
.sec-h .count { color: var(--ink-3); font: 500 16px var(--text); margin-left: 6px; }
.sec-h .aside { font-size: 14px; color: var(--ink-3); }
.foot { font-size: 13px; color: var(--ink-3); margin: 8px 4px 0; line-height: 1.4; }
.muted { color: var(--ink-3); }
.status-line { margin: 4px 0 14px; font: 700 32px/1.08 var(--display); letter-spacing: -.026em; max-width: 14ch; text-wrap: balance; }
@media (min-width: 900px) { .status-line { font-size: 46px; max-width: 16ch; margin-bottom: 18px; } .large-title { font-size: 30px; } }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.stat { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 84px; padding: 12px 12px 11px; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); text-decoration: none; }
.stat b { font: 700 30px/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; line-height: 1.2; font-weight: 500; color: var(--ink-3); }
.stat::before { content: ""; position: absolute; top: 14px; right: 13px; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.stat.working.on::before { background: var(--cobalt); animation: stat-pulse 1.8s ease-in-out infinite; }
.stat.needs.on { background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber-edge); }
.stat.needs.on span { color: var(--amber-ink); }
.stat.needs.on::before { background: var(--amber); }
.stat.ready.on::before { background: var(--moss); }
.stat:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.stat.needs.on:hover { box-shadow: inset 0 0 0 1px var(--amber); }
@keyframes stat-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .stat.working.on::before { animation: none; } }
@media (min-width: 900px) { .stats { gap: 12px; max-width: 560px; } .stat { min-height: 96px; padding: 14px 16px 13px; } .stat b { font-size: 36px; } .stat span { font-size: 14px; } }
.spend-line { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; color: var(--ink-2); font-size: 14.5px; }
.spend-line .meter { width: 64px; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; font-size: 16px; font-weight: 600; white-space: nowrap; background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); transition: transform .12s ease, background-color .15s ease; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--cobalt); color: var(--on-accent); box-shadow: none; }
.btn.primary:hover { background: var(--cobalt-ink); }
.btn.tint { background: var(--cobalt-soft); color: var(--cobalt-ink); box-shadow: none; }
.btn.good { background: var(--moss); color: #fff; box-shadow: none; }
.btn.danger { color: var(--brick); }
.btn.plain { background: none; box-shadow: none; color: var(--cobalt-ink); padding: 0 10px; }
.btn.plain.danger { color: var(--brick); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }
.btn kbd { margin-left: 2px; background: color-mix(in srgb, currentColor 12%, transparent); color: inherit; box-shadow: none; }
@media (min-width: 900px) { .btn { min-height: 40px; font-size: 15px; } .btn.sm { min-height: 34px; font-size: 14px; } }
@media (max-width: 899px) { .btn kbd { display: none; } }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none; color: var(--cobalt-ink); background: var(--cobalt-soft); }
.icon-btn.stop { color: var(--brick); background: var(--brick-soft); }
.icon-btn.ghost { background: none; color: var(--ink-2); }
.icon-btn svg.i { width: 20px; height: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions.grow > .btn { flex: 1 1 0; }

/* ------------------------------------------------------------------ grouped lists */
.group { background: var(--surface); border-radius: var(--r-group); overflow: hidden; }
.group + .group { margin-top: 12px; }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px; width: 100%; text-align: left; }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 66px; border-top: 1px solid var(--line); }
.row.nolead + .row::before, .row + .row.nolead::before { left: 14px; }
a.row:hover, button.row:hover, .row-main:hover { background: var(--surface-2); }
.row-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: 44px; margin: -10px 0 -10px -14px; padding: 10px 0 10px 14px; border-radius: 0; }
.row[aria-current="true"] { background: var(--cobalt-soft); }
.row .body { flex: 1; min-width: 0; }
.row .t { display: flex; align-items: baseline; gap: 8px; font-weight: 600; font-size: 16px; }
.row .t .when { margin-left: auto; font-weight: 400; font-size: 13.5px; color: var(--ink-3); white-space: nowrap; }
.row .s { color: var(--ink-2); font-size: 14.5px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row .s.one { -webkit-line-clamp: 1; }
.row .s.sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.row .chev { color: var(--ink-3); opacity: .7; }
.row .value { color: var(--ink-2); font-size: 14.5px; white-space: nowrap; }
@media (min-width: 900px) { .row { min-height: 52px; padding: 8px 14px; } .row .t { font-size: 15px; } .row .s { font-size: 14px; } }
#needs, #working, #ready, #pipe-card { scroll-margin-top: 16px; }

/* avatars: agents (icons) and people (initials) */
.av { --h: 220; position: relative; display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: hsl(var(--h) 55% 92%); color: hsl(var(--h) 55% 30%); }
:root[data-theme="dark"] .av { background: hsl(var(--h) 30% 20%); color: hsl(var(--h) 70% 78%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .av { background: hsl(var(--h) 30% 20%); color: hsl(var(--h) 70% 78%); } }
.av svg.i { width: 21px; height: 21px; }
.av.lg { width: 60px; height: 60px; border-radius: 18px; }
.av.lg svg.i { width: 30px; height: 30px; }
.av.xs { width: 22px; height: 22px; border-radius: 7px; }
.av.xs svg.i { width: 13px; height: 13px; stroke-width: 2.1; }
.av.person { border-radius: 50%; font: 700 14px var(--text); letter-spacing: .02em; }
.av.person.lg { font-size: 21px; }
.av.person.xs { font-size: 9px; }
.av.paused { filter: grayscale(1); opacity: .55; }
.av.running::after { content: ""; position: absolute; inset: -4px; border-radius: inherit; padding: 2.5px; background: conic-gradient(from var(--sweep), color-mix(in srgb, var(--cobalt) 12%, transparent), var(--cobalt)); -webkit-mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); animation: sweep 1.6s linear infinite; }
.av.lg.running::after { inset: -5px; padding: 3px; border-radius: 22px; }
.av.queued::after { content: ""; position: absolute; inset: -4px; border-radius: 15px; border: 2px dashed var(--cobalt); opacity: .7; }
.av .pip { position: absolute; right: -4px; bottom: -4px; width: 15px; height: 15px; border-radius: 50%; border: 2.5px solid var(--surface); }
.av .pip.needs { background: var(--amber); }
.av .pip.error { background: var(--brick); }
@property --sweep { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes sweep { to { --sweep: 360deg; } }

/* signal dot + word */
.sig { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.sig::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); opacity: .6; }
.sig.running { color: var(--cobalt-ink); } .sig.running::before { background: var(--cobalt); opacity: 1; animation: pulse 1.6s ease-in-out infinite; }
.sig.queued { color: var(--cobalt-ink); } .sig.queued::before { background: transparent; border: 2px solid var(--cobalt); opacity: 1; width: 9px; height: 9px; }
.sig.needs { color: var(--amber-ink); } .sig.needs::before { background: var(--amber); opacity: 1; }
.sig.error, .sig.failed { color: var(--brick); } .sig.error::before, .sig.failed::before { background: var(--brick); opacity: 1; }
.sig.success, .sig.done { color: var(--moss); } .sig.success::before, .sig.done::before { background: var(--moss); opacity: 1; }
.sig.paused, .sig.idle, .sig.stopped { color: var(--ink-3); }
.sig.dot-only { font-size: 0; gap: 0; }
@keyframes pulse { 50% { opacity: .35; } }

/* channel + intent tags */
.ch { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 700; vertical-align: 2px; white-space: nowrap; }
.ch.li { background: #DCE8FA; color: #0E4E9E; }
.ch.em { background: #DFF2E7; color: #1F6A40; }
:root[data-theme="dark"] .ch.li { background: #1A2F4F; color: #8FB8F0; }
:root[data-theme="dark"] .ch.em { background: #12291D; color: #6FD3A0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ch.li { background: #1A2F4F; color: #8FB8F0; } :root:not([data-theme="light"]) .ch.em { background: #12291D; color: #6FD3A0; } }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; background: var(--sunk); color: var(--ink-2); font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag.good { background: var(--moss-soft); color: var(--moss); }
.tag.warm { background: var(--amber-soft); color: var(--amber-ink); }
.tag.cool { background: var(--cobalt-soft); color: var(--cobalt-ink); }
.tag.bad { background: var(--brick-soft); color: var(--brick); }
.needs-ink { color: var(--amber-ink); font-weight: 600; }
.chips-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; font-size: 14px; }
.camp-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.camp-chip:hover { color: var(--cobalt-ink); box-shadow: inset 0 0 0 1px var(--cobalt); }

/* ------------------------------------------------------------------ Today */
.today-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.hero { padding-top: 4px; }
.hero-actions { margin: 4px 0 2px; }
.today { display: grid; gap: 0; }
@media (min-width: 1200px) {
  .today { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 0 40px; align-items: start; }
  .today .col-b { position: sticky; top: 24px; }
}
.conn { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 12px; border-radius: 16px; background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--moss); }
.conn.off::before { background: var(--ink-3); }
.conn.demo::before { background: var(--amber); }
@media (min-width: 900px) { #t-conn { display: none; } }

/* ------------------------------------------------------------------ the queue: a stack of messages waiting for your OK */
.queue-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 2px 10px; }
.queue-h h2 { margin: 0; font: 650 20px/1.2 var(--display); letter-spacing: -.01em; }
.queue-h .pos { font-size: 14px; color: var(--ink-3); }
.stack { position: relative; }
.stack .qcard { position: relative; z-index: 3; }
.stack .peek { position: absolute; left: 10px; right: 10px; bottom: -7px; height: 20px; border-radius: 0 0 var(--r-card) var(--r-card); background: var(--surface); box-shadow: var(--shadow-card); z-index: 2; opacity: .9; }
.stack .peek.two { left: 20px; right: 20px; bottom: -13px; z-index: 1; opacity: .6; }
.qcard { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card); overflow: hidden; touch-action: pan-y; will-change: transform; user-select: none; -webkit-user-select: none; }
.qcard.animating { transition: transform .32s var(--ease), opacity .32s var(--ease); }
.qcard.enter { animation: card-in .28s var(--ease); }
@keyframes card-in { from { transform: translateY(14px) scale(.98); opacity: .5; } }
.qcard .ovl { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; font: 700 28px/1 var(--display); letter-spacing: -.01em; z-index: 5; transition: opacity .1s linear; }
.qcard .ovl.approve { background: color-mix(in srgb, var(--moss) 16%, transparent); color: var(--moss); }
.qcard .ovl.skip { background: color-mix(in srgb, var(--ink-3) 16%, transparent); color: var(--ink-2); }
.qcard .ovl span { display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-float); }
.qcard .ovl svg.i { width: 28px; height: 28px; stroke-width: 2.4; }
.qcard .q-who { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.qcard .q-who .kind { color: var(--amber-ink); }
.qcard .q-who time { margin-left: auto; font-weight: 400; color: var(--ink-3); font-size: 13px; }
.qcard .q-to { display: flex; align-items: center; gap: 12px; padding: 14px 18px 12px; }
.qcard .q-to .name { font: 650 19px/1.2 var(--display); letter-spacing: -.01em; }
.qcard .q-to .name a { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.qcard .q-to .sub { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.qcard .q-to .ch { margin-left: auto; align-self: flex-start; }
.qcard .q-kind { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 18px 10px; font-size: 13.5px; color: var(--ink-3); }
.qcard .letter { margin: 0 12px; padding: 16px 16px 14px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 16.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); max-height: 46dvh; overflow: auto; }
.qcard .letter .subj { font-weight: 650; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.qcard textarea.letter { display: block; width: calc(100% - 24px); min-height: 150px; max-height: 50dvh; border: 0; outline: 0; resize: vertical; font-family: inherit; }
.qcard textarea.letter:focus { box-shadow: inset 0 0 0 2px var(--cobalt); }
.qcard .q-act { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 8px; padding: 14px 12px 12px; }
.qcard .q-act .btn { min-height: 48px; }
.qcard .q-act .btn.approve { background: var(--moss); color: #fff; box-shadow: none; }
.qcard .q-act .btn.approve:hover { filter: brightness(1.06); }
.qcard .q-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 0 18px 14px; font-size: 13px; color: var(--ink-3); }
.qcard .q-foot a { color: var(--cobalt-ink); font-weight: 600; }
.qcard .q-foot .keys { margin-left: auto; display: none; gap: 10px; }
@media (min-width: 900px) { .qcard .q-foot .keys { display: inline-flex; } .qcard .letter { font-size: 15.5px; max-height: 50vh; } .qcard .q-act .btn { min-height: 42px; } }
.qcard .q-foot .keys span { display: inline-flex; align-items: center; gap: 4px; }
/* non-message asks inside the queue */
.qcard.question .letter { background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber-edge); }
.qcard .opts { display: grid; gap: 8px; padding: 12px 12px 0; }
.qcard .opt { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 14px; border-radius: var(--r-row); background: var(--surface-2); text-align: left; font-size: 15.5px; font-weight: 500; box-shadow: inset 0 0 0 1px var(--line); }
.qcard .opt:hover { box-shadow: inset 0 0 0 1.5px var(--cobalt); }
.qcard .opt .n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--sunk); font-size: 13px; font-weight: 700; flex: none; }
.qcard .reply { margin: 10px 12px 0; }
.qcard.error .letter { background: var(--brick-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brick) 35%, transparent); }
.upnext { margin-top: 24px; }
.upnext .row { min-height: 50px; }
.upnext .row .t { font-size: 15px; }
.upnext .row[aria-current="true"] { background: var(--amber-soft); }
.caught-up { background: var(--surface); border-radius: var(--r-card); padding: 22px 20px; display: flex; gap: 14px; align-items: flex-start; }
.caught-up .ok { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--moss-soft); color: var(--moss); flex: none; }
.caught-up h3 { margin: 4px 0 4px; font: 650 20px/1.2 var(--display); }
.caught-up p { margin: 0; color: var(--ink-2); font-size: 15px; }
.caught-up .nums { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.caught-up .nums b { color: var(--ink); font-size: 18px; font-family: var(--display); }

/* reply field (questions, chat) */
.reply { display: flex; align-items: flex-end; gap: 8px; padding: 5px 5px 5px 14px; border-radius: 24px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.reply:focus-within { box-shadow: inset 0 0 0 2px var(--cobalt); }
.reply textarea { flex: 1; min-height: 34px; max-height: 160px; padding: 7px 0; border: 0; outline: 0; resize: none; background: none; font-size: 16px; line-height: 1.35; }
.reply textarea::placeholder { color: var(--ink-3); }
.reply .send { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--cobalt); color: var(--on-accent); flex: none; }
.reply .send[disabled] { background: var(--sunk); color: var(--ink-3); }
.reply .send svg.i { width: 18px; height: 18px; stroke-width: 2.4; }

.empty-note { background: var(--surface); border-radius: var(--r-group); padding: 18px 16px; color: var(--ink-2); font-size: 15px; display: flex; gap: 12px; align-items: flex-start; }
.empty-note svg.i { color: var(--moss); margin-top: 1px; }
.empty-note b { color: var(--ink); display: block; font-size: 16px; }
.empty-note .actions { margin-top: 12px; }

/* brief preview card */
.brief-card { background: var(--surface); border-radius: var(--r-group); padding: 18px 18px 14px; }
.brief-card .kicker { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-3); }
.brief-card h3 { margin: 8px 0 8px; font: 650 22px/1.18 var(--display); letter-spacing: -.015em; }
.brief-card p { margin: 0 0 14px; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.brief-card .from { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; color: var(--ink-3); font-size: 13.5px; flex-wrap: wrap; }
.brief-card .from .av { margin-right: -6px; box-shadow: 0 0 0 2px var(--surface); }
.brief-card .from span { margin-left: 12px; }

/* progress */
.meter { position: relative; height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--ink-2); }
.meter.cobalt i { background: var(--cobalt); }
.meter.warn i { background: var(--amber); }
.meter.over i { background: var(--brick); }
.meter.indet i { width: 35% !important; animation: indet 1.4s ease-in-out infinite; background: var(--cobalt); }
@keyframes indet { from { left: -35%; } to { left: 100%; } }

/* pipeline strip */
.funnel { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; background: var(--surface); border-radius: var(--r-group); padding: 14px 12px 10px; }
.funnel .cell { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; text-align: center; }
.funnel .cell b { font: 650 20px/1 var(--display); }
.funnel .cell i { display: block; width: 100%; max-width: 44px; border-radius: 5px 5px 2px 2px; background: var(--cobalt-soft); }
.funnel .cell.replied i, .funnel .cell.meeting i { background: var(--moss-soft); }
.funnel .cell.meeting b { color: var(--moss); }
.funnel .cell small { font-size: 11px; color: var(--ink-3); line-height: 1.2; }
.funnel .cell em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--moss); }
.funnel.compact { padding: 10px 10px 8px; }
.funnel.compact .cell b { font-size: 17px; }
@media (max-width: 420px) { .funnel .cell small { font-size: 10px; } .funnel .cell em { display: none; } }
.limits .meter { height: 5px; }

/* ------------------------------------------------------------------ nav bar for detail screens */
.navbar { display: flex; align-items: center; gap: 4px; min-height: 44px; margin: 0 -8px 4px; }
.navbar .back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px 0 2px; color: var(--cobalt-ink); font-size: 16px; }
.navbar .back svg.i { width: 24px; height: 24px; stroke-width: 2.2; }
.navbar .sp { flex: 1; }

/* ------------------------------------------------------------------ agent screen */
.agent-head { display: flex; gap: 16px; align-items: flex-start; margin: 6px 0 14px; }
.agent-head h1 { margin: 2px 0 2px; font: 700 26px/1.15 var(--display); letter-spacing: -.02em; }
.agent-head .role { color: var(--ink-2); font-size: 15px; margin: 0 0 6px; max-width: 56ch; }
.agent-grid { display: grid; gap: 0; }
@media (min-width: 1100px) { .agent-grid { grid-template-columns: minmax(0, 1fr) 340px; gap: 0 32px; align-items: start; } .agent-grid .side { position: sticky; top: 24px; } }
.now-card { background: var(--surface); border-radius: var(--r-group); padding: 16px; }
.now-card .top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.now-card .top .elapsed { color: var(--ink-3); font-size: 13.5px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.steps li { position: relative; display: flex; gap: 12px; padding: 0 0 12px 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.4; }
.steps li::before { content: ""; flex: none; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--sunk); box-shadow: inset 0 0 0 2px var(--line-strong); }
.steps li::after { content: ""; position: absolute; left: 4.5px; top: 18px; bottom: 0; width: 1px; background: var(--line-strong); }
.steps li:last-child::after { display: none; }
.steps li.done::before { background: var(--moss); box-shadow: none; }
.steps li.cur { color: var(--ink); font-weight: 500; }
.steps li.cur::before { background: var(--cobalt); box-shadow: 0 0 0 4px var(--cobalt-soft); }
.steps li.warn::before { background: var(--amber); box-shadow: none; }
.steps li.error::before { background: var(--brick); box-shadow: none; }
.steps li time { margin-left: auto; color: var(--ink-3); font-size: 13px; white-space: nowrap; padding-left: 8px; }
.steps.full li { padding-bottom: 14px; }
.live-result { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); max-height: 260px; overflow: auto; }
.mode-card { background: var(--surface); border-radius: var(--r-group); padding: 14px 16px; }
.mode-card .seg.mode button { white-space: nowrap; padding: 0 8px; font-size: 13.5px; }
.mode-card .help { margin: 10px 0 12px; font-size: 14.5px; color: var(--ink-2); }
.mode-card .lim { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); margin-bottom: 8px; }
.mode-card .meter { height: 5px; }

/* conversation (chat with an agent) */
.thread { display: grid; gap: 12px; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 20px; font-size: 16px; line-height: 1.45; }
.bubble.me { justify-self: end; background: var(--cobalt); color: var(--on-accent); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.bubble.agent { justify-self: start; background: var(--surface); border-bottom-left-radius: 6px; max-width: 94%; }
.bubble time, .bubble .meta { display: block; margin-top: 6px; font-size: 13px; color: var(--ink-3); }
.bubble.me time { color: color-mix(in srgb, var(--on-accent) 75%, transparent); text-align: right; }
.bubble .meta a { color: var(--cobalt-ink); font-weight: 600; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: pulse 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
.thread-empty { text-align: center; color: var(--ink-3); font-size: 15px; padding: 18px 12px; }
.composer { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 5; margin: 14px -16px 0; padding: 12px 16px 10px; background: linear-gradient(to bottom, transparent, var(--bg) 16px); }
@media (min-width: 900px) { .composer { bottom: 0; margin: 14px 0 0; padding: 12px 0 18px; } .bubble { font-size: 15px; } }
/* страница с чатом: поле ввода — последнее на странице, лишний отступ под ним не нужен */
.view:has(.composer) { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 2px); }
@media (min-width: 900px) { .view:has(.composer) { padding-bottom: 0; } }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 36px; padding: 0 14px; border-radius: 18px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); box-shadow: none; }

/* ------------------------------------------------------------------ markdown (results, briefs) */
.md { font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h2 { font: 650 20px/1.25 var(--display); margin: 0 0 10px; letter-spacing: -.01em; }
.md h3 { font-size: 16px; font-weight: 700; margin: 18px 0 6px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 0 0 6px; }
.md li::marker { color: var(--ink-3); }
.md code { font-size: .9em; background: var(--sunk); padding: 1px 5px; border-radius: 5px; }
.md.cursor > :last-child::after { content: ""; display: inline-block; width: 8px; height: 1.05em; margin-left: 3px; vertical-align: -2px; border-radius: 2px; background: var(--cobalt); animation: pulse 1s infinite; }
@media (min-width: 900px) { .md { font-size: 15px; } }
.src { display: inline-flex; align-items: center; gap: 4px; vertical-align: 1px; margin: 0 1px; padding: 1px 8px 1px 3px; min-height: 24px; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 600; line-height: 1.6; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.src:hover { box-shadow: inset 0 0 0 1px var(--cobalt); color: var(--cobalt-ink); }
.src .av { width: 18px; height: 18px; border-radius: 6px; }
.src .av svg.i { width: 11px; height: 11px; stroke-width: 2.2; }
.reader { background: var(--surface); border-radius: var(--r-group); padding: 22px 20px; }
@media (min-width: 900px) { .reader { padding: 32px 40px; } }
.reader .md { font-size: 17px; line-height: 1.6; max-width: 66ch; }
.reader .md h2 { font: 700 28px/1.15 var(--display); letter-spacing: -.02em; margin-bottom: 18px; }
.reader .md h3 { font-size: 17px; margin-top: 26px; }
.reader .md ol > li::marker { font-weight: 700; color: var(--ink); }
.reader-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 18px; color: var(--ink-3); font-size: 13.5px; }
.asked { margin: 0 0 18px; padding: 10px 14px; border-radius: var(--r-row); background: var(--cobalt-soft); color: var(--cobalt-ink); font-size: 15px; }
.brief-grid { display: grid; gap: 0; }
@media (min-width: 1100px) { .brief-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 0 32px; align-items: start; } .brief-grid .side { position: sticky; top: 24px; } }
.pipe { background: var(--surface); border-radius: var(--r-group); padding: 16px; margin-bottom: 14px; }
.pipe h3 { margin: 0 0 12px; font-size: 17px; }
.pipe .steps li .what { flex: 1; }
.pipe .steps li .what b { font-weight: 600; color: var(--ink); display: block; }

/* ------------------------------------------------------------------ pipeline board, prospect card */
.seg { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--sunk); gap: 2px; }
.seg button, .seg a { min-height: 36px; padding: 0 14px; border-radius: 8px; font-size: 14.5px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }
.seg button[aria-pressed="true"], .seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.seg.full { display: flex; } .seg.full button, .seg.full a { flex: 1; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 6px; }
.filters .sel { min-height: 36px; }
.board { display: grid; gap: 16px; }
.board .col h3 { margin: 18px 4px 8px; font: 650 16px/1.2 var(--display); display: flex; align-items: baseline; gap: 8px; }
.board .col h3 .count { color: var(--ink-3); font: 500 14px var(--text); }
.board .col .row { min-height: 56px; }
@media (min-width: 1100px) {
  .board { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .board .col h3 { margin-top: 6px; }
  .board .row { padding: 10px; gap: 8px; flex-direction: column; align-items: stretch; }
  .board .row .t { font-size: 14.5px; }
  .board .row .t .when { display: none; }
  .board .row .av { display: none; }
  .board .row + .row::before { left: 10px; }
}
.stage { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--sunk); font-size: 12px; font-weight: 700; color: var(--ink-2); margin-right: 4px; }
.stage.replied, .stage.meeting { background: var(--moss-soft); color: var(--moss); }
.stage.accepted, .stage.conversation { background: var(--cobalt-soft); color: var(--cobalt-ink); }
.pip-needs { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--amber); margin-left: 6px; vertical-align: 1px; }
.stepper { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.stepper li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); text-align: center; line-height: 1.15; }
.stepper li i { display: block; width: 100%; height: 6px; border-radius: 3px; background: var(--sunk); }
.stepper li.done i { background: var(--moss); }
.stepper li.cur i { background: var(--cobalt); }
.stepper li.cur { color: var(--cobalt-ink); font-weight: 700; }
.stepper li.done { color: var(--ink-2); }
.timeline { display: grid; gap: 14px; }
.tl { display: grid; gap: 4px; }
.tl.out { justify-items: end; }
.tl.in { justify-items: start; }
.tl .bubble { max-width: 92%; white-space: pre-wrap; }
.tl.declined .bubble { opacity: .5; text-decoration: line-through; }
.tl .meta { font-size: 13px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl .bubble .subj { font-weight: 650; margin-bottom: 6px; opacity: .9; }
.tl-event { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; font-size: 13.5px; color: var(--ink-2); text-align: center; padding: 4px 0; }
.tl-event span { font-weight: 600; }
.tl-event.note span { font-weight: 500; font-style: italic; }
.tl-event time { color: var(--ink-3); }
@media (min-width: 900px) { .tl .bubble { max-width: 70%; } }

/* ------------------------------------------------------------------ inbox */
.inbox .row { align-items: flex-start; }
.inbox .row .av { margin-top: 2px; }
.inbox .quote { margin: 4px 0 0; color: var(--ink); font-size: 15px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inbox .state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--ink-3); }
.inbox-draft { margin: 10px 0 16px; }

/* ------------------------------------------------------------------ campaigns, costs */
.camps { display: grid; gap: 14px; }
@media (min-width: 1100px) { .camps { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); } }
.camp { background: var(--surface); border-radius: var(--r-group); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.camp-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.camp-head h3 { margin: 0 0 4px; font: 650 19px/1.2 var(--display); }
.camp-head p { margin: 0; font-size: 14px; }
.camp-head .chips-inline { flex: none; margin-top: 0; }
.cf { display: grid; gap: 6px; }
.cf div { display: grid; grid-template-columns: 120px 1fr 36px 44px; align-items: center; gap: 10px; font-size: 14px; }
.cf span { color: var(--ink-2); }
.cf i { display: block; height: 10px; border-radius: 5px; background: var(--cobalt); opacity: .35; }
.cf i.a { opacity: .6; } .cf i.r { opacity: .85; } .cf i.m { background: var(--moss); opacity: 1; }
.cf b { text-align: right; font-weight: 650; }
.cf small { color: var(--ink-3); font-size: 12.5px; }
.camp-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; color: var(--ink-2); padding-top: 8px; border-top: 1px solid var(--line); }
.camp-foot .btn { margin-left: auto; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border-radius: var(--r-group); overflow: hidden; }
.tiles div { display: flex; flex-direction: column; justify-content: space-between; gap: 4px; background: var(--surface); padding: 12px 14px; }  /* подпись сверху, число снизу: числа на одной высоте, даже если подпись в две строки */
.tiles span { display: block; font-size: 12.5px; line-height: 1.25; color: var(--ink-3); }
.tiles b { font: 650 22px/1.1 var(--display); }
.tiles b small { font: 500 13px var(--text); color: var(--ink-3); margin-left: 4px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(6, 1fr); } }
.variants { display: grid; gap: 12px; }
@media (min-width: 900px) { .variants { grid-template-columns: 1fr 1fr; } }
.variant { background: var(--surface); border-radius: var(--r-group); padding: 14px 16px; }
.variant .vh { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 15px; }
.variant .msg { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r-row); background: var(--surface-2); font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; }
.variant .msg .subj { font-weight: 650; margin-bottom: 6px; }
.vm { display: grid; gap: 6px; }
.vm div { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.vm i { display: block; height: 8px; border-radius: 4px; background: var(--cobalt); opacity: .6; }
.vm i.r { opacity: .85; } .vm i.m { background: var(--moss); opacity: 1; }
.vm b { text-align: right; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 120px; padding: 14px 14px 0; }
.bars div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; font-size: 12px; color: var(--ink-3); }
.bars i { display: block; width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: var(--sunk); min-height: 3px; }
.bars div.today i { background: var(--ink-2); }
.bars div.today { color: var(--ink); font-weight: 600; }
.day-h { margin: 22px 4px 8px; font-size: 14.5px; font-weight: 650; color: var(--ink-2); }
.cost { font-size: 13.5px; color: var(--ink-3); white-space: nowrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1px; background: var(--line); border-radius: var(--r-group); overflow: hidden; }
.kv div { background: var(--surface); padding: 12px 14px; }
.kv span { display: block; font-size: 13px; color: var(--ink-3); }
.kv b { font-size: 16px; font-weight: 600; }
.err-box { background: var(--brick-soft); color: var(--ink); border-radius: var(--r-group); padding: 14px 16px; font-size: 15px; margin-bottom: 14px; }
.err-box b { color: var(--brick); display: block; margin-bottom: 2px; }

/* ------------------------------------------------------------------ forms (settings) */
.form-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; position: relative; }
.form-row + .form-row::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; border-top: 1px solid var(--line); }
.form-row label, .form-row .lbl { flex: 1; font-size: 15.5px; }
.form-row .lbl small, .form-row label small { display: block; color: var(--ink-3); font-size: 13.5px; margin-top: 1px; }
.form-row.stack { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px 14px; }
.inp, .sel { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 0; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 16px; }
.inp:focus, .sel:focus { outline: none; box-shadow: inset 0 0 0 2px var(--cobalt); }
textarea.inp { padding: 10px 12px; line-height: 1.45; resize: vertical; width: 100%; }
.inp.money { width: 104px; text-align: right; }
.inp.short { width: 112px; }
.radio-row { cursor: pointer; }
.radio-row input { position: absolute; opacity: 0; pointer-events: none; }
.radio-row .tick { color: var(--cobalt); visibility: hidden; }
.radio-row input:checked ~ .tick { visibility: visible; }
.radio-row:has(input:focus-visible) { outline: 3px solid var(--cobalt); outline-offset: -3px; }
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); transition: background-color .2s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--moss); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--cobalt); outline-offset: 2px; }
details.adv > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 14px; font-size: 15.5px; color: var(--cobalt-ink); font-weight: 500; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary svg { transition: transform .2s; }
details.adv[open] > summary svg { transform: rotate(90deg); }
.savebar { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 10px); margin-top: 18px; display: flex; justify-content: flex-end; }
@media (min-width: 900px) { .savebar { bottom: 18px; } }
.savebar .btn { box-shadow: var(--shadow-float); }
.plan-tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 12px; background: var(--sunk); color: var(--ink-2); font-size: 12px; font-weight: 700; white-space: nowrap; }
.group :focus-visible { outline-offset: -3px; border-radius: 12px; }
.narrow { max-width: 760px; }

/* ------------------------------------------------------------------ sheet (dialog), command palette */
dialog.sheet { border: 0; padding: 0; color: var(--ink); background: var(--surface); width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0; max-height: 92dvh; overflow: auto; box-shadow: var(--shadow-float); padding-bottom: var(--safe-b); }
dialog.sheet[open] { animation: sheet-up .26s var(--ease); }
dialog.sheet::backdrop { background: rgba(10, 14, 22, .38); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 700px) { dialog.sheet { margin: auto; width: 560px; border-radius: 20px; } }
.sheet-in { padding: 10px 18px 22px; }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 6px; }
@media (min-width: 700px) { .sheet-grip { display: none; } }
.sheet-head { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.sheet-head h2 { margin: 0; flex: 1; font: 650 20px/1.2 var(--display); }
.sheet .field-l { font-size: 14.5px; font-weight: 600; color: var(--ink-2); margin: 16px 2px 8px; display: block; }
.sheet textarea.big { width: 100%; min-height: 120px; padding: 14px; border-radius: 14px; border: 0; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 16px; line-height: 1.45; resize: vertical; }
.sheet textarea.big:focus { outline: none; box-shadow: inset 0 0 0 2px var(--cobalt); }
.who-list { display: grid; gap: 8px; }
.who-opt { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; text-align: left; }
.who-opt input { position: absolute; opacity: 0; pointer-events: none; }
.who-opt:has(input:checked) { box-shadow: inset 0 0 0 2px var(--cobalt); background: var(--cobalt-soft); }
.who-opt:has(input:focus-visible) { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.who-opt b { display: block; font-size: 15.5px; }
.who-opt small { display: block; color: var(--ink-2); font-size: 13.5px; }
.sheet .src-body { max-height: 52dvh; overflow: auto; padding: 14px; border-radius: 14px; background: var(--surface-2); margin: 8px 0 14px; }
.keys-list { display: grid; gap: 2px; margin-top: 8px; }
.keys-list div { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; font-size: 15px; border-bottom: 1px solid var(--line); }
.keys-list div:last-child { border-bottom: 0; }
.keys-list span { display: inline-flex; gap: 4px; }
dialog.palette { border: 0; padding: 0; color: var(--ink); background: color-mix(in srgb, var(--surface) 84%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(22px); backdrop-filter: saturate(1.4) blur(22px); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-float); width: min(640px, calc(100% - 24px)); margin: 10vh auto auto; border-radius: 16px; overflow: hidden; }
dialog.palette::backdrop { background: rgba(10, 14, 22, .3); }
/* ноутбук: окно у правого нижнего угла, фиксированной высоты (не прыгает при поиске).
   Появление: правый нижний угол почти неподвижен, окно раскрывается из 95 % и скользит на место; масштаб стартует чуть раньше сдвига,
   в первые кадры лёгкий наклон (0.3°), потом всё оседает на очень слабой пружине. Уход — короче и решительнее, обратно в угол. */
@media (min-width: 900px) {
  dialog.palette {
    --pal-spring: cubic-bezier(.16, 1, .3, 1);
    margin: auto 28px 28px auto; width: min(580px, calc(100% - 56px)); height: min(560px, calc(100dvh - 56px)); transform-origin: 100% 100%;
  }
  @supports (animation-timing-function: linear(0, 1)) { dialog.palette { --pal-spring: linear(0, 0.0157, 0.0568, 0.1152, 0.1847, 0.2603, 0.3381, 0.4152, 0.4894, 0.5594, 0.6241, 0.683, 0.7358, 0.7826, 0.8236, 0.8591, 0.8894, 0.915, 0.9364, 0.9541, 0.9685, 0.98, 0.9891, 0.9961, 1.0014, 1.0053, 1.0079, 1.0097, 1.0107, 1.0111, 1.011, 1.0107, 1.0101, 1.0094, 1.0086, 1.0077, 1); } }
  dialog.palette[open] {
    display: flex; flex-direction: column; will-change: transform, opacity;
    animation: pal-scale-in .56s var(--pal-spring) backwards, pal-move-in .56s .04s var(--pal-spring) backwards, pal-tilt-in .4s cubic-bezier(.2, .7, .2, 1) backwards, pal-fade-in .26s ease-out backwards;
  }
  dialog.palette[open].closing {
    animation: pal-scale-out .34s cubic-bezier(.55, 0, .75, .35) forwards, pal-move-out .34s cubic-bezier(.55, 0, .75, .35) forwards, pal-fade-out .34s cubic-bezier(.4, 0, 1, 1) forwards;
  }
  dialog.palette[open]::backdrop { animation: pal-fade-in .4s ease-out backwards; }
  dialog.palette[open].closing::backdrop { animation: pal-fade-out .34s ease-in forwards; }
  dialog.palette .pal-list { flex: 1; min-height: 0; max-height: none; }
  dialog.palette[open] .pal-list { animation: pal-list-in .52s .06s cubic-bezier(.16, 1, .3, 1) backwards; }  /* поле поиска чуть раньше списка */
}
@keyframes pal-scale-in { from { scale: .95; } }
@keyframes pal-move-in { from { translate: 12px 14px; } }
@keyframes pal-tilt-in { from { rotate: .3deg; } to { rotate: 0deg; } }
@keyframes pal-fade-in { from { opacity: 0; } }
@keyframes pal-scale-out { to { scale: .95; } }
@keyframes pal-move-out { to { translate: 12px 14px; } }
@keyframes pal-fade-out { 40% { opacity: 1; } to { opacity: 0; } }
@keyframes pal-list-in { from { opacity: 0; translate: 8px 6px; } }
@media (prefers-reduced-motion: reduce) {
  dialog.palette[open], dialog.palette[open] .pal-list { animation: pal-fade-in .14s ease-out backwards !important; }
  dialog.palette[open].closing { animation: pal-fade-out .12s linear forwards !important; }
  dialog.palette[open]::backdrop, dialog.palette[open].closing::backdrop { animation: none !important; }
}
.pal-in { display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.pal-in input { flex: 1; min-height: 46px; border: 0; outline: 0; background: none; font-size: 17px; }
.pal-list { max-height: 50vh; overflow: auto; padding: 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 6px 10px; border-radius: 10px; text-align: left; font-size: 15px; }
.pal-item .av { width: 28px; height: 28px; border-radius: 8px; }
.pal-item .av svg.i { width: 16px; height: 16px; }
.pal-item .av.person { font-size: 11px; }
.pal-item small { color: var(--ink-3); margin-left: auto; font-size: 13px; white-space: nowrap; }
.pal-item[aria-selected="true"] { background: var(--cobalt-soft); color: var(--cobalt-ink); }
.pal-group { padding: 10px 12px 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + 10px); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-float); font-size: 14.5px; animation: toast-in .25s ease; }
.toast b { display: block; font-size: 14.5px; }
.toast span { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.toast .sig { margin-top: 6px; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
.loading { padding: 40px 0; text-align: center; color: var(--ink-3); }
.fail { background: var(--surface); border-radius: var(--r-group); padding: 18px; margin-top: 20px; }
.fail b { display: block; margin-bottom: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .av.running::after { animation: none; background: var(--cobalt); }
  .meter.indet i { width: 100% !important; opacity: .5; }
  .qcard.animating { transition: none; }
}

/* offline banner */
.offline { position: sticky; top: 0; z-index: 30; display: flex; gap: 10px; align-items: center; padding: calc(var(--safe-t) + 10px) 16px 10px; background: var(--amber-soft); color: var(--amber-ink); font-size: 14px; }
.offline[hidden] { display: none; }
.offline b { color: var(--ink); }
.queue-h .count { color: var(--ink-3); font: 500 16px var(--text); margin-left: 6px; }
@media (max-width: 899px) { .qcard .letter { max-height: 34dvh; } .status-line { font-size: 27px; } }
@media (max-width: 899px) { .qcard .letter { max-height: 27dvh; } .hero-actions .btn { min-height: 40px; font-size: 15px; } .hero { padding-top: 0; } .status-line { margin-bottom: 10px; } }

/* inside the Mac app the traffic lights sit over the sidebar head */
:root[data-mac] .sidebar { padding-top: 46px; }
:root[data-mac] .view { padding-top: 34px; }
