/* Veysa — operator console. Strict, quiet UI: black rail with line icons, white content,
   restrained weights, one accent (#1d9bf0). */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9fa;
  --surface-3: #eef1f3;
  --border: #ebeef0;
  --border-2: #d4dbe0;

  --rail: #0a0a0a;          /* near-black sidebar */
  --rail-text: #e7e9ea;
  --rail-dim: #7d8590;
  --rail-hover: rgba(255, 255, 255, 0.08);

  --text: #0f1419;
  --text-dim: #56646e;
  --text-faint: #8b98a3;

  --accent: #1d9bf0;
  --accent-soft: #e8f5fd;
  --ink: #0f1419;           /* primary buttons / funnel */
  --ink-hover: #272c30;

  --green: #00a878;
  --amber: #d98a00;
  --red: #e0245e;

  --r-card: 14px;
  --r-ctrl: 9px;
  --side-w: 246px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.num, .tnum { font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: #fff; color: #000; font-weight: 800; display: grid; place-items: center; font-size: 16px; flex: none; }
.logo-mark.sm { width: 24px; height: 24px; font-size: 13px; }

/* ---------- buttons ---------- */
button {
  font: inherit; font-weight: 500; cursor: pointer;
  color: var(--text); background: #fff;
  border: 1px solid var(--border-2); border-radius: var(--r-ctrl);
  padding: 9px 16px; transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
button:hover:not(:disabled) { background: #e9edf0; border-color: #aab4bb; }
/* свитчи держат цвет состояния (специфичность выше общего ховера) */
.auto-toggle .switch:hover { background: var(--border-2); }
.auto-toggle .switch.on:hover { background: var(--green); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--ink-hover); border-color: var(--ink-hover); }
button.sm { padding: 6px 12px; font-size: 13.5px; }
button.danger { color: var(--red); border-color: rgba(224, 36, 94, 0.35); }
button.danger:hover:not(:disabled) { background: rgba(224, 36, 94, 0.06); }
button.ghost { background: none; border-color: transparent; }

input, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--border-2); border-radius: var(--r-ctrl);
  padding: 9px 12px; width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(29, 155, 240, 0.18); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-dim); }
label.check { flex-direction: row; align-items: center; gap: 8px; }
label.check input { width: auto; }
/* native selects are replaced by custom .dd (enhanceSelects); keep them in DOM but hidden */
select.dd-native { display: none; }

/* ---------- custom dropdown (replaces native select) ---------- */
.dd { position: relative; width: 100%; }
.dd-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border: 1px solid var(--border-2); border-radius: var(--r-ctrl); padding: 9px 12px;
  font: inherit; font-weight: 500; color: var(--text); cursor: pointer; text-align: left; }
.dd-btn:hover { border-color: #c3ccd2; }
.dd.open .dd-btn { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(29, 155, 240, 0.18); }
.dd-btn .chev { flex: none; color: var(--text-faint); transition: transform 0.15s; }
.dd.open .dd-btn .chev { transform: rotate(180deg); }
.dd.sm .dd-btn { padding: 6px 10px; font-size: 13.5px; }
.dd-menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 100%;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 14px 38px rgba(15, 20, 25, 0.14); padding: 6px; max-height: 300px; overflow: auto; }
.dd-opt { padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; white-space: nowrap; }
.dd-opt:hover, .dd-opt.cursor { background: var(--surface-2); }
.dd-opt.sel { font-weight: 600; }
.dd-opt .ck { color: var(--accent); opacity: 0; }
.dd-opt.sel .ck { opacity: 1; }

/* ---------- login ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface-2); }
.login-card { width: 360px; max-width: 100%; background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); padding: 32px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 6px 28px rgba(15, 20, 25, 0.07); }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand .logo-mark { width: 42px; height: 42px; font-size: 22px; }
.login-brand h1 { margin: 0; font-size: 20px; font-weight: 700; }
.login-brand p { margin: 1px 0 0; font-size: 13px; color: var(--text-faint); }
.login-hint { margin: 0; font-size: 13px; color: var(--text-faint); min-height: 16px; }
.login-hint.err { color: var(--red); }

/* ---------- layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side-w); flex: none; position: sticky; top: 0; align-self: flex-start;
  height: 100vh; display: flex; flex-direction: column;
  padding: 16px 12px; background: var(--rail); color: var(--rail-text); overflow-y: auto;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 8px 12px 20px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { margin-bottom: 16px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--rail-dim); padding: 6px 14px 6px; font-weight: 600; }
.nav-item {
  text-align: left; background: none; border: none; border-radius: 8px;
  padding: 9px 12px; color: var(--rail-text); display: flex; align-items: center; gap: 12px; width: 100%; font-weight: 400; font-size: 14.5px;
}
.nav-item svg { width: 19px; height: 19px; flex: none; fill: none; stroke: var(--rail-dim); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item span:not(.soon-tag) { flex: 1; }
.nav-item:hover:not(:disabled) { background: var(--rail-hover); }
.nav-item:hover:not(:disabled) svg { stroke: var(--rail-text); }
.nav-item.active { background: var(--rail-hover); font-weight: 600; }
.nav-item.active svg { stroke: #fff; }
.nav-item.soon { color: var(--rail-dim); }
.soon-tag { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--rail-dim); border: 1px solid #2a2d31; border-radius: 999px; padding: 2px 7px; flex: none; }

.side-foot { padding: 12px 8px 4px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid #1b1d20; margin-top: 8px; }
.link-btn { background: none; border: none; padding: 4px 6px; color: var(--rail-dim); text-align: left; font-size: 13.5px; font-weight: 500; }
.link-btn:hover { color: #fff; background: none; }

.main { flex: 1; min-width: 0; padding: 30px 38px 70px; }
.main > #view { max-width: var(--maxw); margin: 0 auto; }
.mobile-bar { display: none; align-items: center; gap: 12px; background: var(--rail); color: #fff; margin: -30px -38px 22px; padding: 14px 18px; }
.mobile-bar b { font-weight: 700; }
.hamburger { background: none; border: none; color: #fff; font-size: 20px; padding: 2px 6px; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 25; }

/* ---------- view header + explainers ---------- */
.view-head { margin-bottom: 8px; }
.view-head h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.view-head .sub { font-size: 14px; color: var(--text-faint); font-weight: 400; }
.view-desc { color: var(--text-dim); font-size: 14px; margin: 0 0 24px; max-width: 740px; }
.view-desc b { font-weight: 600; color: var(--text); }

.callout { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 20px; font-size: 14px; color: var(--text-dim); }
.dev-banner { margin-bottom: 18px; padding: 12px 16px; font-size: 13.5px; background: #fff8e6; border: 1px solid #f1dca0; border-radius: 12px; color: #7a5b00; }
.ok-banner { margin-bottom: 18px; padding: 12px 16px; font-size: 13.5px; background: #e9f7ee; border: 1px solid #b6e2c4; border-radius: 12px; color: #1c6b3a; }

/* ---------- panels / cards ---------- */
.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); padding: 22px 24px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; }

/* ---------- stat strip ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px 18px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat.accent .v { color: var(--accent); }
.stat .k { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }

/* ---------- funnel (centered narrowing stages) ---------- */
.funnel2 { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fstage { display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: var(--ink); color: #fff; border-radius: 10px; padding: 13px 20px; transition: width 0.35s ease; }
.fstage .fl { font-size: 13.5px; font-weight: 400; opacity: 0.92; }
.fstage .fv { font-weight: 700; font-variant-numeric: tabular-nums; }
.fstage.dim { background: var(--surface-3); color: var(--text); }
.fconv { font-size: 11px; color: var(--text-faint); padding: 1px 0; }

/* ---------- search grid ---------- */
.search-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; align-items: end; }
.search-grid .submit { grid-column: 1 / -1; }
@media (min-width: 760px) { .search-grid .submit { grid-column: auto; } }

/* ---------- automatic mode ---------- */
.auto-card { border: 1px solid var(--border-2); border-radius: var(--r-card); overflow: hidden; margin-bottom: 18px; }
.auto-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; background: var(--ink); color: #fff; }
.auto-head .ttl { font-weight: 600; display: flex; align-items: center; gap: 10px; font-size: 15px; }
.auto-head .ttl .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--rail-dim); }
.auto-card.on .auto-head .ttl .dot { background: var(--green); box-shadow: 0 0 0 4px rgba(0, 168, 120, 0.25); }
.auto-sub { font-size: 12.5px; color: rgba(255, 255, 255, 0.6); font-weight: 400; }
.auto-body { padding: 20px 22px; display: block; } /* always expanded */
.auto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; align-items: start; }
.auto-field .lbl { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.auto-field .desc { font-size: 12.5px; color: var(--text-faint); margin-top: 8px; }
.token-row { display: flex; gap: 8px; align-items: center; }
.token-row input { flex: 1; }
.chip-btn { border: 1px solid var(--border-2); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 500; background: #fff; white-space: nowrap; }
.chip-btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.auto-toggle { display: flex; gap: 14px; align-items: flex-start; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.auto-toggle .switch { margin-top: 2px; }
.auto-toggle .switch:not(.on) { background: var(--border-2); }
.auto-toggle .lbl { font-size: 13px; font-weight: 600; }
.auto-toggle .desc { font-size: 12.5px; color: var(--text-faint); margin-top: 4px; }

/* automatic-run progress (task completion %) */
.auto-run { margin-top: 18px; }
.auto-prog-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.auto-prog-head .num { font-size: 16px; }
.auto-bar { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.auto-bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #5ab8ff); border-radius: 999px; transition: width 0.4s ease; }

/* toggle switch */
.switch { width: 44px; height: 25px; border-radius: 999px; background: rgba(255, 255, 255, 0.25); position: relative; cursor: pointer; border: none; flex: none; transition: background 0.15s; padding: 0; }
.switch.on { background: var(--green); }
.switch i { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 999px; background: #fff; transition: left 0.15s; }
.switch.on i { left: 22px; }

/* ---------- connectors ---------- */
/* ── Connectors: вытянутые ряды ── */
.conn-list { display: flex; flex-direction: column; gap: 10px; }
.conn-row { display: flex; align-items: center; gap: 16px; border: 1px solid var(--border); border-radius: var(--r-card); padding: 14px 18px; min-height: 64px; }
.conn-row.soon { opacity: 0.72; }
.conn-ic { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; color: var(--text-dim); }
.conn-main { flex: 1; min-width: 0; }
.conn-name { font-weight: 600; font-size: 14.5px; }
.conn-desc { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }
.conn-metric { flex: none; width: 168px; text-align: right; }
.conn-metric .cm-val { font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.conn-metric .cm-bar { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.conn-metric .cm-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #5ab8ff); border-radius: 999px; }
.pill.soon { color: var(--text-faint); }

/* ── AI token budget ── */
.panel.budget { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; }
.budget-main { flex: 1; min-width: 260px; }
.budget-num { font-size: 40px; font-weight: 750; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.budget-lbl { font-size: 13px; color: var(--text-faint); margin-top: 6px; }
.budget-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 14px 0 8px; max-width: 460px; }
.budget-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #5ab8ff); border-radius: 999px; transition: width 0.5s ease; }
.budget-meta { font-size: 12.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.budget-limit { flex: none; min-width: 230px; }
.budget-limit .lbl { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.budget-limit .desc { font-size: 12px; color: var(--text-faint); margin-top: 8px; }

/* ── Weekly consumption chart ── */
.uc-wrap { width: 100%; }
.uc-svg { width: 100%; height: 170px; display: block; overflow: visible; }
.uc-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.uc-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.uc-dot { fill: #fff; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.uc-labels { display: flex; justify-content: space-between; margin-top: 8px; padding: 0 2px; font-size: 11.5px; color: var(--text-faint); }

/* ── Detailed usage ── */
.u-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.u-search { width: 240px; max-width: 100%; }
.u-total { font-size: 14px; color: var(--text-dim); margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.u-total b { color: var(--text); font-size: 16px; }
.u-block { margin-top: 6px; }
.u-block + .u-block { margin-top: 20px; }
.u-head { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 600; margin-bottom: 8px; display: flex; gap: 10px; align-items: baseline; }
.u-row { display: grid; grid-template-columns: 1fr auto 92px 84px; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.u-row:last-child { border-bottom: none; }
.u-name { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-sub { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; }
.u-tok { text-align: right; font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.u-usd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- lead list ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }
.lead { display: flex; align-items: center; gap: 18px; min-height: 72px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); padding: 12px 16px; }
.lead-score { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; }
.lead-score .num { font-size: 25px; font-weight: 700; }
.lead-score .bar { width: 100%; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.lead-score .bar i { display: block; height: 100%; }
.lead-score .grade { font-size: 11px; color: var(--text-dim); }
.lvl-top .num { color: var(--red); } .lvl-top .bar i { background: var(--red); }
.lvl-good .num { color: var(--amber); } .lvl-good .bar i { background: var(--amber); }
.lvl-weak .num { color: var(--green); } .lvl-weak .bar i { background: var(--green); }
.lvl-no .num, .lvl-na .num { color: var(--text-faint); } .lvl-no .bar i, .lvl-na .bar i { background: var(--text-faint); }
/* Лид = ОДНА строка: бейдж · имя+мета в линию · действия */
.lead-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px 14px; overflow: hidden; }
.lead-body h3 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.lead-meta { display: flex; flex-wrap: nowrap; gap: 6px 10px; font-size: 13px; color: var(--text-dim); align-items: center; min-width: 0; overflow: hidden; }
.lead-actions { display: flex; flex-direction: row; gap: 8px; align-items: center; flex: none; }
/* квадратные icon-кнопки (View/Delete) + значок запуска перед Run */
.icon-btn { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-2); border-radius: var(--r-ctrl); background: #fff; color: var(--text-dim); }
.icon-btn svg { width: 17px; height: 17px; }
.lead-actions .icon-btn:hover { background: #eef1f4; border-color: #aab4bb; color: var(--text); }
.icon-btn.danger { color: var(--red); border-color: rgba(224, 36, 94, 0.35); }
.lead-actions .icon-btn.danger:hover { background: rgba(224, 36, 94, 0.08); border-color: rgba(224, 36, 94, 0.5); color: var(--red); }
.act-run { display: inline-flex; align-items: center; gap: 6px; }
.act-run svg { width: 13px; height: 13px; fill: currentColor; }
.act-design { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); font-weight: 600; }
.act-design svg { width: 14px; height: 14px; }
/* знак «?» с подсказками по сайту, раскрытие при наведении */
.tip-wrap { position: relative; display: inline-flex; flex: none; }
.tip-q { width: 19px; height: 19px; padding: 0; border-radius: 999px; border: 1px solid var(--border-2); background: #fff; color: var(--text-faint); font-size: 11px; font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; cursor: help; }
.tip-q:hover { background: #eef1f4; color: var(--text); }
.tip { position: absolute; bottom: calc(100% + 8px); right: 0; background: var(--ink); color: #fff; border-radius: 10px; padding: 9px 11px; width: max-content; max-width: 300px; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 8px 24px rgba(15, 20, 25, 0.22); opacity: 0; visibility: hidden; transform: translateY(3px); transition: opacity 0.12s, transform 0.12s; z-index: 60; pointer-events: none; }
.tip-wrap:hover .tip { opacity: 1; visibility: visible; transform: translateY(0); }
.tip-row { font-size: 12px; white-space: nowrap; color: rgba(255, 255, 255, 0.82); }
.tip-row.high { color: #ff9bb1; }
.tip-row.med { color: #ffd08a; }
.biz-ok { color: var(--green); } .biz-closed { color: var(--red); } .warnv { color: var(--amber); }
.subtle { color: var(--text-faint); }
.issues { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 11.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text-dim); }
.chip.high { color: var(--red); border-color: rgba(224, 36, 94, 0.3); background: rgba(224, 36, 94, 0.06); }
.chip.med { color: var(--amber); border-color: rgba(217, 138, 0, 0.4); background: rgba(217, 138, 0, 0.1); }
.chip.low { color: var(--text-dim); }
.chip.none { color: var(--green); border-color: rgba(0, 168, 120, 0.4); background: rgba(0, 168, 120, 0.08); }
.note { margin-top: 10px; font-size: 13.5px; color: var(--text-dim); }
.note .lbl { color: var(--text-faint); margin-right: 6px; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.05em; font-weight: 600; }

/* ---------- call disposition chips + satisfaction (Calls) ---------- */
.disp { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.disp-now { background: #e9f7ee; color: #1c6b3a; }
.disp-scheduled { background: var(--accent-soft); color: var(--accent); }
.disp-followup { background: #fff3d6; color: #8a6400; }
.disp-lost { background: #fbe6e6; color: #b23333; }
.disp-open { background: var(--surface-2); color: var(--text-dim); }
.sat { font-weight: 700; }
.sat-top { color: #1c6b3a; } .sat-good { color: #8a6400; } .sat-no { color: #b23333; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: var(--surface-2); }

.pill { display: inline-block; font-size: 11.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--text-dim); }
.pill.on { color: var(--green); border-color: rgba(0, 168, 120, 0.4); }
.pill.off { color: var(--text-faint); }
.side-foot .status { gap: 6px; }
.side-foot .pill { border-color: #2a2d31; color: var(--rail-dim); }
.side-foot .pill.on { color: var(--green); border-color: rgba(0, 168, 120, 0.5); }
.status { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }

.st { font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.st-waiting { color: var(--amber); }
.st-confirmed { color: var(--accent); }
.st-completed { color: var(--green); }
.st-rescheduled { color: var(--text-faint); }
.st-no_show, .st-cancelled { color: var(--red); }

.ai-tag { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 7px; font-weight: 700; }

/* ---------- misc ---------- */
.empty { padding: 48px; text-align: center; color: var(--text-faint); border: 1px dashed var(--border-2); border-radius: var(--r-card); }
.empty .big { font-size: 16px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.skeleton { height: 64px; background: linear-gradient(90deg, var(--surface-2) 25%, #fff 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-card); border: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }
.hint { font-size: 13px; color: var(--text-faint); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.back-btn { background: none; border: none; color: var(--text-dim); padding: 0 0 2px; margin-bottom: 14px; font-weight: 500; }
.back-btn:hover { background: none; color: var(--text); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-dim); }
.kv .num { font-weight: 600; }
.svc-row { display: grid; grid-template-columns: 1.4fr 2fr 0.7fr auto; gap: 8px; margin-bottom: 8px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 12px 14px; color: var(--text-dim); font-weight: 600; }
.tab:hover { background: none; color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- confidence badge (lead card) — 4-step red->green, muted ---------- */
.conf { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2px; min-width: 56px; min-height: 38px; flex: none; }
.conf .pct { font-size: 23px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.conf .cl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.conf.c1 .pct { color: #d96a6a; }   /* low (20-39) */
.conf.c2 .pct { color: #e0964a; }   /* mid (40-59) */
.conf.c3 .pct { color: #b7a23f; }   /* good (60-79) */
.conf.c4 .pct { color: #34a373; }   /* high (80-100) */

/* token cost estimate (gray, next to limit) */
.token-cost { font-size: 12.5px; color: var(--text-faint); margin-top: 8px; }

/* automatic-mode token row note line */
.auto-field .token-cost { margin-top: 10px; }

/* ---------- filter segment + sort row (leads) ---------- */
.filterbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { background: none; border: none; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--text-dim); }
.seg button:hover:not(.active) { background: rgba(15, 20, 25, 0.06); color: var(--text); }
.seg button.active { background: var(--ink); color: #fff; font-weight: 600; }
.range-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.range-row input { width: auto; }
.sort-ctrls { display: flex; gap: 8px; align-items: center; }
.sort-ctrls .dd { width: auto; min-width: 150px; }

/* View/Run actions on a lead */
.lead-actions .run { }
.lead-actions a.sm { display: inline-block; text-align: center; text-decoration: none; }
.lead-actions a.sm:hover { text-decoration: none; }

/* ---------- designs grid (Cycle) ---------- */
.design-card { border: 1px solid var(--border); border-radius: var(--r-card); padding: 18px; }
.design-card h4 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }

/* ---------- design engine cockpit (Cycle → Designs) ---------- */
/* minmax(0,1fr) + min-width:0 + flex-wrap = карточка НЕ распирает контент длинной строкой ошибки (nowrap)
   и переносит кнопки под прогресс на узких экранах. Раньше .dc-err распирал грид → горизонтальный скролл. */
.design-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.design-grid .design-card { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding: 16px 18px; min-width: 0; overflow: hidden; }
.design-card.error { border-color: color-mix(in srgb, var(--red) 45%, var(--border)); }
.dc-main { flex: 1 1 260px; min-width: 0; }
.dc-id { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dc-name { font-size: 15px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.dc-rev { font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.dc-codes { display: flex; gap: 10px; align-items: center; }
.dc-did { font-size: 11px; color: var(--text-faint); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.dc-code { font-size: 12px; font-weight: 600; color: var(--accent); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.dc-prog { margin-top: 13px; }
.dc-prog-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--text-faint); margin-bottom: 7px; }
.dc-cost { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.dc-track { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.dc-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .6s ease; }
.dc-prog.error .dc-fill { background: var(--red); }
.dc-prog.live .dc-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, #fff), var(--accent), color-mix(in srgb, var(--accent) 55%, #fff)); background-size: 220% 100%; animation: dcpulse 1.5s linear infinite; }
@keyframes dcpulse { from { background-position: 220% 0; } to { background-position: 0 0; } }
.dc-err { margin-top: 8px; font-size: 12px; color: var(--red); font-family: ui-monospace, "SF Mono", Menlo, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* фикс-колонки: Open / Redo / Confirm на ОДНИХ местах во всех строках (не съезжают от длины кода/лейбла) */
.dc-actions { display: grid; grid-template-columns: 88px 104px 128px; gap: 8px; align-items: center; flex: 0 0 auto; margin-left: auto; }
.dc-actions > * { width: 100%; box-sizing: border-box; }
.dc-actions > .sm { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center; white-space: nowrap; }
.dc-actions > .meta-chip { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.dc-actions .sm svg { width: 14px; height: 14px; }
/* pending (ждёт аппрува): одна кнопка «Approve & build» на всю ширину блока действий */
.dc-actions.pending { grid-template-columns: 1fr; min-width: 220px; }
/* Redo = ИИ-действие: маленькая «искра-смайлик» в градиентовом кружке перед текстом */
.act-redo { display: inline-flex; align-items: center; gap: 7px; }
.ai-spark { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 999px; background: linear-gradient(135deg, #7c5cff, #2f6bff, #c44bd6); box-shadow: 0 1px 4px rgba(124, 92, 255, .35); flex: none; }
.ai-spark svg { width: 11px; height: 11px; fill: #fff; }
.callout.ok { border-color: color-mix(in srgb, var(--green) 40%, var(--border)); background: color-mix(in srgb, var(--green) 7%, var(--surface)); }
.callout.ok a { color: var(--accent); font-weight: 600; }

/* pending (ждёт аппрува) — янтарный, статичный «не запущено» */
.design-card.pending { border-color: color-mix(in srgb, var(--amber) 38%, var(--border)); background: color-mix(in srgb, var(--amber) 5%, var(--surface)); }
.dc-prog.pending .dc-fill { background: repeating-linear-gradient(45deg, var(--amber), var(--amber) 6px, color-mix(in srgb, var(--amber) 55%, #fff) 6px, color-mix(in srgb, var(--amber) 55%, #fff) 12px); }
.dc-prog.pending .dc-prog-head span { color: var(--amber); font-weight: 600; }
.ds-approve { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* переключатель авто-старта дизайна (над списком дизайнов) */
.ds-toolbar { display: flex; align-items: flex-start; gap: 12px; margin: 14px 2px 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-card); }
.ds-toolbar .switch { margin-top: 1px; }
.ds-toolbar .switch:not(.on) { background: var(--border-2); }
.ds-toolbar .switch:hover { background: var(--border-2); }
.ds-toolbar .switch.on:hover { background: var(--green); }
.ds-tog-txt .lbl { font-size: 13px; font-weight: 600; }
.ds-tog-txt .desc { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; }

/* redo = небольшой ИИ-ЧАТ: админ описывает правки, ИИ подтверждает, кнопка Rebuild запускает переделку */
#redoModal .scrim { z-index: 40; }
.redo-card { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 460px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 48px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: 0 16px 50px rgba(15, 20, 25, .2); display: flex; flex-direction: column; overflow: hidden; }
.redo-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex: none; }
.redo-head .ai-spark { width: 24px; height: 24px; }
.redo-head .ai-spark svg { width: 14px; height: 14px; }
.redo-head .rh-t { font-size: 14px; font-weight: 700; }
.redo-head .rh-s { font-size: 12px; color: var(--text-faint); }
.redo-head .dc-code { font-size: 12px; }
.redo-head .rh-x { margin-left: auto; border: none; background: none; padding: 4px; color: var(--text-faint); cursor: pointer; font-size: 18px; line-height: 1; }
.redo-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.rmsg { max-width: 86%; font-size: 13.5px; line-height: 1.45; padding: 9px 12px; border-radius: 13px; white-space: pre-wrap; }
.rmsg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.rmsg.ai { align-self: flex-start; background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.rmsg.ai.muted { color: var(--text-faint); font-style: italic; }
.redo-foot { flex: none; border-top: 1px solid var(--border); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.redo-inrow { display: flex; gap: 8px; align-items: flex-end; }
.redo-inrow textarea { flex: 1; box-sizing: border-box; border: 1px solid var(--border-2); border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 13.5px; resize: none; max-height: 96px; color: var(--text); }
.redo-inrow textarea:focus { outline: none; border-color: var(--accent); }
.redo-inrow .rsend { flex: none; }
.redo-rebuild { width: 100%; justify-content: center; display: inline-flex; align-items: center; gap: 8px; }
.redo-rebuild .ai-spark { width: 18px; height: 18px; }

@media (max-width: 640px) {
  .design-grid .design-card { gap: 14px; }
}

/* icon inside the dark auto/search header */
.auto-head .ttl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- lead meta as chips ---------- */
.lead-meta { gap: 7px; }
.meta-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px; white-space: nowrap; flex: none; }
.meta-chip .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; display: inline-block; }
.meta-chip .star { color: #e8a93a; font-size: 13px; line-height: 1; }
.meta-chip.ok { color: var(--green); }
.meta-chip.bad { color: var(--red); }
.meta-chip.warn { color: var(--amber); background: #fff8ea; border-color: #f1dca0; }
.meta-chip.a3 { color: #6d28d9; background: #f3effe; border-color: #ddd0fb; font-weight: 600; } /* вердикт Agent 3 */

/* ---------- pipeline (dashboard) — one clean logical chain ---------- */
.chain { display: flex; align-items: stretch; flex-wrap: wrap; gap: 0; }
.cnode { flex: 1 1 134px; min-width: 134px; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; background: #fff; display: flex; flex-direction: column; }
.cnode.accent { border-color: rgba(29, 155, 240, 0.4); background: var(--accent-soft); }
.cnode .cn-num { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.cnode .cn-label { font-weight: 600; margin-top: 7px; }
.cnode .cn-sub { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
.cnode .cn-green { color: var(--green); font-weight: 700; font-size: 15px; margin-top: 5px; }
.cnode .eng { margin-top: 8px; }
.eng-track { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.eng-fill { height: 100%; background: var(--accent); border-radius: 3px; }
.carrow { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 9px; flex: 0 0 auto; }
.carrow .ca { font-size: 16px; color: var(--border-2); line-height: 1; }
.carrow .cc { font-size: 11.5px; font-weight: 600; color: var(--text-dim); margin-top: 4px; }
.carrow .cx { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
@media (max-width: 880px) {
  .chain { flex-direction: column; align-items: stretch; }
  .carrow { flex-direction: row; gap: 8px; padding: 6px 0; }
  .carrow .ca { transform: rotate(90deg); }
}

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 30; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 50px rgba(0, 0, 0, 0.5); }
  .mobile-bar { display: flex; }
  .main { padding: 30px 18px 60px; }
  .lead { flex-wrap: wrap; }
  .lead-body { flex-basis: 100%; order: 3; }
  .grid-2 { grid-template-columns: 1fr; }
  .svc-row { grid-template-columns: 1fr 1fr; }
}

/* Screener cuts panel — отсеянное скринером, с возможностью вернуть в очередь */
.cuts-panel { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--line, #e5e7eb); }
.cuts-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cut-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line, #e5e7eb); border-radius: 12px; margin-bottom: 8px; background: var(--card, #fff); opacity: .9; }
.cut-name { font-weight: 600; }
.cut-cat { font-size: 11px; color: #b91c1c; background: #fee2e2; padding: 1px 8px; border-radius: 999px; margin-left: 6px; }
.cut-reason { font-size: 13px; color: var(--muted, #6b7280); margin-top: 3px; max-width: 70ch; }
.cut-sub { font-size: 12px; color: var(--muted, #9ca3af); margin-top: 3px; }
.cut-row button[data-act="rescue"] { flex-shrink: 0; }

/* ===== Outreach call center (Cycle → Calls) ===== */
:root { --ai: #7c5cff; --ai-soft: #f0ecff; }
.ai-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ai); margin-right: 6px; animation: aipulse 1.2s infinite; vertical-align: middle; }
@keyframes aipulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.7); } }
.meta-chip.ai-soft { color: var(--ai); background: var(--ai-soft); border-color: transparent; }

/* sub-tabs (segmented control) */
.oc-seg { display: inline-flex; gap: 4px; background: var(--surface-3); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.oc-seg-btn { display: inline-flex; align-items: center; gap: 7px; border: none; background: transparent; border-radius: 999px; padding: 7px 16px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--text-dim); cursor: pointer; }
.oc-seg-btn.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.oc-seg-n { font-size: 11px; font-weight: 700; color: var(--text-faint); background: var(--surface-3); border-radius: 999px; padding: 0 7px; min-width: 18px; text-align: center; }
.oc-seg-btn.on .oc-seg-n { background: var(--accent-soft); color: var(--accent); }

/* full-width rows ("request"-style elongated rectangles), collapsible */
.oc-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 22px; }
.oc-list .empty { padding: 40px; }
.oc-row { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.oc-row.live { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.06); }
.oc-row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: pointer; }
.oc-row-head.static { cursor: default; }
.oc-row-head:not(.static):hover { background: var(--surface-2); }
.oc-row-main { min-width: 0; }
.oc-row-title { display: flex; align-items: center; gap: 8px; }
.oc-row-title b { font-size: 15px; }
.oc-row-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.oc-row-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.oc-row-price { font-size: 14px; font-weight: 700; }
.oc-chev { color: var(--text-faint); display: inline-flex; transition: transform .15s; }
.oc-chev svg { width: 18px; height: 18px; }
.oc-row.open .oc-chev { transform: rotate(180deg); }
.oc-row-body { display: none; padding: 0 16px 16px; }
.oc-row.open .oc-row-body, .oc-row-body.open { display: block; }
.oc-row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.oc-row-actions .sm svg, .oc-row-actions a svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 2px; }

.oc-contact { font-size: 12.5px; color: var(--text); margin: 0 0 2px; font-variant-numeric: tabular-nums; }
.oc-instruction { font-size: 12.5px; color: var(--text-dim); background: var(--ai-soft); border-radius: 8px; padding: 7px 10px; margin: 0 0 10px; }

.oc-prep { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.oc-prep.pending { color: var(--ai); font-size: 13px; }
.oc-prep-sum { font-size: 13px; color: var(--text); margin-bottom: 8px; }
.oc-prep-sec { margin-top: 8px; }
.oc-prep-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; margin-bottom: 3px; }
.oc-prep-sec ul { margin: 0; padding-left: 16px; font-size: 12.5px; color: var(--text-dim); display: flex; flex-direction: column; gap: 2px; }
.oc-prep-sec.changes ul li { color: var(--text); }
.oc-price { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.oc-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 11px; }

/* live call */
.oc-live-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.oc-state { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-dim); }
.oc-state.oc-ai { background: var(--ai-soft); color: var(--ai); }
.oc-state.oc-live { background: var(--accent-soft); color: var(--accent); }
.oc-state.oc-ringing { background: #fff7e6; color: var(--amber); }
.oc-state.oc-paused { background: var(--surface-3); color: var(--text-faint); }
.oc-dur { font-size: 13px; font-weight: 700; }
.sp { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; margin: 9px 0 6px; padding: 3px 9px; border-radius: 999px; }
.sp-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: aipulse 1s infinite; }
.sp.sp-ai, .oc-turn.sp-ai .oc-who, .tl-row.sp-ai .tl-who { color: var(--ai); }
.sp.sp-human, .oc-turn.sp-human .oc-who, .tl-row.sp-human .tl-who { color: var(--accent); }
.sp.sp-biz, .oc-turn.sp-biz .oc-who, .tl-row.sp-biz .tl-who { color: var(--text-dim); }
.sp.sp-ai { background: var(--ai-soft); } .sp.sp-human { background: var(--accent-soft); } .sp.sp-biz { background: var(--surface-3); }
.oc-live-script { background: var(--surface-2); border-radius: 9px; padding: 9px 11px; max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.oc-turn { font-size: 12.5px; line-height: 1.45; }
.oc-who { font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; margin-right: 7px; }
.oc-suggest { margin-top: 9px; display: flex; flex-direction: column; gap: 6px; }
.oc-suggest:empty { display: none; }
.oc-sug-item { font-size: 12.5px; color: var(--ai); background: var(--ai-soft); border-radius: 8px; padding: 6px 10px; }

/* completed */
.oc-card.done { padding: 0; }
.oc-det > summary { list-style: none; cursor: pointer; padding: 12px 14px; }
.oc-det > summary::-webkit-details-marker { display: none; }
.oc-done-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.oc-done-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.oc-outcome { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; text-transform: capitalize; background: var(--surface-3); color: var(--text-dim); }
.oc-outcome.oc-won { background: rgba(0, 168, 120, .12); color: var(--green); }
.oc-outcome.oc-callback { background: #fff7e6; color: var(--amber); }
.oc-outcome.oc-declined, .oc-outcome.oc-not_interested { background: rgba(224, 36, 94, .1); color: var(--red); }
.oc-score { font-size: 18px; font-weight: 800; letter-spacing: -.02em; display: inline-flex; align-items: baseline; gap: 3px; }
.oc-score small { font-size: 9px; font-weight: 600; text-transform: uppercase; color: var(--text-faint); }
.oc-score.sm { font-size: 14px; padding: 1px 8px; border-radius: 8px; }
.oc-score.b1 { color: var(--red); } .oc-score.b2 { color: var(--amber); } .oc-score.b3 { color: var(--green); } .oc-score.b0 { color: var(--text-faint); }
.oc-det[open] > summary { border-bottom: 1px solid var(--border); }
.oc-eval { padding: 10px 0 4px; }
.oc-ev-top { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.oc-ev-head { font-size: 13px; color: var(--text); }
.oc-ev-sec { font-size: 12.5px; margin-top: 6px; } .oc-ev-sec b { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.oc-ev-sec ul { margin: 3px 0 0; padding-left: 16px; color: var(--text-dim); }
.oc-det-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; padding: 6px 0 2px; }
.oc-timeline { padding: 0 0 6px; display: flex; flex-direction: column; gap: 0; }
.tl-row { display: grid; grid-template-columns: 40px 14px 1fr; gap: 6px; align-items: start; font-size: 12.5px; padding: 4px 0; position: relative; }
.tl-time { color: var(--text-faint); font-size: 11px; padding-top: 1px; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin: 5px auto 0; }
.tl-row.sp-ai .tl-dot { color: var(--ai); } .tl-row.sp-human .tl-dot { color: var(--accent); } .tl-row.sp-biz .tl-dot { color: var(--border-2); }
.tl-who { display: none; }
.tl-txt { color: var(--text); grid-column: 3; }
.tl-row::before { content: ""; position: absolute; left: 46px; top: 14px; bottom: -4px; width: 1px; background: var(--border); }
.tl-row:last-child::before { display: none; }
.oc-requeue { display: flex; gap: 8px; padding: 12px 0 0; margin-top: 10px; border-top: 1px solid var(--border); }
.oc-requeue .rq-text { flex: 1; }

/* call-count circle + score delta near the business name */
.oc-calls { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.oc-delta { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.oc-delta.up { color: var(--green); }
.oc-delta.down { color: var(--red); }
.oc-delta.flat { color: var(--text-faint); }

/* combined AI box (quick actions + history-aware summary + chat) */
.ai-box { margin-top: 14px; border: 1px solid color-mix(in srgb, var(--ai) 22%, var(--border)); border-radius: 12px; background: linear-gradient(180deg, var(--ai-soft) 0%, #fff 60%); padding: 12px 14px; }
.ai-box-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.ai-badge { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 12px; letter-spacing: .02em; background: linear-gradient(90deg, #7c5cff, #c558ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ai-badge svg { width: 15px; height: 15px; fill: #9a6cff; }
.ai-box-title { font-size: 12.5px; font-weight: 600; color: var(--text-dim); flex: 1; }
.ai-chat-btn { display: inline-flex; align-items: center; gap: 6px; border-color: color-mix(in srgb, var(--ai) 40%, var(--border-2)); color: var(--ai); }
.ai-chat-btn svg { width: 15px; height: 15px; }
.ai-chat-btn:hover { background: var(--ai-soft); }
.ai-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.ai-actions:empty { display: none; }
.ai-act { font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; border-radius: 999px; padding: 7px 13px; border: 1px solid var(--border-2); background: #fff; color: var(--text); }
.ai-act:hover { background: var(--surface-2); }
.ai-act.k-schedule { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.ai-act.k-rework { border-color: color-mix(in srgb, var(--ai) 45%, #fff); color: var(--ai); background: var(--ai-soft); }
.ai-act.k-won { border-color: rgba(0, 168, 120, .4); color: var(--green); }
.ai-act.k-lost { border-color: rgba(224, 36, 94, .35); color: var(--red); }
.ai-act:disabled { opacity: .6; cursor: default; }
.ai-summary { font-size: 13px; color: var(--text); }
.ai-sum-text { line-height: 1.5; }
.ai-dyn { display: flex; gap: 6px; align-items: flex-start; margin-top: 7px; font-size: 12.5px; color: var(--ai); font-weight: 500; }
.ai-dyn svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.ai-recs { margin: 8px 0 0; padding-left: 17px; font-size: 12.5px; color: var(--text-dim); display: flex; flex-direction: column; gap: 3px; }

/* skeleton shimmer while the AI thinks (matches the admin loaders) */
.ai-skel { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.ai-skel .sk-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3) 25%, #e9edf0 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
.sk-line.w40 { width: 40%; } .sk-line.w50 { width: 50%; } .sk-line.w70 { width: 70%; } .sk-line.w75 { width: 75%; } .sk-line.w90 { width: 90%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* per-call AI chat */
.ai-chat { margin-top: 12px; border-top: 1px dashed var(--border-2); padding-top: 12px; }
.ai-chat-log { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; margin-bottom: 10px; }
.ai-chat-hint { font-size: 12.5px; color: var(--text-faint); }
.aic-msg { font-size: 13px; line-height: 1.45; max-width: 88%; }
.aic-msg.user { align-self: flex-end; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; }
.aic-msg.ai { align-self: flex-start; display: flex; gap: 8px; }
.aic-badge { flex: none; }
.aic-badge svg { width: 15px; height: 15px; fill: #9a6cff; margin-top: 2px; }
.aic-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-chat-row { display: flex; gap: 8px; }
.ai-chat-in { flex: 1; font: inherit; padding: 9px 12px; border: 1px solid var(--border-2); border-radius: var(--r-ctrl); }
.ai-chat-in:focus { outline: none; border-color: var(--ai); }

@media (max-width: 900px) { .oc-board { grid-template-columns: 1fr; } }

/* ============ BUILD: дев-агент Claude в консоли ============ */
:root { --ai1: #7c5cff; --ai2: #2f6bff; --ai3: #c44bd6; --ai-grad: linear-gradient(120deg, var(--ai1), var(--ai2) 55%, var(--ai3)); }
.nav-dev svg { color: var(--ai1); }
/* Build занимает всю ширину экрана (шире остальных разделов): чату нужно место */
.main > #view:has(.dev2) { max-width: none; }
.dev2 { display: flex; gap: 28px; height: calc(100vh - 56px); padding: 6px 0 14px 40px; }
.dev2-chats { margin-left: 8px; }
.dev2-main { flex: 1; min-width: 0; max-width: 1240px; margin: 0 auto 0 8px; display: flex; flex-direction: column; min-height: 0; }

/* список чатов слева */
.dev2-chats { flex: 0 0 220px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.dev2-newchat { flex: 0 0 auto; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); border-radius: 11px; padding: 10px 12px; font-size: 13px; font-weight: 650; cursor: pointer; text-align: left; transition: all .15s; }
.dev2-newchat:hover { border-color: var(--ai1); color: var(--ai1); }
.dev2-chats-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 2px; }
.dev2-chats-empty { color: var(--text-faint); font-size: 12.5px; padding: 8px 4px; }
.dev2-chat-item { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border-radius: 9px; cursor: pointer; color: var(--text-dim); transition: background .12s; }
.dev2-chat-item:hover { background: var(--surface-2); color: var(--text); }
.dev2-chat-item.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.dev2-chat-item .dc-ttl { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev2-chat-item .dc-del { flex: 0 0 auto; border: 0; background: transparent; color: var(--text-faint); cursor: pointer; font-size: 17px; line-height: 1; width: 20px; height: 20px; border-radius: 6px; opacity: 0; }
.dev2-chat-item:hover .dc-del { opacity: 1; }
.dev2-chat-item .dc-del:hover { background: var(--surface); color: var(--red); }

/* кнопка рестарта в баре + баннер «нужен рестарт» */
.dev2-restart { border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-dim); border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .15s; }
.dev2-restart:hover { background: var(--surface-3); color: var(--text); }
.dev2-restart:disabled { opacity: .6; cursor: default; }
.dev2-restart.need { border-color: #f59e0b; background: #fff8ed; color: #92510a; animation: dev2pulse 1.6s ease-in-out infinite; }
@keyframes dev2pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); } 50% { box-shadow: 0 0 0 4px rgba(245,158,11,.18); } }
.dev2-restart-note { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff8ed; border: 1px solid #fde2bd; color: #92510a; border-radius: 10px; padding: 10px 13px; font-size: 13px; }
.dev2-restart-btn { border: 0; background: #f59e0b; color: #fff; border-radius: 9px; padding: 8px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.dev2-restart-btn:hover { background: #d98a00; }

/* верхняя панель: заголовок · переключатель моделей · лимиты */
.dev2-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 2px 2px 12px; border-bottom: 1px solid var(--border); }
.dev2-title { font-size: 19px; font-weight: 750; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.dev2-spark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 14px; background: var(--ai-grad); box-shadow: 0 4px 12px rgba(124, 92, 255, .35); }
.dev2-bar-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dev2-models { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 999px; padding: 3px; gap: 2px; }
.dev2-models.locked { opacity: .55; pointer-events: none; }
.dev2-model { border: 0; background: transparent; color: var(--text-dim); font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 999px; cursor: pointer; transition: all .15s; }
.dev2-model:hover { color: var(--text); }
.dev2-model.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.dev2-lim { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-dim); }
.dev2-lim::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--text-faint); }
.dev2-lim.ok { color: #0a7d57; background: #ecfdf5; border-color: #b7ebd6; }
.dev2-lim.ok::before { background: var(--green); box-shadow: 0 0 0 3px rgba(0,168,120,.18); }
.dev2-lim.bad { color: #9a1c40; background: #fdf0f4; border-color: #f6c9d8; }
.dev2-lim.bad::before { background: var(--red); box-shadow: 0 0 0 3px rgba(224,36,94,.18); }
.dev2-lim.muted { font-weight: 500; }

.dev2-sub { color: var(--text-dim); font-size: 12.5px; margin-top: 12px; line-height: 1.55; }
.dev2-sub code, .dev2-warn code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: 11.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.dev2-warn { display: flex; align-items: center; gap: 9px; background: #fff8ed; border: 1px solid #fde2bd; color: #92510a; font-size: 12px; padding: 9px 13px; border-radius: 10px; margin-top: 10px; }
.dev2-warn-ic { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 999px; background: #f59e0b; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12px; }

/* лента диалога */
.dev2-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 18px 2px 14px; scroll-behavior: smooth; }
.dev2-log::-webkit-scrollbar { width: 9px; }
.dev2-log::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
.dev2-hello { display: flex; gap: 13px; align-items: flex-start; color: var(--text-dim); font-size: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-card); padding: 17px 18px; line-height: 1.55; }
.dev2-hello-av { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; background: var(--ai-grad); color: #fff; display: grid; place-items: center; font-size: 15px; box-shadow: 0 4px 12px rgba(124,92,255,.3); }

.dev2-msg.user { align-self: flex-end; max-width: 78%; background: var(--ink); color: #fff; padding: 11px 15px; border-radius: 16px 16px 5px 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 2px 8px rgba(15,20,25,.14); }

.dev2-turn { align-self: stretch; display: flex; gap: 12px; align-items: flex-start; max-width: 94%; animation: dev2in .25s ease; }
@keyframes dev2in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dev2-av { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; background: var(--ai-grad); color: #fff; display: grid; place-items: center; font-size: 15px; box-shadow: 0 3px 10px rgba(124,92,255,.28); }
.dev2-turn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; padding-top: 2px; }
.dev2-steps { display: flex; flex-direction: column; gap: 5px; }
.dev2-steps:empty { display: none; }
.dev2-step { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 11px; animation: dev2in .2s ease; }
.dev2-step .s-ic { color: var(--ai1); width: 15px; text-align: center; flex: 0 0 auto; font-size: 13px; }
.dev2-step .s-tx { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev2-answer { font-size: 14.5px; line-height: 1.62; color: var(--text); white-space: pre-wrap; word-wrap: break-word; }
.dev2-answer:empty { display: none; }
.dev2-err { font-size: 13px; color: var(--red); background: #fdf0f4; border: 1px solid #f6c9d8; border-radius: 9px; padding: 9px 12px; }
.dev2-stopped { font-size: 12.5px; color: var(--text-dim); background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: 9px; padding: 8px 12px; }
.dev2-thinking { display: inline-flex; gap: 5px; padding: 5px 2px; }
.dev2-thinking i { width: 7px; height: 7px; border-radius: 999px; background: var(--ai1); opacity: .5; animation: dev2b 1.1s ease-in-out infinite; }
.dev2-thinking i:nth-child(2) { background: var(--ai2); animation-delay: .15s; }
.dev2-thinking i:nth-child(3) { background: var(--ai3); animation-delay: .3s; }
@keyframes dev2b { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-5px); opacity: 1; } }

/* быстрые подсказки + композер */
.dev2-quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 2px 10px; }
.dev2-chip { font-size: 12.5px; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 999px; padding: 7px 13px; cursor: pointer; transition: all .15s; }
.dev2-chip:hover { background: var(--surface); border-color: var(--ai1); color: var(--text); }
.dev2-form { display: flex; align-items: flex-end; gap: 9px; border: 1.5px solid var(--border-2); border-radius: 16px; padding: 9px 9px 9px 22px; background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.04); transition: border-color .15s, box-shadow .15s; }
.dev2-form:focus-within { border-color: var(--border-2); }
#devInput { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; font: inherit; font-size: 14.5px; line-height: 1.5; background: transparent; color: var(--text); padding: 14px 0; min-height: 72px; max-height: 260px; }
#devInput::placeholder { color: var(--text-faint); }
.dev2-actions { display: flex; align-items: center; gap: 7px; }
.dev2-new { background: transparent; border: 1px solid var(--border-2); color: var(--text-dim); border-radius: 11px; padding: 9px 13px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s; }
.dev2-new:hover { background: var(--surface-3); color: var(--text); }
.dev2-new:disabled { opacity: .45; cursor: default; }
.dev2-send { display: inline-flex; align-items: center; gap: 7px; background: var(--ai-grad); color: #fff; border: 0; border-radius: 11px; padding: 10px 18px; cursor: pointer; font-size: 13.5px; font-weight: 700; box-shadow: 0 4px 12px rgba(124,92,255,.3); transition: transform .12s, box-shadow .15s, background .2s; }
.dev2-send:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(124,92,255,.4); }
.dev2-send:active { transform: none; }
.dev2-send .ds-ic { font-size: 12px; }
.dev2-send.is-stop { background: var(--red); box-shadow: 0 4px 12px rgba(224,36,94,.32); }
.dev2-send.is-stop:hover { box-shadow: 0 6px 16px rgba(224,36,94,.42); }
