/* FORUM-AUTO · прототип системы отдела продаж.
   Направление: индустриальный утилитаризм — светлая рабочая тема,
   графит + фирменный красный, жёсткая типографика, табличная точность. */

:root {
  --paper: oklch(97.3% 0.004 75);
  --paper-2: oklch(94.8% 0.006 75);
  --card: oklch(99.2% 0.002 75);
  --ink: oklch(23% 0.012 265);
  --ink-2: oklch(42% 0.014 265);
  --ink-3: oklch(58% 0.012 265);
  --line: oklch(88% 0.008 75);
  --line-2: oklch(80% 0.01 75);
  --red: oklch(54% 0.205 27);
  --red-bright: oklch(60% 0.23 27);
  --red-dim: oklch(94% 0.03 27);
  --ok: oklch(56% 0.13 152);
  --ok-dim: oklch(94% 0.04 152);
  --warn: oklch(70% 0.14 75);
  --warn-dim: oklch(95% 0.05 85);
  --graphite: oklch(25% 0.014 265);
  --graphite-2: oklch(31% 0.016 265);
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --shadow: 0 1px 2px oklch(20% 0.01 265 / 0.06), 0 4px 16px oklch(20% 0.01 265 / 0.05);
}

* { box-sizing: border-box; margin: 0; }

html { color-scheme: light; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: 'tnum' 1;
}

/* ── Каркас ────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.side {
  background: var(--graphite);
  color: oklch(88% 0.006 75);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid oklch(35% 0.014 265);
}
.side__logo {
  width: 38px; height: 38px; flex: none;
  background: var(--red-bright);
  color: oklch(98% 0.005 75);
  font-family: var(--font-display); font-size: 24px; line-height: 38px;
  text-align: center; letter-spacing: 0.5px;
}
.side__brand b { font-family: var(--font-display); font-weight: 400; font-size: 21px; letter-spacing: 1.5px; color: oklch(96% 0.004 75); }
.side__brand small { display: block; font-size: 10px; letter-spacing: 0.4px; color: oklch(66% 0.01 75); margin-top: -2px; }

.side__group { padding: 14px 16px 4px; font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: oklch(58% 0.012 265); }
.side nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  color: oklch(84% 0.008 75);
  text-decoration: none; font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.side nav a:hover { background: var(--graphite-2); }
.side nav a.active {
  background: var(--graphite-2);
  border-left-color: var(--red-bright);
  color: oklch(97% 0.004 75);
  font-weight: 600;
}
.side nav a .n {
  margin-left: auto; background: var(--red-bright); color: white;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 9px;
}
.side__foot { margin-top: auto; padding: 14px 16px; font-size: 11px; color: oklch(55% 0.012 265); border-top: 1px solid oklch(35% 0.014 265); }

/* ── Шапка ─────────────────────────────────────────────── */
.top {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.top h1 { font-family: var(--font-display); font-weight: 400; font-size: 27px; letter-spacing: 1.2px; }
.top__period { display: flex; gap: 8px; margin-left: auto; align-items: center; font-size: 13px; color: var(--ink-2); }
.top select {
  font: inherit; font-size: 13px; color: var(--ink);
  padding: 6px 10px; border: 1px solid var(--line-2); background: var(--card);
}
.top .who { max-width: 300px; }

.content { padding: 24px 28px 56px; max-width: 1240px; }

/* ── Общие элементы ────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }

.panel { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.panel__head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.panel__head h2 { font-family: var(--font-display); font-weight: 400; font-size: 19px; letter-spacing: 1.2px; color: var(--ink); }
.panel__head .sub { font-size: 12px; color: var(--ink-3); }
.panel__body { padding: 14px 16px; }
.panel__body--flush { padding: 0; }

.note { font-size: 12px; color: var(--ink-3); padding: 10px 16px; border-top: 1px dashed var(--line-2); }
.note b { color: var(--ink-2); }

/* Метрики */
.metric { padding: 2px 0 6px; }
.metric .l { font-size: 11.5px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-3); }
.metric .v { font-family: var(--font-display); font-size: 30px; letter-spacing: 0.8px; line-height: 1.1; }
.metric .v small { font-size: 18px; color: var(--ink-3); }
.metric.metric--red .v { color: var(--red); }
.metric.metric--ok .v { color: var(--ok); }

/* Плашка выполнения */
.gauge { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.gauge__cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.gauge__pct {
  font-family: var(--font-display); font-size: 52px; line-height: 1;
  color: var(--ok);
}
.gauge__pct.bad { color: var(--red); }
.bar { height: 8px; background: var(--paper-2); position: relative; overflow: hidden; flex: 1; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--ok); }
.bar i.bad { background: var(--red); }

/* Таблицы */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th {
  text-align: left; font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  padding: 9px 12px; border-bottom: 1px solid var(--line-2);
  background: var(--paper-2);
  white-space: nowrap;
}
.t td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.t tr:hover td { background: oklch(96.5% 0.005 75); }
.t .tot td { font-weight: 700; background: var(--paper-2); border-top: 2px solid var(--line-2); }

/* Бейджи */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 2px; white-space: nowrap; }
.badge--new { background: oklch(93% 0.05 250); color: oklch(42% 0.12 255); }
.badge--work { background: var(--warn-dim); color: oklch(52% 0.12 75); }
.badge--done { background: var(--paper-2); color: var(--ink-2); }
.badge--ok { background: var(--ok-dim); color: var(--ok); }
.badge--bad { background: var(--red-dim); color: var(--red); }
.badge--off { background: var(--paper-2); color: var(--ink-3); text-decoration: line-through; }
.badge--late { background: var(--red); color: white; }

.prog { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; padding: 2px 6px; }
.prog--gp { background: var(--graphite); color: white; }
.prog--lp { background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line-2); }

.delta { font-size: 12px; font-weight: 600; white-space: nowrap; }
.delta--up { color: var(--ok); }
.delta--down { color: var(--red); }

/* Кольца KPI */
.rings { display: flex; flex-wrap: wrap; gap: 18px 26px; align-items: flex-end; }
.ring { position: relative; width: var(--size); text-align: center; }
.ring svg { display: block; }
.ring__track { fill: none; stroke: var(--paper-2); stroke-width: 7; }
.ring__bar { fill: none; stroke-width: 7; stroke-linecap: butt; }
.ring--ok .ring__bar { stroke: var(--ok); }
.ring--mid .ring__bar { stroke: var(--warn); }
.ring--bad .ring__bar { stroke: var(--red); }
.ring__val {
  position: absolute; inset: 0 0 18px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 21px;
}
.ring__label { font-size: 10.5px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }

/* Кнопки */
.btn {
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn--red { background: var(--red); border-color: var(--red); color: white; }
.btn--red:hover { background: var(--red-bright); border-color: var(--red-bright); }
.btn--ghost { border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--line-2); }
.btn[disabled] { opacity: 0.45; cursor: default; }

/* Вкладки */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line-2); }
.tabs button {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  border: 0; background: none; padding: 8px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tabs button.active { color: var(--red); border-bottom-color: var(--red); }

/* Фильтры-чипы */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2); border-radius: 999px;
}
.chip.active { background: var(--graphite); border-color: var(--graphite); color: white; }

/* Задачи */
.task { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task__type { font-weight: 700; font-size: 13.5px; }
.task__type .auto { font-size: 10.5px; font-weight: 600; color: var(--ink-3); border: 1px solid var(--line-2); padding: 1px 5px; margin-left: 8px; letter-spacing: 0.5px; }
.task__client { font-size: 12.5px; color: var(--red); cursor: pointer; text-decoration: underline dotted; }
.task__text { font-size: 13px; color: var(--ink-2); max-width: 640px; }
.task__meta { font-size: 11.5px; color: var(--ink-3); }
.task__side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.task__actions { display: flex; gap: 6px; }

/* Панель клиента */
.drawer {
  position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end;
  background: oklch(20% 0.01 265 / 0.35);
}
.drawer__card {
  width: min(440px, 92vw); background: var(--card); height: 100%;
  overflow: auto; box-shadow: -8px 0 32px oklch(20% 0.01 265 / 0.2);
  animation: slide-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.drawer__head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer__head h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; letter-spacing: 1px; }
.drawer dl { display: grid; grid-template-columns: 150px 1fr; gap: 7px 12px; padding: 16px 20px; font-size: 13px; }
.drawer dt { color: var(--ink-3); }
.drawer dd { font-weight: 600; }
.drawer__actions { display: flex; gap: 8px; padding: 0 20px 20px; }
.drawer .photo {
  margin: 0 20px 16px; aspect-ratio: 16/7; background: repeating-linear-gradient(45deg, var(--paper-2) 0 12px, var(--card) 12px 24px);
  border: 1px dashed var(--line-2); display: grid; place-items: center;
  color: var(--ink-3); font-size: 12px; text-align: center;
}

/* Ввод в таблицах KPI */
.t input[type='number'] {
  font: inherit; font-size: 13px; width: 64px; text-align: right;
  border: 1px solid var(--line-2); padding: 3px 6px; background: var(--card);
}
.t input[type='number']:focus { outline: 2px solid var(--red-dim); border-color: var(--red); }

/* Переключатели */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch i {
  width: 34px; height: 18px; border-radius: 999px; background: var(--line-2); position: relative; transition: background 0.15s; flex: none;
}
.switch i::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: white; transition: translate 0.15s;
}
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { translate: 16px 0; }

/* Рейтинг */
.rate-pos { font-family: var(--font-display); font-size: 22px; width: 40px; color: var(--ink-3); }
.rate-pos.top { color: var(--red); }
.rate-avg { font-family: var(--font-display); font-size: 16px; letter-spacing: 0.5px; }
.likebar { display: inline-flex; gap: 8px; font-size: 12px; color: var(--ink-2); }

/* Оргструктура */
.org { font-size: 13px; padding: 6px 16px 14px; }
.org ul { list-style: none; padding-left: 22px; border-left: 1px solid var(--line-2); margin-left: 7px; }
.org > ul { border: 0; padding-left: 0; margin-left: 0; }
.org li { padding: 4px 0; }
.org .p { font-weight: 700; }
.org .r { font-size: 11.5px; color: var(--ink-3); margin-left: 8px; }
.org .reg { font-family: var(--font-display); letter-spacing: 1px; font-size: 16px; color: var(--red); }
.org .org__head-name { margin-left: 8px; }
.org .org__curator { font-size: 15px; }

/* Планирование: сетка факторов */
.factors { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.factor { border: 1px solid var(--line); padding: 10px 12px; }
.factor h4 { font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.factor .row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; }
.factor .row b { font-variant-numeric: tabular-nums; }

/* Мини-график план/факт */
.spark { display: flex; align-items: flex-end; gap: 10px; height: 120px; padding: 6px 4px 0; }
.spark .col { flex: 1; display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.spark .b { flex: 1; min-width: 10px; }
.spark .b--fact { background: var(--graphite); }
.spark .b--plan { background: var(--red); }
.spark-x { display: flex; gap: 10px; font-size: 10.5px; color: var(--ink-3); padding: 4px 4px 0; }
.spark-x span { flex: 1; text-align: center; }
.legend { display: flex; gap: 16px; font-size: 11.5px; color: var(--ink-2); padding-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; }

/* Док-строки */
.docrow { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.docrow:last-child { border-bottom: 0; }
.docrow .pdf {
  flex: none; width: 34px; height: 40px; background: var(--red-dim); color: var(--red);
  display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: 0.5px;
  border: 1px solid oklch(88% 0.05 27);
}
.docrow .meta { font-size: 11.5px; color: var(--ink-3); }

/* Заглушка-баннер прототипа */
.proto-note {
  margin-bottom: 18px; padding: 10px 14px; font-size: 12.5px;
  background: var(--warn-dim); border: 1px solid oklch(85% 0.08 85); color: oklch(40% 0.07 75);
}
.panel__body .proto-note { margin: 12px 0 0; }

/* Инструкция-подсказка (в отличие от жёлтого дисклеймера) */
.callout {
  padding: 10px 14px; font-size: 12.5px; color: var(--ink-2);
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--red); box-shadow: var(--shadow);
}

/* ── Полиш-слой: единый ритм и варианты ────────────────── */

/* Вертикальный ритм экрана: каждый view — стек секций с одинаковым зазором */
.stack { display: grid; gap: 16px; align-content: start; }

/* Асимметричная пара колонок — один ratio на весь прототип */
.cols-2--main { grid-template-columns: 1.4fr 1fr; }

/* Таблица «ключ–значение» (показатели, аналитика): без hover и капс-шапки */
.t--kv td:first-child { color: var(--ink-2); }
.t--kv tr:hover td { background: none; }

/* Цветовые акценты чисел */
.num--ok { color: var(--ok); font-weight: 700; }
.num--bad { color: var(--red); font-weight: 700; }
.num--dim { color: var(--ink-3); }

/* Вторичная строка (роль, филиал, метаданные) */
.dim { font-size: 11px; color: var(--ink-3); }

/* Компактные панели (сетки KPI-шкал) */
.panel--compact .panel__head h2 { font-size: 15px; letter-spacing: 0.8px; }

/* Прокрутка внутри панелей */
.scroll-x { overflow-x: auto; }
.scroll-y { max-height: 340px; overflow: auto; }

/* Разделитель между зонами внутри панели */
.panel__section { border-bottom: 1px solid var(--line); }

/* Подшапка года в сводной таблице планирования */
.t tr.subhead td {
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600; background: var(--paper-2);
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.t td.yr { vertical-align: middle; }
.t td.yr b { font-family: var(--font-display); font-weight: 400; font-size: 20px; letter-spacing: 1px; }

/* Мелкие общие элементы */
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.body-text { font-size: 13px; color: var(--ink-2); max-width: 72ch; }
.num-cond { font-variant-numeric: tabular-nums; }
.factor .row--sum { border-top: 1px dashed var(--line-2); margin-top: 6px; padding-top: 6px; }
.docrow__main { flex: 1; }
.chip--empty { opacity: 0.4; }
.panel__head-action { margin-left: auto; align-self: center; }
.empty { padding: 24px 16px; color: var(--ink-3); font-size: 13px; }
.row-link { cursor: pointer; }
.link-red { color: var(--red); }

/* Состояния взаимодействия */
:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px; border-radius: 1px;
}
.chip { transition: border-color 0.15s, background 0.15s; }
.chip:hover:not(.active) { border-color: var(--ink-3); }
.btn:active:not([disabled]) { transform: translateY(1px); }
.side nav a, .tabs button, .t input[type='number'] { transition: color 0.15s, background 0.15s, border-color 0.15s; }

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

@media (max-width: 960px) {
  .cols-2--main { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side nav { display: flex; flex-wrap: wrap; }
  .side nav a { border-left: 0; border-bottom: 3px solid transparent; }
  .side nav a.active { border-bottom-color: var(--red-bright); }
  .side__group, .side__foot { display: none; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .top { padding: 10px 16px; flex-wrap: wrap; }
  .panel__body { overflow-x: auto; }
}
