/* Общий стиль страниц креатора, продюсера, оператора и таблиц. Страница подключает /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; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 17px; line-height: 1.2; }
.brand img { width: 28px; height: 28px; flex: none; }
.brand b { color: var(--brand); font-weight: 700; letter-spacing: -.02em; }
.brand span { color: var(--muted); }

/* Шапка страницы: заголовок, справа действие, под ним строка с пояснением и временем */
.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=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; }
: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=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; }
}

/* Выбор из двух-трёх вариантов */
.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 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)); }

/* Метки состояния: цветная таблетка с точкой. 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; } }

/* Списки с разделителями */
: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; }

/* Сценка с трактором (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; }
}
