/* Плотный рабочий интерфейс: смотреть в него по восемь часов, а не любоваться.
   Отсюда правила: приглушённый фон, тонкие линии вместо теней и заливок,
   бордовый только там, где он что-то значит, и цифры в моноширинном —
   в колонках охватов и цен пропорциональные знаки пляшут и мешают сравнивать. */
:root {
  color-scheme: light;
  /* палитра onsi.store: бордовый #801324, текст #1b1e1b, светлый #ededeb */
  --bg: #f4f3f1;
  --panel: #ffffff;
  --panel-2: #faf9f7;      /* шапки таблиц, вложенные заливки */
  --ink: #1b1e1b;
  --ink-2: #4c514c;        /* второстепенный текст, ещё читаемый */
  --muted: #83867f;
  --line: #e6e4e0;
  --line-2: #d6d3ce;       /* там, где граница должна читаться */
  --accent: #801324;
  --accent-hover: #991137;
  --accent-soft: #f7e8ec;
  --accent-ink: #801324;   /* бордовый поверх фона: в тёмной теме светлеет */
  --ok: #2f6b4f;
  --ok-soft: #e7f0eb;
  --warn: #8a6d1a;
  --warn-soft: #f5efdc;
  --danger: #b4483c;
  --danger-soft: #f7e9e7;
  --radius: 10px;          /* контейнеры */
  --radius-inner: 7px;     /* вложенное — плотнее, иначе всё сливается в мыло */
  --btn-radius: 6px;
  /* Тени в тон фону, а не чёрные: палитра тёплая, чистый чёрный её грязнит */
  --shadow-sm: 0 1px 2px rgba(60, 42, 38, .06);
  --shadow-md: 0 4px 14px rgba(60, 42, 38, .08);
  --shadow-lg: 0 16px 44px rgba(60, 42, 38, .16);
  --font-head: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --font-text: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sunken: #edebe6;       /* колонки канбана, «утопленные» подложки */
  --danger-line: #f0d5d1;
  --warn-line: #ecdfbd;
  --ok-line: #cfe3d7;
  --tag-ai: #59456a;
  --tag-creative: #79601c;
  --tag-comments: #2f6b4f;
  --tag-risk: #a13425;
  --tag-money: #3a5a75;
  --info: #4a6d99;
  --danger-hover: #9c4534;
}

/* Тёмная тема. Бордовый #801324 на тёмном фоне нечитаем — берём осветлённый
   тон той же гаммы, иначе ссылки и активные пункты меню пропадают. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131513;
  --panel: #1a1c1a;
  --panel-2: #202320;
  --ink: #e9e9e4;
  --ink-2: #b4b8b0;
  --muted: #868a80;
  --line: #2a2d29;
  --line-2: #3a3e39;
  --accent: #c9556c;
  --accent-hover: #d9687e;
  --accent-soft: #2c1a1f;
  --accent-ink: #d9788a;
  --ok: #6bbd90;
  --ok-soft: #182a21;
  --warn: #c9a94e;
  --warn-soft: #2a2415;
  --danger: #d9756a;
  --danger-soft: #2d1c1a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, .55);
  --sunken: #0f110f;
  --danger-line: #4a2a26;
  --warn-line: #453c1f;
  --ok-line: #24402f;
  --tag-ai: #b79ed4;
  --tag-creative: #d4b96a;
  --tag-comments: #6bbd90;
  --tag-risk: #e08a7d;
  --tag-money: #8fb4d4;
  --info: #7fa8d4;
  --danger-hover: #c65f52;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131513;
    --panel: #1a1c1a;
    --panel-2: #202320;
    --ink: #e9e9e4;
    --ink-2: #b4b8b0;
    --muted: #868a80;
    --line: #2a2d29;
    --line-2: #3a3e39;
    --accent: #c9556c;
    --accent-hover: #d9687e;
    --accent-soft: #2c1a1f;
    --accent-ink: #d9788a;
    --ok: #6bbd90;
    --ok-soft: #182a21;
    --warn: #c9a94e;
    --warn-soft: #2a2415;
    --danger: #d9756a;
    --danger-soft: #2d1c1a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
    --shadow-lg: 0 16px 44px rgba(0, 0, 0, .55);
    --sunken: #0f110f;
    --danger-line: #4a2a26;
    --warn-line: #453c1f;
    --ok-line: #24402f;
    --tag-ai: #b79ed4;
    --tag-creative: #d4b96a;
    --tag-comments: #6bbd90;
    --tag-risk: #e08a7d;
    --tag-money: #8fb4d4;
    --info: #7fa8d4;
    --danger-hover: #c65f52;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; font: 14px/1.5 var(--font-text);
  color: var(--ink); background: var(--bg);
  display: flex; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "lnum" 1;   /* цифры одной ширины */
}
h1, h2, h3, .brand, .col-head { font-family: var(--font-head); }
.card .value, .kpi-value, .metric-val { font-family: var(--font-num); }
/* Боковое меню приглушено намеренно: это не содержание страницы, а рамка
   вокруг него. Активный пункт помечен вертикальной чертой, а не заливкой —
   заливка на каждом экране перетягивала взгляд на себя. */
.sidebar {
  width: 210px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--line); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100dvh;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: -.01em; padding: 0 8px; }
.brand span { color: var(--accent-ink); font-weight: 500; margin-left: 5px; }
.brand.big { font-size: 24px; }
nav { display: flex; flex-direction: column; gap: 1px; }
nav a {
  position: relative; padding: 7px 10px; border-radius: 7px; text-decoration: none;
  color: var(--ink-2); display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; transition: color .15s ease, background-color .15s ease;
}
nav a svg {
  width: 16px; height: 16px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; opacity: .6;
}
nav a.active svg { opacity: 1; }
nav a:hover { background: var(--panel-2); color: var(--ink); }
nav a.active { color: var(--ink); font-weight: 600; background: transparent; }
nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 6px; bottom: 6px;
  width: 2px; border-radius: 0 2px 2px 0; background: var(--accent);
}
.sidebar-footer { margin-top: auto; font-size: 12.5px; padding: 0 8px; }
.whoami { font-weight: 600; }
.sidebar-actions { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.theme-toggle {
  margin-left: auto; background: none; border: 1px solid var(--line);
  border-radius: 6px; padding: 4px; cursor: pointer; color: var(--muted);
  display: inline-flex; line-height: 0;
  transition: color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-2); }
.theme-toggle svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: inline; }
}
main { flex: 1; min-width: 0; padding: 24px 30px 40px; max-width: 1250px; }
h1 {
  font-size: 23px; margin: 0 0 16px; font-weight: 700;
  letter-spacing: -.025em; line-height: 1.2; text-wrap: balance;
}
h2 {
  font-size: 13px; margin: 28px 0 10px; padding-bottom: 0; border-bottom: none;
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}
a { color: var(--accent); }
.muted { color: var(--muted); }
.flash {
  background: var(--accent-soft); border: 1px solid var(--accent);
  color: var(--accent); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
}
.flash.error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
/* Карточка метрики: подпись мелкая и приглушённая, значение крупное и
   моноширинное. Читают здесь число, а не слово над ним. */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 215px)); justify-content: start; gap: 10px; margin-bottom: 18px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 13px;
}
.card .value {
  font-size: 20px; font-weight: 600; margin-top: 3px; line-height: 1.15;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.card .value.bad { color: var(--danger); }
.card .label {
  font-size: 11px; color: var(--muted); font-weight: 500;
  letter-spacing: .05em; text-transform: uppercase;
}
.card .muted { font-size: 12px; margin-top: 3px; }

/* Таблица — основной экран работы. Зебра убрана: на сотне строк она рябит.
   Вместо неё тонкая сетка, подсветка строки под курсором и отметка слева,
   чтобы взгляд не терял, в какой строке находится. */
table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  font-variant-numeric: tabular-nums;
}
th, td { text-align: left; padding: 7px 11px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
th {
  background: var(--panel-2); font-weight: 600; font-size: 11px;
  letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  position: sticky; top: 0; z-index: 5;
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
th a { color: inherit; text-decoration: none; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover td, table tr:hover td { background: var(--panel-2); }
tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
td a { font-weight: 500; text-decoration: none; color: var(--accent-ink); }
td a:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; }
.btn {
  display: inline-block; border: 1px solid var(--line-2); background: var(--panel);
  border-radius: var(--btn-radius); padding: 6px 12px; font-size: 13.5px; cursor: pointer;
  text-decoration: none; color: var(--ink); font-family: var(--font-text); font-weight: 500;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .06s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.small { padding: 3px 9px; font-size: 12.5px; }
.btn.wide { width: 100%; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar form { display: inline; }
.chip {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink-2);
}

/* Статус и оценка — точка плюс текст, без заливки. Семь цветных плашек
   в одной строке таблицы спорят между собой и с самими данными; точка
   различается так же хорошо, но не перетягивает внимание. */
.chip.negotiation, .chip.agreed, .chip.waiting, .chip.published,
.chip.missing, .chip.closed, .chip.refused,
.chip.good, .chip.mid, .chip.bad {
  background: transparent; border-color: transparent; padding: 2px 2px;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 500;
}
.chip.negotiation::before, .chip.agreed::before, .chip.waiting::before,
.chip.published::before, .chip.missing::before, .chip.closed::before,
.chip.refused::before, .chip.good::before, .chip.mid::before, .chip.bad::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0; background: currentColor;
}
.chip.negotiation { color: var(--muted); }
.chip.agreed { color: var(--info); }
.chip.waiting { color: var(--warn); }
.chip.published { color: var(--ok); }
.chip.missing { color: var(--danger); }
.chip.closed { color: var(--muted); }
.chip.closed::before { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }
.chip.refused { color: var(--muted); }
.chip.refused::before { background: transparent; box-shadow: inset 0 0 0 1px currentColor; }
.chip.good { color: var(--ok); }
.chip.mid { color: var(--warn); }
.chip.bad { color: var(--danger); }
form.panel, .panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px; margin-bottom: 16px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 13.5px; color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--btn-radius); padding: 6px 9px; background: var(--panel);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
label { letter-spacing: .01em; }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff; display: flex; align-items: center;
  justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 22px;
}
.bv-head { display: flex; align-items: center; gap: 14px; }
.bv-name { font-family: var(--font-head); font-weight: 700; font-size: 19px; }
.bv-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.bv-chips .chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; font-size: 13px; }
.bv-chips .chip svg, .info-row svg {
  width: 14px; height: 14px; flex-shrink: 0; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.chip a { text-decoration: none; }
.info-rows { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 24px; }
.info-row { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.info-row svg { align-self: center; color: var(--muted); }
.info-row .vlabel { color: var(--muted); font-size: 13px; white-space: nowrap; }
.info-row.wide { grid-column: 1 / -1; }
.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px 20px; align-items: start; }
.view-item .vlabel { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.view-item .vvalue { font-size: 14.5px; overflow-wrap: anywhere; }
.view-item.wide { grid-column: 1 / -1; }
.view-item .vvalue.pre { white-space: pre-line; }
.period-nav { gap: 6px; }
.period-nav .period-input { padding: 6px 10px; font-size: 14px; }
.period-nav form { display: inline-flex; }
.flash { position: relative; padding-right: 36px; }
.flash .flash-close { position: absolute; right: 8px; top: 6px; background: none; border: none; cursor: pointer; font-size: 16px; color: inherit; }
textarea { min-height: 60px; resize: vertical; }
.form-actions { margin-top: 14px; }
.login-body { display: grid; place-items: center; background: var(--bg); }
.login-card {
  width: 340px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 30px; display: flex; flex-direction: column; gap: 12px;
}
.login-card form { display: flex; flex-direction: column; gap: 12px; }
details.adder { margin-bottom: 18px; }
details.form-sec { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
details.form-sec summary { cursor: pointer; font-weight: 600; margin-bottom: 10px; color: var(--muted); }
details.form-sec[open] summary { color: var(--accent); }
details.adder summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: 8px; }
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.mobile-board-status { display: none; }
.col {
  min-width: 215px; width: 215px; flex-shrink: 0;
  background: var(--sunken); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; min-height: 220px;
}
.col.over { outline: 2px dashed var(--accent); }
.col-head {
  font-weight: 600; font-size: 11.5px; margin-bottom: 9px; display: flex;
  gap: 6px; align-items: baseline; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-2);
}
.col-head .auto { margin-left: auto; font-size: 11px; border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; background: var(--panel); }
.kcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 6px; cursor: grab; font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.kcard:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.kcard.dragging { opacity: .5; }
.kcard.readonly { cursor: pointer; border-left: 3px solid var(--warn); }
.kcard a { text-decoration: none; color: var(--ink); font-weight: 500; }
.kmeta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.ktitle { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.col-head .budget { margin-left: auto; font-size: 11.5px; }
.quick-add { margin-bottom: 8px; font-size: 13px; }
.quick-add summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.quick-add form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.overlay { position: fixed; inset: 0; background: rgba(20, 22, 20, .35); z-index: 40; }
.modal {
  position: fixed; top: 12vh; left: 50%; transform: translateX(-50%);
  width: 560px; max-width: 94vw; max-height: 72vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; z-index: 60; box-shadow: var(--shadow-lg);
}
.modal h2 { margin: 0 0 14px; font-size: 17px; }
.modal .cols-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.modal .cols-grid label {
  flex-direction: row; align-items: center; gap: 8px;
  font-size: 14px; color: var(--ink); cursor: pointer;
}
.modal .cols-grid input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.gear-btn { margin-left: auto; }
th .sort-hint { opacity: .3; font-size: 11px; }
th a:hover .sort-hint { opacity: .8; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 92vw;
  background: var(--panel); border-left: 1px solid var(--line); z-index: 50;
  padding: 20px; overflow-y: auto; box-shadow: -8px 0 30px rgba(60, 42, 38, .14);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.drawer .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.drawer table { font-size: 13px; }
.kcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.d-form-grid { display: flex; flex-direction: column; gap: 12px; }
.d-section {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  min-width: 0; margin: 0;
}
.d-section legend { font-weight: 700; padding: 0 6px; color: var(--ink); }
.d-section > label { margin-top: 10px; }
.d-hint { font-size: 12px; margin: 8px 0 0; }
.form-feedback { margin: 10px 0; padding: 9px 11px; border-radius: 9px; font-size: 13px; }
.form-feedback.success { background: var(--ok-soft); color: var(--ok); border: 1px solid var(--ok-line); }
.form-feedback.error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-line); }
.scope-label { font-weight: 600; color: var(--muted); padding: 7px 2px; }
.compact-list { margin: 10px 0 0; padding-left: 20px; }
.compact-list li { margin: 4px 0; font-size: 13px; }
.role-callout {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: var(--accent-soft); border: 1px solid var(--danger-line); border-radius: var(--radius);
  padding: 12px 14px; margin: -6px 0 18px;
}
.role-callout p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.role-callout-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 800px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  body { display: block; min-height: 100dvh; }
  .sidebar {
    width: 100%; height: auto; min-width: 0; position: static; padding: 12px 16px 10px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { align-self: center; }
  nav {
    grid-column: 1 / -1; width: 100%; min-width: 0;
    flex-direction: row; flex-wrap: nowrap; gap: 4px; overflow-x: auto;
    padding-bottom: 3px; scrollbar-width: thin;
  }
  nav a { flex: 0 0 auto; padding: 7px 9px; font-size: 13px; white-space: nowrap; }
  nav a svg { width: 16px; height: 16px; }
  .sidebar-footer { grid-column: 2; grid-row: 1; margin: 0; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
  .sidebar-footer .whoami { display: none; }
  main { width: 100%; min-width: 0; max-width: none; padding: 16px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { padding: 12px; }
  .card .value { font-size: 19px; }
  .role-callout { align-items: flex-start; flex-direction: column; gap: 10px; margin-top: -6px; }
  .role-callout-actions { width: 100%; }
  .role-callout-actions .btn { flex: 1; text-align: center; }
  .toolbar > input, .toolbar > select { min-width: 0; max-width: 100%; }
  .drawer {
    width: 100%; max-width: 100%; left: 0; border-left: none;
    padding: 16px; box-shadow: none;
  }
  .drawer .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer .grid { grid-template-columns: minmax(0, 1fr); }
  .drawer .table-wrap { overflow-x: auto; }
  .mobile-board-status { display: flex; margin: 0 0 12px; }
  .mobile-board-status select { width: 100%; }
  .board { display: block; overflow: visible; padding-bottom: 0; }
  .board .col { display: none; width: 100%; min-width: 0; }
  .board .col.mobile-visible { display: block; }
}

/* ---------- карточка интеграции: hero ---------- */
/* ---------- Карточка сделки ---------- */
.deal-top { margin-bottom: 18px; }
.deal-top .back { font-size: 13px; text-decoration: none; }
.deal-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 9px; }
.deal-title h1 { font-size: 27px; margin: 0; line-height: 1.1; }
.deal-title h1 a { text-decoration: none; }
.deal-subtitle {
  color: var(--muted); font-size: 13.5px; margin-top: 6px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.deal-subtitle .sep { opacity: .4; }

.deal-page { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 24px; align-items: start; }
.deal-page.no-rail { grid-template-columns: minmax(0, 1fr); }
.deal-rail { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 12px; }
.deal-main { min-width: 0; }
.deal-main > h2:first-child { margin-top: 0; }

.rail-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
}
.rail-media { width: 100%; aspect-ratio: 9 / 16; display: block; background: #0d0d0d; object-fit: contain; }
.rail-media.cover { object-fit: cover; }
.rail-empty {
  min-height: 128px; display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center; text-align: center;
  padding: 22px 20px; color: var(--muted); font-size: 12.5px;
  background: repeating-linear-gradient(45deg, var(--panel-2), var(--panel-2) 10px, var(--sunken) 10px, var(--sunken) 20px);
}
.rail-empty .ico { font-size: 26px; opacity: .5; }
.rail-facts { padding: 6px 15px 10px; font-size: 13px; margin: 0; }
.rail-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rail-row:last-child { border-bottom: none; }
.rail-row dt { color: var(--muted); flex-shrink: 0; }
.rail-row dd {
  margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rail-actions { display: flex; flex-direction: column; gap: 7px; }
.rail-actions form { display: block; }
.rail-actions .btn { width: 100%; text-align: center; }

/* полоса ключевых метрик */
.metric-strip {
  display: flex; flex-wrap: wrap; margin-bottom: 16px;
  width: max-content; max-width: 100%;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
}
.metric-strip .m {
  flex: 1 1 auto; min-width: 148px; padding: 14px 18px;
  border-right: 1px solid var(--line);
}
.metric-strip .m:last-child { border-right: none; }
.metric-strip .m-value {
  font-family: var(--font-head); font-size: 21px; font-weight: 700;
  line-height: 1.15; font-variant-numeric: tabular-nums;
}
.metric-strip .m-label { font-size: 12px; color: var(--muted); margin-top: 3px; }
.metric-strip .m-value .unit { font-size: 14px; font-weight: 600; }

.caption-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 16px; font-size: 13.5px;
}
.caption-box .vlabel { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.caption-box .text { white-space: pre-line; line-height: 1.55; max-height: 132px; overflow-y: auto; }

/* компактные оповещения вместо тяжёлых панелей */
.alert {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 15px; border-radius: 12px; margin-bottom: 12px; font-size: 13.5px;
  border: 1px solid var(--line); background: var(--panel);
}
.alert .a-icon { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.alert .a-body { min-width: 0; }
.alert strong { font-size: 14px; }
.alert ul { margin: 5px 0 0; padding-left: 18px; }
.alert .a-note { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.alert.danger { background: var(--danger-soft); border-color: var(--danger-line); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.alert.ok { background: var(--ok-soft); border-color: var(--ok-line); }
.alert.info { background: var(--panel-2); border-color: var(--line); }

@media (max-width: 980px) {
  .deal-page { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .deal-rail { position: static; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .deal-rail .rail-card:first-child { width: 220px; }
  .deal-rail .rail-card:not(:first-child) { flex: 1 1 260px; }
  .rail-actions { flex: 1 1 100%; flex-direction: row; }
  .rail-actions .btn { width: auto; }
}

/* ---------- секции и карточки разбора ---------- */
.sec { margin-bottom: 30px; }
.sec:last-child { margin-bottom: 0; }
.sec-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 9px; margin-bottom: 14px;
}
.sec-head h2 { margin: 0; padding: 0; border: none; font-size: 17px; }
.sec-head .sec-hint { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }

.rcard {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 15px 17px; margin-bottom: 12px;
}
.rcard > header { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; }
.rcard .rbody { font-size: 14px; line-height: 1.55; }
.rcard .rbody.pre { white-space: pre-line; }
.rcard .rnote { color: var(--muted); font-size: 12px; margin-top: 8px; }
.rcard .when { margin-left: auto; color: var(--muted); font-size: 12px; }
.rtag {
  font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; font-weight: 700;
  padding: 4px 9px; border-radius: 7px; background: var(--panel-2); color: var(--ink-2); white-space: nowrap;
}
.rtag.ai { background: var(--panel-2); color: var(--tag-ai); }
.rtag.creative { background: var(--panel-2); color: var(--tag-creative); }
.rtag.comments { background: var(--panel-2); color: var(--tag-comments); }
.rtag.risk { background: var(--panel-2); color: var(--tag-risk); }
.rtag.money { background: var(--panel-2); color: var(--tag-money); }
.rcard .score { font-family: var(--font-head); font-weight: 700; font-size: 15.5px; }

.empty-note {
  color: var(--muted); font-size: 13px; padding: 15px 17px;
  border: 1px dashed var(--line); border-radius: 12px;
}

.inline-stats { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; margin-top: 4px; }
.inline-stats b { font-family: var(--font-head); }

/* ровный спек-лист вместо рваной сетки */
.spec { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 32px; }
.spec .row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.spec .row dt { color: var(--muted); flex-shrink: 0; }
.spec .row dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.spec .row dd .sub { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.spec .row.wide { grid-column: 1 / -1; flex-direction: column; align-items: stretch; gap: 4px; }
.spec .row.wide dd { font-weight: 400; text-align: left; width: 100%; white-space: pre-line; }

.risk-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 26px; margin-top: 9px; }
.risk-cols .vlabel { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.risk-cols ul { margin: 4px 0 0; padding-left: 17px; }
.risk-cols li { margin-bottom: 3px; }
.alert.warn .a-note, .alert.danger .a-note { color: var(--muted); }

img.avatar { object-fit: cover; }

/* аватар в списках: маленький кружок перед именем */
.who { display: inline-flex; align-items: center; gap: 9px; }
.mini-ava {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; background: var(--bg);
}
.mini-ava.letter {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-head); font-weight: 700; font-size: 12px;
}

/* Удаление сделки: спрятано в раскрывающийся блок, чтобы кнопка не стояла
   рядом с обычными действиями и не нажималась по инерции. */
.rail-danger { margin-top: 14px; border: 1px solid var(--danger-line); border-radius: 10px;
  background: var(--danger-soft); }
.rail-danger > summary { cursor: pointer; padding: 9px 12px; font-size: 13px;
  color: var(--danger); list-style: none; }
.rail-danger > summary::-webkit-details-marker { display: none; }
.rail-danger > summary::before { content: "⚠ "; }
.rail-danger[open] > summary { border-bottom: 1px solid var(--danger-line); }
.danger-form { padding: 10px 12px 12px; display: grid; gap: 8px; }
.danger-form p { margin: 0; font-size: 12px; line-height: 1.45; }
.danger-form label { font-size: 12px; display: grid; gap: 4px; }
.danger-form input { padding: 6px 8px; border: 1px solid var(--danger-line); border-radius: 7px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: var(--danger-hover); }
.danger-check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.danger-check input { width: 15px; height: 15px; margin: 0; }

/* Текст телеграм-поста в рельсе: у таких сделок он и есть креатив. */
.tg-post { padding: 12px 14px; font-size: 13px; line-height: 1.5; white-space: pre-wrap;
  border-bottom: 1px solid var(--line); max-height: 320px; overflow-y: auto; }

/* Отметка контрольной точки в истории замеров. */
.chk { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  background: var(--panel-2); color: var(--ink-2); font-size: 11px; white-space: nowrap; }
.refreshing { color: var(--muted); font-size: 12px; }

/* Поле, которое сервис заполняет сам: показываем значение и источник,
   но не даём вводить — вписанное руками всё равно перетрёт сборщик. */
.ro-field { display: grid; gap: 2px; padding: 7px 10px; border-radius: 9px;
  background: var(--panel-2); border: 1px solid var(--line); align-content: start; }
.ro-label { font-size: 12px; color: var(--muted); }
.ro-value { font-size: 14px; font-weight: 600; }
.ro-src { font-size: 11.5px; color: var(--muted); line-height: 1.35; }

/* Ссылка на публикацию: показана как ссылка, правка — за кнопкой. */
.link-field { grid-column: 1 / -1; display: grid; gap: 4px; padding: 9px 11px;
  border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }
.link-value { font-size: 13px; word-break: break-all; }
.link-edit > summary { cursor: pointer; font-size: 12.5px; color: var(--accent-ink); width: max-content; }
.link-edit p { margin: 7px 0 5px; font-size: 12px; line-height: 1.45; }
.link-edit input { width: 100%; }

/* Выбор товаров плашками вместо строки с разделителями. */
.field-wide { grid-column: 1 / -1; display: grid; gap: 4px; }
.field-title { font-size: 13px; color: var(--muted); }
.picker { border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel); padding: 6px; }
.picker:focus-within { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:not(:empty) { margin-bottom: 6px; }
.chip-item { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px;
  border-radius: 999px; background: var(--panel-2); color: var(--ink-2); font-size: 12.5px; }
.chip-item.unknown { background: var(--danger-soft); color: var(--danger); }
.chip-x { border: none; background: none; cursor: pointer; font-size: 15px; line-height: 1;
  padding: 0 2px; color: inherit; opacity: .55; }
.chip-x:hover { opacity: 1; }
.picker-input { width: 100%; border: none; outline: none; padding: 4px 4px; font: inherit;
  background: transparent; }

/* Отправка товара: шапка с фактами и сетка позиций с превью. */
.ship-head { display: flex; flex-wrap: wrap; gap: 26px; align-items: flex-start;
  padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.ship-fact { display: grid; gap: 3px; }
.ship-label { font-size: 12px; color: var(--muted); }
.ship-value { font-size: 14px; font-weight: 600; }
.ship-value.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.ship-refresh { margin-left: auto; }
.ship-grid { display: grid; gap: 14px; margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.ship-item { display: grid; gap: 4px; align-content: start; }
.ship-item img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 9px;
  background: var(--panel-2); }
.ship-noimg { width: 100%; aspect-ratio: 3 / 4; border-radius: 9px; background: var(--panel-2);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.ship-name { font-size: 12.5px; line-height: 1.3; }
.ship-variant { font-size: 11.5px; color: var(--muted); }
.ship-qty { font-size: 11.5px; color: var(--muted); }
/* «в плане» — согласованное, но ещё не вышедшее: рядом с фактом, но тише. */
.planned { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
/* Сторис из отметки: скриншот живёт сутки, но у нас остаётся. */
.story-card { display: flex; gap: 16px; align-items: flex-start; }
.story-shot { width: 180px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 10px;
  background: var(--panel-2); flex: none; }
/* Сторис внутри карточки сделки: она часть того же размещения. */
.rail-story { display: flex; gap: 10px; padding: 10px 14px; align-items: center;
  border-top: 1px solid var(--line); }
.rail-story img { width: 46px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 6px;
  background: var(--panel-2); flex: none; }
.rail-story-note { display: grid; gap: 2px; font-size: 12px; }
.rail-story-note strong { font-size: 12.5px; }
.rail-story-note span { color: var(--muted); }
.m-note { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.3; }

/* Сообщение о результате: липнет к верху, чтобы его было видно после
   сохранения из нижней части длинной карточки. */
.flash { position: sticky; top: 8px; z-index: 20; box-shadow: var(--shadow-md); }


/* ---------- доступность и движение ---------- */
html { scroll-behavior: smooth; }

/* Уважаем системную настройку: анимация мешает при вестибулярных нарушениях
   и просто раздражает на слабых машинах. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* Ссылка «к содержимому»: клавиатурная навигация начинается с меню из
   четырнадцати пунктов, и до таблицы приходится жать Tab полтора десятка раз. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px;
  border-radius: 0 0 var(--btn-radius) 0; text-decoration: none;
}
.skip-link:focus { left: 0; }

/* Нажатие должно ощущаться: кнопка слегка проседает под курсором. */
.btn:active { transform: translateY(1px); }

/* Страница «не найдено» ---------- */
.notfound { max-width: 520px; margin: 8vh auto; text-align: left; }
.notfound .code {
  font: 700 64px/1 var(--font-head); color: var(--accent);
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.notfound p { color: var(--muted); margin: 10px 0 22px; }
.notfound .links { display: flex; gap: 10px; flex-wrap: wrap; }

/* Сброс пароля в «Команде»: кнопка-раскрывашка без маркера details */
.pw-reset summary { list-style: none; display: inline-block; }
.pw-reset summary::-webkit-details-marker { display: none; }

/* Поле даты: текстовый ввод дд.мм.гггг + кнопка родного календаря.
   Сам пикер прячется в углу обёртки — showPicker() требует, чтобы
   элемент был отрисован, поэтому не display:none, а нулевая видимость. */
.date-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.date-wrap > input[data-ru-date] { flex: 1; min-width: 0; padding-right: 30px; }
.date-picker-native {
  position: absolute; right: 4px; bottom: 0; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; border: 0; padding: 0;
}
.date-pick-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 3px; cursor: pointer;
  color: var(--muted); display: inline-flex; line-height: 0; border-radius: 5px;
}
.date-pick-btn:hover { color: var(--accent-ink); background: var(--panel-2); }
.date-pick-btn:disabled { opacity: .35; cursor: default; }
.date-pick-btn svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
