/* Настройки: карточки свёрнуты до заголовка, раскрываются по клику. */
details.fold-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; }
details.fold-card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: .01em; user-select: none; }
details.fold-card > summary::-webkit-details-marker { display: none; }
/* Стрелка вниз справа: подсказывает, что блок раскрывается; в раскрытом — вверх. При наведении заголовок жёлтый. */
details.fold-card > summary::after { content: ""; width: 18px; height: 18px; margin-left: auto; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  color: var(--text-muted); transition: transform .2s; }
details.fold-card[open] > summary::after { transform: rotate(180deg); }
details.fold-card > summary:hover, details.fold-card > summary:hover::after { color: var(--accent); }
details.fold-card > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 14px; }
details.fold-card > .card { border: 0; border-radius: 0; background: none; padding: 0 20px 20px; }
details.fold-card > .card > h2 { display: none; }
details.fold-card > .card > .hint { margin-top: 0; }
.install-guide { border: 1px dashed var(--border); border-radius: 12px; padding: 16px 20px; margin: 8px 0 12px; }
.install-guide h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 17px; }
.install-guide .hint { color: var(--text-secondary); font-size: 12px; margin: 0 0 12px; }
.install-guide ol.steps { margin: 8px 0 0; padding-left: 24px; display: grid; gap: 12px; }
.install-guide ol.steps li { line-height: var(--lh-text); }
.install-guide ol.steps .button { margin-right: 8px; vertical-align: middle; }
.license-link { font-size: 12px; font-weight: 400; margin-left: 4px; white-space: nowrap; }
.license-link::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 4px; vertical-align: 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.license-link.open::after { transform: rotate(225deg); vertical-align: -1px; }
.license-text { max-width: 320px; margin-top: 4px; }
.pull-bar { height: 4px; border-radius: 2px; background: var(--grid); margin-top: 4px; width: 140px; overflow: hidden; }
.pull-bar .fill { height: 100%; background: var(--brand-accent); transition: width .5s; }
.pull-bar.paused .fill { opacity: .45; }
tr.current td { box-shadow: inset 3px 0 0 var(--accent); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; padding: 16px 16px; min-width: 0; }
.tile:first-child { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.tile:first-child .label, .tile:first-child .delta { color: #d9d8d2; }
.tile:first-child .value { color: var(--brand-accent); }
.tile .label { color: var(--text-secondary); font-size: 12px; }
.tile .value { font-family: var(--font-display); font-size: 32px; font-weight: 700; line-height: var(--lh-none);
  font-variant-numeric: tabular-nums; margin-top: 4px; }
.tile .delta { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
/* Справка в плитке (соинвест Ozon): заголовок, фраза «что это» и строки «подпись — цифра». */
.tile-facts { display: grid; gap: 4px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--grid); font-size: 12px; line-height: var(--lh-tight); }
.tile-facts .facts-title { font-weight: 600; color: var(--text-primary); }
.tile-facts .facts-hint { margin: 0 0 4px; color: var(--text-muted); line-height: var(--lh-text); }
.tile-facts .fact { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--text-secondary); }
.tile-facts .fact b { font-weight: 600; color: var(--text-primary); text-align: right; }
details.tile-facts { display: block; }
details.tile-facts > summary { display: flex; align-items: baseline; gap: 8px; cursor: pointer; list-style: none; user-select: none; }
details.tile-facts > summary::-webkit-details-marker { display: none; }
details.tile-facts > summary::before { content: "▸"; font-size: 11px; color: var(--text-muted); transition: transform .15s; }
details.tile-facts[open] > summary::before { transform: rotate(90deg); }
details.tile-facts > summary b { margin-left: auto; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
details.tile-facts .facts-body { display: grid; gap: 4px; padding-top: 8px; }

.callout { border-left: 3px solid var(--info-border); background: var(--info-bg); padding: 8px 12px; border-radius: 4px; }
.callout.warn { border-color: var(--warn-border); background: var(--warn-bg); }
.callout.bad { border-color: var(--bad-border); background: var(--bad-bg); }
.callout.good { border-color: var(--good-border); background: var(--good-bg); }
.callouts { display: grid; gap: 8px; }
.rights { margin: 8px 0 4px; }
.rights summary { cursor: pointer; color: var(--text-secondary); }
.rights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 24px; margin-top: 8px; }
.rights-grid h4 { margin: 0 0 4px; font-size: 13px; }
.rights-grid ul { margin: 0; padding-left: 20px; color: var(--text-secondary); font-size: 13px; }
.ops-inline { display: none; }
/* Экраны вместо панели: подписка закончилась, магазинов нет (data-gate на <html>). */
:root[data-gate] .sidebar, :root[data-gate] #toolbar, :root[data-gate] #notice, :root[data-gate] .mobile-bar { display: none !important; }
.card.gate { max-width: 720px; margin: 8vh auto 0; }
.card.gate .actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.card.gate .form { max-width: none; }
.card.gate .form .actions { justify-content: flex-end; }
/* Тарифы подписки */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 12px 0 4px; }
.plan { border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: grid; gap: 8px; background: var(--info-bg); }
.plan-title { font-weight: 600; }
.plan-price { font-family: var(--font-display); font-size: 24px; font-weight: 800; }
.plan button { justify-content: center; margin-top: 4px; }
button.danger { color: var(--bad-border); border-color: var(--bad-border); }
/* Ссылки-кнопки: стеклянные правила тем ниже исключают .link, иначе под текстом рисовалась «таблетка» (владелец, 19 октября 2026). */
button.link { background: none; border: 0; padding: 0; height: auto; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; box-shadow: none; }
.login-card #info { margin-bottom: 12px; }
.notice-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.notice-row > span { flex: 1 1 240px; }
.notice-row .eye-btn { flex: none; }
.notice-row > .notice-time { flex: none; white-space: nowrap; font-size: 12px; }
.bell-list .notice-time { margin-top: 2px; }
/* Колокольчик скрытых уведомлений рядом с «Обновить из Ozon»: счётчик в углу. */
#bell { position: relative; }
#bell .bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; line-height: var(--lh-none);
  display: inline-flex; align-items: center; justify-content: center; }
#bell .bell-count:empty { display: none; }
/* Пока есть скрытые уведомления, колокольчик покачивается (просьба владельца); при reduced-motion — стоит. */
@keyframes bell-ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 80% { transform: rotate(-12deg); }
  85% { transform: rotate(9deg); } 90% { transform: rotate(-6deg); } 95% { transform: rotate(3deg); } }
#bell:not([hidden]) .icon { transform-origin: 50% 15%; animation: bell-ring 3s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { #bell .icon { animation: none; } }
#subscriptions tr.sub-never td { color: var(--text-muted); }
#subscriptions tr.sub-never td.name { color: inherit; }
#bell-dialog { width: min(760px, 94vw); }
.bell-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.notice-row button { height: 30px; padding: 0 12px; }
.conclusion { margin-top: 12px; }

.table-wrap { overflow-x: auto; }
/* Сортировка числовых колонок кликом по заголовку: стрелка показывает направление. */
td .pos { color: var(--good-border); }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent); }
th.sortable[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
th.sortable[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--grid); vertical-align: top; }
th { color: var(--text-secondary); font-weight: 500; font-size: 12px; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
/* «Статьи» на дашборде: «Сумма» и «% от выручки» стоят рядом (владелец, 21 октября 2026) — статья, сумма, доля и изменение
   по содержимому, свободное место забирает колонка прошлого периода. */
table.articles td:nth-child(-n+3), table.articles th:nth-child(-n+3), table.articles td:nth-child(5), table.articles th:nth-child(5) {
  width: 1%; white-space: nowrap; }
table.articles th:nth-child(3), table.articles td:nth-child(3) { padding-left: 24px; }
tr.total td { font-weight: 600; }
tr.part td:first-child { padding-left: 24px; color: var(--text-secondary); }
tr.muted td { color: var(--text-secondary); }
tr.sub td { color: var(--text-muted); font-size: 13px; }
tr.sub td:first-child { padding-left: 40px; }
tbody tr:last-child td { border-bottom: 0; }
td .sub { color: var(--text-muted); font-size: 12px; }
.name { max-width: 420px; }

.mark { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: 4px; border: 1px solid; white-space: nowrap; }
.mark.bad { border-color: var(--bad-border); background: var(--bad-bg); }
.mark.warn { border-color: var(--warn-border); background: var(--warn-bg); }
.mark.good { border-color: var(--good-border); background: var(--good-bg); }
.mark.info { border-color: var(--border); color: var(--text-secondary); }
td:has(> .mark) { white-space: nowrap; }
.mark + .mark, .mark + button { margin-left: 8px; }
td > button { height: 24px; padding: 0 8px; font-size: 12px; }

.thumb { display: block; border-radius: 6px; object-fit: cover; background: var(--grid); }
td:has(> .thumb) { width: 1%; padding-right: 0; }
input.cost { width: 120px; height: 34px; text-align: right; font: inherit; color: var(--text-primary);
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; }
input.cost:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Настройки: магазины и ключи */
.form { display: grid; gap: var(--space-3); max-width: 520px; }
.form-group { display: grid; gap: var(--space-3); }   /* группа полей внутри формы (поля маркетплейса и т. п.) */
.field { display: grid; gap: var(--space-1); }
.field > span { color: var(--text-secondary); font-size: 12px; line-height: var(--lh-tight); }
.field small { color: var(--text-muted); font-size: 12px; line-height: var(--lh-text); }
/* Подсказка под полями или блоком: мелко, свободный интервал, без внешних отступов браузера. */
.hint { color: var(--text-secondary); font-size: 12px; line-height: var(--lh-text); margin: 0; }
/* Поиск и числа — как обычные поля (без этого у «Поиска» и «Порога» в РНП текст лип к краю; владелец, 21 октября 2026). */
input[type="text"], input[type="password"], input[type="search"], input[type="number"] {
  font: inherit; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; height: 34px; width: 100%;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea.rules { font: inherit; color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; width: 100%; resize: vertical; min-height: 84px; box-sizing: border-box; }
textarea.rules:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
:root[data-theme="dark"] textarea.rules { background: rgb(255 255 255 / .07); border-color: rgb(255 255 255 / .16); box-shadow: inset 0 1px 0 rgb(255 255 255 / .14); }
:root[data-theme="light"] textarea.rules { background: rgb(255 255 255 / .7); border-color: rgb(15 23 42 / .14); }
:root[data-glass="off"] textarea.rules { background: var(--surface-1); border-color: var(--border); box-shadow: none; }
.rules-form { max-width: 720px; }
/* Кнопки в любом блоке действий — с промежутком и переносом, а не вплотную (владелец, 21 октября 2026: «кнопки слиплись»). */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form .actions { display: flex; gap: 8px; align-items: center; }
.store-name { font-weight: 600; }
.paths { color: var(--text-secondary); font-size: 12px; display: grid; gap: 4px; }
.cost-cell { white-space: nowrap; width: 1%; }
.cost-wrap { position: relative; display: inline-block; }
.cost-wrap input.cost { padding-right: 28px; }
.cost-wrap .unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.save-status { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 2px; min-height: 16px; }
.save-status.bad { color: var(--bad-border); font-weight: 600; }

.legend { display: flex; gap: 16px; color: var(--text-secondary); font-size: 12px; margin-bottom: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; }
.chart svg { display: block; width: 100%; }
.anim-num { font-variant-numeric: tabular-nums; }
.chart text { fill: var(--text-muted); font-size: 11px; }
.chart .grid { stroke: var(--grid); }
.chart .zero { stroke: var(--text-muted); }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--text-muted); fill-opacity: .1; }
.tooltip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; font-size: 12px;
  box-shadow: 0 4px 14px rgb(0 0 0 / .18); font-variant-numeric: tabular-nums;
  width: max-content; white-space: nowrap;   /* у края окна не сжимается и не переносит строки (владелец, 21 октября 2026: «всё съехало») */
}
.tooltip b { display: block; margin-bottom: 2px; }
.tooltip div { display: flex; justify-content: space-between; gap: 16px; }
.tooltip div > span { white-space: nowrap; }
.tooltip div > span:last-child { margin-left: auto; text-align: right; }   /* цифры — ровно по правому краю (владелец, 21 октября 2026) */

.empty { text-align: center; padding: 48px 16px; color: var(--text-secondary); }
.empty .actions { justify-content: center; margin-top: 24px; }   /* кнопка под текстом с воздухом (просьба владельца) */
.empty h2 { color: var(--text-primary); font-size: 22px; }
.empty code, code { background: var(--grid); padding: 2px 4px; border-radius: 4px; font-size: 12px; }
.empty ol { display: inline-block; text-align: left; margin: 12px 0 0; }

dialog {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface-1); color: var(--text-primary);
  padding: 20px; width: min(860px, 94vw); max-height: 88vh;
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
dialog h3 { font-size: 13px; margin: 16px 0 8px; }

