/* ═══════════════════════════════════════════════════════════
   Админка — дизайн-система

   Замысел: интерфейс молчит, говорят данные.

   Вся хромота (кнопки, активные состояния, фокус, ссылки) —
   чернильная: чёрное на светлом, белое на тёмном. Цвет на экране
   остаётся ровно у трёх вещей: у рядов данных, у состояний
   (хорошо / внимание / стоп) и у знака бренда. Так график —
   самое яркое пятно на странице, а это ровно то, ради чего
   панель открывают. Заодно исчезает старая беда: акцент
   интерфейса больше не спорит с цветом рядов на графике.

   Опоры вместо теней. Структуру держат волосяные линии и три
   ступени поверхности; тень осталась только у всплывающего —
   у подсказки графика, которой положено лежать над страницей.

   Onest — из брендинга сайтов парка, хорошая кириллица.
   Числа набираются им же с табличными цифрами: моноширинный
   шрифт в крупных показателях выглядит телетайпом. JetBrains
   Mono остался там, где важна посимвольная разборчивость:
   телефоны, идентификаторы, коды, имена задач сборщиков.
   ═══════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* Ни одного загружаемого шрифта: панель обязана открываться в закрытой
     сети, а тихий откат на системный ломает всю настройку размеров. */
  --sans: "Segoe UI", Roboto, "Helvetica Neue", system-ui, -apple-system,
          "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* поверхности: тёплый графит, а не голубоватый офисный серый */
  --bg:            #F5F5F7;
  --surface:       #FFFFFF;
  --surface-2:     #F0F1F4;
  --surface-3:     #E5E7EB;
  --line:          #E5E6EA;
  --line-2:        #C9CCD3;

  /* текст */
  --ink:           #14161A;
  --ink-2:         #434952;
  --muted:         #767D88;

  /* Действие — тёплый янтарь из знака панели. Раньше кнопки и активный
     пункт заливались чернилами: экран получался тяжёлым, а нажимаемое
     не отличалось от заголовков. */
  --accent:        #A66A0B;
  --accent-ink:    #FFFFFF;
  --accent-soft:   #FBF1DF;
  --accent-line:   #E0B978;

  /* состояния */
  --ok:            #15794F;  --ok-soft:   #E4F2EA;
  --warn:          #96650A;  --warn-soft: #FBF1DF;
  --stop:          #B5372A;  --stop-soft: #FAE9E6;

  /* Данные. Набор проверен на различимость по всем парам, а не только
     соседним: в легенде рядом стоят одни цвета, а на графике сходятся
     любые. Поэтому от смены оформления он не меняется. */
  --series-1:      #2563C9;  /* заявки */
  --series-2:      #C8501C;  /* расход */
  --series-3:      #158E5C;  /* третий ряд */
  --series-4:      #B5308F;  /* четвёртый ряд */
  --series-x:      #98A0AC;  /* «прочее» — не категория, а остаток */
  --grid:          #ECEDF1;

  /* направления: такси и доставка, метки в списках */
  --line-taxi:     #7C4FC4;
  --line-del:      #0E7D70;

  /* знак бренда */
  --brand-a:       #E9A13B;
  --brand-b:       #C9631E;

  --r-xs: 6px; --r-sm: 9px; --r: 13px; --r-lg: 17px; --r-xl: 22px;

  /* Тени почти нет: на плоском фоне рамка в один пиксель отделяет
     карточку лучше, чем размытое пятно, и не утяжеляет экран. */
  --pop: 0 1px 2px rgba(20,22,26,.05), 0 14px 32px -14px rgba(20,22,26,.20);
  --lift: 0 1px 2px rgba(20,22,26,.05), 0 4px 12px -6px rgba(20,22,26,.12);

  --ease: cubic-bezier(.2,.7,.3,1);
  --fast: .14s var(--ease);
  --slow: .32s var(--ease);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:          #0B0D10;
    --surface:     #15181D;
    --surface-2:   #1C2027;
    --surface-3:   #262B33;
    --line:        #252931;
    --line-2:      #383F4A;
    --ink:         #EDEFF3;
    --ink-2:       #B4BBC6;
    --muted:       #7C8490;
    --accent:      #E0A24C;
    --accent-ink:  #1A1408;
    --accent-soft: #2A2114;
    --accent-line: #6B5427;
    --ok:          #4BC48C;  --ok-soft:   #10241C;
    --warn:        #E0A24C;  --warn-soft: #2A2114;
    --stop:        #F08A79;  --stop-soft: #2C1815;
    --series-1:    #5A8BE8;
    --series-2:    #E0703C;
    --series-3:    #35A96F;
    --series-4:    #D861B4;
    --series-x:    #79818D;
    --grid:        #23272F;
    --line-taxi:   #A98BE0;
    --line-del:    #45B3A4;
    --brand-a:     #E9A13B;
    --brand-b:     #C9631E;
    --pop:  0 2px 6px rgba(0,0,0,.5), 0 18px 40px -16px rgba(0,0,0,.8);
    --lift: 0 1px 3px rgba(0,0,0,.4), 0 8px 20px -10px rgba(0,0,0,.6);
  }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg:          #0B0D10;
    --surface:     #15181D;
    --surface-2:   #1C2027;
    --surface-3:   #262B33;
    --line:        #252931;
    --line-2:      #383F4A;
    --ink:         #EDEFF3;
    --ink-2:       #B4BBC6;
    --muted:       #7C8490;
    --accent:      #E0A24C;
    --accent-ink:  #1A1408;
    --accent-soft: #2A2114;
    --accent-line: #6B5427;
    --ok:          #4BC48C;  --ok-soft:   #10241C;
    --warn:        #E0A24C;  --warn-soft: #2A2114;
    --stop:        #F08A79;  --stop-soft: #2C1815;
    --series-1:    #5A8BE8;
    --series-2:    #E0703C;
    --series-3:    #35A96F;
    --series-4:    #D861B4;
    --series-x:    #79818D;
    --grid:        #23272F;
    --line-taxi:   #A98BE0;
    --line-del:    #45B3A4;
    --brand-a:     #E9A13B;
    --brand-b:     #C9631E;
    --pop:  0 2px 6px rgba(0,0,0,.5), 0 18px 40px -16px rgba(0,0,0,.8);
    --lift: 0 1px 3px rgba(0,0,0,.4), 0 8px 20px -10px rgba(0,0,0,.6);
}

/* ── основание ────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01";
}

h1, h2, h3, h4 { margin: 0; color: var(--ink); font-weight: 600; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 650; letter-spacing: -.028em; text-wrap: balance; }
h2 { font-size: 17px; letter-spacing: -.018em; }
h3 { font-size: 14.5px; letter-spacing: -.01em; }
h4 { font-size: 14px; letter-spacing: -.01em; }
p  { margin: 0; }

a { color: var(--ink); text-decoration-color: var(--line-2);
    text-underline-offset: 2px; transition: text-decoration-color var(--fast); }
a:hover { text-decoration-color: currentColor; }

::selection { background: var(--ink); color: var(--surface); }

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Числа выравниваются по разрядам везде, где их читают столбиком. */
.tnum, .kpi .val, table.grid td.num, .mono, code { font-variant-numeric: tabular-nums; }
.mono, code { font-family: var(--mono); letter-spacing: -.01em; }
code {
  font-size: .86em; background: var(--surface-2); color: var(--ink-2);
  padding: .12em .42em; border-radius: var(--r-xs); border: 1px solid var(--line);
}
.dim { color: var(--muted); }
.nowrap { white-space: nowrap; }
.scroller { overflow-x: auto; -webkit-overflow-scrolling: touch;
            scrollbar-width: thin; }

.lbl {
  display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}

/* ── каркас ───────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: 232px minmax(0,1fr); min-height: 100vh; }

.side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand { padding: 20px 18px 16px; display: flex; align-items: center; gap: 10px; }
.brand b { font-size: 15.5px; font-weight: 650; letter-spacing: -.025em; }
.brand .mark {
  width: 26px; height: 26px; border-radius: var(--r-sm); flex: 0 0 auto;
  background: linear-gradient(145deg, var(--brand-a), var(--brand-b));
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 11.5px; letter-spacing: .02em;
}

.menu { padding: 2px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: background var(--fast), color var(--fast);
}
.menu a:hover { background: var(--surface-2); color: var(--ink); }
/* Активный пункт помечен янтарём и полоской слева. Раньше он заливался
   чернилами во всю ширину: пятно было тяжелее заголовка страницы и
   перетягивало взгляд на меню вместо содержимого. */
.menu a.on {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
  position: relative;
}
.menu a.on::before {
  content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.menu a.on .ico { opacity: 1; color: var(--accent); }
.menu .ico { width: 16px; height: 16px; flex: 0 0 auto; opacity: .55;
             transition: opacity var(--fast); }
.menu a:hover .ico { opacity: .8; }
.menu a.on .ico { opacity: 1; }

.whoami { padding: 14px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.whoami .nm { color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
.whoami .rl { color: var(--muted); font-size: 11.5px; }
.whoami form { margin-top: 10px; }

main { padding: 26px 30px 72px; min-width: 0; max-width: 1480px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head p { color: var(--muted); margin-top: 4px; max-width: 68ch; font-size: 13.5px; }
.back {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--muted); text-decoration: none; margin-bottom: 6px;
  transition: color var(--fast);
}
.back:hover { color: var(--ink); }
.head-actions { display: flex; gap: 8px; align-items: center; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 30px 0 12px;
}
.section-head .note { color: var(--muted); font-size: 12.5px; }

/* ── карточки ─────────────────────────────────────────── */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.card.pad-lg { padding: 22px; }
.card > h3 { margin-bottom: 12px; }

a.card {
  display: block; text-decoration: none; color: inherit;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
/* Карточка не подпрыгивает под курсором: на плитках сводки это
   выглядит как дрожь, а не как отклик. Меняем только рамку. */
a.card:hover { border-color: var(--accent-line); background: var(--surface); }
a.card:active { border-color: var(--accent); }

/* ── плитки сводки ────────────────────────────────────── */

.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr));
       gap: 12px; margin-bottom: 24px; }
.kpi .card { padding: 16px 18px 15px; display: flex; flex-direction: column; }
.kpi .lbl { margin-bottom: 10px; }
.kpi .val {
  font-size: 34px; font-weight: 650; letter-spacing: -.045em; line-height: 1;
  color: var(--ink); margin-top: auto;
}
.kpi .val.accent { color: var(--ink); }
/* Прочерк вместо числа — это «данных нет», а не «ноль». Он не должен
   занимать место как настоящий показатель. */
.kpi .val.muted  { color: var(--line-2); font-size: 26px; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.45; }

/* ── кнопки ───────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; font: inherit; font-size: 13.5px; font-weight: 600;
  letter-spacing: -.005em;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: var(--r-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: opacity var(--fast), background var(--fast),
              border-color var(--fast), color var(--fast);
}
.btn:hover { opacity: .86; }
.btn:active { opacity: 1; }
.btn.wide { width: 100%; }
.btn.small { padding: 5px 11px; font-size: 12.5px; }
.btn.ghost {
  background: transparent; color: var(--ink-2); border-color: var(--line-2);
}
.btn.ghost:hover { background: var(--surface-2); color: var(--ink);
                   border-color: var(--line-2); opacity: 1; }
/* Цвет из токенов: в тёмной теме --stop светлый, и белый текст
   на нём был бы нечитаем. */
.btn.danger { background: var(--stop-soft); border-color: var(--stop); color: var(--stop); }
.btn.danger:hover { background: var(--stop); color: var(--surface); opacity: 1; }

.xbtn {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  width: 24px; height: 24px; border-radius: var(--r-xs); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.xbtn:hover { background: var(--stop-soft); color: var(--stop); border-color: var(--stop); }

/* ── поля ─────────────────────────────────────────────── */

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=search], input[type=tel], input[type=datetime-local], select, textarea {
  width: 100%; padding: 8px 11px; font: inherit; font-size: 13.5px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  transition: border-color var(--fast), box-shadow var(--fast);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type=date], input[type=datetime-local] { font-variant-numeric: tabular-nums; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) calc(50% + 1px), calc(100% - 10px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
select:disabled { opacity: .55; cursor: not-allowed; }
textarea { resize: vertical; min-height: 66px; font-family: inherit; line-height: 1.5; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.inline-form { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.inline-form select, .inline-form input { width: auto; flex: 0 1 auto; min-width: 130px; }
.radio { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.radio input { accent-color: var(--accent); }

.form-card { max-width: 720px; }
.form-row { display: grid; gap: 12px;
            grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px;
                padding-top: 14px; border-top: 1px solid var(--line); }
.new-task { margin-bottom: 16px; }
.new-task[hidden] { display: none; }

/* ── вкладки: сегментный переключатель ────────────────── */

.tabs {
  display: inline-flex; gap: 2px; flex-wrap: wrap; align-items: center;
  padding: 3px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.tab {
  padding: 5px 12px; border-radius: var(--r-xs); text-decoration: none;
  color: var(--muted); font-size: 13px; font-weight: 550; white-space: nowrap;
  transition: background var(--fast), color var(--fast);
}
.tab:hover { color: var(--ink); }
.tab.on { background: var(--surface); color: var(--ink); font-weight: 600;
          box-shadow: 0 1px 2px rgba(13,15,20,.07); }
.tab .cnt, .tab b { color: var(--muted); font-weight: 600; margin-left: 5px;
                    font-size: 11.5px; }
.tab.on .cnt, .tab.on b { color: var(--ink); }
.tabs.kinds { margin-bottom: 12px; }

.filters { margin-bottom: 18px; display: flex; flex-direction: column; gap: 11px; }
.filters > .tabs { align-self: flex-start; }
.filter-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center;
              width: 100%; }
.filter-row input[type=search] { flex: 1 1 220px; max-width: 320px; }
.filter-row select { width: auto; }

/* Управление периодом — одна строка. Раньше кнопки, выбор месяца и
   даты стояли тремя рядами лесенкой у правого края: три ряда органов
   управления над экраном с данными читаются как три разных настройки,
   хотя настройка одна — какой период показать. */
.period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
          justify-content: flex-end; }
.period .range { display: flex; align-items: center; gap: 6px; }
.period .range select { width: auto; min-width: 150px; }
.period .range input[type=date] { padding: 6px 9px; font-size: 12.5px; width: auto; }
.period .dash { color: var(--muted); }

@media (max-width: 1180px) {
  .period { justify-content: flex-start; }
}

/* ── таблицы ──────────────────────────────────────────── */

table.grid {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
table.grid th {
  text-align: left; padding: 9px 14px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  font-weight: 600; font-size: 10.5px; color: var(--muted);
  letter-spacing: .07em; text-transform: uppercase; white-space: nowrap;
}
table.grid td {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  vertical-align: middle; color: var(--ink-2);
}
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid th.num, table.grid td.num { text-align: right; }
table.grid tr.clickable, table.grid tr.row-link { cursor: pointer; }
table.grid tbody tr td { transition: background var(--fast); }
table.grid tbody tr:hover td { background: var(--surface-2); }
table.grid td.title b { color: var(--ink); font-size: 14px; font-weight: 600; }
table.grid td.title .sub { color: var(--muted); font-size: 11px; margin-top: 1px;
                           font-family: var(--mono); }
table.grid td a { color: var(--ink); text-decoration: none; font-weight: 600; }
table.grid td a:hover { text-decoration: underline; text-underline-offset: 2px; }
table.grid tfoot td { background: var(--surface-2); border-top: 1px solid var(--line-2);
                      color: var(--ink); font-weight: 600; border-bottom: 0; }
td .pct   { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
td .price { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.row-act, table.grid th:last-child:empty { text-align: right; }
table.grid th.acts { text-align: right; }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
tr.row-off td { opacity: .5; }
.sortlink { color: inherit; text-decoration: none; }
.sortlink:hover { color: var(--ink); }

.pager { display: flex; align-items: center; gap: 14px; margin-top: 18px;
         font-size: 13px; color: var(--muted); }

/* ── ярлыки ───────────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: -.005em;
  padding: 2px 8px; border-radius: var(--r-xs); white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.pill.ok   { background: var(--ok-soft);   color: var(--ok);   border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.stop { background: var(--stop-soft); color: var(--stop); border-color: transparent; }
/* Молчание — итог такой же, как отказ, но красным его красить нельзя:
   красный на экране значит «случилось плохое, посмотри». Здесь никто
   ничего не сделал, и требовать внимания незачем. */
.pill.quiet { background: var(--surface-2); color: var(--muted);
              border-color: var(--line); }

.src { font-weight: 600; color: var(--ink); }
.src.ad { color: var(--series-2); }

/* ── сообщения ────────────────────────────────────────── */

.msg {
  padding: 12px 14px; border-radius: var(--r-sm); font-size: 13.5px;
  margin-bottom: 16px; background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line); border-left: 3px solid var(--line-2);
}
.msg .t { font-weight: 650; display: block; margin-bottom: 2px; color: var(--ink);
          letter-spacing: -.01em; }
.msg.warn { border-left-color: var(--warn); background: var(--warn-soft);
            border-color: transparent; }
.msg.ok   { border-left-color: var(--ok);   background: var(--ok-soft);
            border-color: transparent; }
.msg.stop { border-left-color: var(--stop); background: var(--stop-soft);
            border-color: transparent; }
.msg ul.pairs { margin: 8px 0 0; padding: 0; list-style: none;
                display: grid; gap: 4px; }
.msg a { color: var(--ink); font-weight: 600; }

/* Пусто — это короткое сообщение, а не пустая комната. Прежние 44
   пикселя отступа сверху и снизу превращали «заявок нет» в блок
   высотой с таблицу, и страница выглядела сломанной. */
.empty {
  border: 1px dashed var(--line-2); border-radius: var(--r);
  padding: 20px 22px; color: var(--muted); background: var(--surface);
  font-size: 13px; line-height: 1.5;
}
.empty b { display: block; color: var(--ink-2); font-size: 13.5px;
           font-weight: 600; margin-bottom: 3px; letter-spacing: -.01em; }

.danger-zone { display: flex; justify-content: space-between; align-items: center;
               gap: 16px; flex-wrap: wrap; border-left: 3px solid var(--stop); }

/* ── раскладки ────────────────────────────────────────── */

.two-col { display: grid; grid-template-columns: minmax(0,1fr) 320px;
           gap: 20px; align-items: start; }
/* Две равные колонки. Раньше это писалось инлайном в шаблоне, и
   медиазапрос ниже не срабатывал: инлайн выигрывает по важности,
   и на узком экране колонки оставались рядом, сжимая обе. */
.two-col.even { grid-template-columns: minmax(0,1fr) minmax(0,1fr);
                margin-top: 14px; }
.two-col.wide-aside { grid-template-columns: minmax(0,1fr) 380px; }
dl.facts { margin: 0; display: grid; grid-template-columns: auto 1fr;
           gap: 6px 14px; font-size: 13.5px; }
dl.facts dt { color: var(--muted); white-space: nowrap; }
dl.facts dd { margin: 0; color: var(--ink-2); min-width: 0; word-break: break-word; }
ul.plain { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
ul.plain li { padding: 7px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; padding-bottom: 0; }
ul.plain li:first-child { padding-top: 0; }

/* ══════════════════════════════════════════════════════
   Графики

   Встроенный SVG: без библиотек и без обращений наружу —
   панель должна открываться в закрытой сети.
   ══════════════════════════════════════════════════════ */

.chart-card { padding: 18px 18px 12px; }
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.chart-head h3 { margin: 0; }
.chart-head .sum, .chart-head .note { font-size: 12.5px; color: var(--muted); }
.chart-head .sum b { color: var(--ink); font-weight: 650; }
.chart-figs { display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: baseline;
              font-size: 12.5px; color: var(--muted); }
.chart-figs b { color: var(--ink); font-size: 14px; font-weight: 650;
                letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* График не сжимается ниже разумного: SVG масштабирует вместе с
   геометрией и подписи, и на узком экране цифры оси превращались в
   нечитаемую крупу. Ниже предела холст остаётся прежним, а полоса
   прокручивается — читать по частям можно, гадать по пикселям нет. */
.chart-wrap { position: relative; overflow-x: auto; overflow-y: visible;
              scrollbar-width: thin; }
.plot { display: block; width: 100%; height: auto; overflow: visible;
        min-width: 900px; }
/* Мелкие графики в карточке водителя и в строках таблицы этого
   ограничения не знают: у них своя, маленькая геометрия. */
.plot.mini, .spark .plot { min-width: 0; }
/* Сетка едва заметна: она нужна для сверки высоты, а не для чтения. */
.plot .grid-line { stroke: var(--grid); stroke-width: 1; }
.plot .grid-label, .plot .axis-label, .plot .axis-title {
  fill: var(--muted); font-size: 10px; font-family: var(--sans);
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.plot .bar-total { fill: var(--muted); font-size: 9.5px; font-family: var(--sans);
                   font-variant-numeric: tabular-nums; }
.plot .empty-note { fill: var(--muted); font-size: 12px; font-family: var(--sans); }

.plot .area-1 { fill: url(#grad-1); }
.plot .area-2 { fill: url(#grad-2); }
.plot .line-1 { fill: none; stroke: var(--series-1); stroke-width: 2;
                stroke-linejoin: round; stroke-linecap: round; }
.plot .line-2 { fill: none; stroke: var(--series-2); stroke-width: 2;
                stroke-linejoin: round; stroke-linecap: round; }
.plot .bar-1 { fill: var(--series-1); }
.plot .bar-2 { fill: var(--series-2); }
.plot .bar-3 { fill: var(--series-3); }

/* Точка под курсором. Кольцо цвета подложки отделяет её от линии. */
.plot .dot { r: 4; stroke: var(--surface); stroke-width: 2; opacity: 0;
             transition: opacity var(--fast); }
.plot .dot.on { opacity: 1; }
.plot .hitbox { fill: transparent; cursor: crosshair; }
.plot .crosshair { stroke: var(--line-2); stroke-width: 1;
                   stroke-dasharray: 2 3; opacity: 0; transition: opacity var(--fast); }
.plot .crosshair.on { opacity: 1; }

.chart-tip {
  position: absolute; pointer-events: none; opacity: 0;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); box-shadow: var(--pop);
  padding: 8px 11px; font-size: 12.5px; z-index: 30; min-width: 124px;
  transition: opacity .1s var(--ease);
}
.chart-tip.on { opacity: 1; }
.chart-tip .when { color: var(--muted); font-size: 11px; margin-bottom: 5px;
                   font-variant-numeric: tabular-nums; }
.chart-tip .row { display: flex; align-items: center; gap: 12px;
                  justify-content: space-between; }
.chart-tip .row + .row { margin-top: 2px; }
.chart-tip .row span { display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.chart-tip .row b { color: var(--ink); font-weight: 650;
                    font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: center;
          margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 9px; height: 9px; border-radius: 2px; display: block; flex: 0 0 auto; }
.sw.s1 { background: var(--series-1); }
.sw.s2 { background: var(--series-2); }
.sw.s3 { background: var(--series-3); }

/* ── воронка ──────────────────────────────────────────
   Горизонтальные полосы, а не сужающаяся труба: у трубы
   ширина и площадь врут о величине, у полосы — нет. */

.funnel { display: flex; flex-direction: column; gap: 4px; }
.funnel-step { display: grid; grid-template-columns: 162px 1fr 68px;
               gap: 12px; align-items: center; }
.funnel-step .name { font-size: 13.5px; font-weight: 550; color: var(--ink); }
.funnel-step .name small { display: block; color: var(--muted);
                           font-size: 11px; font-weight: 400; line-height: 1.35; }
.funnel-track { height: 32px; background: var(--surface-2);
                border-radius: var(--r-sm); overflow: hidden; position: relative; }
.funnel-fill {
  height: 100%; border-radius: var(--r-sm);
  background: var(--series-1);
  display: flex; align-items: center; padding-left: 11px;
  min-width: 3px; transition: width .65s var(--ease);
}
.funnel-fill b { color: #fff; font-size: 13px; font-weight: 650;
                 font-variant-numeric: tabular-nums; white-space: nowrap; }
.funnel-step.zero .funnel-fill { background: var(--line-2); }
.funnel-step.zero .funnel-fill b { color: var(--muted); }
/* Между кликами и заявками разница в сто раз, поэтому вторая полоса
   выходит в несколько пикселей и число внутри неё не прочитать —
   белым по узкой полоске. Такие числа выносим наружу. */
.funnel-step.tiny .funnel-fill { padding-left: 0; overflow: visible; }
.funnel-step.tiny .funnel-fill b { color: var(--ink); margin-left: calc(100% + 8px); }
.funnel-step .conv { font-size: 12.5px; color: var(--muted); text-align: right;
                     font-variant-numeric: tabular-nums; }
.funnel-step .conv.drop { color: var(--stop); font-weight: 600; }

/* ── кольцо ───────────────────────────────────────────── */

.donut-row { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.donut { flex: 0 0 auto; position: relative; }
.donut svg { display: block; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-linecap: butt; transition: stroke-width var(--fast); }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center;
                 text-align: center; pointer-events: none; }
.donut .center b { display: block; font-size: 24px; font-weight: 650;
                   letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.donut .center small { color: var(--muted); font-size: 11px; }
.donut-legend { flex: 1 1 200px; min-width: 0; display: flex;
                flex-direction: column; gap: 8px; }
.donut-legend .item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.donut-legend .item .nm { flex: 1; color: var(--ink-2); min-width: 0;
                          overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .item .vl { color: var(--ink); font-weight: 650;
                          font-variant-numeric: tabular-nums; }
.donut-legend .item .pc { color: var(--muted); font-size: 11.5px; width: 42px;
                          text-align: right; font-variant-numeric: tabular-nums; }

.spark { display: block; overflow: visible; }
.spark path { fill: none; stroke: var(--series-2); stroke-width: 1.6;
              stroke-linejoin: round; stroke-linecap: round; }

/* ── когортная карта ──────────────────────────────────── */

table.heat { border-collapse: separate; border-spacing: 2px; font-size: 12px;
             font-variant-numeric: tabular-nums; }
table.heat th { padding: 3px 5px; font-size: 10px; font-weight: 600; color: var(--muted);
                text-transform: none; letter-spacing: .04em; background: none;
                border: 0; text-align: center; white-space: nowrap; }
table.heat th.who, table.heat td.who { text-align: left; }
table.heat td { padding: 7px 5px; text-align: center; border: 0;
                border-radius: var(--r-xs); min-width: 44px; font-weight: 600; }
table.heat tbody tr:hover td { background-image: none; }
table.heat td.who { background: none; color: var(--ink); font-weight: 600;
                    padding-right: 10px; white-space: nowrap; }
table.heat td.cnt, table.heat th.cnt { background: none; color: var(--muted);
                                       font-weight: 400; text-align: right;
                                       padding-right: 10px; }
table.heat td.void { background: none; color: var(--line-2); font-weight: 400; }
.heat-scale { display: flex; gap: 2px; }
.heat-scale i { width: 14px; height: 10px; border-radius: 2px; display: block; }

/* ── рассеяние ────────────────────────────────────────── */

.plot.scatter .quad.good { fill: var(--ok-soft); opacity: .6; }
.plot .dot-mark {
  fill: color-mix(in srgb, var(--series-1) 55%, transparent);
  stroke: var(--series-1); stroke-width: 1.5;
  transition: fill var(--fast); cursor: default;
}
.plot .dot-mark:hover { fill: color-mix(in srgb, var(--series-1) 82%, transparent); }

/* ── малые кратные: карточка на кампанию или источник ── */

.lanes { display: grid; gap: 12px;
         grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); }
.lane { display: flex; flex-direction: column; gap: 11px; }
.lane.is-ad { border-top: 2px solid var(--series-2); }
.lane-head { display: flex; justify-content: space-between; gap: 10px;
             align-items: flex-start; }
.lane-head h4 { margin: 0; line-height: 1.3; }
.lane-head h4 a { color: var(--ink); text-decoration: none; }
.lane-head h4 a:hover { text-decoration: underline; text-underline-offset: 2px; }
.lane-head .dim { font-size: 11px; }
.lane-money { display: flex; gap: 14px; flex-wrap: wrap;
              padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.lane-money div { display: flex; flex-direction: column; gap: 1px; }
.lane-money .lbl { margin-bottom: 0; }
.lane-money b { font-size: 14.5px; font-weight: 650; letter-spacing: -.02em;
                font-variant-numeric: tabular-nums; }
.mini { display: flex; gap: 5px; align-items: flex-end; height: 98px; }
.mini-col { flex: 1; display: flex; flex-direction: column; align-items: center;
            gap: 4px; height: 100%; }
.mini-col b { font-size: 12.5px; font-weight: 650; line-height: 1;
              font-variant-numeric: tabular-nums; }
.mini-col small { font-size: 9px; color: var(--muted); text-align: center;
                  line-height: 1.15; }
.mini-track { flex: 1; width: 100%; display: flex; align-items: flex-end; min-height: 0; }
.mini-bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px;
            background: var(--series-1); transition: height .55s var(--ease); }
/* Столбики считают людей, а не деньги, поэтому синий — цвет
   заявок на всех экранах. Оранжевый закреплён за расходом. */
.mini-col small { white-space: nowrap; }
.mini-col.zero .mini-bar { background: var(--line-2); }
.mini-col.zero b { color: var(--muted); }
.lane-foot { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.lane-foot b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── задачи ───────────────────────────────────────────── */

.tasklist { list-style: none; margin: 0; padding: 0;
            display: flex; flex-direction: column; gap: 6px; }
.tasklist li {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 12px 14px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.tasklist li:hover { border-color: var(--line-2); box-shadow: var(--lift); }
.tasklist .tick { flex: 0 0 auto; margin: 0; padding-top: 1px; }
.checkbox {
  width: 19px; height: 19px; border-radius: var(--r-xs); cursor: pointer;
  border: 1.5px solid var(--line-2); background: var(--surface);
  display: grid; place-items: center; padding: 0;
  color: transparent; font-size: 11px; line-height: 1;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.checkbox:hover { border-color: var(--ink); }
.checkbox.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.tasklist .body { flex: 1; min-width: 0; }
.tasklist .ttl-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tasklist .ttl { color: var(--ink); text-decoration: none; font-weight: 600;
                 font-size: 14px; letter-spacing: -.012em; }
.tasklist .ttl:hover { text-decoration: underline; text-underline-offset: 2px; }
.tasklist .excerpt { margin: 3px 0 0; font-size: 12.5px; color: var(--muted);
                     line-height: 1.45; }
.tasklist .meta { display: flex; gap: 5px 10px; flex-wrap: wrap;
                  align-items: center; margin-top: 7px; font-size: 12px;
                  color: var(--muted); }
.tasklist .meta .overdue { color: var(--stop); font-weight: 600; }
.tasklist li.is-done { opacity: .55; }
.tasklist li.is-done .ttl { text-decoration: line-through; }
/* Полоса слева — важность: она должна читаться раньше текста. */
.tasklist li.p3 { box-shadow: inset 3px 0 0 var(--stop); }
.tasklist li.p2 { box-shadow: inset 3px 0 0 var(--warn); }
.tasklist li.p3:hover { box-shadow: inset 3px 0 0 var(--stop), var(--lift); }
.tasklist li.p2:hover { box-shadow: inset 3px 0 0 var(--warn), var(--lift); }
.tasklist li.is-late .ttl { color: var(--stop); }
.tasklist .row-edit { align-self: center; opacity: 0;
                      transition: opacity var(--fast); }
.tasklist li:hover .row-edit, .tasklist .row-edit:focus-visible { opacity: 1; }
.tasklist.compact li { padding: 9px 12px; }
.task-body .lbl { display: block; }

.kind {
  font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: var(--r-xs);
  white-space: nowrap; border: 1px solid var(--line);
  color: var(--muted); background: var(--surface-2);
}
.kind.k-dev  { color: var(--series-1); background: color-mix(in srgb, var(--series-1) 11%, transparent);
               border-color: color-mix(in srgb, var(--series-1) 32%, transparent); }
.kind.k-ads  { color: var(--series-2); background: color-mix(in srgb, var(--series-2) 11%, transparent);
               border-color: color-mix(in srgb, var(--series-2) 32%, transparent); }
.kind.k-docs { color: var(--series-3); background: color-mix(in srgb, var(--series-3) 11%, transparent);
               border-color: color-mix(in srgb, var(--series-3) 32%, transparent); }

/* ── лента событий ────────────────────────────────────── */

.timeline { list-style: none; margin: 0; padding: 0 0 0 16px;
            border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 14px; }
.timeline li::before {
  content: ""; position: absolute; left: -21px; top: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--surface); border: 1.5px solid var(--line-2);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline .when { color: var(--muted); font-size: 11.5px;
                  font-variant-numeric: tabular-nums; }
.timeline .what { font-size: 13.5px; color: var(--ink-2); margin-top: 1px; }
.timeline .what b { color: var(--ink); }
.timeline .who { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

/* ── связка заявки с водителем ────────────────────────── */

.linked { border-left: 3px solid var(--ok); }
.linked-head { display: flex; justify-content: space-between; gap: 12px;
               align-items: flex-start; }
.linked-inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
                 margin-top: 3px; font-size: 12px; }
.candidates { list-style: none; margin: 0 0 12px; padding: 0;
              display: flex; flex-direction: column; gap: 7px; }
.candidates li { display: flex; justify-content: space-between; gap: 12px;
                 align-items: center; padding: 11px 12px;
                 border: 1px solid var(--line); border-radius: var(--r-sm);
                 background: var(--surface); }
.candidates li.strong { border-color: var(--ok); background: var(--ok-soft); }
.candidates .who b { color: var(--ink); }
.candidates .why { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.candidates .why span { font-size: 10.5px; color: var(--muted);
                        border: 1px solid var(--line-2); border-radius: var(--r-xs);
                        padding: 1px 6px; }

/* ── настройки ────────────────────────────────────────── */

.role-cards { display: grid; gap: 10px;
              grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.matrix td.mid, .matrix th.mid { text-align: center; }
.matrix td.yes { color: var(--ok); font-weight: 700; }
.matrix td.no  { color: var(--line-2); }
.matrix tr.group td { background: var(--surface-2); font-size: 10px;
                      text-transform: uppercase; letter-spacing: .08em;
                      color: var(--muted); font-weight: 700;
                      padding-top: 9px; padding-bottom: 9px; }
.matrix tbody tr:hover td { background: var(--surface-2); }
code.pw { font-size: 15px; padding: 3px 9px; letter-spacing: 0;
          background: var(--surface-2); border-radius: var(--r-xs); user-select: all; }
.chg { display: inline-block; margin-right: 9px; }
.chg b { color: var(--ink); font-weight: 550; }

/* ── экран входа ──────────────────────────────────────── */

.auth-wrap { display: grid; place-items: center; min-height: 100vh; padding: 24px;
             background: var(--bg); }
.auth {
  width: 100%; max-width: 372px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 30px; box-shadow: var(--pop);
}
.auth .brand { padding: 0 0 20px; }

/* ── появление ────────────────────────────────────────── */

@keyframes rise { from { opacity: 0; transform: translateY(6px); }
                  to   { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.card, .kpi > *, .funnel-step, .tasklist li {
  animation: rise .3s var(--ease) backwards;
}
.kpi > *:nth-child(2), .funnel-step:nth-child(2), .tasklist li:nth-child(2) { animation-delay: .03s; }
.kpi > *:nth-child(3), .funnel-step:nth-child(3), .tasklist li:nth-child(3) { animation-delay: .06s; }
.kpi > *:nth-child(4), .funnel-step:nth-child(4), .tasklist li:nth-child(4) { animation-delay: .09s; }
.funnel-step:nth-child(5), .tasklist li:nth-child(5) { animation-delay: .12s; }
.funnel-step:nth-child(6), .tasklist li:nth-child(6) { animation-delay: .15s; }

.plot .bar-1, .plot .bar-2, .plot .bar-3 {
  transform-origin: center bottom; animation: grow .42s var(--ease) backwards;
}
.plot .dot-mark { animation: rise .36s var(--ease) backwards; }
.donut circle:hover { stroke-width: 26; }

/* ── узкий экран ──────────────────────────────────────── */

@media (max-width: 1180px) {
  .two-col, .two-col.even, .two-col.wide-aside {
    grid-template-columns: minmax(0,1fr);
  }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .menu { flex-direction: row; flex-wrap: wrap; padding: 6px 10px 12px; }
  .whoami { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .whoami form { margin-top: 0; margin-left: auto; }
  main { padding: 20px 16px 56px; }
  h1 { font-size: 22px; }
  .kpi .val { font-size: 26px; }
  .tasklist .row-edit { opacity: 1; }
  .period { align-items: flex-start; }
}
@media (max-width: 720px) {
  .funnel-step { grid-template-columns: 108px 1fr 52px; gap: 8px; }
  .funnel-step .name small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ── путь водителя: вехи ──────────────────────────────── */

.milestones { list-style: none; margin: 0; padding: 0;
              display: flex; flex-direction: column; gap: 2px; }
.milestones li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface);
}
.milestones li .mark {
  width: 19px; height: 19px; border-radius: 50%; flex: 0 0 auto;
  border: 1.5px solid var(--line-2); background: var(--surface);
  display: grid; place-items: center;
  font-size: 10px; line-height: 1; color: transparent;
}
.milestones li.done { border-color: color-mix(in srgb, var(--ok) 35%, transparent);
                      background: var(--ok-soft); }
.milestones li.done .mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.milestones li b { color: var(--ink); font-weight: 600; font-size: 13.5px;
                   letter-spacing: -.01em; }
.milestones li:not(.done) b { color: var(--muted); }

/* ── тихое опасное действие ───────────────────────────────
   Внизу страницы, одной строкой. Кнопка без отмены не должна
   попадаться под курсор рядом с обычными действиями. */
.quiet-danger { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
                margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line);
                font-size: 12px; color: var(--muted); }
.quiet-danger form { margin: 0; }
.quiet-danger button {
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: var(--r-xs);
  padding: 4px 10px;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}
.quiet-danger button:hover { color: var(--stop); border-color: var(--stop);
                             background: var(--stop-soft); }

/* ── задача, раскрытая на месте ───────────────────────────── */
.tasklist .ttl {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; letter-spacing: -.012em;
  color: var(--ink); text-align: left;
}
.tasklist .ttl:hover { text-decoration: underline; text-underline-offset: 2px; }
.caret {
  width: 0; height: 0; flex: 0 0 auto; margin-top: 1px;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  transition: transform var(--fast);
}
.tasklist .ttl[aria-expanded="true"] .caret { transform: rotate(-180deg); }

.task-more { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--line); }
.task-more[hidden] { display: none; }
.task-more .descr { margin: 0; font-size: 13px; color: var(--ink-2);
                    white-space: pre-wrap; line-height: 1.5; }
.task-more-acts { display: flex; gap: 8px; align-items: center;
                  flex-wrap: wrap; margin-top: 12px; }

.subs { list-style: none; margin: 12px 0 0; padding: 0;
        display: flex; flex-direction: column; gap: 5px; }
.subs li { display: flex; align-items: center; gap: 9px; font-size: 13px;
           color: var(--ink-2); }
.subs li form { margin: 0; display: flex; }
.subs .checkbox { width: 17px; height: 17px; }
.subs .nm { flex: 1; min-width: 0; }
.subs .dim { font-size: 11.5px; }
.subs li.is-done .nm { text-decoration: line-through; color: var(--muted); }

/* ── бухгалтерия ──────────────────────────────────────────── */
.ledger { display: flex; flex-direction: column; }
.ledger .row { display: flex; justify-content: space-between; align-items: baseline;
               gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line);
               font-size: 14px; color: var(--ink-2); }
.ledger .row small { display: block; font-size: 11.5px; color: var(--muted); }
.ledger .row b { font-size: 16px; font-weight: 650; color: var(--ink);
                 letter-spacing: -.02em; white-space: nowrap; }
.ledger .row.minus b { color: var(--stop); }
.ledger .row.total { border-bottom: 0; border-top: 1px solid var(--line-2);
                     padding-top: 13px; margin-top: 2px; }
.ledger .row.total span { font-weight: 600; color: var(--ink); }
.ledger .row.total b { font-size: 21px; }

.group-card { padding: 0; margin-bottom: 8px; }
.group-card > summary {
  display: flex; align-items: baseline; gap: 12px; cursor: pointer;
  padding: 13px 16px; list-style: none; font-size: 14px;
}
.group-card > summary::-webkit-details-marker { display: none; }
.group-card > summary::before {
  content: ""; width: 0; height: 0; flex: 0 0 auto; margin-right: 2px;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--muted); transition: transform var(--fast);
}
.group-card[open] > summary::before { transform: rotate(-90deg); }
.group-card > summary .nm { font-family: var(--mono); font-size: 12.5px;
                            color: var(--ink); }
.group-card > summary .dim { font-size: 12px; }
.group-card > summary b { margin-left: auto; font-weight: 650;
                          letter-spacing: -.02em; }
.group-card > summary b.neg { color: var(--stop); }
.group-card > div { padding: 0 16px 16px; }
.group-card table.grid { border: 0; }
table.grid td.over { color: var(--stop); font-weight: 600; }

/* ── периоды тарифов ──────────────────────────────────────── */
.tariff-period { padding-bottom: 12px; margin-bottom: 12px;
                 border-bottom: 1px solid var(--line); }
.tariff-period:last-of-type { border-bottom: 0; }
.tariff-period .field { margin-bottom: 8px; }
.tariff-add { margin-top: 6px; }
.tariff-add > summary { cursor: pointer; font-size: 12.5px; color: var(--muted);
                        list-style: none; }
.tariff-add > summary::-webkit-details-marker { display: none; }
.tariff-add > summary::before { content: "+ "; font-weight: 700; }
.tariff-add > summary:hover { color: var(--ink); }

/* ── этапы обработки заявки ───────────────────────────────
   Дорожка, а не список галочек: заполненная часть сразу
   показывает, сколько пройдено, без чтения подписей. */

.track-card { padding-bottom: 16px; }
.track-head { display: flex; align-items: baseline; justify-content: space-between;
              gap: 12px; margin-bottom: 16px; }
.track-head h3 { margin: 0; }
.track-count { font-size: 12.5px; color: var(--muted); }
.track-count b { font-size: 15px; font-weight: 650; color: var(--ink);
                 letter-spacing: -.02em; }

.track { list-style: none; margin: 0; padding: 0; display: grid;
         grid-template-columns: repeat(var(--all), 1fr); gap: 0;
         position: relative; }

/* Линия под кружками — одна на всю дорожку, чтобы не собирать её
   из кусочков между шагами и не ловить щели на дробных ширинах. */
.track::before, .track::after {
  content: ""; position: absolute; top: 13px; height: 2px; border-radius: 2px;
  left: calc(100% / var(--all) / 2); right: calc(100% / var(--all) / 2);
  background: var(--line-2);
}
.track::after {
  right: auto; background: var(--ok);
  width: calc((100% - 100% / var(--all)) * (var(--done) - 1) / (var(--all) - 1));
  transition: width .45s var(--ease);
}
.track li:first-child.done ~ li::before { display: none; }

.track li { display: flex; flex-direction: column; align-items: center;
            gap: 8px; text-align: center; position: relative; z-index: 1;
            padding: 0 4px; }
.track form { margin: 0; }
.track .dot {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid var(--line-2); background: var(--surface);
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 650;
  display: grid; place-items: center;
  transition: background var(--fast), border-color var(--fast),
              color var(--fast), transform var(--fast);
}
.track .dot:hover { border-color: var(--ink); color: var(--ink); transform: scale(1.08); }
.track li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.track li.now .dot { box-shadow: 0 0 0 4px var(--ok-soft); }

.track .what b { display: block; font-size: 12.5px; font-weight: 600;
                 color: var(--ink); line-height: 1.25; letter-spacing: -.01em; }
.track li:not(.done) .what b { color: var(--muted); font-weight: 500; }
.track .what small, .track .what time {
  display: block; margin-top: 3px; font-size: 10.5px; color: var(--muted);
  line-height: 1.3;
}
.track .what time { font-variant-numeric: tabular-nums; }
.track li.done .what time { color: var(--ok); }

.track-note { margin: 16px 0 0; font-size: 12px; color: var(--muted);
              line-height: 1.45; padding-top: 12px;
              border-top: 1px solid var(--line); }

@media (max-width: 560px) {
  .track { grid-template-columns: 1fr; gap: 12px; }
  .track::before, .track::after { display: none; }
  .track li { flex-direction: row; text-align: left; gap: 11px; }
  .track .what { flex: 1; }
}

/* ── этап в списке заявок ─────────────────────────────────
   Три деления вместо слова: строку читают по диагонали, и
   заполненность видна раньше, чем текст. */
.stage-dots { display: flex; align-items: center; gap: 4px; margin-top: 6px;
              font-size: 11px; color: var(--muted); }
.stage-dots i { width: 14px; height: 4px; border-radius: 2px; flex: 0 0 auto;
                background: var(--line-2); }
.stage-dots i.on { background: var(--ok); }
.stage-dots span { margin-left: 3px; white-space: nowrap; }
.stage-dots.none i { background: var(--line); }
.stage-dots.none span { font-style: italic; opacity: .8; }

/* ── дела по заявке ───────────────────────────────────────
   Список вместо одного напоминания: работа по заявке редко
   состоит из одного шага, и одна дата вмещала только ближайший. */

.todo-card .track-head { margin-bottom: 12px; }
.todos { list-style: none; margin: 0 0 14px; padding: 0;
         display: flex; flex-direction: column; }
.todos li { display: flex; align-items: flex-start; gap: 11px;
            padding: 10px 0; border-bottom: 1px solid var(--line); }
.todos li:first-child { padding-top: 0; }
.todos li:last-child { border-bottom: 0; padding-bottom: 0; }
.todos form { margin: 0; display: flex; flex: 0 0 auto; }
.todos .checkbox { width: 19px; height: 19px; margin-top: 1px; }
.todos .body { flex: 1; min-width: 0; }
.todos .ttl { font-size: 13.5px; color: var(--ink); line-height: 1.4;
              overflow-wrap: anywhere; }
.todos .meta { display: flex; gap: 5px 12px; flex-wrap: wrap;
               margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.todos .meta .when { font-variant-numeric: tabular-nums; }
.todos .meta .overdue { color: var(--stop); font-weight: 600; }
.todos li.late .when { color: var(--stop); }
.todos li.done .ttl { color: var(--muted); text-decoration: line-through; }
.todos li .xbtn { opacity: 0; }
.todos li:hover .xbtn, .todos li .xbtn:focus-visible { opacity: 1; }

.todo-add { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.todo-add input[type=text] { flex: 1 1 220px; min-width: 0; }
.todo-add input[type=datetime-local] { width: auto; flex: 0 0 auto; }
.todo-card .hint { display: block; margin-top: 7px; font-size: 11.5px;
                   color: var(--muted); }

@media (max-width: 640px) {
  .todos li .xbtn { opacity: 1; }
  .todo-add input[type=datetime-local] { flex: 1 1 100%; width: 100%; }
}

/* ── направления: такси и доставка ────────────────────────
   Цвет здесь не украшение: в общем списке заявок он единственное,
   что отличает одну линию от другой на скорости чтения. */

.tabs.lines { margin-bottom: 14px; }
.tab.l-taxi.on     { box-shadow: 0 1px 2px rgba(13,15,20,.07), inset 0 -2px 0 var(--line-taxi); }
.tab.l-delivery.on { box-shadow: 0 1px 2px rgba(13,15,20,.07), inset 0 -2px 0 var(--line-del); }

.line-mark {
  display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 600;
  padding: 2px 7px; border-radius: var(--r-xs); white-space: nowrap;
  letter-spacing: .01em;
}
.line-mark.l-taxi {
  color: var(--line-taxi);
  background: color-mix(in srgb, var(--line-taxi) 12%, transparent);
}
.line-mark.l-delivery {
  color: var(--line-del);
  background: color-mix(in srgb, var(--line-del) 12%, transparent);
}

/* ── горизонтальные полосы ─────────────────────────────
   Сравнение категорий: все полосы стоят от одной линии,
   поэтому разница читается сразу, без счёта долей. */
.hbars { display: flex; flex-direction: column; gap: 2px; }
.hbar-row {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) auto 46px;
  align-items: center; gap: 14px; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
/* Суммы шире счётчиков: «120 000 ₽» в колонку под число штук не влезает
   и переносится на две строки, разрывая строку пополам. */
.hbar-row .vl { min-width: 54px; white-space: nowrap; }
.hbar-row:last-child { border-bottom: 0; }
/* Названия кампаний длинные — «сайт.рф | Динамические объявления».
   Обрезать их многоточием значит превратить строки в неразличимые:
   у половины кампаний совпадает начало. Даём вторую строку. */
.hbar-row .nm {
  font-size: 12.5px; color: var(--ink-2); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
.hbar-row .track {
  height: 10px; background: var(--surface-2); border-radius: 5px;
  overflow: hidden; display: block;
}
.hbar-row .track i { display: block; height: 100%; border-radius: 5px;
                     min-width: 2px; transition: width var(--slow); }
.hbar-row .vl { font-size: 13.5px; text-align: right; color: var(--ink); }
.hbar-row .pc { font-size: 12px; text-align: right; color: var(--muted); }

@media (max-width: 620px) {
  .hbar-row { grid-template-columns: minmax(0,1fr) 52px 44px; }
  .hbar-row .track { grid-column: 1 / -1; order: 3; }
}

/* Названия кампаний длинные и занимают по три строки, растягивая
   строку таблицы вдвое. Двух строк хватает, чтобы отличить кампанию
   от соседней; целиком она видна в карточке заявки. */
table.grid td .src-wrap {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.4;
}

/* ── графики ───────────────────────────────────────────
   Высоту задаёт сам график после разбора данных: она
   складывается из числа панелей, а не угадывается стилем. */
.chart { width: 100%; min-height: 120px; }
.chart-empty {
  display: grid; place-items: center; min-height: 120px;
  color: var(--muted); font-size: 13px;
}
