/* КЗ — щит диспетчера контент-завода.
   Нейтрали — один оттенок (250) шагами светлоты, тема по устройству. Сигнальные цвета —
   только по смыслу: зелёный «пуск, в канале», янтарный «ждёт», красный «стоп, сбой».
   Модуль сетки 4/8 px, цифры табличные, один системный гротеск, веса 400/500/700.
   Система записана в DESIGN.md. */

:root {
  color-scheme: light;
  --ground: oklch(0.945 0.005 250);
  --plate: oklch(0.99 0.002 250);
  --plate-sunk: oklch(0.918 0.006 250);
  --rule: oklch(0.86 0.006 250);
  --rule-strong: oklch(0.72 0.009 250);
  --ink: oklch(0.24 0.013 250);
  --ink-2: oklch(0.45 0.013 250);
  --go: oklch(0.50 0.12 152);
  --go-ink: oklch(0.985 0.01 152);
  --go-text: oklch(0.43 0.10 152);
  --go-soft: oklch(0.94 0.035 152);
  --wait: oklch(0.80 0.15 78);
  --wait-ink: oklch(0.30 0.06 70);
  --wait-text: oklch(0.47 0.10 68);
  --wait-soft: oklch(0.955 0.045 85);
  --halt: oklch(0.55 0.19 28);
  --halt-ink: oklch(0.985 0.01 28);
  --halt-text: oklch(0.50 0.17 28);
  --halt-soft: oklch(0.945 0.03 28);
  --hazard: oklch(0.86 0.16 95);
  --lamp-off: oklch(0.80 0.006 250);
  --focus: oklch(0.56 0.14 250);
  --lift: 0 1px 1px oklch(0.25 0.02 250 / 0.08), 0 3px 10px oklch(0.25 0.02 250 / 0.05);
  --press: inset 0 1px 2px oklch(0.25 0.02 250 / 0.14);
  --r: 6px;
  --gap: 16px;
  --tabs-h: 60px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --t-xs: 0.8125rem;
  --t-s: 0.875rem;
  --t-m: 1rem;
  --t-l: 1.1875rem;
  --t-xl: 1.5rem;
  --t-xxl: 2rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: oklch(0.205 0.008 250);
    --plate: oklch(0.25 0.009 250);
    --plate-sunk: oklch(0.19 0.008 250);
    --rule: oklch(0.34 0.01 250);
    --rule-strong: oklch(0.47 0.012 250);
    --ink: oklch(0.93 0.006 250);
    --ink-2: oklch(0.76 0.01 250);
    --go: oklch(0.64 0.13 152);
    --go-ink: oklch(0.17 0.03 152);
    --go-text: oklch(0.80 0.12 152);
    --go-soft: oklch(0.30 0.05 152);
    --wait: oklch(0.82 0.15 78);
    --wait-ink: oklch(0.25 0.05 70);
    --wait-text: oklch(0.86 0.12 82);
    --wait-soft: oklch(0.31 0.05 80);
    --halt: oklch(0.64 0.19 28);
    --halt-ink: oklch(0.16 0.03 28);
    --halt-text: oklch(0.80 0.13 30);
    --halt-soft: oklch(0.31 0.07 28);
    --hazard: oklch(0.84 0.15 95);
    --lamp-off: oklch(0.43 0.01 250);
    --focus: oklch(0.74 0.12 250);
    --lift: 0 1px 1px oklch(0 0 0 / 0.35), 0 3px 12px oklch(0 0 0 / 0.22);
    --press: inset 0 1px 3px oklch(0 0 0 / 0.45);
  }
}

/* ---------------------------------------------------------------- основа */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--rule-strong) transparent; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--t-m)/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--wait-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: inherit; text-decoration-thickness: 1px; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font-size: var(--t-xl); line-height: 1.2; font-weight: 700; letter-spacing: -0.012em; text-wrap: balance; }
h2 { font-size: var(--t-l); line-height: 1.25; font-weight: 700; text-wrap: balance; }
code { font: 500 var(--t-xs)/1.4 var(--mono); }
button, input, textarea { font: inherit; color: inherit; }
input, textarea { caret-color: var(--focus); }
img { max-width: 100%; }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon .solid { fill: currentColor; stroke: none; }
.note { color: var(--ink-2); font-size: var(--t-s); }
.empty { color: var(--ink-2); max-width: 62ch; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------------------------------------------------------------- лампы и плиты */

.lamp {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  background: var(--lamp-off);
  box-shadow: inset 0 -2px 2px oklch(0 0 0 / 0.22), inset 0 1px 1px oklch(1 0 0 / 0.5), 0 0 0 1px oklch(0 0 0 / 0.12);
}
.lamp.is-go { background: var(--go); }
.lamp.is-wait { background: var(--wait); }
.lamp.is-halt { background: var(--halt); }
.lamp.is-busy { animation: lamp 1.4s ease-in-out infinite; }
@keyframes lamp { 50% { opacity: 0.4; } }

.plate {
  position: relative;
  padding: 16px;
  background: var(--plate);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  box-shadow: var(--lift);
}
.page > .plate + .plate, .page > .page-head + .plate { margin-top: var(--gap); }
.plate-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 12px;
}
.plate-head .note { text-decoration: none; }
a.note:hover { color: var(--ink); text-decoration: underline; }

/* Диагональ блокировки: при стопе плита перечёркнута сверху косой разметкой. */
.is-blocked::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto;
  height: 6px;
  border-radius: var(--r) var(--r) 0 0;
  background: repeating-linear-gradient(-45deg, var(--hazard) 0 8px, var(--ink) 8px 16px);
}

/* ---------------------------------------------------------------- шапка и меню */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  background: var(--plate);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 32px;
  padding: 0 8px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--plate), inset 0 0 0 3px var(--rule-strong);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.nav { display: none; }
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px;
  white-space: nowrap;
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: var(--t-s);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.nav a:hover { background: var(--plate-sunk); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--plate-sunk); color: var(--ink); box-shadow: var(--press); }
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
  padding: 0 8px;
  min-height: 38px;
  font-size: var(--t-s);
  font-weight: 500;
  text-decoration: none;
}
.bar-device {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r);
  color: var(--ink-2);
}
.bar-device:hover, .bar-device[aria-current="page"] { background: var(--plate-sunk); color: var(--ink); }
.count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--wait);
  color: var(--wait-ink);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.tabs {
  position: fixed;
  inset: auto 0 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--plate);
  border-top: 1px solid var(--rule);
}
.tabs a {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  min-height: var(--tabs-h);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
}
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 28%;
  right: 28%;
  height: 3px;
  border-radius: 0 0 2px 2px;
  background: var(--ink);
}
.tabs .count { position: absolute; top: 6px; left: calc(50% + 4px); box-shadow: 0 0 0 2px var(--plate); }

/* Меню ноутбука — в одну строку: до 1100 px подпись мелко под значком, как во вкладках
   телефона; до 1280 px в шапке нет времени следующего прогона. */
@media (min-width: 900px) {
  .nav { display: flex; gap: 2px; margin-left: 12px; }
  .tabs { display: none; }
}
@media (min-width: 900px) and (max-width: 1099px) {
  .nav { gap: 0; }
  .nav a {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    height: 44px;
    padding: 0 7px;
    font-size: 0.6875rem;
    line-height: 1.1;
  }
  .nav .count {
    position: absolute;
    top: 1px;
    left: calc(50% + 3px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.6875rem;
    box-shadow: 0 0 0 2px var(--plate);
  }
  .nav a:hover .count, .nav a[aria-current="page"] .count { box-shadow: 0 0 0 2px var(--plate-sunk); }
}
@media (min-width: 1100px) and (max-width: 1279px) {
  .nav { gap: 0; margin-left: 8px; }
  .nav a { padding: 0 8px; }
}
@media (min-width: 900px) and (max-width: 1279px) {
  .status-next { display: none; }
}

/* ---------------------------------------------------------------- страница */

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(var(--tabs-h) + 32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 4px 0 16px;
}
.page-head .note { max-width: 60ch; }
.demo-note {
  margin-bottom: 12px;
  padding: 6px 12px;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: var(--t-xs);
}
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid color-mix(in oklch, var(--go) 35%, transparent);
  border-radius: var(--r);
  background: var(--go-soft);
  font-weight: 500;
}
.flash.is-error { border-color: color-mix(in oklch, var(--halt) 40%, transparent); background: var(--halt-soft); }
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  margin-bottom: 4px;
  color: var(--ink-2);
  font-size: var(--t-s);
  text-decoration: none;
}
.back:hover { color: var(--ink); }
.back .icon { transform: rotate(180deg); }
@media (min-width: 900px) {
  .page { padding: 24px 32px 56px; }
}

/* ---------------------------------------------------------------- кнопки и поля */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--plate);
  color: var(--ink);
  box-shadow: 0 1px 1px oklch(0.25 0.02 250 / 0.12);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover { background: var(--plate-sunk); }
.btn:active { transform: translateY(1px); box-shadow: var(--press); }
.btn:disabled {
  cursor: not-allowed;
  color: var(--ink-2);
  background: repeating-linear-gradient(-45deg, var(--plate) 0 6px, var(--plate-sunk) 6px 12px);
  box-shadow: none;
  transform: none;
}
.btn-go { border-color: transparent; background: var(--go); color: var(--go-ink); box-shadow: none; }
.btn-go:hover { background: color-mix(in oklch, var(--go) 88%, var(--ink)); }
.btn-wait { border-color: color-mix(in oklch, var(--wait) 70%, var(--rule-strong)); background: var(--wait-soft); color: var(--wait-text); }
.btn-wait:hover { background: color-mix(in oklch, var(--wait-soft) 80%, var(--wait)); }
.btn-halt { border-color: transparent; background: var(--halt); color: var(--halt-ink); box-shadow: none; }
.btn-halt:hover { background: color-mix(in oklch, var(--halt) 88%, var(--ink)); }
.btn-quiet { border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.btn-quiet:hover { background: var(--plate-sunk); color: var(--ink); }
.btn-wide { width: 100%; }

input:not([type="checkbox"], [type="hidden"]), textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--plate);
  box-shadow: var(--press);
  transition: border-color 0.15s;
}
input:not([type="checkbox"], [type="hidden"]):focus, textarea:focus { border-color: var(--focus); outline-offset: 0; }
::placeholder { color: var(--ink-2); }
textarea { resize: vertical; line-height: 1.55; }
.num { max-width: 10rem; }
.field { display: grid; gap: 4px; }
.field > span, .fold-form label, .days legend {
  color: var(--ink-2);
  font-size: var(--t-xs);
  font-weight: 500;
}

/* ---------------------------------------------------------------- вход */

.is-login {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  min-height: 100vh;
  padding-bottom: 16px;
}
.is-login .demo-note { width: min(100%, 380px); margin: 0; }
.login { width: min(100%, 380px); display: grid; gap: 12px; padding: 28px 24px; }
.brand-lg { justify-self: start; min-width: 64px; height: 44px; font-size: 1.25rem; }
.login-form { display: grid; gap: 8px; margin-top: 8px; }
.login-form label { font-size: var(--t-s); font-weight: 500; }
.code-input {
  height: 60px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  background: var(--plate-sunk) !important;
}
.login-alt { margin-top: 4px; }

/* ---------------------------------------------------------------- щит */

.shield { display: grid; gap: var(--gap); }
.shield-main, .shield-side { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
@media (min-width: 900px) {
  .shield { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); align-items: start; }
  .alerts, .line-plate { grid-column: 1 / -1; }
}

.alerts { padding-block: 6px; }
.alert { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.alert + .alert { border-top: 1px solid var(--rule); }
.alert a { font-weight: 500; text-decoration: none; }
.alert a:hover { text-decoration: underline; }

/* Мнемосхема: станции на линии процесса. Отрезок после станции — её состояние: тёмный —
   поток идёт, янтарный — копится, красная штриховка — сбой, пунктир — пусто, жёлто-чёрная
   штриховка — линия остановлена. Стрелка — направление потока. На телефоне сверху вниз. */
.line { --dash: to bottom; display: grid; grid-auto-rows: 1fr; }
.line > li { --seg: var(--ink-2); --seg-fill: var(--seg); position: relative; }
.line > li.is-wait { --seg: var(--wait); }
.line > li.is-halt { --seg: var(--halt); --seg-fill: repeating-linear-gradient(-45deg, var(--halt) 0 4px, transparent 4px 7px); }
.line > li.is-off { --seg: var(--rule-strong); --seg-fill: repeating-linear-gradient(var(--dash), var(--rule-strong) 0 5px, transparent 5px 9px); }
.line.is-stopped > li { --seg: var(--ink); --seg-fill: repeating-linear-gradient(-45deg, var(--hazard) 0 5px, var(--ink) 5px 10px); }
.line > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: calc(50% + 12px);
  left: 10px;
  width: 4px;
  height: calc(100% - 24px);
  border-radius: 2px;
  background: var(--seg-fill);
}
.line > li:not(:last-child)::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: calc(150% - 21px);
  left: 7px;
  border-top: 7px solid var(--seg);
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
}
.station {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  height: 100%;
  min-height: 44px;
  padding: 2px 4px 2px 0;
  text-decoration: none;
}
.station > .lamp {
  position: relative;
  z-index: 1;
  justify-self: center;
  width: 16px;
  height: 16px;
  outline: 4px solid var(--plate);
}
.station-label { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; min-width: 0; }
.station-name { font-weight: 500; }
.station:hover .station-name { text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.station-note { color: var(--ink-2); font-size: var(--t-s); line-height: 1.35; }
.station-read { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.01em; line-height: 1; }
.station.is-live .station-read { color: var(--wait-text); }
.station.is-alert .station-read { color: var(--halt-text); }
@media (min-width: 900px) {
  .line { --dash: to right; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .station {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    justify-items: start;
    row-gap: 8px;
    min-height: 0;
    padding: 0 24px 4px 0;
  }
  .station > .lamp { order: 0; justify-self: start; }
  .station-label { display: contents; }
  .station-name { order: 1; }
  .station-read { order: 2; margin-top: 2px; font-size: var(--t-xxl); }
  .station-note { order: 3; }
  .line > li:not(:last-child)::after { top: 6px; left: 26px; right: 10px; width: auto; height: 4px; }
  .line > li:not(:last-child)::before {
    top: 3px;
    left: auto;
    right: 3px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid var(--seg);
    border-right: 0;
  }
}

.brief { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; text-decoration: none; }
.brief-cover {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--plate-sunk);
}
.brief-cover.is-empty { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--ink-2); font-size: var(--t-xs); }
.brief-body { display: grid; gap: 4px; align-content: start; min-width: 0; }
.brief-title { font-size: 1.0625rem; font-weight: 700; line-height: 1.3; }
.brief:hover .brief-title { text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
@media (max-width: 899px) {
  .brief { grid-template-columns: 64px minmax(0, 1fr); }
  .brief-cover { width: 64px; height: 64px; }
  .brief .row-excerpt { display: none; }
}
@media (min-width: 900px) {
  .brief { grid-template-columns: 120px minmax(0, 1fr); gap: 16px; }
  .brief-cover { width: 120px; height: 120px; }
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions form { display: contents; }
/* Щит на телефоне: решение по брифу — два равных столбца в одном ряду; «Открыть» не нужен,
   бриф над ними сам ведёт на карточку. */
@media (max-width: 479px) {
  .brief-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .brief-actions .btn { width: 100%; padding-inline: 6px; }
  .brief-actions > .btn-quiet { display: none; }
}

.meter + .meter { margin-top: 16px; }
.meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.meter-label { font-weight: 500; }
.meter-read { color: var(--ink-2); font-size: var(--t-s); }
.meter-read b { color: var(--ink); font-size: var(--t-l); font-weight: 700; }
.meter-track { display: block; width: 100%; height: 12px; overflow: visible; }
.meter-track .track { fill: var(--plate-sunk); stroke: var(--rule-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.meter-track .fill { fill: var(--ink-2); }
.meter.is-high .fill { fill: var(--wait); }
.meter.is-over .fill { fill: var(--halt); }
.meter-track .tick { stroke: var(--plate); stroke-width: 2; vector-effect: non-scaling-stroke; }
.meter-track .tick.is-warn { stroke: var(--wait-text); }

.estop { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 16px; }
.estop-title { font-weight: 700; }
.estop-button {
  width: 88px;
  height: 88px;
  padding: 10px;
  border: 0;
  border-radius: 50%;
  background: var(--hazard);
  box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.2);
  cursor: pointer;
}
.estop-button span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--halt);
  color: var(--halt-ink);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--halt) 70%, black);
  font-size: var(--t-s);
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.1s ease-out, background-color 0.15s;
}
.estop-button:hover span { background: color-mix(in srgb, var(--halt) 90%, black); }
.estop-button:active span { transform: scale(0.94); }
.halted { display: grid; gap: 12px; }
.halted-text { display: flex; align-items: center; gap: 10px; color: var(--halt-text); font-weight: 700; }
.cycle { display: grid; gap: 6px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--rule); }

.event-list li {
  display: grid;
  grid-template-columns: 10px 5.25rem minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 7px 0;
  font-size: var(--t-s);
}
.event-list li + li { border-top: 1px solid var(--rule); }
.event-list time { color: var(--ink-2); }
.event-list .lamp { width: 10px; height: 10px; margin-top: 6px; }
.event-list a { text-decoration: none; overflow-wrap: anywhere; }
.event-list a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- черновики */

.rows > li + li { border-top: 1px solid var(--rule); }
.row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 12px 0; text-decoration: none; }
.row:hover .row-title { text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--plate-sunk);
}
.thumb.is-empty { display: grid; place-items: center; color: var(--ink-2); }
.row-body { display: grid; gap: 3px; align-content: start; min-width: 0; }
.row-meta { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: var(--t-xs); }
.row-score { margin-left: auto; color: var(--ink); font-weight: 700; }
.row-title { font-weight: 500; line-height: 1.35; }
.row-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-2);
  font-size: var(--t-s);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Карточка: на телефоне одна колонка в порядке решения, на ноутбуке обложка и сведения слева. */
.draft { display: grid; gap: var(--gap); }
.draft-side, .draft-main { display: contents; }
.draft-head { order: 1; display: grid; gap: 6px; }
.versions { order: 2; }
.cover { order: 3; }
.cover-tools { order: 4; }
.post-plate { order: 5; }
.decide { order: 6; }
.fold { order: 7; }
.facts { order: 8; }
.history { order: 9; }
@media (min-width: 900px) {
  .draft { grid-template-columns: minmax(280px, 5fr) minmax(0, 7fr); align-items: start; }
  .draft-side, .draft-main { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
  .draft-side { position: sticky; top: 72px; }
}
.cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--plate-sunk);
}
.cover.is-empty { display: grid; place-items: center; align-content: center; gap: 8px; border-style: dashed; color: var(--ink-2); }
.cover.is-empty .icon { width: 32px; height: 32px; }
.working { display: flex; align-items: center; gap: 8px; color: var(--wait-text); font-size: var(--t-s); font-weight: 500; }
.post-plate .working { margin-bottom: 10px; }
.cover-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin-top: -8px; }
.cover-tools .btn { margin-left: -10px; padding-inline: 10px; }
.cover-tools.working { margin-top: -4px; }
.btn .price { color: var(--ink-2); font-weight: 400; }
.btn:disabled .price { color: inherit; }
.timer { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.readout { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.readout-s { font-size: var(--t-l); font-weight: 700; }
.post { max-width: 68ch; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.counter { color: var(--ink-2); font-size: var(--t-s); }
.counter b { color: var(--ink); font-weight: 700; }
.counter.is-over, .counter.is-over b { color: var(--halt-text); font-weight: 700; }
.post + .post-note { max-width: 68ch; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--rule); }

/* Версии сюжета: переключатель площадок над постом — тот же сегментный блок, что Выкл/Вкл,
   у каждой площадки лампа подключения. Неподключённая версия — пустое место, пунктиром. */
.versions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  margin-bottom: -6px;
  padding: 3px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--plate-sunk);
}
.version {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--ink-2);
  font-size: var(--t-s);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.version:hover { background: color-mix(in oklch, var(--plate) 55%, transparent); color: var(--ink); }
.version[aria-current="page"] {
  border-color: var(--rule-strong);
  background: var(--plate);
  color: var(--ink);
  box-shadow: 0 1px 2px oklch(0.25 0.02 250 / 0.15);
}
.version .lamp { width: 10px; height: 10px; }
/* Неподключённая площадка — одна строка состояния: погасшая лампа и подпись, без резерва
   под обложку. */
.post-plate.is-off { padding: 12px 16px; border-style: dashed; border-color: var(--rule-strong); background: transparent; box-shadow: none; }
.post-plate.is-off h2 { color: var(--ink-2); font-size: var(--t-m); font-weight: 500; line-height: 1.5; }

.decide {
  position: sticky;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  z-index: 5;
  display: grid;
  gap: 8px;
  margin-inline: -16px;
  padding: 12px 16px;
  border-top: 1px solid var(--rule);
  background: color-mix(in oklch, var(--ground) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.decide.is-blocked::before { border-radius: 0; }
/* Решение админа: в канал, отложить (воздержаться — выйдет сам), править, снять.
   На телефоне — две колонки, на ноутбуке — одна строка по ширине подписей. */
.decide { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.decide .btn { width: 100%; padding-inline: 10px; white-space: nowrap; }
.decide .btn-halt { grid-column: 1 / -1; }
.decide form { display: contents; }
.btn-two { flex-direction: column; gap: 0; padding-block: 4px; line-height: 1.2; }
.btn-two > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.btn-sub { font-size: 0.75rem; font-weight: 400; white-space: normal; }
.decide .btn-two { padding-inline: 6px; }
/* На ноутбуке панель решения тоже держится в первом экране: прилипает к низу окна, пока
   карточка открыта, и встаёт на своё место под постом, когда до неё долистали. */
@media (min-width: 900px) {
  .decide {
    position: sticky;
    bottom: 16px;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--rule);
    border-radius: var(--r);
    background: var(--plate);
    box-shadow: var(--lift);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .decide.is-blocked::before { border-radius: var(--r) var(--r) 0 0; }
  .decide { display: flex; flex-wrap: wrap; }
  .decide .btn { flex: 1 1 auto; width: auto; }
  .decide .btn-quiet { flex: 0 1 auto; }
}

.fold { padding: 0; }
.fold > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .note { margin-left: auto; font-weight: 400; }
.fold > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin: 0 2px 4px 8px;
  border-right: 2px solid var(--ink-2);
  border-bottom: 2px solid var(--ink-2);
  transform: rotate(45deg);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.fold > summary:not(:has(.note))::after { margin-left: auto; }
.fold[open] > summary::after { transform: translateY(4px) rotate(225deg); }
.fold > summary .fold-title { flex: 1; display: grid; gap: 1px; min-width: 0; padding-block: 8px; }
.fold > summary .fold-title .note { margin-left: 0; line-height: 1.35; }
.fold-form { display: grid; gap: 8px; padding: 0 16px 16px; }
.fold-hint { max-width: 62ch; color: var(--ink-2); font-size: var(--t-s); }
.fold-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.fold-form .btn { justify-self: start; }
.fold-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.facts-list { display: grid; gap: 12px; }
.facts-list > div { display: grid; gap: 2px; }
.facts-list dt { color: var(--ink-2); font-size: var(--t-xs); font-weight: 500; }
.facts-list dd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.facts-list dd a { display: inline-flex; align-items: center; gap: 4px; }
.facts-list dd a .icon { width: 16px; height: 16px; }
.criteria { display: grid; gap: 4px; width: 100%; }
.criteria li { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--t-s); }
.segments { display: inline-flex; gap: 3px; }
.seg { width: 22px; height: 8px; border-radius: 2px; background: var(--plate-sunk); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.seg.on { background: var(--ink-2); box-shadow: none; }


/* Лампа перед заголовком, строка сведений — под ним. */
.titled { display: grid; grid-template-columns: 12px minmax(0, 1fr); align-items: start; column-gap: 10px; }
.titled > .lamp { margin-top: calc(0.5lh - 6px); }
.row-body > .row-meta, .row-body > .row-excerpt, .brief-body > .row-meta, .brief-body > .row-excerpt,
.draft-head > .row-meta { padding-left: 22px; }
.timer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-self: start;
  gap: 4px 10px;
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--plate);
}
.status-next { color: var(--ink-2); font-weight: 400; }
.status-next::before { content: "· "; }

/* При стопе перечёркнуты только кнопки, которые не работают; живые остаются чистыми. */
.is-blocked .btn:disabled {
  border-color: color-mix(in srgb, var(--hazard) 60%, var(--rule-strong));
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--hazard) 40%, var(--plate)) 0 8px, var(--plate) 8px 16px);
}

/* ---------------------------------------------------------------- журнал */

.log-row {
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 2px;
  padding: 9px 0;
  font-size: var(--t-s);
}
.log-row + .log-row { border-top: 1px solid var(--rule); }
.log-row time { grid-row: span 3; color: var(--ink-2); }
.log-row .who { color: var(--ink-2); font-size: var(--t-xs); }
.log-row .what { font-weight: 500; overflow-wrap: anywhere; }
.log-row .what a { text-decoration: none; }
.log-row .what .note { font-weight: 400; }
.log-row .what a:hover { text-decoration: underline; }
.log-row .why { grid-column: 2; color: var(--ink-2); overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .log.is-wide .log-row { grid-template-columns: 6.5rem minmax(0, 1.4fr) 6.5rem minmax(0, 1fr); }
  .log.is-wide .log-row time { grid-row: auto; }
  .log.is-wide .log-row .who { font-size: var(--t-s); }
  .log.is-wide .log-row .why { grid-column: auto; }
}
.filter { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 18px;
  background: var(--plate);
  font-size: var(--t-s);
  font-weight: 500;
  text-decoration: none;
}
.chip:hover { background: var(--plate-sunk); }
.chip[aria-current="page"] { border-color: var(--ink); background: var(--ink); color: var(--plate); }
.chip { gap: 6px; }
.chip .icon { width: 18px; height: 18px; margin-left: -4px; }
.chip-n { margin-left: 2px; color: var(--ink-2); font-weight: 700; }
@media (max-width: 899px) { .filter .chip .icon { display: none; } }
.chip[aria-current="page"] .chip-n { color: color-mix(in oklch, var(--plate) 70%, var(--ink)); }

/* ---------------------------------------------------------------- ручки */

.knobs { display: grid; gap: var(--gap); }
.knob { display: grid; gap: 10px; scroll-margin-top: 80px; }
.knob:target { border-color: var(--focus); }
.knob .plate-head { margin: 0; }
.key { color: var(--ink-2); }
.hint { max-width: 62ch; color: var(--ink-2); }
.knob-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.knob-now .lamp { align-self: center; }
.knob-form { display: grid; gap: 12px; align-content: start; }
.knob-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 900px) {
  .knob {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    grid-template-areas: "head form" "hint form" "now form" "scale form" ". form";
    column-gap: 40px;
    align-items: start;
  }
  .knob .plate-head { grid-area: head; }
  .knob .hint { grid-area: hint; }
  .knob .knob-now { grid-area: now; }
  .knob .scale { grid-area: scale; }
  .knob .knob-form { grid-area: form; }
}
.scale { max-width: 460px; }
.scale-svg { display: block; width: 100%; height: auto; overflow: visible; }
.scale-band { fill: var(--plate-sunk); }
.scale-track { stroke: var(--rule-strong); stroke-width: 2; }
.scale-tick { stroke: var(--rule-strong); stroke-width: 1; }
.scale-stop { stroke: var(--ink); stroke-width: 3; }
.scale-notch { fill: var(--ink-2); }
.scale-mark { fill: var(--ink); stroke: var(--plate); stroke-width: 3; }
.scale-text { fill: var(--ink-2); font: 500 12px var(--font); font-variant-numeric: tabular-nums; }
.segmented {
  display: inline-grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 3px;
  justify-self: start;
  min-width: 220px;
  padding: 3px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--plate-sunk);
}
.segmented .btn { min-height: 38px; border-color: transparent; background: transparent; box-shadow: none; color: var(--ink-2); }
.segmented .btn.is-on { border-color: var(--rule-strong); background: var(--plate); color: var(--ink); box-shadow: 0 1px 2px oklch(0.25 0.02 250 / 0.15); }
#stop .segmented .btn.is-on[value="on"] { border-color: transparent; background: var(--halt); color: var(--halt-ink); }
#autopilot .segmented .btn.is-on[value="on"] { border-color: transparent; background: var(--go); color: var(--go-ink); }
.days { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; border: 0; }
.days legend { margin-bottom: 6px; padding: 0; }
.days .note { flex-basis: 100%; }
.day { position: relative; }
.day input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.day span {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  height: 44px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--plate);
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
}
.day input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--plate); }
.day input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------------------------------------------------------------- состояние, выпуски, устройство */

.state-grid { display: grid; gap: var(--gap); }
@media (min-width: 900px) {
  .state-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .state-grid > :first-child { grid-row: span 2; }
}
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.table th {
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--ink-2);
  font-size: var(--t-xs);
  font-weight: 500;
  text-align: left;
}
.table td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table td > .lamp { margin-right: 8px; vertical-align: -1px; }
.cell-note { display: block; overflow-wrap: anywhere; }
.spend-note { margin-top: 12px; }

.digest-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 0; }
.digest-row .actions { margin: 0; }
.build { display: grid; justify-items: start; gap: 10px; }

.push { display: grid; justify-items: start; gap: 12px; }
.push-state { font-weight: 500; }
.hint-ios summary { color: var(--ink-2); font-size: var(--t-s); cursor: pointer; }
.hint-ios p { max-width: 62ch; margin-top: 6px; color: var(--ink-2); font-size: var(--t-s); }
.devices li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.devices li + li { border-top: 1px solid var(--rule); }
.devices li.is-this .row-title::after { content: " · это устройство"; color: var(--go-text); font-weight: 500; }

.menu { padding-block: 4px; }
.menu li + li { border-top: 1px solid var(--rule); }
.menu a {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  text-decoration: none;
}
.menu a > span { display: grid; gap: 2px; }
.menu a:hover b { text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 900px) {
  .menu .is-tab-extra { display: none; }
  .menu .is-tab-extra + li:not(.is-tab-extra) { border-top: 0; }
}
.empty-plate { display: grid; gap: 12px; max-width: 640px; }

/* ---------------------------------------------------------------- инбокс */

.msgs > li + li { border-top: 1px solid var(--rule); }
.msg {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 2px;
  padding: 10px 0;
}
.msg:first-child { padding-top: 0; }
.msg:last-child { padding-bottom: 0; }
.msg > .lamp { margin-top: 6px; }
.msg > :not(.lamp) { grid-column: 2; }
.msg-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.msg-author { font-weight: 500; }
.msg-meta { color: var(--ink-2); font-size: var(--t-xs); }
.msg-meta > span { white-space: nowrap; }
.msg-meta > span:not(:last-child)::after { content: " ·"; }
.msg-meta .icon { width: 16px; height: 16px; margin-right: 4px; vertical-align: -4px; }
.msg-text { max-width: 68ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.is-replied .msg-text { color: var(--ink-2); }
/* Ответ и ссылки — одной строкой под текстом; раскрытый ответ уходит на свою строку. */
.msg-actions { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; min-width: 0; font-size: var(--t-s); }
.msg-actions a { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; min-height: 40px; color: var(--ink-2); text-decoration: none; }
.msg-actions a:hover { color: var(--ink); text-decoration: underline; }
.msg-actions .icon { width: 16px; height: 16px; }
.msg-to { flex: 0 1 auto; }
.msg-out { flex: none; }
.msg-post { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply { flex: none; }
.reply[open] { order: 9; flex-basis: 100%; }
.reply > summary { list-style: none; min-height: 40px; margin-left: -10px; padding-inline: 10px; font-size: var(--t-s); }
.reply > summary::-webkit-details-marker { display: none; }
.reply[open] > summary { color: var(--ink); }
.reply-form { display: grid; gap: 8px; max-width: 68ch; padding: 4px 0 8px; }
.reply-form label { color: var(--ink-2); font-size: var(--t-xs); font-weight: 500; }
.reply-form .btn { justify-self: start; }
.inbox-off { max-width: 720px; }
.inbox-off p { max-width: 62ch; padding-left: 22px; color: var(--ink-2); }

/* ---------------------------------------------------------------- статистика */

.period { min-width: 200px; }
.period .btn { padding-inline: 14px; }

/* Табло сводной: строки показаний в порядке важности — подпись, показание с фиксированными
   разрядами, пояснение. Охват — три показания по площадкам, они не складываются.
   Работа конвейера — одной строкой под табло. */
.readings-caption { margin: -4px 0 8px; }
.readings { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.reading-val { padding-left: 16px; }
.reading { display: contents; }
.readings dt, .reading-val { padding-top: 10px; border-top: 1px solid var(--rule); }
.reading:first-child > dt, .reading:first-child > .reading-val { padding-top: 0; border-top: 0; }
.readings dt { font-weight: 500; line-height: 1.75rem; }
.reading-val { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; line-height: 1.75rem; }
.reading-val b { min-width: 4ch; font-size: var(--t-l); font-weight: 700; text-align: right; }
.split { display: inline-flex; align-items: center; gap: 6px; }
.split .icon { width: 16px; height: 16px; color: var(--ink-2); }
.split b { min-width: 4.5ch; }
.reading-note { grid-column: 1 / -1; padding: 0 0 10px; color: var(--ink-2); font-size: var(--t-xs); }
.reading.is-split > dt { grid-column: 1 / -1; }
.reading.is-split > .reading-val { grid-column: 1 / -1; justify-content: flex-start; padding: 2px 0 0; border-top: 0; }
.work { display: grid; gap: 4px; padding-top: 12px; border-top: 1px solid var(--rule-strong); }
.work-title { color: var(--ink-2); font-size: var(--t-xs); font-weight: 500; }
.work-row { display: flex; flex-wrap: wrap; gap: 4px 0; }
.work-row > div { display: flex; align-items: baseline; gap: 8px; padding-right: 16px; margin-right: 16px; border-right: 1px solid var(--rule); }
.work-row > div:last-child { padding-right: 0; margin-right: 0; border-right: 0; }
.work-row dt { color: var(--ink-2); font-size: var(--t-s); }
.work-row dd { font-size: var(--t-l); font-weight: 700; }
@media (min-width: 900px) {
  .readings { grid-template-columns: 12rem minmax(15rem, max-content) minmax(0, 1fr); column-gap: 0; }
  .readings dt, .readings dd { padding: 10px 0; border-top: 1px solid var(--rule); }
  .readings dt { padding-right: 24px; }
  .reading:first-child > * { padding-top: 0; border-top: 0; }
  .reading-note, .reading.is-split > dt, .reading.is-split > .reading-val { grid-column: auto; }
  .reading-val { padding-left: 0; }
  .readings .reading-note { align-self: stretch; padding-left: 24px; line-height: 1.75rem; }
  .reading-val, .reading.is-split > .reading-val { justify-content: flex-end; padding-top: 10px; }
  .reading:first-child > .reading-val { padding-top: 0; }
  .reading.is-split > .reading-val { border-top: 1px solid var(--rule); }
  .reading:first-child.is-split > .reading-val { border-top: 0; }
  .work { grid-template-columns: 12rem minmax(0, 1fr); align-items: baseline; column-gap: 24px; margin-top: 4px; }
}

.table thead th { vertical-align: bottom; }
.table tbody th {
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-size: var(--t-s);
  font-weight: 400;
  text-align: left;
  vertical-align: top;
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table .group { padding-left: 12px; border-left: 1px solid var(--rule); }
.table thead tr:first-child th.group { text-align: center; border-bottom-color: var(--rule); }
.table thead tr:first-child th.group[rowspan] { text-align: right; border-bottom-color: var(--rule-strong); }
.table thead .icon, .table tbody th .icon { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; }
.table td.num { white-space: nowrap; }
.rack-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.rack-name .icon { margin-right: 0; color: var(--ink-2); }
.rack-name .lamp { margin: 0; }
.rack th[scope="row"] { min-width: 14rem; }
.rack tr.is-off td { color: var(--ink-2); }
.stories th[scope="row"] { min-width: 15rem; }
.stories th[scope="row"] a { font-weight: 500; text-decoration: none; }
.stories th[scope="row"] a:hover { text-decoration: underline; }
.stories-note { display: grid; gap: 2px; margin-top: 12px; }
.stories-note:empty { display: none; }

@media (max-width: 899px) {
  .rack, .rack tbody { display: block; }
  .rack thead { display: none; }
  .rack tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--rule);
  }
  .rack tr:first-child { padding-top: 0; }
  .rack tr:last-child { padding-bottom: 0; border-bottom: 0; }
  .rack th[scope="row"], .rack td { padding: 0; border: 0; }
  .rack th[scope="row"] { grid-column: 1 / -1; min-width: 0; }
  .rack td, .rack td.num { display: grid; gap: 1px; text-align: left; font-size: 1.0625rem; font-weight: 700; }
  .rack td::before { content: attr(data-label); color: var(--ink-2); font-size: var(--t-xs); font-weight: 500; }
  .rack .group { padding-left: 0; border-left: 0; }
  .rack tr.is-off td { display: none; }
  .d-only { display: none !important; }
}
@media (min-width: 900px) {
  .m-only { display: none !important; }
}
.story-list > li + li { border-top: 1px solid var(--rule); }
.story { display: grid; gap: 4px; padding: 12px 0; }
.story:first-child { padding-top: 0; }
.story-title { font-weight: 500; line-height: 1.35; text-decoration: none; }
.snaps { width: 100%; margin-top: 4px; border-collapse: collapse; font-size: var(--t-s); }
.snaps th, .snaps td { padding: 5px 0 5px 8px; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.snaps thead th { border-bottom-color: var(--rule-strong); color: var(--ink-2); font-size: var(--t-xs); font-weight: 500; }
.snaps tbody th { padding-left: 0; font-weight: 500; text-align: left; }
.snaps tbody tr:last-child > * { border-bottom: 0; }
.snaps .icon { width: 16px; height: 16px; margin-right: 6px; color: var(--ink-2); vertical-align: -3px; }

/* ---------------------------------------------------------------- календарь */

.week-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.week-step { min-height: 40px; padding-inline: 12px; gap: 4px; }
.week-step.is-back .icon { transform: rotate(180deg); }
@media (max-width: 899px) {
  .week-step { width: 44px; padding: 0; }
  .week-step span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.week-range { min-width: 8.5rem; font-size: var(--t-l); font-weight: 700; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-bottom: 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .lamp { width: 10px; height: 10px; }

/* Неделя: на телефоне — дни строками, на ноутбуке — семь колонок графика. Сегодня — день
   залит чернилами, как выбранный день в ручке «дни недели». Плановый слот — пунктиром. */
.cal-day {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--rule);
}
.cal-day:last-child { padding-bottom: 0; }
.day-head { display: grid; align-content: start; justify-items: start; gap: 2px; padding-top: 3px; font-size: var(--t-s); font-weight: 700; line-height: 1.35; }
.day-label { padding: 1px 6px; margin-left: -6px; border-radius: 4px; }
.cal-day.is-today .day-label { background: var(--ink); color: var(--plate); }
.day-today { color: var(--ink-2); font-size: var(--t-xs); font-weight: 500; }
.day-none { padding-top: 3px; color: var(--ink-2); font-size: var(--t-s); }
.entries { display: grid; gap: 8px; }
.entry {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--plate);
}
.entry.is-slot { border-style: dashed; border-color: var(--rule-strong); background: transparent; }
.entry-when { display: flex; align-items: flex-start; gap: 8px; font-size: var(--t-s); line-height: 1.35; }
.entry-when .lamp { width: 10px; height: 10px; margin-top: calc(0.5lh - 5px); }
.entry-title, .entry-where { padding-left: 18px; }
.entry-title { font-size: var(--t-s); font-weight: 500; line-height: 1.35; text-decoration: none; overflow-wrap: anywhere; }
a.entry-title:hover { text-decoration: underline; text-decoration-color: var(--rule-strong); }
.entry.is-slot .entry-title { color: var(--ink-2); font-weight: 400; }
.entry-where { display: flex; gap: 6px; margin-top: 1px; color: var(--ink-2); }
.entry-where .icon { width: 16px; height: 16px; }
@media (min-width: 900px) {
  .week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--rule);
    border-radius: var(--r);
  }
  .cal-day {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    gap: 0;
    min-height: 320px;
    padding: 0;
    border-top: 0;
    border-left: 1px solid var(--rule);
  }
  .cal-day:first-child { border-left: 0; }
  .cal-day.is-today { background: var(--plate-sunk); }
  .day-head {
    grid-auto-flow: column;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 10px;
    border-bottom: 1px solid var(--rule);
    background: var(--plate);
  }
  .day-label { margin-left: -6px; }
  .entries { align-content: start; padding: 8px; }
  .entry { padding: 8px; }
  .entry-title, .entry-where { padding-left: 0; }
  .day-none { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ---------------------------------------------------------------- установка и «нет связи» */

.install { display: grid; justify-items: start; gap: 12px; }
.install .note { max-width: 62ch; }
.install-state { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; }
.install-state .lamp { margin-top: calc(0.5lh - 6px); }
.offline-title { display: flex; align-items: center; gap: 10px; }
.offline-title .icon { width: 24px; height: 24px; color: var(--ink-2); }
.offline .btn { margin-top: 4px; }

/* ---------------------------------------------------------------- движение */

@media (prefers-reduced-motion: no-preference) {
  .flash { animation: arrive 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
}
@keyframes arrive { from { opacity: 0.6; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  .lamp.is-busy { animation: none; }
  .btn, .estop-button span, .fold > summary::after { transition: none; }
}
