/* Стиль «Фирменный»: белые поверхности, фиолетовый МедиаКузни, заголовки Tektur, текст Mulish. */
@font-face { font-family: "Tektur Medium"; src: url("/fonts/TekturMedium-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Mulish"; src: url("/fonts/Mulish-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mulish"; src: url("/fonts/Mulish-Bold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }

:root {
  /* плашка про куки — зелёная, как на mediakuznya.com; темнее их зелёного, чтобы белый текст читался */
  --cookie-bg: #2f7d45;
  --cookie-ink: #ffffff;
  --bg: #f7f5fa;
  --surface: #ffffff;
  --surface-2: #f1eef5;
  --line: #e4dfeb;
  --line-strong: #d9d2e3;
  /* граница полей ввода: не слабее 3:1 к фону */
  --field-line: #8d8199;
  --text: #1f1a26;
  --muted: #5f5870;
  --placeholder: #776d84;
  --accent: #6c4796;
  --accent-hover: #5a3a80;
  --accent-ink: #ffffff;
  --accent-soft: #ece4f6;
  --ok: #23613d;
  --ok-soft: #e3f2e8;
  --ok-dot: #2f7d4f;
  --warn: #7a4d00;
  --warn-soft: #fbefd9;
  --warn-num: #8a5a00;
  --warn-dot: #a8730f;
  --bad: #9b2019;
  --bad-soft: #fbe5e3;
  --bad-dot: #b3261e;
  /* синий — всё, что «в работе»: очередь, генерация, текущий шаг, прогресс, справки */
  --info: #1f5fa8;
  --info-soft: #e3eefb;
  --info-dot: #2f74c0;
  --info-ink: #ffffff;
  --overlay: rgba(31, 26, 38, .5);
  --shadow-pop: 0 20px 60px rgba(31, 26, 38, .25);
  --pop-line: #e4dfeb;
  --radius: 10px;
  --radius-sm: 6px;
  --font-head: "Tektur Medium", "Tektur", system-ui, sans-serif;
  --font-body: "Mulish", system-ui, sans-serif;
  color-scheme: light;
}

/* тёмная тема: data-theme ставит скрипт в <head> по выбору в меню или по системе */
:root[data-theme="dark"] {
  --bg: #15121a;
  --surface: #1e1a25;
  --surface-2: #29232f;
  --line: #322b3b;
  --line-strong: #463d52;
  --field-line: #75698a;
  --text: #ece8f1;
  --muted: #a89fb4;
  --placeholder: #8f869c;
  --accent: #a989d4;
  --accent-hover: #bca1e2;
  --accent-ink: #160f1f;
  --accent-soft: #2f2541;
  --ok: #86d6a6;
  --ok-soft: #1a3224;
  --ok-dot: #4fbe7d;
  --warn: #f1c77f;
  --warn-soft: #382b13;
  --warn-num: #f1c77f;
  --warn-dot: #d9a54a;
  --bad: #f2a099;
  --bad-soft: #3c1d1b;
  --bad-dot: #e86a60;
  --info: #93c1f5;
  --info-soft: #182a40;
  --info-dot: #5a9be0;
  --info-ink: #0d1724;
  --overlay: rgba(0, 0, 0, .6);
  --shadow-pop: 0 20px 60px rgba(0, 0, 0, .55);
  --pop-line: #463d52;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font-body); overflow-wrap: break-word; }
body:has(.modal:not([hidden])) { overflow: hidden; }
::selection { background: var(--accent-soft); }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 400; margin: 0; letter-spacing: .01em; text-transform: uppercase; }
h1, h2 { overflow-wrap: break-word; text-wrap: balance; }
h1 { font-size: 30px; color: var(--accent); line-height: 1.2; }
h2 { font-size: 18px; }
h3 { font-size: 14px; color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--placeholder); opacity: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* каркас */
/* wrap только на узком экране: выше 900px меню и содержимое всегда рядом */
.shell { display: flex; flex-wrap: nowrap; min-height: 100vh; }
.nav { flex: 1 1 280px; max-width: 304px; min-width: 260px; background: var(--surface); border-right: 1px solid var(--line);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; overscroll-behavior: contain; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; }
.brand svg { flex: 0 0 auto; color: var(--accent); }
.brand-name { font-family: var(--font-head); color: var(--accent); font-size: 18px; line-height: 1.2; }
.brand-sub { color: var(--muted); font-size: 12px; }
.nav-demo { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft);
  color: var(--warn); font-weight: 600; font-size: 14px; text-decoration: none; }
.nav-demo span { font-weight: 400; font-size: 12px; }
.nav-demo:hover { color: var(--warn); }
.nav-demo[hidden] { display: none; }
.nav nav { display: flex; flex-direction: column; gap: 4px; }
.nav nav a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.nav nav a:hover { background: var(--surface-2); color: var(--text); }
.nav nav a.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.nav-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 16px; }
.nav-foot { display: flex; flex-direction: column; gap: 10px; padding: 0 8px; font-size: 13px; }
.theme-pick { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.theme-pick select { min-height: 34px; width: auto; padding: 0 28px 0 10px; font-size: 13px; }
.nav-status { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.nav-status > div { display: flex; align-items: flex-start; gap: 8px; }
.nav-status > div > .dot { margin-top: calc(.75em - 4px); }
.nav-gen { padding: 0 4px; font-size: 13px; }
.nav-gen-link { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; transition: border-color .15s, background .15s; }
.nav-gen-link:hover { border-color: var(--accent); background: var(--surface-2); color: var(--text); }
.nav-gen-head, .nav-gen-sub, .nav-gen-empty, .nav-gen-queue { color: var(--muted); }
.nav-gen-head { display: flex; align-items: center; gap: 8px; }
.nav-gen-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-gen-empty { padding: 0 4px; }
/* подробности раскрываются вверх: карточка прижата к низу меню, растущая высота уходит наверх */
.nav-gen-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s cubic-bezier(.25, 1, .5, 1); }
.nav-gen-more > span { overflow: hidden; min-height: 0; }
.nav-gen-link:hover .nav-gen-more, .nav-gen-link:focus-visible .nav-gen-more { grid-template-rows: 1fr; }
.nav-gen-body { display: flex; flex-direction: column; gap: 10px; padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.nav-gen-steps { display: flex; flex-direction: column; gap: 3px; }
.nav-gen-steps > span { position: relative; padding-left: 16px; color: var(--muted); }
.nav-gen-steps > span::before { content: ""; position: absolute; left: 2px; top: calc(.75em - 4.5px); width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line-strong); }
.nav-gen-steps > .done { color: var(--text); }
.nav-gen-steps > .done::before { background: var(--ok-dot); border-color: var(--ok-dot); }
.nav-gen-steps > .now { color: var(--info); font-weight: 600; }
.nav-gen-steps > .now::before { background: var(--info-dot); border-color: var(--info-dot); }
.nav-gen-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-variant-numeric: tabular-nums; }
.nav-gen-facts > span:nth-child(odd) { color: var(--muted); }
.nav-gen-err { color: var(--bad); }
.nav-queue { margin-top: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; min-width: 0; }
.nav-queue-head, .nav-queue-more { color: var(--muted); }
.nav-queue-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-queue-list a { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: var(--text); text-decoration: none; border-radius: 4px; }
.nav-queue-list a:hover { color: var(--text); background: var(--surface-2); }
.nav-queue-n { flex: 0 0 auto; min-width: 1.2em; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-queue-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-queue-more { margin-top: 2px; }
.nav-hit { animation: nav-hit .8s ease-out; }
@keyframes nav-hit { from { background-color: var(--info-soft); } to { background-color: transparent; } }
.fly-chip { position: fixed; left: 0; top: 0; z-index: 45; pointer-events: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--info-soft); color: var(--info); font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; will-change: transform, opacity; }
@media (prefers-reduced-motion: reduce) { .nav-gen-more { transition: none; } }
.dot { display: inline-block; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.dot.on { background: var(--ok-dot); } .dot.off { background: var(--bad-dot); } .dot.busy { background: var(--info-dot); } .dot.warn { background: var(--warn-dot); }
.status-line { display: flex; align-items: flex-start; gap: 8px; }
/* точка по центру первой строки текста: .75em — половина строки при line-height 1.5, 4px — половина точки */
.status-line > .dot { margin-top: calc(.75em - 4px); }
.status-sub { padding-left: 16px; }
.head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.account { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: inherit; }
.linkbtn:hover { color: var(--accent-hover); }

/* вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.login .brand { padding: 0; }
.login h1 { font-size: 26px; }
.login p { margin: 6px 0 0; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
/* text-indent равен letter-spacing: без него разреженные цифры по центру съезжают влево */
.login input.code { font-size: 24px; letter-spacing: .3em; text-indent: .3em; text-align: center; }
.login .msg { min-height: 1.5em; margin: 0; font-size: 14px; }
.login .msg.bad { color: var(--bad); }
.login .msg.ok { color: var(--ok); }

.view { flex: 1 1 0; min-width: 0; padding: 32px 40px 56px; outline: none; display: flex; flex-direction: column; gap: 24px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; color: var(--muted); }
.head p, p.hint { max-width: 75ch; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .wide { flex: 3 1 520px; min-width: 0; }
.split > .side { flex: 2 1 380px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; min-width: 0; }
.card > h2 { margin-bottom: 16px; }
.title-lg { font-size: 18px; font-weight: 600; margin-top: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.mt-sm { margin-top: 10px; }
.mt-md { margin-top: 16px; }
.end { align-self: end; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-sm); cursor: pointer;
  text-decoration: none; color: var(--text); white-space: nowrap; }
.btn:not(:disabled):hover { border-color: var(--accent); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.danger:not(:disabled):hover { border-color: var(--bad); color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:not(:disabled):hover { border-color: transparent; background: var(--surface-2); }
.btn.ghost.danger:not(:disabled):hover { background: var(--bad-soft); border-color: transparent; }
.btn:not(:disabled):active { transform: translateY(1px); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* статусы и шаги */
.badge, .chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--muted); white-space: nowrap; line-height: 1.3; }
.badge.prepared, .badge.ok, .badge.sent, .chip.done { background: var(--ok-soft); color: var(--ok); }
.chip.done::before { content: ""; display: inline-block; width: .5em; height: .28em; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateY(-.2em) rotate(-45deg); margin-right: 6px; }
.badge.running, .badge.queued { background: var(--info-soft); color: var(--info); }
.chip.now { background: var(--info-dot); color: var(--info-ink); }
.badge.blocked_data, .badge.blocked_quality, .badge.paused_limit, .badge.warn, .badge.sent_test, .chip.wait, .chip.warn { background: var(--warn-soft); color: var(--warn); }
.badge.failed, .badge.bad, .chip.fail { background: var(--bad-soft); color: var(--bad); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.job-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.job-actions-end { margin-left: auto; }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--info-dot); transition: width .4s; }
.progress.wait > i { background: var(--warn-num); }

/* плашки-цифры, как на слайдах КП */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.tile { border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; justify-content: space-between; min-height: 112px;
  background: var(--surface); border: 1px solid var(--line); }
.tile b { font-family: var(--font-head); font-weight: 400; font-size: 34px; line-height: 1; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: var(--muted); }
.tile.solid { background: var(--accent); border-color: var(--accent); }
.tile.solid b, .tile.solid span { color: var(--accent-ink); }
.tile.warn b { color: var(--warn-num); }
.tile.info b { color: var(--info); }
.now-card { grid-column: span 2; display: flex; flex-direction: column; gap: 16px; }
.home-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.job-line { display: flex; gap: 8px; align-items: center; padding: 3px 0; }

/* таблицы */
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 400; text-transform: uppercase; letter-spacing: .04em; }
td.dim { color: var(--muted); }
td.mono, td.time { overflow-wrap: normal; white-space: nowrap; }
td.pick, th.pick { width: 44px; padding: 0; text-align: center; vertical-align: middle; }
.pick .hit { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tr:has([data-sel]:checked) td { background: var(--accent-soft); }
.table-wrap { overflow-x: auto; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; text-transform: inherit; letter-spacing: inherit; cursor: pointer; min-height: 28px; }
.th-sort:hover, .th-sort.on { color: var(--text); }
.cell-link { background: none; border: 0; padding: 0; font-weight: 600; text-align: left; cursor: pointer; }
.cell-link:hover { color: var(--accent); text-decoration: underline; }

/* формы */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field > span { color: var(--text); font-weight: 600; }
.time-pick { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.time-pick select { width: auto; min-width: 84px; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack:empty { display: none; }
.times { display: flex; flex-direction: column; gap: 6px; }
.field > [data-add-time] { align-self: flex-start; }
.time-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.send-queue-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.pick-box .check span { min-width: 0; overflow-wrap: anywhere; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=time], input[type=date], select, textarea {
  border: 1px solid var(--field-line); border-radius: var(--radius-sm); padding: 0 12px; min-height: 44px; background: var(--surface); width: 100%; }
textarea { min-height: 120px; resize: vertical; padding: 10px 12px; line-height: 1.5; }
select { padding-right: 32px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.check:has(input:disabled) { color: var(--muted); cursor: not-allowed; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
.form { display: grid; gap: 16px; }
.form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hint { font-size: 12px; color: var(--muted); }
.pick-box { display: flex; flex-direction: column; gap: 2px; min-height: 44px; max-height: 200px; overflow: auto; padding: 6px 12px;
  border: 1px solid var(--field-line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.pick-box > * { flex-shrink: 0; }  /* в прокручиваемом списке строки не сжимаются, а прокручиваются */
.pick-box > .muted { padding: 6px 0; }
.pick-box .check { align-items: flex-start; padding: 5px 0; }
.pick-box .check input { flex: 0 0 18px; margin-top: 1px; }
.pick-box .bad { color: var(--bad); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: 0; background: none; min-height: 44px; padding: 0 16px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.tabs button:hover, .tabs a:hover { color: var(--text); }
.tabs button.active, .tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* документация */
.docs { display: flex; flex-direction: column; gap: 24px; }
.docs section { display: flex; flex-direction: column; gap: 8px; }
/* две колонки «каменной кладкой»: блок встаёт сразу под предыдущим, без пустот между блоками разной высоты */
.docs-part { column-count: 2; column-gap: 16px; }
.docs-part > section, .docs-col > section { break-inside: avoid; margin: 0 0 16px; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.docs-part > section.wide { column-span: all; }
/* вкладка с заданными колонками: слева одни блоки, справа другие */
.docs-part.split { column-count: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; align-items: start; }
.docs-col { min-width: 0; }
@media (max-width: 1100px) { .docs-part { column-count: 1; } .docs-part.split { grid-template-columns: minmax(0, 1fr); } }
.docs p { margin: 0; }
.docs ul, .docs ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.docs td:first-child { white-space: nowrap; font-weight: 600; }
.docs td:first-child .badge { font-weight: 400; }
.subtabs { margin-top: -6px; }
.subtabs button { min-height: 40px; padding: 0 12px; font-size: 14px; }
.cmd { font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 6px; white-space: nowrap; }
.cmd.wrap { white-space: normal; overflow-wrap: anywhere; }

/* журнал */
.log { display: flex; flex-direction: column; gap: 24px; margin-top: 16px; }
.log-day { display: flex; flex-direction: column; gap: 10px; }
.log-day > h3 { color: var(--text); margin-bottom: 2px; }
.log-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 14px; }
.log-group > summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 44px; padding: 6px 0; cursor: pointer; list-style: none; }
.log-group > summary::-webkit-details-marker { display: none; }
.log-group > summary::before { content: "▸"; color: var(--muted); width: 10px; }
.log-group[open] > summary::before { content: "▾"; }
.log-group[open] > summary { border-bottom: 1px solid var(--line); }
.log-title { font-weight: 600; }
.log-group .events { max-height: none; padding: 4px 0; }
.log-group .events div:last-child { border-bottom: 0; }

/* слайды */
.thumbs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.thumbs img, .slides img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; background: #fff; cursor: zoom-in; }
.zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--radius-sm); }
.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.slides figure { margin: 0; }
.slides figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }

.issues { margin: 0; padding: 0; list-style: none; }
.issues li { display: flex; gap: 8px; align-items: baseline; margin: 6px 0; }
.events { max-height: 360px; overflow: auto; font-size: 13px; }
.events div { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.events .warning { color: var(--warn); }
.events .error { color: var(--bad); }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.bad a { color: inherit; }
.conn-lost { position: sticky; top: 0; z-index: 40; margin-bottom: 16px; }
.notice-list { margin: 6px 0; padding-left: 20px; }
.fix-link { white-space: nowrap; font-weight: 600; }
.toast.has-link { pointer-events: auto; }
.toast .fix-link { color: inherit; text-decoration: underline; }
pre.out { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); padding: 12px; border-radius: var(--radius-sm); max-height: 260px; overflow: auto; margin: 0; font: 13px/1.5 var(--font-body); }
details.card > summary { cursor: pointer; font-family: var(--font-head); text-transform: uppercase; min-height: 28px; }
details.card[open] > summary { margin-bottom: 12px; }

.modal { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; padding: 20px; z-index: 50; }
.dialog { background: var(--surface); border: 1px solid var(--pop-line); border-radius: var(--radius); padding: 24px; width: min(720px, 100%);
  max-height: 90vh; max-height: 90dvh; overflow: auto; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 16px; }
.dialog.wide { width: min(1100px, 100%); }
.dialog .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.lightbox img { max-width: 100%; max-height: 78vh; display: block; margin: auto; border-radius: var(--radius-sm); }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: var(--radius-sm); opacity: 0; transform: translateY(8px);
  transition: opacity .2s cubic-bezier(.25, 1, .5, 1), transform .2s cubic-bezier(.25, 1, .5, 1); pointer-events: none; max-width: 440px; z-index: 60; overflow-wrap: anywhere; }
.toast.show { opacity: 1; transform: none; }
.cookie-note { position: fixed; right: 20px; bottom: 20px; z-index: 48; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 40px);
  padding: 8px 8px 8px 14px; border-radius: var(--radius-sm); background: var(--cookie-bg); color: var(--cookie-ink); font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 20px rgb(0 0 0 / .18); transition: opacity .3s cubic-bezier(.25, 1, .5, 1), transform .3s cubic-bezier(.25, 1, .5, 1); }
.cookie-note.hide { opacity: 0; transform: translateY(8px); }
.cookie-note button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 2px; background: var(--cookie-ink); color: var(--cookie-bg);
  font-size: 13px; cursor: pointer; }
.cookie-note button:focus-visible { outline: 2px solid var(--cookie-ink); outline-offset: 2px; }
body:has(.cookie-note) .toast { bottom: 76px; }
@media (prefers-reduced-motion: reduce) { .cookie-note { transition: none; } }
.toast.bad { background: var(--bad); }
.toast a:focus-visible { outline-color: currentColor; }

@media (max-width: 1100px) {
  .home-top { grid-template-columns: 1fr; }
  .now-card { grid-column: auto; }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { flex-wrap: wrap; align-content: flex-start; }
  .nav { position: static; height: auto; max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px;
    border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .nav nav { flex-direction: row; flex-wrap: nowrap; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav nav a { flex: 0 0 auto; }
  .nav-status { display: none; }
  .nav-gen-link { flex-direction: row; align-items: center; gap: 8px; padding: 6px 10px; min-width: 0; }
  .nav-gen-head { flex: 0 0 auto; white-space: nowrap; }
  .nav-gen, .nav-gen-name { min-width: 0; max-width: 100%; }
  .nav-gen-sub, .nav-gen-more { display: none; }
  .nav-queue { margin-top: 0; padding: 6px 10px; }
  .nav-queue-list, .nav-queue-more { display: none; }
  .job-actions-end { margin-left: 0; }
  .nav-bottom { margin: 0 0 0 auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
  .nav-foot { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 16px; padding: 0; }
  #navVer { display: none; }
  .view { flex-basis: 100%; padding: 20px 16px 48px; }
  .grid.two, .grid.four, .form.two { grid-template-columns: 1fr; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs > * { flex: 0 0 auto; }
}
@media (max-width: 600px) {
  h1 { font-size: 24px; }
  .cmd { white-space: normal; overflow-wrap: anywhere; }
  .toast { left: 16px; right: 16px; max-width: none; }
}
@media (pointer: coarse) {
  .btn.sm, .gchip, .tabs a, .tabs button, .theme-pick select, .check, .nav-gen-link, .th-sort { min-height: 44px; }
  details.card > summary { padding: 8px 0; }
}
@media (prefers-reduced-motion: reduce) { .progress > i, .toast { transition: none; } }

/* поправки после просмотра */
.row > select, .row > input[type=text], .row > input[type=email] { width: auto; min-width: 180px; }
.field input, .field select, .field textarea { font-size: 15px; color: var(--text); }
.save-state { min-height: 20px; }

/* отчёты, рассылка, теги */
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.6; vertical-align: middle;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.on { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.adm { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 5px 0; }
.adm-problem { flex-basis: 100%; }
.pick-box.tall { max-height: 360px; }
/* «Составить отчёт»: слева выбор периода, справа итог за период и что с ним сделать */
.rp-build { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px 32px; }
.rp-custom { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.rp-date { display: inline-flex; align-items: center; gap: 6px; }
.rp-date input { width: auto; }
.rp-result { display: flex; flex-direction: column; gap: 16px; padding-left: 32px; border-left: 1px solid var(--line); }
.rp-nums { display: flex; gap: 40px; }
.rp-nums div { display: flex; flex-direction: column; gap: 6px; }
.rp-nums b { font-family: var(--font-head); font-weight: 400; font-size: 34px; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.rp-nums .warn b { color: var(--warn-num); }
.rp-nums span { font-size: 13px; color: var(--muted); }
@media (max-width: 1180px) {
  .rp-build { grid-template-columns: minmax(0, 1fr); }
  .rp-result { padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--line); }
}
/* доли колонок заданы в <colgroup>; уже 900px таблица прокручивается внутри .table-wrap */
.rp-table { table-layout: fixed; min-width: 900px; }
.rp-table td { overflow-wrap: break-word; }
.rp-table td.rp-mail { overflow-wrap: anywhere; }
.rp-note { display: block; width: calc(100% + 12px); margin: -4px -6px; padding: 4px 6px; border: 1px dashed transparent; border-radius: var(--radius-sm);
  background: none; text-align: left; white-space: pre-line; overflow-wrap: break-word; cursor: text; }
.rp-note:hover, .rp-note:focus-visible { border-color: var(--field-line); background: var(--surface-2); }
.rp-note.empty { color: var(--muted); }
.rp-edit { min-height: 80px; padding: 6px 8px; font-size: 14px; }
.rp-err { margin-top: 4px; }

/* группы клиентов */
.groups { display: flex; gap: 10px; flex-wrap: wrap; }
.gchip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; font-size: 14px; }
.gchip span { color: var(--muted); font-size: 12px; }
.gchip:hover { border-color: var(--accent); }
.gchip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.gchip.active span { color: var(--accent-ink); }
.gchip.add { border-style: dashed; color: var(--accent); }
.sel-bar { padding: 8px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.group-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
