/* Пульт Гермеса v2 — стили. Mobile-first, светлая/тёмная тема, цвета Telegram через JS.
   Движение: 150–250 мс, только чтобы показать смену состояния; prefers-reduced-motion выключает всё. */

:root {
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: 200ms;
  --shadow: 0 1px 2px rgb(16 24 32 / .05), 0 1px 1px rgb(16 24 32 / .03);
  --shadow-up: 0 6px 20px rgb(16 24 32 / .10);
  --bg: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #eceff2;
  --text: #16191d;
  --muted: #5d6672;
  --border: #dde1e6;
  --accent: #0b7489;
  --accent-contrast: #ffffff;
  --accent-soft: #e1f1f4;
  --link: #0a6779;
  --ok: #1d7a3d;
  --ok-soft: #e2f3e7;
  --warn: #855400;
  --warn-soft: #fbefd2;
  --bad: #b3261e;
  --bad-soft: #fce8e6;
  --info: #1f5ea8;
  --info-soft: #e5edf9;
  --topbar-h: 52px;
  --tabbar-h: 62px;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) {
    --shadow: none;
    --shadow-up: 0 8px 24px rgb(0 0 0 / .45);
    --bg: #0e1114;
    --surface: #171b1f;
    --surface-2: #20262d;
    --text: #e6e9ed;
    --muted: #98a1ac;
    --border: #2c333b;
    --accent: #3cb2c4;
    --accent-contrast: #05252b;
    --accent-soft: #123239;
    --link: #5cc3d3;
    --ok: #5fc98b;
    --ok-soft: #14301f;
    --warn: #e5b44e;
    --warn-soft: #362a10;
    --bad: #ff8577;
    --bad-soft: #3b1b18;
    --info: #85b5ef;
    --info-soft: #152a44;
    color-scheme: dark;
  }
}
:root[data-scheme="dark"] {
  --shadow: none;
  --shadow-up: 0 8px 24px rgb(0 0 0 / .45);
  --bg: #0e1114;
  --surface: #171b1f;
  --surface-2: #20262d;
  --text: #e6e9ed;
  --muted: #98a1ac;
  --border: #2c333b;
  --accent: #3cb2c4;
  --accent-contrast: #05252b;
  --accent-soft: #123239;
  --link: #5cc3d3;
  --ok: #5fc98b;
  --ok-soft: #14301f;
  --warn: #e5b44e;
  --warn-soft: #362a10;
  --bad: #ff8577;
  --bad-soft: #3b1b18;
  --info: #85b5ef;
  --info-soft: #152a44;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
  min-height: 100vh;
}
body.no-tabs { padding-bottom: calc(16px + var(--safe-b)); }

[hidden] { display: none !important; }

a { color: var(--link); }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
svg { display: block; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-t);
}
.topbar-in {
  max-width: 900px; margin: 0 auto;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 4px;
  padding: 0 4px 0 12px;
}
.topbar-in:has(#back:not([hidden])) { padding-left: 2px; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 {
  font-size: 17px; font-weight: 700; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-sub { font-size: 12px; color: var(--muted); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub:empty { display: none; }

.icon-btn {
  flex: none;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text);
  border-radius: 10px; cursor: pointer; padding: 0;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg, .tab-ic svg, .ic {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
#refresh.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Нижние вкладки ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(var(--tabs, 5), 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
}
.tab {
  min-height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); text-decoration: none;
  font-size: 11.5px; font-weight: 550; line-height: 1.1;
  padding: 6px 0 5px;
  transition: color var(--dur) var(--ease);
}
.tab[aria-current="page"] { color: var(--text); font-weight: 700; }
.tab-ic {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 30px; border-radius: 15px;
  transition: background-color var(--dur) var(--ease), transform 120ms var(--ease);
}
/* индикатор активной вкладки — мягкая «таблетка» под иконкой */
.tab[aria-current="page"] .tab-ic { background: var(--accent-soft); color: var(--accent); }
.tab:active .tab-ic { transform: scale(0.92); }
.tab-l { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.badge {
  position: absolute; top: -5px; left: 32px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--accent); color: var(--accent-contrast);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface);
}
.badge.hot { background: var(--bad); color: #fff; }

/* ---------- Баннер связи ---------- */
.banner {
  position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); z-index: 15;
  display: flex; align-items: center; gap: 10px;
  max-width: 900px; margin: 0 auto;
  padding: 4px 6px 4px 14px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 13px; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.banner span { flex: 1; }

/* ---------- Контент ---------- */
main {
  display: block;
  max-width: 900px; margin: 0 auto;
  padding: 12px 12px 20px;
}
.stack > * + * { margin-top: 12px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 4px; }
.spinner {
  width: 16px; height: 16px; flex: none;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.panel > * + * { margin-top: 8px; }
.sec-title {
  font-size: 13px; font-weight: 650; color: var(--muted);
  display: flex; align-items: center; gap: 8px;
}
.sec-title .grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp1, .clamp2, .clamp3, .clamp5 {
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.clamp1 { -webkit-line-clamp: 1; }
.clamp2 { -webkit-line-clamp: 2; }
.clamp3 { -webkit-line-clamp: 3; }
.clamp5 { -webkit-line-clamp: 5; }
.unclamp { -webkit-line-clamp: unset; display: block; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
  text-align: center; text-decoration: none;
  cursor: pointer; user-select: none;
}
.btn:active { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn.primary:active { filter: brightness(0.93); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--link); }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.btn-sm { min-height: 44px; padding: 0 12px; font-size: 13px; }
.btn.block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row > .btn { flex: 1 1 auto; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-grid .wide { grid-column: 1 / -1; }

/* ---------- Чипы ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 22px; padding: 1px 8px;
  border-radius: 11px;
  background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 600; line-height: 1.25;
  white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.accent { background: var(--accent-soft); color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Сегменты-переключатели ---------- */
.seg {
  display: flex; gap: 2px;
  padding: 3px; border-radius: 12px;
  background: var(--surface-2);
}
.seg > * {
  flex: 1 1 0; min-width: 0;
  min-height: 44px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.seg > [aria-current="page"], .seg > [aria-pressed="true"] {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}
.seg .cnt { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; font-size: 12px; }
.seg.scroll { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll > * { flex: 1 0 auto; padding: 0 10px; }
.cnt-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--bad); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- Поля ввода ---------- */
.field { display: block; }
.field > .lbl { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
textarea, input[type="search"], input[type="text"], select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; /* 16px — чтобы iOS не увеличивал страницу */
  line-height: 1.35;
}
textarea { resize: vertical; display: block; }
textarea.grow { resize: none; overflow-y: hidden; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
::placeholder { color: var(--muted); opacity: 0.85; }
.hint { font-size: 12px; color: var(--muted); }
.err-text { font-size: 13px; color: var(--bad); font-weight: 600; }
.toolbar { display: grid; gap: 8px; }
.toolbar-row { display: flex; gap: 8px; align-items: center; }
.toolbar-row > * { flex: 1 1 0; min-width: 0; }
.count-line { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.count-line .btn { flex: none; }

/* ---------- Состояние / предупреждения ---------- */
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding: 0 2px; }
.status-line .dot.ok { background: var(--ok); }
.status-line .dot.bad { background: var(--bad); }
.status-line .dot.warn { background: var(--warn); }
.status-line b { color: var(--text); font-weight: 650; }
.alert { border-radius: var(--radius); padding: 10px 12px; font-size: 14px; border: 1px solid transparent; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert li + li { margin-top: 2px; }
.alert-title { font-weight: 700; }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert li, .alert p { color: var(--text); }

/* ---------- Главная ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px;
  min-height: 88px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.tile:active { background: var(--surface-2); }
.tile .n { font-size: 30px; font-weight: 700; line-height: 1; }
.tile .l { font-size: 14px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.tile .l svg { width: 16px; height: 16px; }
.tile.hot { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tile.hot .n { color: var(--accent); }
.tile.zero .n { color: var(--muted); }
.tiles > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 72px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.stat .v { font-size: 22px; font-weight: 700; line-height: 1.15; }
.stat .v.txt { font-size: 15px; line-height: 1.4; padding-top: 3px; color: var(--muted); font-weight: 600; }
.stat .l { font-size: 12px; color: var(--muted); }

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 7px 6px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl th:first-child, .tbl td:first-child { text-align: left; padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl th { font-size: 12px; font-weight: 600; color: var(--muted); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.zero { color: var(--muted); }
.tbl td.wrap { white-space: normal; }

/* ---------- Список карточек ---------- */
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.list > * { min-width: 0; }
.item {
  display: block;
  padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
a.item:active { background: var(--surface-2); }
.item > * + * { margin-top: 5px; }
.item-top { display: flex; align-items: baseline; gap: 8px; font-size: 13px; min-width: 0; }
.item-top .id { font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.item-top .meta { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-top .age { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.item .cust { font-size: 14px; }
.item .need { font-size: 13px; color: var(--muted); }
.item .need b { color: var(--text); font-weight: 650; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.empty .ic { width: 36px; height: 36px; margin: 0 auto 10px; color: var(--ok); stroke-width: 1.6; }
.empty .btn { margin-top: 12px; }

/* ---------- Карточка ---------- */
.card-head .row1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card-head .big-id { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.card-head .sub { color: var(--muted); font-size: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; align-items: baseline; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.need-box { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.need-box .sec-title { color: var(--text); }
.quote { font-size: 15px; }

details.fold { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
details.fold > summary {
  list-style: none; cursor: pointer;
  min-height: 44px; padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 650;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after {
  content: ""; margin-left: auto; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.15s; flex: none; margin-top: -4px;
}
details.fold[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.fold > summary .muted { font-weight: 500; font-size: 13px; }
.fold-body { padding: 0 12px 12px; }

.dialog { display: grid; gap: 6px; }
.msg { padding: 7px 10px; border-radius: 10px; max-width: 92%; font-size: 14px; background: var(--surface-2); }
.msg .who { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 1px; }
.msg.shop { justify-self: end; background: var(--accent-soft); }
.msg.sys { justify-self: center; background: transparent; color: var(--muted); font-size: 12px; text-align: center; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history li { border-left: 2px solid var(--border); padding-left: 10px; font-size: 14px; }
.history .h-meta { font-size: 12px; color: var(--muted); }

.score-total { display: flex; align-items: baseline; gap: 8px; }
.score-total .v { font-size: 26px; font-weight: 750; line-height: 1; }
.score-rows { width: 100%; border-collapse: collapse; font-size: 13px; }
.score-rows td { padding: 6px 0; border-top: 1px solid var(--border); vertical-align: top; }
.score-rows td.s { width: 40px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-rows .note { color: var(--muted); display: block; font-size: 12px; }

.contacts { display: grid; gap: 8px; }
.contact-row { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.contact-row .lbl { color: var(--muted); font-size: 13px; width: 70px; flex: none; }
.contact-row .val { flex: 1; min-width: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.contact-row a.val { text-decoration: none; }

.editor { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.editor.danger-zone { background: var(--bad-soft); }
.editor .confirm-text { font-size: 14px; font-weight: 600; }

.act-status { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 14px; background: var(--info-soft); }
.act-status .t { font-weight: 650; }
.act-status .s { font-size: 12px; color: var(--muted); }
.act-status.ok { background: var(--ok-soft); }
.act-status.ok .t { color: var(--ok); }
.act-status.err { background: var(--bad-soft); }
.act-status.err .t { color: var(--bad); }
.act-status.wait { background: var(--warn-soft); }
.act-status .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.act-status .spinner { margin-top: 2px; }

/* ---------- Вопросы ---------- */
.q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow: hidden; }
.q > * + * { margin-top: 8px; }
.q-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.q-model { font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.q-wait { color: var(--muted); flex: none; }
.q-text { font-size: 16px; font-weight: 550; line-height: 1.4; overflow-wrap: anywhere; }
.q-cards { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.q-cards a { font-weight: 650; font-variant-numeric: tabular-nums; text-decoration: none; padding: 2px 0; }
.q-src { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.q-web { background: var(--info-soft); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.q-web .lbl { font-weight: 700; color: var(--info); }
.q-input { display: flex; gap: 8px; align-items: flex-end; }
.q-input textarea { flex: 1; min-width: 0; }
.q-input .btn { flex: none; }
.q-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.q.done { background: var(--ok-soft); border-color: transparent; }
.q-ok { display: flex; gap: 8px; align-items: center; color: var(--ok); font-weight: 650; font-size: 14px; }
.q-ok .ic { width: 18px; height: 18px; }
.q-ok span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 500; }
.q.leaving { transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.28s ease, margin 0.28s ease, border-width 0.28s; opacity: 0; padding-top: 0; padding-bottom: 0; border-width: 0; }
.q.hl { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Журнал ответов ---------- */
.ans > * + * { margin-top: 6px; }
.ans .a-q { font-size: 13px; color: var(--muted); }
.ans .a-q b { color: var(--text); font-weight: 600; }
.ans .a-text { font-size: 14px; }
.more-btn { min-height: 44px; padding: 0; font-size: 13px; margin-top: -6px; margin-bottom: -10px; }
.score-chip { font-variant-numeric: tabular-nums; }
.a-problems { margin: 0; padding: 0 0 0 18px; font-size: 13px; color: var(--text); }
.a-problems li { padding-left: 2px; }
.a-problems li::marker { color: var(--warn); }
.item-top a.id { text-decoration: none; color: var(--link); }
/* мелкие ссылки-номера: зона касания ~44px без сдвига вёрстки */
.item-top a.id, .q-cards a { display: inline-block; padding: 12px 6px; margin: -12px -6px; position: relative; }
.q-cards a + a { margin-left: 2px; }
.a-problems .more { list-style: none; margin-left: -16px; color: var(--muted); font-size: 12px; }
.a-problems.full { -webkit-line-clamp: unset; }
.a-better { background: var(--ok-soft); border-radius: 8px; padding: 8px 10px; font-size: 14px; margin-top: 8px; }
.d-lbl { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 1px; }
.fold-body .d-lbl { margin-top: 8px; }
.ans details.fold { background: var(--surface-2); border-color: transparent; border-radius: 10px; }
.ans details.fold > summary { font-size: 13px; min-height: 44px; padding: 8px 10px; }
.ans .fold-body { padding: 0 10px 10px; }

/* ---------- Отчёты (markdown) ---------- */
.md { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md h1 { font-size: 21px; margin: 18px 0 8px; line-height: 1.25; }
.md h2 { font-size: 18px; margin: 18px 0 8px; line-height: 1.3; }
.md h3 { font-size: 16px; margin: 14px 0 6px; }
.md h4, .md h5, .md h6 { font-size: 15px; margin: 12px 0 4px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md li > ul, .md li > ol { margin: 2px 0 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.md pre { background: var(--surface-2); border-radius: 8px; padding: 10px; overflow-x: auto; margin: 0 0 10px; }
.md pre code { background: none; padding: 0; white-space: pre; }
.md blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid var(--border); color: var(--muted); }
.md .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 12px; border: 1px solid var(--border); border-radius: 8px; }
.md table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.md th, .md td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: normal; word-break: normal; min-width: 4.5em; max-width: 22em; }
.md th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.md td.r, .md th.r { text-align: right; }
.md td.c, .md th.c { text-align: center; }

/* ---------- Ещё ---------- */
.menu { display: grid; gap: 0; padding: 0; overflow: hidden; }
.menu a {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 8px 12px;
  color: var(--text); text-decoration: none; font-weight: 600;
  border-top: 1px solid var(--border);
}
.menu a:first-child { border-top: 0; }
.menu a:active { background: var(--surface-2); }
.menu .grow { flex: 1; }
.menu .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.menu .chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); flex: none; }
.menu .ic { color: var(--accent); }
.pill { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: var(--accent-contrast); font-size: 12px; font-weight: 700; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Цифры: диаграмма ---------- */
.chart { position: relative; }
.chart-read { font-size: 13px; color: var(--muted); min-height: 20px; }
.chart-read b { color: var(--text); font-variant-numeric: tabular-nums; }
.chart-body { display: grid; grid-template-columns: auto 1fr; gap: 6px; margin-top: 8px; }
.chart-y { position: relative; height: 160px; width: 26px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-y span { position: absolute; right: 0; transform: translateY(50%); line-height: 1; }
.chart-plot { position: relative; height: 160px; }
.chart-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.chart-grid.base { border-top-color: color-mix(in srgb, var(--muted) 55%, transparent); }
.chart-bars { position: absolute; inset: 0; display: flex; align-items: stretch; }
.chart-col {
  flex: 1 1 0; min-width: 0; position: relative;
  display: flex; align-items: flex-end; justify-content: center;
  border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer;
  border-radius: 4px;
}
.chart-col:focus-visible { outline-offset: 0; }
.chart-bar {
  width: min(24px, 64%);
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 1px;
}
.chart-col.sel { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.chart-col .val {
  position: absolute; left: 50%; transform: translate(-50%, -100%);
  font-size: 11px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums;
  padding-bottom: 2px; white-space: nowrap; pointer-events: none;
}
.chart-x { display: flex; margin-left: 32px; font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.chart-x span { flex: 1 1 0; text-align: center; min-width: 0; overflow: visible; white-space: nowrap; }
.types { display: grid; }
.type-row { padding: 8px 0; border-top: 1px solid var(--border); }
.type-row:first-child { border-top: 0; padding-top: 2px; }
.type-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.type-name { font-weight: 650; font-size: 15px; }
.goal { display: flex; gap: 8px; align-items: center; }
.goal .ic { color: var(--accent); width: 20px; height: 20px; flex: none; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; min-width: 60px; }
.meter > span { display: block; height: 100%; border-radius: 3px; background: var(--ok); }
.meter.warn > span { background: var(--warn); }
.meter.bad > span { background: var(--bad); }

/* ---------- Улучшения ---------- */
.dec > * + * { margin-top: 8px; }
.dec .d-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.dec .d-lbl { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 1px; }
.dec .d-text { font-size: 14px; }
.change { display: grid; gap: 6px; }
.change .was, .change .now { border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.change .was { background: var(--bad-soft); }
.change .now { background: var(--ok-soft); }
.change .d-lbl { color: inherit; opacity: 0.8; }

/* ---------- Нет входа ---------- */
.noauth { text-align: center; padding: 48px 20px; max-width: 420px; margin: 0 auto; }
.noauth .logo { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 16px; }
.noauth h2 { font-size: 19px; margin-bottom: 8px; }
.noauth p { color: var(--muted); margin-bottom: 8px; }
.noauth .btn { margin-top: 12px; }

/* ---------- Тост ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); z-index: 30;
  max-width: min(92vw, 420px);
  padding: 10px 14px; border-radius: 10px;
  background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
}
body.no-tabs .toast { bottom: calc(16px + var(--safe-b)); }

.noscript { padding: 24px; text-align: center; }

/* ---------- Скелет загрузки ---------- */
.sk { background: var(--surface-2); border-radius: 6px; height: 14px; animation: pulse 1.2s ease-in-out infinite; }
.sk + .sk { margin-top: 8px; }
.sk.w60 { width: 60%; } .sk.w80 { width: 80%; } .sk.w40 { width: 40%; }
.sk-item { padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
@keyframes pulse { 50% { opacity: 0.55; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Широкий экран: вкладки сверху, колонка до 900px ---------- */
@media (min-width: 760px) {
  body { padding-bottom: 32px; }
  .tabbar {
    position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); bottom: auto;
    max-width: 900px; margin: 0 auto;
    display: flex; gap: 2px; padding: 6px 8px;
    background: var(--bg); border-top: 0; border-bottom: 1px solid var(--border);
  }
  .tab { flex-direction: row; min-height: 44px; padding: 0 12px; gap: 8px; font-size: 14px; border-radius: 10px; }
  .tab[aria-current="page"] { background: var(--surface); }
  .tab-ic svg { width: 20px; height: 20px; }
  .badge { position: static; margin-left: 2px; box-shadow: none; display: inline-block; }
  .tab-ic { display: flex; align-items: center; gap: 6px; }
  .tab-ic .badge { order: 2; }
  .banner { top: calc(var(--topbar-h) + var(--safe-t) + 57px); }
  .toast { bottom: 24px; }
  main { padding: 16px 16px 32px; }
  .tiles { grid-template-columns: repeat(5, 1fr); }
  .tiles > .tile:last-child:nth-child(odd) { grid-column: auto; min-height: 88px; }
  .tbl-wrap { margin: 0; padding: 0; }
  .item:hover, .tile:hover, .menu a:hover { background: var(--surface-2); }
  .q-btns { grid-template-columns: repeat(3, minmax(0, 140px)); }
}

/* 26.10 Ещё → Система */
.sys-list{margin:0;padding-left:18px;display:grid;gap:6px}

/* ================================================================
   v2: движение, сводка, показатели, товары, аудит, агент, голос
   ================================================================ */

/* ---------- Поверхности и отклик ---------- */
.panel, .item, .q, .sk-item { box-shadow: var(--shadow); }
.btn { transition: transform 120ms var(--ease), background-color 150ms var(--ease), border-color 150ms var(--ease), filter 150ms var(--ease); }
.btn:active:not(:disabled) { transform: scale(0.98); }
a.item, .todo-row, .flag-row, .menu a, .kt.link { transition: background-color 150ms var(--ease); }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); flex: none; opacity: .8; }
.status-line a { color: inherit; text-decoration: none; }

/* скелет: бегущий блик вместо мигания */
.sk {
  background: linear-gradient(90deg, var(--surface-2) 0%, color-mix(in srgb, var(--surface-2) 45%, var(--surface)) 40%, var(--surface-2) 80%);
  background-size: 240% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -110% 0; } }

/* появление экрана после перехода: блоки поднимаются по очереди */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#view.enter > .stack > *, #view.enter > :not(.stack) { animation: rise 260ms var(--ease-out) both; }
#view.enter > .stack > :nth-child(2) { animation-delay: 35ms; }
#view.enter > .stack > :nth-child(3) { animation-delay: 70ms; }
#view.enter > .stack > :nth-child(4) { animation-delay: 105ms; }
#view.enter > .stack > :nth-child(n+5) { animation-delay: 140ms; }
#view.enter .list > :nth-child(-n+8) { animation: rise 240ms var(--ease-out) both; }
#view.enter .list > :nth-child(2) { animation-delay: 60ms; }
#view.enter .list > :nth-child(3) { animation-delay: 85ms; }
#view.enter .list > :nth-child(4) { animation-delay: 110ms; }
#view.enter .list > :nth-child(5) { animation-delay: 135ms; }
#view.enter .list > :nth-child(6) { animation-delay: 160ms; }
#view.enter .list > :nth-child(7) { animation-delay: 185ms; }
#view.enter .list > :nth-child(8) { animation-delay: 210ms; }

/* счётчики вкладок */
.badge.live { background: var(--info); color: #fff; }
.badge.bump { animation: bump 320ms var(--ease-out); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }

.toast { animation: toast-in 220ms var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- «Сейчас»: что ждёт людей и агента ---------- */
.todo { padding: 0; overflow: hidden; }
.todo > .sec-title { padding: 12px 12px 4px; }
.todo-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 58px; padding: 8px 12px;
  color: var(--text); text-decoration: none;
  border-top: 1px solid var(--border);
}
.todo > .sec-title + .todo-row { border-top: 0; }
.todo-row:active { background: var(--surface-2); }
.todo-n {
  min-width: 42px; height: 34px; padding: 0 8px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; flex: none;
  font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--muted);
}
.todo-n.on { background: var(--accent-soft); color: var(--text); }
.todo-n.hot { background: var(--accent); color: var(--accent-contrast); }
.todo-n.live { background: var(--info-soft); color: var(--info); }
.todo-n.bad { background: var(--bad); color: #fff; }
.todo-row > .grow, .flag-row > .grow { flex: 1; min-width: 0; }
.todo-n .ic { width: 19px; height: 19px; color: var(--accent); }
.todo-l { display: block; font-weight: 650; font-size: 15px; }
.todo .sub, .flag-row .sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.3; }
.todo-row.zero .todo-l { color: var(--muted); font-weight: 600; }

/* ---------- Неделя (сводка продаж) ---------- */
.kpi-week { display: block; color: var(--text); text-decoration: none; }
a.kpi-week:active { background: var(--surface-2); }
.kw-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kw-v { font-size: 30px; font-weight: 780; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kw-sub { font-size: 13px; color: var(--muted); }
.kw-cabs { display: grid; gap: 8px; margin-top: 12px !important; padding-top: 10px; border-top: 1px solid var(--border); }
.kw-cab { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 14px; }
.kw-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kw-rev { font-weight: 700; }
.kw-more { display: flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 650; color: var(--link); }
.kw-more .ic { width: 16px; height: 16px; }

.chip.delta { gap: 1px; padding: 1px 8px 1px 5px; font-variant-numeric: tabular-nums; }
.chip .dx { width: 14px; height: 14px; stroke-width: 2.4; }
.chip .ic.dx { flex: none; }

/* ---------- Требует внимания ---------- */
.flags { padding: 0 0 6px; overflow: hidden; }
.flags > .sec-title { padding: 12px 12px 4px; }
.flag-row {
  display: flex; align-items: center; gap: 10px;
  min-height: 54px; padding: 8px 12px;
  color: var(--text); text-decoration: none;
  border-top: 1px solid var(--border);
}
.flags > .sec-title + .flag-row { border-top: 0; }
a.flag-row:active { background: var(--surface-2); }
.fl-ic { width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--warn-soft); color: var(--warn); }
.fl-ic.stock { background: var(--bad-soft); color: var(--bad); }
.fl-ic.grow { background: var(--ok-soft); color: var(--ok); }
.fl-ic.ads { background: var(--info-soft); color: var(--info); }
.fl-ic .ic { width: 18px; height: 18px; }
.fl-t { display: block; font-size: 14px; font-weight: 600; line-height: 1.35; }
.flags > .btn { margin: 2px 4px 0 !important; }

/* ---------- Показатели ---------- */
.kt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kt { display: block; min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.kt-l { font-size: 12px; font-weight: 600; color: var(--muted); }
.kt-v { margin-top: 2px; font-size: 22px; font-weight: 760; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kt-s { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: var(--muted); }
.kt.link:active { background: color-mix(in srgb, var(--surface-2) 88%, var(--text)); }
.t-bad { color: var(--bad); font-weight: 650; }
.cab-h { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 760; }
.sub-h { font-size: 13px; font-weight: 650; color: var(--muted); padding-top: 6px; }

.funnel { display: grid; gap: 10px; }
.fn-top { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.fn-l { flex: 1; min-width: 0; color: var(--muted); }
.fn-v { font-weight: 700; color: var(--text); }
.fn-c { min-width: 54px; text-align: right; font-weight: 700; color: var(--accent); }
.fn-bar { height: 8px; margin-top: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.fn-bar span { display: block; height: 100%; border-radius: 4px; background: var(--accent); transform-origin: left center; }
#view.enter .fn-bar span { animation: grow-x 560ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms + 140ms); }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.camps { display: grid; }
.camp { padding: 9px 0; border-top: 1px solid var(--border); }
.camp:first-child { border-top: 0; padding-top: 2px; }
.camp-top { display: flex; align-items: center; gap: 8px; }
.camp-t { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.live-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); opacity: .6; }
.live-dot.on { color: var(--ok); background: currentColor; opacity: 1; animation: ping 1.6s var(--ease) infinite; }
.chip .live-dot.on, .pb-top .live-dot.on { color: inherit; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 50%, transparent); } 75%, 100% { box-shadow: 0 0 0 6px transparent; } }

/* ---------- Товары ---------- */
.prod .item-top { align-items: center; }
.prod .p-name { flex: 0 1 auto; max-width: 62%; font-size: 15px; font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-nums { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; font-size: 14px; }
.p-nums b { font-size: 15px; font-weight: 720; }
.cov { font-size: 13px; font-weight: 600; color: var(--muted); }
.cov.warn { color: var(--warn); }
.cov.bad { color: var(--bad); }
.p-flag { font-size: 13px; color: var(--warn); font-weight: 550; }

.p-head .p-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.p-big { font-size: 22px; font-weight: 780; letter-spacing: -0.01em; line-height: 1.2; }
.p-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.p-meta .btn { margin-right: -8px; }

/* ---------- Глубокий аудит ---------- */
.audit { border: 1.5px solid color-mix(in srgb, var(--accent) 45%, var(--border)); }
.audit > * + * { margin-top: 10px; }
.au-t { font-size: 18px; font-weight: 760; }
.au-d { color: var(--muted); }
.au-go { min-height: 52px; font-size: 15.5px; }
.au-go .ic { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.au-last { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.au-last .btn { justify-self: start; }

/* ---------- Ход выполнения поручения ---------- */
.progress-box { display: grid; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--info-soft); color: var(--info); }
.pb-top { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 8px; font-size: 14px; line-height: 1.35; }
.pb-top .live-dot { align-self: center; }
.pb-top b { color: var(--text); font-weight: 650; }
.progress { position: relative; height: 6px; border-radius: 3px; overflow: hidden; background: color-mix(in srgb, var(--info) 18%, transparent); }
.progress span { position: absolute; top: 0; bottom: 0; left: 0; width: 36%; border-radius: 3px; background: var(--info); animation: indet 1.5s var(--ease) infinite; }
.progress.queued span { width: 16%; opacity: .55; animation-duration: 2.6s; }
@keyframes indet { from { transform: translateX(-110%); } to { transform: translateX(290%); } }

/* ---------- Агент ---------- */
.cmd { padding: 14px; }
.cmd > * + * { margin-top: 10px; }
.cmd-t { font-size: 18px; font-weight: 760; }
.cmd textarea { min-height: 88px; }
.cmd.compact textarea { min-height: 64px; }
.cmd-foot { display: flex; align-items: center; gap: 12px; }
.cmd-foot .hint { flex: 1; min-width: 0; }
.cmd-foot .btn { flex: none; min-width: 128px; min-height: 48px; }
.cmd-foot .btn .ic { width: 18px; height: 18px; }
.ex { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin-left: -14px !important; margin-right: -14px; padding: 0 14px 2px; }
.ex::-webkit-scrollbar { display: none; }
.ex-chip {
  flex: none; max-width: 76vw; min-height: 40px; padding: 0 14px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 20px;
  background: transparent; color: var(--text); font: inherit; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  transition: background-color 150ms var(--ease), transform 120ms var(--ease);
}
.ex-chip:active { background: var(--accent-soft); transform: scale(0.98); }

.dl { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.dl-l { display: inline-flex; align-items: center; color: var(--muted); margin-right: 1px; }
.dl-l .ic { width: 18px; height: 18px; }
.dl-opt {
  position: relative; display: inline-flex; align-items: center;
  min-height: 38px; padding: 0 11px; border-radius: 19px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.dl-opt[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.dl-date { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; cursor: pointer; }

.task.running { border-color: color-mix(in srgb, var(--info) 45%, var(--border)); }
.task.overdue { border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); }
.task > * + * { margin-top: 8px; }
.t-sku { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: 13px; font-weight: 650; text-decoration: none; }
.t-sku .ic { width: 16px; height: 16px; }
.t-res-wrap { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.t-res { font-size: 14px; }
.t-res h1, .t-res h2, .t-res h3 { font-size: 15px; margin: 8px 0 4px; }
.t-res-wrap.clipped .t-res { max-height: 10em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.t-res-wrap .more-btn { margin: 0; }
.item-top .chip { flex: none; }

/* ---------- Голос ---------- */
.vfield { position: relative; flex: 1 1 auto; min-width: 0; }
.vfield textarea { padding-right: 54px; }
.mic-wrap { position: absolute; right: 5px; bottom: 5px; }
.mic-wrap.busy { position: static; margin-top: 8px; }
.mic-wrap:has(.mic-err) { position: static; display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.mic {
  width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); cursor: pointer;
  transition: transform 120ms var(--ease), background-color 150ms var(--ease);
}
.mic:active { transform: scale(0.9); }
.mic .ic { width: 22px; height: 22px; }
.q-input .mic { width: 34px; height: 34px; }
.q-input .mic-wrap { right: 5px; bottom: 5px; }
.mic-err { flex: 1; margin: 0; font-size: 13px; }

.rec {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 6px 6px 6px 14px; border-radius: 26px;
  background: var(--bad-soft); color: var(--bad);
  animation: rise 180ms var(--ease-out);
}
.rec.up { padding: 6px 16px; background: var(--info-soft); color: var(--info); font-size: 14px; font-weight: 650; }
.rec-dot { width: 12px; height: 12px; flex: none; border-radius: 50%; background: var(--bad); animation: recpulse 1.2s ease-in-out infinite; }
@keyframes recpulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.7); opacity: .5; } }
.rec-t { min-width: 40px; font-size: 15px; font-weight: 760; }
.rec-bars { flex: 1; min-width: 0; height: 30px; display: flex; align-items: center; gap: 4px; }
.rec-bars i { display: block; width: 4px; border-radius: 2px; background: currentColor; opacity: .85; height: calc(5px + var(--lv, .12) * 24px * var(--k, 1)); transition: height 90ms linear; }
.rec-x { flex: none; min-height: 40px; padding: 0 6px; border: 0; background: none; color: var(--bad); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.btn.rec-stop { flex: none; min-height: 40px; padding: 0 16px; border-radius: 20px; background: var(--bad); border-color: var(--bad); color: var(--surface); }
.btn.rec-stop .ic { width: 16px; height: 16px; fill: currentColor; stroke: none; }

textarea.flash { animation: flash 1s var(--ease); }
@keyframes flash { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 50%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- Широкий экран ---------- */
@media (min-width: 760px) {
  .tab-ic { width: auto; height: auto; border-radius: 0; background: none !important; color: inherit !important; }
  .tab[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
  .tabbar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  .kt-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .badge { left: auto; }
  a.kpi-week:hover, .todo-row:hover, a.flag-row:hover, .kt.link:hover { background: var(--surface-2); }
  .ex { flex-wrap: wrap; margin: 0 !important; padding: 0; overflow: visible; }
}

/* ---------- 2.1: шесть вкладок (добавилась «Реклама») ---------- */
.tabbar.many .tab { font-size: 11px; }
.tabbar.many .tab-ic { width: 46px; }
.tabbar.many .badge { left: 26px; }

/* ---------- 2.1: Продвижение ---------- */
.spin-ic { animation: spin 0.9s linear infinite; }
.pr-status .grow { flex: 1; min-width: 0; }
.pr-status .btn { flex: none; min-height: 36px; }
.pr-status .btn .ic { width: 16px; height: 16px; }
.pr-cabs { display: grid; gap: 12px; }
@media (min-width: 720px) { .pr-cabs { grid-template-columns: 1fr 1fr; align-items: start; } }
.pr-cab > * + * { margin-top: 10px; }
.pr-cab-h { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 760; }
.pr-cab-h .grow { flex: 1; min-width: 0; }
.pr-week { display: grid; gap: 6px; }
.pr-week-t { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pr-week-t b { font-weight: 700; }
.pr-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.pr-bar span { display: block; height: 100%; border-radius: 4px; transform-origin: left center;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--ok))); }
#view.enter .pr-bar span { animation: grow-x 640ms var(--ease-out) both; animation-delay: 160ms; }
.pr-camps-btn { width: 100%; justify-content: space-between; color: var(--muted); }
.pr-camps-btn .dx { width: 16px; height: 16px; }
.pr-h { margin-top: 18px !important; }
.pr-list { gap: 10px; }
.pr-card { position: relative; overflow: hidden; padding-left: 18px; }
.pr-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.pr-card.t-ok::before { background: var(--ok); }
.pr-card.t-warn::before { background: var(--warn); }
.pr-card.t-bad::before { background: var(--bad); }
.pr-card.t-info::before { background: var(--info); }
.pr-card > * + * { margin-top: 10px; }
.pr-card .d-title { font-size: 16px; font-weight: 720; line-height: 1.3; }
.pr-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.pr-top .meta { flex: 1 1 150px; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-top .chip { flex: none; }
.pr-n { font-weight: 800; color: var(--muted); font-size: 13px; }
.pr-act { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 7px; border-radius: 999px;
  font-size: 12.5px; font-weight: 720; background: var(--accent-soft); color: var(--accent); flex: none; }
.pr-act .ic { width: 15px; height: 15px; stroke-width: 2.3; }
.pr-act.ok { background: var(--ok-soft); color: var(--ok); }
.pr-act.warn { background: var(--warn-soft); color: var(--warn); }
.pr-act.bad { background: var(--bad-soft); color: var(--bad); }
.pr-act.info { background: var(--info-soft); color: var(--info); }
.pr-act.sm { padding: 6px; }
.pr-act.sm .ic { width: 16px; height: 16px; }
.pr-why { margin: 2px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.pr-why li::marker { color: var(--muted); }
.pr-facts { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.pr-fact { display: flex; gap: 8px; align-items: flex-start; }
.pr-fact .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--muted); }
.pr-fact b { font-weight: 650; }
.pr-val-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-val-in { width: 170px; max-width: 100%; min-height: 44px; padding: 8px 12px; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.pr-btns .btn { min-height: 48px; gap: 6px; }
.pr-btns .btn .ic { width: 18px; height: 18px; }
.pr-live, .pr-done { animation: pr-pop 320ms var(--ease-out) both; }
@keyframes pr-pop { from { transform: scale(0.97); opacity: 0.3; } to { transform: none; opacity: 1; } }
.pr-after { color: var(--ok) !important; font-weight: 650; }
.pr-old > * + * { margin-top: 8px; }
.pr-old-h { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; background: none; border: 0; padding: 0;
  text-align: left; color: inherit; font: inherit; cursor: pointer; }
.pr-old-h .grow { flex: 1; min-width: 0; }
.pr-old-t { display: block; font-size: 14px; font-weight: 600; }
.pr-old .sub { display: block; font-size: 12px; color: var(--muted); }
.pr-reply .sec-title { display: flex; align-items: center; gap: 8px; }
.pr-reply .sec-title .ic { width: 18px; height: 18px; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .pr-live, .pr-done, #view.enter .pr-bar span, .spin-ic { animation: none; } }
/* ---------- 27.10 пульт 3.0: рекламации, поставки, план, деньги (biz.js) ---------- */
input[type="date"] {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; line-height: 1.35;
}
.f-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.f-grid .wide { grid-column: 1 / -1; }
.f-grid + .f-grid { margin-top: 8px; }
@media (max-width: 380px) { .f-grid { grid-template-columns: minmax(0, 1fr); } }
.cl-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.cl-fact { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.cl-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.cl-steps li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); }
.cl-steps .st-dot {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.cl-steps li.done { color: var(--text); }
.cl-steps li.done .st-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.cl-steps li.now { color: var(--text); font-weight: 700; }
.cl-steps li.now .st-dot { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sum-lines { display: grid; gap: 4px; font-size: 14px; }
.sum-lines > div { display: flex; justify-content: space-between; gap: 8px; }
.sum-lines .tot { font-weight: 700; border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; }
.ship-list, .sup-list { display: grid; }
.ship-row { display: flex; gap: 8px; align-items: center; font-size: 14px; padding: 4px 0; }
.ship-row + .ship-row, .sup-row + .sup-row { border-top: 1px solid var(--border); }
.ship-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cell-sub { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.icon-x {
  min-width: 44px; min-height: 44px; border: 0; border-radius: 10px; flex: none;
  background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-x:active { background: var(--surface-2); }
.sup-row { display: grid; gap: 4px; padding: 10px 0; min-width: 0; }
.sup-row:first-child { padding-top: 2px; }
.sup-row p { margin: 0; }
.prog { position: relative; height: 10px; border-radius: 5px; background: var(--surface-2); overflow: visible; }
.prog > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--accent); }
.prog > i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); opacity: .55; border-radius: 1px; }
.pl-chart { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 76px; padding-top: 4px; }
.pl-chart > span { flex: 1 1 0; min-width: 2px; border-radius: 2px 2px 0 0; background: var(--accent); opacity: .7; }
.pl-chart > span.today { opacity: 1; background: var(--info); }
.pl-chart > span.empty { height: 2px; opacity: 1; background: var(--border); }
.pl-chart > i { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--warn); pointer-events: none; }
.gaps { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.comp { display: grid; gap: 6px; }
.comp-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 0.8fr) minmax(0, 1.4fr) 44px; gap: 6px; align-items: center; }
.comp-row.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) 44px; }
.mn-tbl tbody tr { cursor: pointer; }
.mn-tbl tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mn-tbl tr.sel td { background: var(--accent-soft); }
.mn-tbl td.neg { color: var(--bad); font-weight: 700; }
.mn-tbl td:first-child { white-space: normal; min-width: 96px; }
