/* Общий стиль страниц креатора, продюсера и оператора. Страница подключает /style.css,
   в своём <style> держит только то, что есть лишь у неё. Цвета - переменными, тёмная тема - по настройке системы.
   Кнопки и поля таблицы AG Grid (классы ag-*) не трогаем: у неё своя тема. */

@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(https://cdn.jsdelivr.net/npm/@fontsource-variable/onest@5.3.1/files/onest-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(https://cdn.jsdelivr.net/npm/@fontsource-variable/onest@5.3.1/files/onest-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  --bg: #f2f4f8; --card: #ffffff; --soft: #eef1f6; --text: #182030; --muted: #5f6b7f; --line: #e3e7ee;
  --card-line: transparent;
  --accent: #2563eb; --accent-fg: #ffffff; --accent-soft: #dbeafe; --brand: #1e3a8a;
  --raised: #ffffff; --main-bg: var(--accent); --main-fg: #ffffff;
  --ok: #0f7a45; --ok-bg: #dcf5e7; --bad: #b42318; --bad-bg: #fde6e3; --bad-fg: #ffffff;
  --warn: #9a5b06; --warn-bg: #fcefd3; --info: #175cd3; --info-bg: #e0ebff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --pop: 0 12px 40px rgba(16, 24, 40, .18);
  --r: 10px; --r-lg: 16px; --pad: 18px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131a; --card: #161d27; --soft: #1e2733; --text: #e7ecf3; --muted: #97a3b6; --line: #273344;
    --card-line: #273344;
    --accent: #60a5fa; --accent-fg: #0b1b3a; --accent-soft: rgba(96, 165, 250, .16); --brand: #dbe6ff;
    --raised: #2a3546; --main-bg: rgba(96, 165, 250, .14); --main-fg: #93c5fd;
    --ok: #4ade80; --ok-bg: rgba(74, 222, 128, .13); --bad: #fb7185; --bad-bg: rgba(251, 113, 133, .14); --bad-fg: #2a0a10;
    --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .14); --info: #8ab4ff; --info-bg: rgba(138, 180, 255, .14);
    --shadow: none;
    --pop: 0 12px 40px rgba(0, 0, 0, .5);
  }
}
@media (max-width: 560px) {
  :root { --pad: 16px; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
main { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; }
h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -.005em; }
h3 { margin: 0; font-size: 16px; line-height: 1.3; font-weight: 600; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
pre, code { font-family: var(--mono); }
.muted { color: var(--muted); font-size: 13.5px; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.cut { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num, td, .tile { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
@media (max-width: 560px) {
  main { padding: 24px 12px 48px; }
  h1 { font-size: 23px; }
}

/* Строка над шапкой: знак, Combine и роль (Оператор, Продюсер, Креатор) - ссылка в свой кабинет; справа - кто смотрит
   чужой кабинет (роль - ссылка в свой) и «Выйти». На телефоне подпись чужого кабинета - второй строкой */
.brand { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 18px; font-size: 17px; line-height: 1.2; }
.brand .home { display: flex; flex: none; align-items: center; gap: 8px; border-radius: 6px; color: inherit; text-decoration: none; }
.brand .home:hover b { color: var(--accent); }
.brand .home:active { transform: translateY(1px); }
.brand img { width: 28px; height: 28px; flex: none; }
.brand b { color: var(--brand); font-weight: 700; letter-spacing: -.02em; }
.brand span { color: var(--muted); }
.brand .viewer { flex: 0 1 auto; margin-left: auto; font-size: 13.5px; }
.brand .out { flex: none; margin-left: auto; color: var(--muted); font-size: 13.5px; text-decoration: none; }
.brand .viewer + .out { margin-left: 8px; }
.brand .out:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 560px) {
  .brand .viewer { order: 1; flex-basis: 100%; margin-left: 0; }
  .brand .viewer + .out { margin-left: auto; }
}

/* Шапка страницы: заголовок, справа действие, под ним строка с пояснением и временем */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 8px; color: var(--muted); font-size: 13.5px; }
.meta b { color: var(--text); font-weight: 600; }

/* Блок-карточка и её шапка: слева заголовок и подпись, справа кнопки */
.card { min-width: 0; margin-top: 16px; padding: var(--pad); background: var(--card); border: 1px solid var(--card-line);
        border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.card-head .muted { margin-top: 2px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 32px; }
.section-head + .card, .section-head + * > .card:first-child { margin-top: 12px; }
/* Ряд кнопок в шапке карточки, перед ними может стоять серая подпись («Выгрузить») */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tools > .muted { margin-right: 4px; }

/* Кнопки. Базовые правила без веса (:where), любое правило страницы их перебивает.
   Основная - цветом акцента; ghost, tool, plain - вторичные; danger и trash - удаление */
:where(button:not([class*="ag-"])) {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--r); background: var(--accent); color: var(--accent-fg);
  font: inherit; font-size: 14.5px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
:where(button:not([class*="ag-"]):hover:not(:disabled)) { background: color-mix(in srgb, var(--accent) 86%, var(--text)); }
:where(button:not([class*="ag-"]):active:not(:disabled)) { transform: translateY(1px); }
:where(button:not([class*="ag-"]):disabled) { opacity: .45; cursor: default; }
:where(button:not([class*="ag-"]) svg) { width: 16px; height: 16px; flex: none; }
button:is(.ghost, .tool, .plain, .screen-close) { background: var(--card); color: var(--text); border-color: var(--line); font-weight: 500; }
button:is(.ghost, .tool, .plain, .screen-close):hover:not(:disabled) { background: var(--soft); }
button:is(.tool, .screen-close, .sm) { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
button.tool svg { color: var(--muted); }
button.danger { background: var(--bad); color: var(--bad-fg); }
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 86%, #000); }
button.trash { background: var(--card); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
button.trash:hover:not(:disabled) { background: var(--bad-bg); }
/* Ссылка в виде вторичной кнопки (страницы на входе, кабинет человека) */
a.ghost { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--card); color: var(--text);
  font-size: 14.5px; font-weight: 500; line-height: 1.2; text-decoration: none; transition: background-color .15s; }
a.ghost:hover { background: var(--soft); }
a.ghost:active { transform: translateY(1px); }
a.ghost svg { width: 16px; height: 16px; flex: none; }
button.link, button.link:hover:not(:disabled) { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); font-size: inherit;
  font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
:where(:not([class*="ag-"]):focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) {
  a.ghost { min-height: 44px; }
  :where(button:not([class*="ag-"])) { min-height: 44px; }
  button:is(.tool, .screen-close, .sm) { min-height: 40px; }
}

/* Поля ввода */
:where(input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea):where(:not([class*="ag-"])) {
  min-width: 0; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); color: var(--text); font: inherit; font-size: 15px; caret-color: var(--accent);
  transition: border-color .15s, box-shadow .15s;
}
:where(textarea:not([class*="ag-"])) { width: 100%; min-height: 96px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
:where(input, select, textarea):where(:not([class*="ag-"])):focus-visible { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
:where(input, textarea):where(:not([class*="ag-"]))::placeholder { color: var(--muted); opacity: 1; }
:where(input[readonly]:not([class*="ag-"])) { background: var(--soft); border-color: transparent; color: var(--muted); }
:where(input[type=date]:not([class*="ag-"])) { padding: 0 10px; }
/* textfield - иначе Safari не учитывает отступ поля поиска */
:where(input[type=search]:not([class*="ag-"])) { -webkit-appearance: textfield; appearance: textfield; }
/* Поиск по таблице: лупа в поле слева */
.search-field { padding-left: 38px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 12px center / 16px; }
:where(select:not([class*="ag-"])) { width: 100%; padding-right: 36px; appearance: none; cursor: pointer;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 18px; }
:where(input[type=checkbox], input[type=radio]):where(:not([class*="ag-"])) { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
:where(input[type=file]:not([class*="ag-"])) { max-width: 100%; font: inherit; font-size: 14px; color: var(--muted); }
:where(input[type=file]:not([class*="ag-"]))::file-selector-button {
  margin-right: 10px; min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--card); color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
}
@media (pointer: coarse) {
  /* 16px и больше - телефон не увеличивает страницу при вводе */
  :where(input, select, textarea):where(:not([class*="ag-"])) { font-size: 16px; }
  :where(input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], select):where(:not([class*="ag-"])) { min-height: 44px; }
}

/* Строка "поле + кнопка" */
.line { display: flex; align-items: center; gap: 8px; }
.line > input { flex: 1; }

/* Переключатели-таблетки. .strip - на телефоне в одну строку с прокруткой вбок */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 34px; padding: 0 14px; border-radius: 999px; border-color: var(--line);
  background: var(--card); color: var(--text); font-size: 13.5px; font-weight: 500; }
.chips button:hover:not(:disabled):not(.on) { background: var(--soft); }
.chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
@media (max-width: 560px) {
  .chips.strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--pad)); padding-inline: var(--pad);
                 scroll-padding-inline: var(--pad); }
  .chips.strip::-webkit-scrollbar { display: none; }
  .chips.strip button { flex: none; }
}
/* Переключатель площадки статистики над карточками (креатор, продюсер): подпись и .chips */
.pf-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 16px; }

/* Выбор из двух-трёх вариантов */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--soft); }
.seg button { flex: 1 1 0; min-width: 0; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 500; line-height: 1.25; white-space: normal; text-wrap: balance; }
.seg button:hover:not(:disabled):not(.on) { background: transparent; color: var(--text); }
.seg button.on { background: var(--raised); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .14); }
@media (pointer: coarse) {
  .chips button, .seg button { min-height: 40px; }
}

/* Выбор периода статистики (common.js periodPicker): кнопка «7 дней · 02.10 - 08.10», под ней меню - группы через
   линию, у выбранного галочка, внизу «Свой период» с двумя датами. На телефоне меню - лист у нижнего края экрана во
   всю ширину */
.pp { position: relative; max-width: 100%; }
button.pp-btn { max-width: 100%; min-height: 36px; padding: 0 10px 0 14px; background: var(--card); color: var(--text);
  border-color: var(--line); font-size: 14px; font-weight: 600; }
button.pp-btn:hover:not(:disabled) { background: var(--soft); }
.pp-btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pp-dates { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.pp-dates:empty { display: none; }
.pp-dates::before { content: "· "; }
button.pp-btn svg { color: var(--muted); }
.pp-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.pp-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 280px; max-width: calc(100vw - 24px);
  padding: 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); box-shadow: var(--pop);
  overflow-y: auto; overscroll-behavior: contain; }
.pp-menu.up { top: auto; bottom: calc(100% + 6px); }
button.pp-item { position: relative; width: 100%; justify-content: flex-start; min-height: 34px; padding: 0 10px 0 32px;
  border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 14px; font-weight: 400; }
button.pp-item:hover:not(:disabled) { background: var(--soft); }
button.pp-item:focus-visible { outline-offset: -2px; background: var(--soft); }
.pp-item[aria-checked="true"] { font-weight: 600; }
.pp-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.pp-own { padding: 4px 10px 6px 32px; }
.pp-own-head { position: relative; font-size: 14px; line-height: 26px; }
.pp-own-head.on { font-weight: 600; }
/* Галочка у выбранного: уголок рамки, повёрнутый на 45° */
:is(.pp-item[aria-checked="true"], .pp-own-head.on)::before { content: ""; position: absolute; left: 12px; top: 50%;
  width: 10px; height: 5px; margin-top: -5px; border-bottom: 2px solid var(--accent); border-left: 2px solid var(--accent);
  transform: rotate(-45deg); }
.pp-own-head.on::before { left: -20px; }
.pp-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 8px; margin-top: 4px; }
.pp-fields label { display: contents; color: var(--muted); font-size: 13.5px; }
.pp-fields input { width: 100%; min-height: 36px; }
.pp-err { margin-top: 6px; font-size: 13px; }
.pp-own > button { width: 100%; margin-top: 8px; }
@media (max-width: 560px) {
  .pp-menu { position: fixed; top: auto; right: 12px; bottom: 12px; left: 12px; width: auto; max-width: none;
    max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
}
@media (pointer: coarse) {
  button.pp-btn { min-height: 40px; }
  button.pp-item { min-height: 44px; }
  .pp-fields input { min-height: 44px; }
}

/* Сравнение итога с прошлым периодом (common.js trendNode): «+12%» зелёным, «-5%» красным, «новое» - прошлый 0 */
.trend { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 600;
  line-height: 18px; white-space: nowrap; vertical-align: 1px; font-variant-numeric: tabular-nums; }
.trend.up { background: var(--ok-bg); color: var(--ok); }
.trend.down { background: var(--bad-bg); color: var(--bad); }
.trend.flat { background: var(--card); color: var(--muted); }
.trend.new { background: var(--info-bg); color: var(--info); }

/* Вкладки страницы под шапкой (common.js initTabs): кнопки [data-tab], блоки [data-panel]. Жирность у всех
   одна - при переключении ширина не прыгает. Число на вкладке - .count, .count.bad - красное. На узком экране
   вкладки не сжимаются, а прокручиваются вбок */
.tabs { display: flex; gap: 4px; margin-top: 20px; padding: 4px; overflow-x: auto; border-radius: 12px; background: var(--soft);
  scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; min-height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600; }
.tabs button:hover:not(:disabled):not(.on) { background: transparent; color: var(--text); }
.tabs button.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .14); }
.tabs .count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--line); color: var(--text);
  font-size: 12px; line-height: 20px; font-variant-numeric: tabular-nums; }
.tabs .count.bad { background: var(--bad); color: var(--bad-fg); }
.tabs .count:empty { display: none; }
@media (max-width: 560px) {
  .tabs { gap: 2px; }
  .tabs button { padding: 0 6px; font-size: 13.5px; }
}
@media (pointer: coarse) { .tabs button { min-height: 44px; } }
/* Вкладки разной высоты: место под полосу прокрутки держим всегда, иначе на короткой вкладке полоса пропадает
   и страница сдвигается вбок */
html:has(.tabs) { scrollbar-gutter: stable; }

/* Итоговые цифры. .main - главная цифра блока */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { min-width: 0; padding: 12px 14px; border-radius: 12px; background: var(--soft); }
.tile .num { font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tile .lbl { margin-top: 2px; color: var(--muted); font-size: 13px; }
.tile.main { background: var(--main-bg); color: var(--main-fg); }
.tile.main .lbl { color: inherit; }
@media (max-width: 560px) { .tile .num { font-size: 23px; } }

/* Таблица цифр. Внутри карточки .scroll выходит до её краёв, первая колонка стоит на месте при прокрутке вбок */
.scroll { overflow-x: auto; margin-inline: calc(-1 * var(--pad)); scrollbar-width: thin; }
.scroll table { min-width: 460px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th, td { padding: 10px; text-align: right; white-space: nowrap; border-top: 1px solid var(--line); background: var(--card); }
th { padding-top: 4px; padding-bottom: 8px; border-top: 0; color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; user-select: none; }
th:hover, th.on { color: var(--text); }
th.on { font-weight: 600; }
th .arr { display: inline-block; width: 12px; margin-left: 2px; font-size: 10px; }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; text-align: left; padding-left: var(--pad); }
th:first-child { width: 40%; }
th:last-child, td:last-child { padding-right: var(--pad); }
tfoot td { border-top: 0; background: var(--soft); font-weight: 700; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, var(--card)); }

/* Плитки-фильтры над таблицей AG Grid: у оператора - счётчики аккаунтов и метка импорта, у оператора и продюсера -
   метка проваливания статистики каналов. Не таблетки вкладок: прямоугольные, выбранная - рамкой акцента */
.stat { flex: none; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); background: var(--card);
        color: var(--muted); font-size: 13.5px; font-weight: 500; }
.stat:hover:not(:disabled) { background: var(--soft); }
.stat b { color: var(--text); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.alarm b { color: var(--bad); }
.stat.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); color: var(--text);
           box-shadow: inset 0 0 0 1px var(--accent); }
.stat.on:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 13%, var(--card)); }
@media (pointer: coarse) { .stat { min-height: 40px; } }

/* Над статистикой каналов (оператор, вкладка «Статистика из таблицы» продюсера): период, режим, «Итого по», выгрузка, у оператора -
   и таблица команды; ниже - метка проваливания и строкой - какие дни, когда данные и откуда сетки. Пояснение
   режима - в подсказке его кнопки */
.st-bar { display: flex; flex-direction: column; gap: 6px; --pad: 12px; }
.st-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.st-row .seg { flex: none; padding: 3px; }
.st-row .seg button { flex: none; min-height: 28px; padding: 0 12px; white-space: nowrap; }
.st-level { display: flex; align-items: center; gap: 8px; }
.st-level > .muted { font-size: 13.5px; white-space: nowrap; }
#st-drill { align-self: flex-start; }
#st-drill svg { flex: none; width: 14px; height: 14px; }
.st-out { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.st-out > .muted { margin-right: 2px; }
.st-info { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: 13px; }
.st-info > :empty { display: none; }
.st-info a { overflow-wrap: anywhere; }

/* Таблица AG Grid (#grid, тема - links.js gridTheme) у оператора и продюсера. Шапка постоянной высоты: подписи в одну
   строку с многоточием, место под стрелку сортировки оставлено всегда, воронка фильтра видна при наведении, фокусе и
   включённом фильтре. Строка групп - своей полосой, линия между группами заметнее обычной и идёт через шапку и все
   строки */
#grid { --line-strong: color-mix(in srgb, var(--text) 20%, var(--line)); --group-bg: color-mix(in srgb, var(--text) 5%, var(--soft)); }
/* Под закреплёнными колонками AG Grid держит пустую полосу прокрутки ради высоты - высоту оставляем, полосу прячем */
#grid .ag-horizontal-left-spacer { overflow-x: hidden; }
/* Подпись группы - по центру группы и липкая: пока видна хоть часть группы, подпись держится у её видимого края.
   AG Grid не даёт прокрутку строке групп только со старым классом ag-header-row-column-group, а в 34-й у неё
   ag-header-row-group - строка становится прокручиваемой, и подпись не липнет */
#grid .ag-header-row-group { overflow: visible; background: var(--group-bg); }
#grid .ag-header-group-cell .ag-header-cell-comp-wrapper { justify-content: center; }
#grid .ag-header-group-cell-label.ag-sticky-label { right: var(--ag-cell-horizontal-padding); }
/* Над закреплёнными колонками своих групп нет - полоса без черточек между пустыми клетками и одна подпись по центру
   всего закреплённого блока (у аккаунтов - "Аккаунт", текст ставит скрипт в --pinned-group) */
#grid .ag-header-group-cell-no-group::after { display: none; }
#grid .ag-pinned-left-header .ag-header-row-group::after { content: var(--pinned-group, ""); position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; color: var(--text); font-size: 12px; font-weight: 600; pointer-events: none; }
#grid .ag-header-group-text { color: var(--text); font-size: 12px; font-weight: 600; }
#grid .ag-sort-indicator-container { min-width: calc(var(--ag-icon-size) + var(--ag-spacing)); }
#grid .ag-header-cell-filter-button { opacity: 0; transition: opacity .15s; }
#grid .ag-header-cell:is(:hover, :focus-within, .ag-header-active) .ag-header-cell-filter-button,
#grid .ag-header-cell-filter-button.ag-filter-active { opacity: 1; }
#grid .ag-cell.group-end { border-right-color: var(--line-strong); }
#grid :is(.ag-header-cell, .ag-header-group-cell).group-end::after { border-right-color: var(--line-strong); }
/* Текст ячеек выделяется мышью и копируется. Не опцией enableCellTextSelection: она заворачивает каждую ячейку
   в обёртку, и содержимое со своей разметкой (таблетка шага) съезжает вверх */
#grid .ag-cell { -webkit-user-select: text; user-select: text; }
/* Выделенные ячейки (links.js): пока тянут мышью через ячейки - текст не выделяется; Ctrl+C - на миг ярче */
html.ranging #grid .ag-cell { -webkit-user-select: none; user-select: none; }
#grid .ag-cell.in-range { background: color-mix(in srgb, var(--accent) 16%, transparent); }
#grid.range-copied .ag-cell:is(.in-range, .ag-cell-focus) { background: color-mix(in srgb, var(--accent) 34%, transparent); }

.main-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Статистика каналов: строка дубля - серая, не принятая ссылка - жёлтая; их пометка вместо цифр - одной ячейкой во
   всю ширину цифр. «Итого» закреплено внизу и выделено */
#grid .ag-row.ls-gray { color: var(--muted); }
#grid .ag-row.ls-warn { background: color-mix(in srgb, var(--warn-bg) 70%, var(--card)); }
/* width: 0; min-width: 100% - пометка не раздвигает колонку цифр при подборе ширины: ширину дают колонки, которые
   она накрывает */
.ls-mark { display: block; width: 0; min-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ls-warn .ls-mark { color: var(--warn); }
.ls-grid { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ls-grid .pill { flex: none; padding: 0 8px; font-size: 11.5px; line-height: 1.6; }
/* Имя креатора или сетки, по которому проваливаются ниже: ссылкой, длинное - с многоточием */
#grid button.ls-drill { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-align: left;
  text-overflow: ellipsis; white-space: nowrap; line-height: inherit; }
#grid .ag-floating-bottom .ag-row { background: var(--soft); font-weight: 700; }
/* Всплывающие окна AG Grid (фильтр колонки, список выбора) - как карточки страницы; цвета, рамки и тени - в теме */
#grid .ag-menu { border-radius: 12px; }
#grid .ag-select-list { border-radius: var(--r); }
#grid .ag-picker-field-wrapper { border-radius: var(--r); min-height: 36px; }
/* Пустая таблица - надпись в ней самой. Откуда берутся записи - своё у каждой таблицы, текст ставит скрипт в --no-rows */
.no-rows { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 16px; font-size: 14px; text-align: center; }
.no-rows span { color: var(--muted); font-size: 13.5px; }
.no-rows span::before { content: var(--no-rows, ""); }
@media (max-width: 640px) {
  .st-out { margin-left: 0; }
  .st-out > .muted { display: none; }
  /* Режим не влез в строку - подписи переносятся внутри кнопок, а не вылезают за край */
  .st-row #st-modes { flex: 0 1 auto; min-width: 0; }
  .st-row #st-modes button { flex: 0 1 auto; padding-block: 4px; white-space: normal; }
}
@media (pointer: coarse) {
  .st-row .seg button { min-height: 34px; }
}
/* Без наведения (сенсорный экран) воронка видна всегда */
@media (hover: none) {
  #grid .ag-header-cell-filter-button { opacity: 1; }
}

/* Метки состояния: цветная таблетка с точкой. button.shot - такая же, но открывает снимок проверки */
.pill, button.shot {
  display: inline-flex; align-items: center; gap: 6px; min-height: 0; padding: 2px 10px; border: 0; border-radius: 999px;
  background: var(--soft); color: var(--muted); font-size: 12.5px; font-weight: 500; line-height: 1.5; white-space: nowrap; vertical-align: 1px;
}
.pill::before, button.shot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.plain::before { display: none; }
:is(.pill, button.shot).ok { background: var(--ok-bg); color: var(--ok); }
:is(.pill, button.shot).bad { background: var(--bad-bg); color: var(--bad); }
:is(.pill, button.shot).warn { background: var(--warn-bg); color: var(--warn); }
:is(.pill, button.shot).info { background: var(--info-bg); color: var(--info); }
button.shot:hover:not(:disabled) { background: var(--soft); box-shadow: inset 0 0 0 1px currentColor; }
button.shot.ok:hover { background: var(--ok-bg); } button.shot.bad:hover { background: var(--bad-bg); }
button.shot.warn:hover { background: var(--warn-bg); } button.shot.info:hover { background: var(--info-bg); }
a.pill { text-decoration: none; }
a.pill:hover { box-shadow: inset 0 0 0 1px currentColor; }
@media (pointer: coarse) { button.shot, a.pill { min-height: 28px; padding: 3px 11px; } }
/* Крутилка вместо точки: работа идёт прямо сейчас (живой шаг аккаунта, «удаляется») */
.pill.busy::before { box-sizing: border-box; width: 9px; height: 9px; border: 1.5px solid currentColor; border-right-color: transparent;
                     background: none; animation: turn .8s linear infinite; }
@keyframes turn { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .pill.busy::before { animation: none; }
}

/* Таблица «Сейчас» (common.js nowTable): что делает каждый аккаунт. Группа (сетка креатора или креатор продюсера) -
   своя карточка: полоса на всю ширину, под ней аккаунты, строки разделены линиями; между карточками отступ. Узкая
   таблица - аккаунт блоком в 2-3 линии, широкая - колонки с заголовками и линиями между ними, колонки общие на все
   карточки. Раскладку выбирает ширина .now, строки - в .now-list внутри него */
.now { container-type: inline-size; font-size: 14px; }
/* Общей рамки нет - рамку карточек рисуют сами строки: бока у каждой, верх у полосы группы, низ у последней строки
   группы. Рамка - только у таблицы со строками: «Аккаунтов пока нет» и «Сейчас никто не работает» стоят без неё */
.now-list:has(> .now-head) > * { border-inline: 1px solid var(--line); }
.now-head { display: none; }
.now-group, .now-row, .now-none { border-top: 1px solid var(--line); }
.now-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; margin-top: 12px; padding: 8px 12px;
  border-radius: 12px 12px 0 0; background: color-mix(in srgb, var(--soft) 55%, var(--card)); }
.now-head + .now-group { margin-top: 0; }
.now-list:has(> .now-head) > :not(.now-head, .now-sizer):is(:has(+ .now-group), :has(+ .now-sizer), :last-child) {
  border-bottom: 1px solid var(--line); border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.now-group b { min-width: 0; font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
/* Полоса группы кнопкой (opts.groupHead): кнопка на всю полосу, при наведении темнеет вся полоса - фон не уезжает
   вместе с кнопкой при нажатии. Рамка фокуса - внутри полосы, со скруглением карточки */
.now-group:has(> button) { padding: 0; }
.now-group > button { flex: 1 1 100%; justify-content: flex-start; gap: 10px; padding: 8px 12px; border: 0; border-radius: inherit;
  background: none; color: var(--text); font-size: inherit; font-weight: 400; line-height: 1.5; text-align: left; white-space: normal; }
@media (hover: hover) {
  .now-group:has(> button:hover:not(:disabled)) { background: color-mix(in srgb, var(--text) 7%, var(--soft)); }
}
.now-group > button:focus-visible { outline-offset: -2px; }
.now-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: "acc shot day" "what what what" "video video video"; column-gap: 12px; align-items: baseline;
  padding: 10px 12px; }
/* Снимок экрана: значок-кнопка, на узкой карточке - в строке аккаунта, на широкой - своя узкая колонка за логином */
.now-shot { grid-area: shot; align-self: center; line-height: 0; }
button.now-shot-btn { display: inline-grid; place-items: center; width: 26px; min-height: 24px; padding: 0; border: 0;
  border-radius: 6px; background: none; color: var(--muted); }
button.now-shot-btn:hover:not(:disabled) { background: var(--soft); color: var(--text); }
button.now-shot-btn svg { width: 16px; height: 16px; }
@media (pointer: coarse) { button.now-shot-btn { width: 36px; min-height: 32px; } }
.now-acc { grid-area: acc; display: flex; align-items: baseline; min-width: 0; font-weight: 500; }
.now-pf { display: inline-block; flex: none; align-self: center; margin-right: 6px; color: var(--muted); vertical-align: -2px; }
.now-pf svg { display: block; width: 15px; height: 15px; }
/* Логин в одну строку с многоточием, целиком - в подсказке ячейки. С opts.onAccount логин - кнопка, текст - в span внутри */
:is(span.now-login, .now-login > span) { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.now-login { display: block; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none;
  color: inherit; font: inherit; text-align: left; }
/* Наведение - только где есть мышь: на телефоне после касания логин оставался бы подчёркнутым */
@media (hover: hover) {
  button.now-login:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
}
.now-what { grid-area: what; min-width: 0; margin-top: 4px; }
/* Живой шаг: длинный текст переносится внутри таблетки, время шага остаётся справа от неё */
.now-step { display: flex; align-items: center; gap: 8px; }
.now-step .pill { min-width: 0; border-radius: 12px; white-space: normal; overflow-wrap: anywhere; }
/* Время шага - секундами, место под «999 с» сразу: таблетка не сжимается и не переносит текст, когда в числе
   прибавляется цифра. Цифры одной ширины - и в окне аккаунта, вне таблицы */
.now-dur { flex: none; min-width: 4.5ch; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
/* Прошлые шаги: линия от крутилки вниз */
.now-trail { margin: 6px 0 0 13px; padding-left: 11px; border-left: 2px solid var(--line); color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.now-trail > div { display: flex; gap: 8px; }
.now-trail > div + div { margin-top: 2px; }
.now-at { flex: none; }
.now-idle { font-size: 13.5px; overflow-wrap: anywhere; }
/* Ролик: на узкой карточке «опубликовал» и имя - одной строкой, имя занимает остаток и обрезается многоточием */
.now-video { grid-area: video; display: flex; column-gap: .3em; min-width: 0; margin-top: 2px; color: var(--muted); font-size: 13.5px;
  white-space: nowrap; }
.now-video:empty { display: none; }
/* Имя ролика везде в одну строку с многоточием, целиком - в подсказке */
.now-name { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
.now-name:has(a) { color: var(--accent); }
/* Ссылка - блоком на ширину имени и сама режет текст: строчная ссылка внутри обрезанного имени тянулась бы на всю
   длину названия за край экрана - глазу не видно, но элемент шире экрана */
.now-name a { display: block; overflow: hidden; text-overflow: ellipsis; }
.now-name a:focus-visible { outline-offset: -2px; }
.now-cur { color: var(--text); }
.now-day { grid-area: day; font-size: 13.5px; white-space: nowrap; }
.now-lbl { color: var(--muted); }
.now-none { padding: 10px 12px; color: var(--muted); font-size: 13.5px; }
.now-sizer { display: none; }
.now :is(.now-group .muted, .now-at, .now-day) { font-variant-numeric: tabular-nums; }
@container (min-width: 560px) {
  /* Колонки общие на всю таблицу, строки и заголовки их берут (subgrid). «Аккаунт» - по самому длинному из показанных
     логинов, но не шире 274px вместе с отступами: дальше многоточие, логин целиком - в подсказке. «Сейчас» и «Ролик»
     делят остаток 5:3, «За сутки» - по заголовку. Текст шагов и роликов на ширину колонок не влияет */
  .now-list { display: grid; grid-template-columns: fit-content(274px) max-content minmax(0, 5fr) minmax(0, 3fr) max-content; }
  .now-list > * { grid-column: 1 / -1; }
  /* Распорка (common.js sizerNode, «Только в работе»): невидимые логины всех аккаунтов в первой колонке - она не меняет
     ширину, когда строки появляются и пропадают */
  .now-list > .now-sizer { display: block; grid-column: 1; height: 0; overflow: hidden; visibility: hidden; }
  .now-head, .now-row { display: grid; grid-template-columns: subgrid; grid-template-areas: "acc shot what video day"; column-gap: 0;
    padding: 0; }
  .now-head { border-block: 1px solid var(--line); border-radius: 12px 12px 0 0; background: var(--soft); color: var(--muted);
    font-size: 12.5px; font-weight: 500; }
  .now-head > * { padding: 8px 12px; }
  /* Шапка колонок - верх первой карточки */
  .now-head + .now-group { border-top: 0; border-radius: 0; }
  .now-row > *, .now-sizer > * { padding: 10px 12px; }
  /* Линии между колонками. Ячейки строки стоят по линии текста и не тянутся на её высоту, поэтому линии строки рисуют
     ::before (слева от «Сейчас») и ::after (по бокам «Ролика») на всю высоту; у «Снимка» линия слева - своя, ячейка
     тянется. У шапки - сами ячейки, те же стороны */
  .now-row::before, .now-row::after { content: ""; grid-row: 1; align-self: stretch; border-left: 1px solid var(--line); }
  .now-row::before { grid-column: 3; }
  .now-row::after { grid-column: 4; border-right: 1px solid var(--line); }
  .now-head > :nth-child(2), .now-head > :nth-child(3) { border-left: 1px solid var(--line); }
  .now-head > :nth-child(4) { border-inline: 1px solid var(--line); }
  /* Колонка «Снимок» - по значку, своя линия слева на всю высоту строки, значок - на уровне первой строки */
  .now-head > .now-shot { display: grid; place-items: center; padding-inline: 10px; }
  .now-head > .now-shot svg { width: 15px; height: 15px; }
  .now-row > .now-shot { align-self: stretch; padding: 8px 6px; border-left: 1px solid var(--line); text-align: center; }
  .now-head > :last-child, .now-day { text-align: right; }
  .now-what, .now-video { margin-top: 0; }
  /* Колонка узкая: «опубликовал» переносится, имя не влезло в остаток строки - уходит на свою строку */
  .now-video { display: block; white-space: normal; }
  /* Ролика нет - «-». Подписи «за сутки» и «ролик» здесь не нужны: они в заголовках колонок */
  .now-video:empty { display: block; }
  .now-video:empty::before { content: "-"; }
  .now-lbl { display: none; }
}

/* Списки с разделителями */
:where(main ul:not([class*="ag-"])) { margin: 0; padding: 0; list-style: none; }
:where(main ul:not([class*="ag-"]) > li) { padding: 11px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
:where(main ul:not([class*="ag-"]) > li:first-child) { border-top: 0; }
/* Строка списка: слева имя с многоточием, справа таблетка состояния */
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; font-weight: 500; }
.row .pill { flex: none; }

/* Раскрывашка */
:where(details:not(.multi) > summary) { display: inline-flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; font-weight: 500; }
:where(details:not(.multi) > summary)::-webkit-details-marker { display: none; }
:where(details:not(.multi) > summary)::before { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s; opacity: .7; }
:where(details[open]:not(.multi) > summary)::before { transform: rotate(45deg); }
/* Старые записи под раскрывашкой «Ещё N» у продюсера и оператора */
.more > summary { min-height: 32px; color: var(--muted); font-size: 13px; }
.more > summary:hover { color: var(--text); }
@media (pointer: coarse) { :where(details:not(.multi) > summary), .more > summary { min-height: 40px; } }

/* Сообщения и подсказки */
.msg { font-size: 14px; overflow-wrap: anywhere; }
.hint { color: var(--muted); font-size: 13px; }
.empty { padding: 20px 0 8px; color: var(--muted); text-align: center; }

/* Окна: снимок экрана аккаунта и выгрузка в Google таблицу */
dialog.screen { width: min(920px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto;
  border: 1px solid var(--card-line); border-radius: var(--r-lg); background: var(--card); color: var(--text); box-shadow: var(--pop); }
dialog.screen:has(.steps) { width: min(560px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(8, 12, 20, .55); }
.screen-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px var(--pad); border-bottom: 1px solid var(--line); }
.screen-head b { font-size: 16px; overflow-wrap: anywhere; }
.screen-reason { margin-top: 4px; font-size: 14px; overflow-wrap: anywhere; }
.screen-body { padding: 16px var(--pad) var(--pad); }
.screen-body img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r); }
.steps { font-size: 14px; }
.steps > div + div { margin-top: 12px; }
.steps .msg { min-height: 1em; }
/* Окно снимка: снимок по ширине окна в рамке постоянной высоты (окно не меняет размер, когда снимок пришёл), под ним -
   когда снят и итог. Снимка нет - серая плитка с ответом сервера. Ячейка сетки - строго по рамке: иначе высокий снимок
   (телефон, длинная страница) растягивает её по своей высоте и рамка срезает низ */
dialog.screen.shot-win { width: min(960px, calc(100vw - 24px)); }
.shot-win .screen-head { align-items: center; }
.shot-win .screen-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-pic { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; aspect-ratio: 16 / 10;
  max-height: calc(100dvh - 220px); overflow: hidden; border: 1px solid var(--line); border-radius: var(--r); background: var(--soft); color: var(--muted); font-size: 14px;
  text-align: center; overflow-wrap: anywhere; }
.shot-pic.none { padding: 16px; }
.shot-pic > a { display: block; width: 100%; height: 100%; }
.screen-body .shot-pic img { width: 100%; height: 100%; object-fit: contain; border: 0; border-radius: 0; }
.shot-meta { margin-top: 10px; font-size: 14px; overflow-wrap: anywhere; }
.shot-meta > * + * { margin-top: 2px; }

/* Сценка с трактором (scene.js) - низ карточки во всю ширину, земля по нижнему краю. Карточке нужен overflow: hidden */
.scene { margin: 20px calc(-1 * var(--pad)) calc(-1 * var(--pad)); }
.scene svg { display: block; width: 100%; height: auto; }
.scene .soil { fill: var(--soft); }
.scene .ground { stroke: var(--line); stroke-width: 1; }
.scene .dust { fill: var(--muted); }
.scene .wh { fill: #1e3a8a; }
.scene .fur { fill: #7c4a24; }
.scene .arm { stroke: #7c4a24; stroke-width: 7; stroke-linecap: round; }
.scene .skin { fill: #f0cfa0; }
.scene .cym { fill: #eab308; stroke: #a16207; stroke-width: 1; }
.scene #mk { cursor: pointer; -webkit-tap-highlight-color: transparent; }
@media (prefers-color-scheme: dark) {
  .scene .wh { fill: #475569; }
}
