/*
 * Tutas — оформление кабинета и админки (макет «Coral», 19.10.2026).
 * Светлый холст, белые панели с крупным скруглением без рамок, чёрные кнопки-капсулы,
 * коралловый акцент для главного действия и счётчиков. Памятка — docs/design.md.
 * Файл подключается из layouts/app.blade.php с версией по содержимому (?v=…), nginx отдаёт его с годовым кэшем.
 */

/* Onest — переменный шрифт: один файл на алфавит покрывает начертания 400–700. */
@font-face { font-family: 'Onest'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/onest-cyrillic.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: 400 700; font-display: swap; src: url(/fonts/onest-latin.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 {
    --canvas: #f6f6f5;          /* фон страницы */
    --paper: #fff;              /* панели, таблицы, поля */
    --soft: #f1f1f0;            /* наведение, вторичные плашки */
    --ink: #111;                /* основной текст */
    --muted: #737373;           /* подписи, пояснения */
    --line: #ebebea;            /* разделители */
    --line-ctl: #e2e2e0;        /* рамки полей и второстепенных кнопок */
    --dark: #101010;            /* основные кнопки, активный пункт меню */
    --dark-hover: #2b2b2b;
    --coral: #df624a;           /* главное действие страницы, счётчики, графики */
    --coral-hover: #c8513a;
    --coral-ink: #b2412c;       /* ссылки и коралловый текст (контраст ≥ 4.5:1) */
    --coral-soft: #fbece7;
    --coral-softest: #fcf6f3;
    --ok: #317759;   --ok-soft: #eef7f1;
    --warn: #a15c37; --warn-soft: #fcf0e9;
    --bad: #b6483e;  --bad-soft: #ffefec;
    --r-panel: 24px;            /* карточки, таблицы, меню */
    --r-inner: 16px;            /* плашки внутри карточек */
    --r-ctl: 12px;              /* поля ввода */
    --sidebar: 232px;
    /* Единая шкала отступов (кратно 4): внутри строк — 8–12, между блоками — 16, внутри карточек — 24, между
       разделами страницы — 32. Новых чисел в отступах не вводить. */
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
    /* Прежние имена — на них опираются стили отдельных экранов. */
    --ink-soft: #4a4a4a; --ink-faint: var(--muted); --hover: var(--soft); --sunken: var(--canvas); --seg: var(--soft);
    --btn: var(--dark); --btn-hover: var(--dark-hover); --link: var(--coral-ink);
    --danger: var(--bad); --danger-soft: var(--bad-soft); --blue-soft: var(--coral-softest);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 'Onest', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: var(--coral-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--coral-hover); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--soft); border-radius: 6px; padding: 1px 6px; }
svg.ic { width: 18px; height: 18px; flex-shrink: 0; }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

/* ---------- Каркас: шапка во всю ширину, меню-панель слева, страница справа ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--dark); color: #fff; font-size: 19px; font-weight: 600; letter-spacing: -1px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 19px; font-weight: 600; letter-spacing: -.6px; }
.brand-text span { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.who { display: flex; align-items: center; gap: 10px; }
.who form { margin: 0; }
.me { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; color: var(--ink); text-decoration: none; }
.me:hover, .me.active { background: var(--paper); color: var(--ink); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--coral-soft); color: var(--ink); font-size: 12px; font-weight: 600; border: 2px solid var(--paper); }
.me-text { display: flex; flex-direction: column; line-height: 1.3; }
.me-name { font-size: 12.5px; font-weight: 500; }
.me-role { font-size: 11.5px; color: var(--muted); }

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); gap: 20px; padding: 0 28px 40px; align-items: start; }
.sidebar { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin; padding: 8px; background: var(--paper); border-radius: var(--r-panel); }
.nav-toggle { display: none; }
.nav-group + .nav-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.nav-group-title { padding: 10px 12px 6px; color: var(--muted); font-size: 11px; font-weight: 500; }
.nav-link { position: relative; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; margin-bottom: 2px; border-radius: 14px; color: #555; font-size: 13px; font-weight: 500; text-decoration: none; }
.nav-link:hover { background: var(--soft); color: var(--ink); }
.nav-link.active { background: var(--dark); color: #fff; }
.nav-link.active:hover { color: #fff; }
/* Пункт «Диалоги» со счётчиком и вторым уровнем (livewire/nav/chat-menu). */
.nav-parent { padding-right: 6px; }
.nav-parent-link { display: flex; align-items: center; gap: 10px; flex: 1; align-self: stretch; color: inherit; text-decoration: none; }
.nav-parent-link:hover { color: inherit; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--coral-soft); color: var(--coral-ink); font-size: 11px; font-weight: 600; line-height: 20px; text-align: center; flex-shrink: 0; }
.nav-link.active .nav-badge { background: var(--coral); color: #fff; }
.nav-caret { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: inherit; opacity: .7; }
.nav-caret:hover { background: rgba(127,127,127,.15); color: inherit; opacity: 1; }
.nav-caret svg { width: 16px; height: 16px; transition: transform .15s; }
.nav-sub { margin: 2px 0 6px 21px; padding-left: 10px; border-left: 1px solid var(--line); }
.nav-sublink { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 0 8px 0 10px; border-radius: 10px; color: #555; font-size: 12.5px; text-decoration: none; }
.nav-sublink span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sublink:hover { background: var(--soft); color: var(--ink); }
.nav-sublink.active { background: var(--coral-softest); color: var(--ink); font-weight: 600; }

/* Пока Livewire обновляет отчёт, он приглушён: видно, что запрос идёт. */
.is-loading { opacity: .5; cursor: progress; transition: opacity .15s; }
#nprogress .bar { background: var(--coral) !important; height: 3px !important; }

/* ---------- Страница ---------- */
main { min-width: 0; max-width: 1240px; padding-top: 4px; }
main.wide { max-width: none; }
.crumbs { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 400; letter-spacing: -1.2px; margin: 0 0 var(--s5); }
h2 { font-size: 16px; line-height: 1.4; font-weight: 500; letter-spacing: -.3px; margin: var(--s6) 0 var(--s3); }
h3 { font-size: 14px; font-weight: 500; margin: var(--s5) 0 var(--s2); }
.card > h2:first-child, .card > h3:first-child, .card > form > h2:first-child { margin-top: 0; }
p { margin: 0 0 var(--s3); }
.muted { color: var(--muted); font-size: 12.5px; }
.card { background: var(--paper); border-radius: var(--r-panel); padding: var(--s5); margin-bottom: var(--s4); }
.inset { background: var(--canvas); border-radius: var(--r-inner); padding: var(--s3) var(--s4); font-size: 12.5px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); }
/* Поля в сетке разделяет промежуток сетки, а не отступ подписи: и в строку, и в столбик на телефоне — по 16. */
.grid > div > label:first-child { margin-top: 0; }
.grid:has(> .card) { margin-bottom: var(--s4); }
.grid > .card { margin-bottom: 0; }
.card > .grid + p.muted { margin: var(--s3) 0 0; }
.scroll-x { overflow-x: auto; margin-bottom: var(--s4); }
.scroll-x > table { margin-bottom: 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Таблицы: белая панель, заголовки на холсте ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--paper); border-radius: var(--r-panel); font-size: 13px; line-height: 1.5; margin-bottom: var(--s4); overflow: hidden; }
/* Середина по высоте: кнопки и метки в строке стоят вровень с текстом. */
th, td { text-align: left; padding: 14px var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; color: var(--muted); font-weight: 400; background: var(--paper); }
thead th { padding-top: var(--s4); padding-bottom: var(--s3); }
tbody tr:last-child > td, tfoot tr:last-child > td, table > tr:last-child > td { border-bottom: 0; }
tbody tr:hover > td { background: var(--coral-softest); }
tfoot td { font-weight: 600; background: var(--canvas); }
.card table { margin-bottom: 0; border-radius: var(--r-inner); }
.card table th { background: var(--canvas); }
/* Широкие отчёты: столбцов много, поэтому чуть уже по бокам, но строки так же свободны по высоте. */
main.wide th, main.wide td { padding: var(--s3) 14px; font-size: 12.5px; }
main.wide table[data-sources] td, main.wide table[data-by-source] td { white-space: nowrap; }
main.wide thead th { white-space: nowrap; }
.nowrap { white-space: nowrap; }
/* Таблица «показатель — значение» (Итого за период): не растягивается на весь экран, значение у подписи. */
table[data-totals] { max-width: 760px; }
table[data-totals] td:last-child { text-align: right; font-weight: 500; white-space: nowrap; }

/* ---------- Формы ---------- */
label { display: block; font-weight: 400; color: var(--muted); margin: var(--s4) 0 var(--s2); font-size: 12.5px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); margin: 6px 18px 6px 0; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], input[type=tel], select, textarea {
    width: 100%; min-height: 40px; padding: 9px 13px; border: 1px solid var(--line-ctl); border-radius: var(--r-ctl); font: inherit; font-size: 13.5px; color: var(--ink); background: var(--paper);
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 3px rgba(223,98,74,.14); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--canvas); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--dark); }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--canvas); }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s5); }
/* Первое поле карточки — без верхнего отступа: сверху уже есть отступ карточки или заголовок. */
:is(.card, form.card, .card > form) > label:first-child,
:is(.card, form.card, .card > form) > :is(h2, h3) + label,
:is(.card, form.card, .card > form) > :is(h2, h3) + p + label { margin-top: 0; }
/* Сетка полей после текста или поля — с тем же отступом, что поле. */
:is(.card, form.card, .card > form) > :is(input, select, textarea, p, .muted, div:not(.grid)) + .grid { margin-top: var(--s4); }
/* Одиночное поле вне сетки не растягивается на весь экран. */
:is(.card, form.card, .card > form) > :is(input:not([type=checkbox]):not([type=radio]), select) { max-width: 560px; }
/* Галочка с подписью: в одну строку, с промежутком. */
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { display: flex; align-items: center; gap: var(--s2); color: var(--ink); font-size: 13px; }
textarea.code { min-height: 0; }

/* ---------- Кнопки: чёрная капсула; .accent — коралловая (одна на экран); .secondary — белая с рамкой ---------- */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 18px; border: 1px solid var(--dark); border-radius: 999px; background: var(--dark); color: #fff; font: inherit; font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s, color .15s; }
button:hover, .button:hover { background: var(--dark-hover); border-color: var(--dark-hover); color: #fff; }
button.accent, .button.accent { background: var(--coral); border-color: var(--coral); }
button.accent:hover, .button.accent:hover { background: var(--coral-hover); border-color: var(--coral-hover); }
button.secondary, .button.secondary { background: var(--paper); color: var(--ink); border-color: var(--line-ctl); }
button.secondary:hover, .button.secondary:hover { background: var(--soft); color: var(--ink); border-color: var(--line-ctl); }
button.danger { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-soft); }
button.danger:hover { background: #fde2dd; color: var(--bad); border-color: #fde2dd; }
button.small, .button.small { height: 30px; padding: 0 13px; font-size: 12px; }
button[disabled] { opacity: .5; cursor: not-allowed; }
/* Переключатель вариантов (периоды, вкладки отчёта): белая капсула, выбранный — чёрный. */
.seg-tabs, .srv-periods, .wa-filters { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: var(--paper); border-radius: 999px; }
.seg-tabs { margin-bottom: var(--s4); }
.srv-periods { margin-bottom: var(--s4); }
:is(.seg-tabs, .srv-periods, .wa-filters) button { height: 32px; padding: 0 14px; background: transparent; border-color: transparent; color: var(--muted); font-size: 12.5px; }
:is(.seg-tabs, .srv-periods, .wa-filters) button:hover { background: var(--soft); color: var(--ink); border-color: transparent; }
:is(.seg-tabs, .srv-periods, .wa-filters) button.active { background: var(--dark); color: #fff; border-color: var(--dark); }
/* Быстрый выбор периода — отдельные маленькие капсулы. */
.presets { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }

/* ---------- Сообщения и метки ---------- */
.error { color: var(--bad); font-size: 12.5px; margin-top: 5px; }
p.ok, .notice { color: var(--ok); background: var(--ok-soft); padding: 11px 15px; border-radius: var(--r-inner); font-size: 13px; }
.notice { margin-bottom: var(--s4); }
.secret { background: var(--warn-soft); border-radius: var(--r-panel); padding: var(--s5); margin-bottom: var(--s4); }
.secret code { display: block; word-break: break-all; background: var(--paper); border-radius: var(--r-ctl); padding: 9px 12px; margin: 6px 0 12px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 500; line-height: 1.45; white-space: nowrap; background: var(--soft); color: #444; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.off, .badge.bad { background: var(--bad-soft); color: var(--bad); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--coral); color: #fff; font-size: 11px; font-weight: 600; line-height: 20px; text-align: center; }

/* ---------- Показатели и графики (Посещаемость, Загрузка сервера) ---------- */
.kpis, .srv-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.kpi, .srv-card { background: var(--paper); border-radius: 20px; padding: var(--s4) var(--s5); display: flex; flex-direction: column; gap: 4px; }
.kpi > span:first-child, .srv-card .k { color: var(--muted); font-size: 12px; }
.kpi b, .srv-card .v { font-size: 28px; font-weight: 400; letter-spacing: -1px; line-height: 1.15; }
.srv-card .s { font-size: 12px; color: var(--muted); }
.srv-card.warn .v { color: var(--warn); } .srv-card.bad .v { color: var(--bad); }
.delta { font-size: 12px; color: var(--muted); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--coral); }
.chart .bar:hover { fill: var(--coral-hover); }
.chart .prev-line { fill: none; stroke: #b5b5b5; stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .grid-line { stroke: var(--line); }
.chart .axis { font-size: 10px; fill: var(--muted); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin: 0 4px 0 10px; }
.legend .sw.bar { background: var(--coral); }
.legend .sw.prev { border-top: 2px dashed #b5b5b5; height: 0; border-radius: 0; vertical-align: 3px; }
.traffic-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(540px, 1fr)); gap: 0 var(--s4); }
table[data-traffic] td, table[data-traffic] th { white-space: nowrap; }
table[data-traffic] td:first-child { white-space: normal; }
.share-cell { position: relative; min-width: 90px; }
.share-cell .share-bar { position: absolute; left: 0; top: 22%; bottom: 22%; background: var(--coral-soft); border-radius: 6px; max-width: 100%; }
.share-cell span:last-child { position: relative; }
td.path { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: var(--s4); }
.srv-chart { margin: 0; }
.srv-chart-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.srv-chart-head .muted { font-weight: 400; font-size: 12px; }
.srv-chart svg { width: 100%; height: 120px; display: block; }
.srv-chart .grid { stroke: var(--line); stroke-width: 1; }
.srv-chart path { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.srv-chart .line { stroke: var(--coral); } .srv-chart .green { stroke: var(--ok); } .srv-chart .orange { stroke: #d98a3d; } .srv-chart .red { stroke: var(--bad); }
.srv-scale { font-size: 11px; margin-top: 2px; }

/* ---------- Статистика сайтов: список и страница сайта, как в Яндекс.Метрике (reports/site-list, reports/site) ---------- */
/* Цвета линий и долей по порядку строк: t1 — коралловый, t7 — прошлый период. */
.t1 { --tone: var(--coral); } .t2 { --tone: #3b7dd8; } .t3 { --tone: #2f9e6e; } .t4 { --tone: #e0a030; }
.t5 { --tone: #8b5cc4; } .t6 { --tone: #2a9dae; } .t7 { --tone: #b5b5b5; }
i.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--tone); margin-right: 8px; vertical-align: -1px; flex-shrink: 0; }
i.sw.dashed { height: 0; border-top: 2px dashed var(--tone); background: none; border-radius: 0; vertical-align: 3px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.page-head h1 { margin: 0; }
.page-tools { display: flex; gap: 8px; align-items: center; }
.page-tools input[type=search] { width: 300px; border-radius: 999px; }
th.num, td.num { text-align: right; white-space: nowrap; }
.sites-table td { vertical-align: middle; }
.sites-table .sub-head th { padding-top: 0; font-size: 11px; color: var(--muted); }
.sites-table tr.off { opacity: .55; }
.sites-table td.num b { font-size: 16px; font-weight: 500; }
.site-cell { display: flex; gap: 12px; align-items: flex-start; min-width: 260px; }
.site-name { font-size: 14.5px; font-weight: 500; color: var(--ink); text-decoration: none; }
.site-name:hover { color: var(--coral-ink); text-decoration: underline; }
.site-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.status-ok { color: var(--ok); } .status-warn { color: var(--warn); } .status-off { color: var(--bad); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--muted); }
.status-dot.ok { background: #3fb67b; box-shadow: 0 0 0 3px var(--ok-soft); } .status-dot.warn { background: #e0a030; box-shadow: 0 0 0 3px var(--warn-soft); } .status-dot.off { background: var(--bad); }
.live { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 600; text-align: center; }
.spark-col { width: 140px; }
svg.spark { width: 120px; height: 32px; display: block; }
svg.spark polyline { fill: none; stroke: var(--coral); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
svg.spark.wide { width: 100%; height: 48px; margin: 6px 0; }

.site-head { margin-bottom: var(--s5); }
.back-link { font-size: 12.5px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }
.site-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.site-title h1 { margin: 0; }
.site-domains { margin: 4px 0 0; }
.report-tabs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: var(--s1); margin-bottom: var(--s4); background: var(--paper); border-radius: 18px; }
.report-tabs button, .report-tabs a { height: 36px; padding: 0 15px; border: 0; border-radius: 14px; background: transparent; color: #555; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; text-decoration: none; }
.report-tabs button:hover, .report-tabs a:hover { background: var(--soft); color: var(--ink); }
.report-tabs button.active { background: var(--dark); color: #fff; }
.report-tabs a { color: var(--muted); font-weight: 400; }
.section-tabs a { color: #555; font-weight: 500; }
.section-tabs a.active { background: var(--dark); color: #fff; }
.section-tabs a.active:hover { color: #fff; }
details.snippet { margin-top: 6px; font-size: 12px; }
details.snippet summary { cursor: pointer; color: var(--coral-ink); }
details.snippet textarea { min-height: 60px; margin: 6px 0; min-width: 260px; }
.tabs-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.period-bar { display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
.period-bar .seg-tabs { margin: 0; }
.period-dates { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.period-dates input[type=date] { width: 150px; min-height: 36px; padding: 6px 10px; border-radius: 999px; }

.widgets { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.widget { background: var(--paper); border-radius: var(--r-panel); padding: var(--s5); min-width: 0; }
.widget.w-4 { grid-column: span 4; } .widget.w-6 { grid-column: span 6; } .widget.w-8 { grid-column: span 8; }
.widget > header { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s4); }
.widget > header h2 { margin: 0; font-size: 15px; }
button.link { height: auto; padding: 0; border: 0; background: none; color: var(--coral-ink); font-size: 12.5px; font-weight: 400; }
button.link:hover { background: none; color: var(--coral-hover); text-decoration: underline; }
.metric-switch { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.metric-switch .metric { flex: 1 1 140px; height: auto; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-inner); background: var(--paper); color: var(--ink); text-align: left; }
.metric-switch .metric:hover { background: var(--coral-softest); color: var(--ink); border-color: var(--line); }
.metric-switch .metric.active { border-color: var(--coral); background: var(--coral-softest); box-shadow: inset 0 -3px 0 var(--coral); }
.metric-switch .metric span:first-child { color: var(--muted); font-size: 12px; font-weight: 400; }
.metric-switch .metric b { font-size: 24px; font-weight: 400; letter-spacing: -.8px; }
.line-chart .line { fill: none; stroke: var(--tone); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.line-chart .line.dashed { stroke-width: 1.5; stroke-dasharray: 5 4; }
.line-chart .area { fill: var(--tone); opacity: .1; }
.line-chart .dot { fill: var(--paper); stroke: var(--tone); stroke-width: 1.8; }
.line-chart .axis { font-size: 12.5px; }
.line-chart .hover-band { fill: transparent; }
.line-chart .hover-band:hover { fill: rgba(0,0,0,.035); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-legend span { display: inline-flex; align-items: center; }
.big-number { display: flex; align-items: center; gap: 10px; font-size: 44px; font-weight: 300; letter-spacing: -1.6px; line-height: 1.1; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #3fb67b; box-shadow: 0 0 0 4px var(--ok-soft); animation: live 2s infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 7px rgba(63,182,123,.12); } }
.mini-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; }
.mini-list li { display: flex; justify-content: space-between; gap: var(--s2); padding: var(--s2) 0; border-top: 1px solid var(--line); }
.mini-list .path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leads-box { margin-top: var(--s4); padding: var(--s3) var(--s4); background: var(--coral-softest); border-radius: var(--r-inner); font-size: 12.5px; }
.leads-head { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.leads-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 2px 0; }
.leads-row b { font-size: 26px; font-weight: 400; letter-spacing: -.8px; }
.stat-row { display: flex; align-items: baseline; gap: 10px; }
.stat-row b { font-size: 30px; font-weight: 400; letter-spacing: -1px; }
.stat-widget p { margin: 0; }
.stack-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--soft); margin: 4px 0 12px; }
.stack-bar span { background: var(--tone); }
.stack-bar span + span { border-left: 2px solid var(--paper); }
table.compact th, table.compact td { padding: 8px 10px; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
svg.donut { width: 150px; height: 150px; flex-shrink: 0; }
.donut-bg { fill: none; stroke: var(--soft); stroke-width: 6; }
.donut-seg { fill: none; stroke: var(--tone); stroke-width: 6; }
.donut-center { font-size: 6px; fill: var(--ink); }
.legend-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; font-size: 13px; }
.legend-list li { display: flex; align-items: center; gap: var(--s1); padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.legend-list li span { flex: 1; }
.bar-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.bar-list li { position: relative; display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); margin-bottom: var(--s1); border-radius: 10px; overflow: hidden; }
.bar-list .bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--coral-softest); z-index: 0; }
.bar-list li > :not(.bar-fill) { position: relative; }
.bar-list .bar-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-list .muted { width: 44px; text-align: right; }
.report-chart { padding-bottom: var(--s5); }
.report-table .lead-cell { background: var(--coral-softest); }
.report-table tr.totals td { background: var(--canvas); font-weight: 600; }
.report-table .label-cell { white-space: normal; }
.report-table tr.open > td { background: var(--coral-softest); }
.report-table tr.child td:first-child { padding-left: 52px; color: #444; }
.report-table tr.child td { font-size: 12px; }
.tree-toggle { width: 22px; height: 22px; padding: 0; margin-right: 8px; border: 1px solid var(--line-ctl); border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 14px; line-height: 1; }
.tree-toggle:hover { background: var(--soft); color: var(--ink); border-color: var(--line-ctl); }
@media (max-width: 1199px) {
    .widget.w-4, .widget.w-6, .widget.w-8 { grid-column: span 6; }
    .widget.w-8 { grid-column: span 12; }
}
@media (max-width: 767px) {
    .widget.w-4, .widget.w-6, .widget.w-8 { grid-column: span 12; }
    .page-tools, .page-tools input[type=search] { width: 100%; }
    .spark-col { display: none; }
    /* Вкладки отчётов и периоды — одной строкой с прокруткой, а не столбиком. */
    .report-tabs, .period-bar .seg-tabs, .site-page .seg-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
    .report-tabs > *, .site-page .seg-tabs button { flex-shrink: 0; }
}

/* ---------- Страница сайта: узкая чёрная колонка и шапка с обоями (layouts/rail, reports/site, App\Support\Wallpaper) ---------- */
.rail-body { background: #f3f3f1; }
.rail-app { display: grid; grid-template-columns: 92px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: none; background: #000; color: #8f8f8f; display: flex; flex-direction: column; align-items: center; gap: var(--s1); padding: var(--s5) 0 var(--s4); }
.rail-logo { width: 40px; height: 40px; border: 1.5px solid #fff; border-radius: 10px; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 19px; text-decoration: none; margin-bottom: var(--s5); flex-shrink: 0; }
.rail-logo:hover { color: #fff; }
.rail-link { width: 78px; padding: var(--s2) 0; display: flex; flex-direction: column; align-items: center; gap: 6px; color: inherit; text-decoration: none; font-size: 9.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; text-align: center; border-radius: 12px; flex-shrink: 0; }
.rail-link svg { width: 22px; height: 22px; }
.rail-link:hover, .rail-link.active { color: #fff; }
.rail-link.active { background: #1c1c1c; }
.rail-sep { width: 28px; height: 1px; background: #262626; margin: var(--s1) 0; flex-shrink: 0; }
.rail-foot { margin-top: auto; padding-top: var(--s4); display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.rail-foot form { margin: 0; }
.rail-me { width: 40px; height: 40px; border-radius: 12px; background: #f3d9cf; color: #9c3b1d; display: grid; place-items: center; font-weight: 700; font-size: 13px; text-decoration: none; }
.rail-out { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #8f8f8f; }
.rail-out:hover { background: #1c1c1c; border: 0; color: #fff; }
.rail-out svg { width: 20px; height: 20px; }
.rail-main { min-width: 0; max-width: none; padding: 0; }
.rail-chat { display: contents; }
.rail-link { position: relative; }
.rail-badge { position: absolute; top: 4px; right: 14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--coral); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; letter-spacing: 0; }
.rail-me.active { box-shadow: 0 0 0 2px #fff; }

.hero-page { --hp-up: #1f9d6b; --hp-down: #d6453a; font-size: 14px; }
.hero { position: relative; color: #fff; padding: 40px 48px 120px; background: #111; }
.hero .paint { position: absolute; inset: 0; overflow: hidden; }
.hero .paint svg { width: 100%; height: 100%; display: block; }
.hero .paint::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(0,0,0,.4) 0%, rgba(0,0,0,.12) 45%, rgba(0,0,0,0) 70%), linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,0) 50%, rgba(0,0,0,.2)); }
.hero > * { position: relative; }
.hero-top { z-index: 30; display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s5); }
.hero-head { position: relative; min-width: 0; }
.hero h1 { margin: 0; font-size: 38px; line-height: 1.15; font-weight: 700; letter-spacing: -1px; color: #fff; }
.hero .pick { display: inline-flex; align-items: center; gap: 10px; height: auto; padding: 0 0 2px; border: 0; border-bottom: 2px solid rgba(255,255,255,.75); border-radius: 0; background: none; color: #fff; font: inherit; font-weight: 400; letter-spacing: inherit; }
.hero .pick:hover { background: none; color: #fff; border-color: #fff; }
.hero .pick svg { width: 26px; height: 26px; }
.period-pop { position: absolute; left: 0; top: 56px; z-index: 40; padding: var(--s4); border-radius: 18px; background: #fff; color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.28); min-width: 460px; }
.period-pop .seg-tabs { margin-bottom: var(--s3); background: var(--canvas); }
.period-pop .muted { margin: var(--s3) 0 0; }
.hero-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: var(--s3); font-size: 13px; color: rgba(255,255,255,.82); }
.hero-sub a { color: rgba(255,255,255,.9); text-decoration: none; }
.hero-sub a:hover { color: #fff; text-decoration: underline; }
.hero-sub b { color: #fff; font-weight: 600; }
.live-tag { padding: 2px 9px; border-radius: 999px; background: rgba(31,157,107,.35); color: #fff; font-size: 12px; }
.live-tag.off { background: rgba(214,69,58,.45); }
.hero-actions { display: flex; gap: var(--s2); align-items: flex-start; flex-shrink: 0; }
.glass-btn { display: inline-flex; align-items: center; gap: var(--s2); height: 38px; padding: 0 var(--s4); border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.24); color: #fff; font: inherit; font-size: 13px; font-weight: 500; text-decoration: none; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); cursor: pointer; white-space: nowrap; }
.glass-btn:hover { background: rgba(255,255,255,.26); border-color: rgba(255,255,255,.34); color: #fff; }
.glass-btn svg { width: 15px; height: 15px; }
.wp-wrap { position: relative; }
.wp-panel { position: absolute; right: 0; top: 48px; z-index: 40; width: 580px; background: #fff; color: var(--ink); border-radius: 20px; padding: var(--s4); box-shadow: 0 20px 60px rgba(0,0,0,.28); }
.wp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--s3); }
.wp-head b { font-size: 16px; }
.wp-head span { font-size: 12px; color: var(--muted); }
.wp-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s3); }
.wp-kinds button { height: 30px; padding: 0 var(--s3); border: 0; border-radius: 999px; background: var(--canvas); color: var(--ink); font-size: 12.5px; }
.wp-kinds button:hover { background: var(--soft); color: var(--ink); border: 0; }
.wp-kinds button.on { background: #000; color: #fff; }
.wp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.wp-grid button { position: relative; height: auto; padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 7; background: #222; outline: 3px solid transparent; outline-offset: 2px; }
.wp-grid button:hover { border: 0; outline-color: var(--line-ctl); }
.wp-grid button.on { outline-color: #000; }
.wp-grid button svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wp-grid button span { position: absolute; left: 7px; bottom: 5px; font-size: 10.5px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.wp-actions { display: flex; gap: var(--s2); margin-top: var(--s4); }
.hero-tabs { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 30px 0 26px; }
.hero-tabs button { height: auto; padding: 0 0 6px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: rgba(255,255,255,.65); font-size: 18px; font-weight: 500; }
.hero-tabs button:hover { background: none; border: 0; border-bottom: 2px solid rgba(255,255,255,.4); color: #fff; }
.hero-tabs button.active { color: #fff; border-bottom-color: #fff; }
.kpi-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 20px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.hkpi { padding: 18px 22px; min-width: 0; }
.hkpi + .hkpi { border-left: 1px solid rgba(255,255,255,.18); }
.hkpi small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.8); }
.hkpi b { display: block; margin: var(--s1) 0 6px; font-size: 30px; font-weight: 700; letter-spacing: -.8px; line-height: 1.1; white-space: nowrap; }
.hero .chip { display: inline-flex; padding: 1px 7px; border-radius: 6px; background: rgba(255,255,255,.2); font-size: 11.5px; font-weight: 600; }

.board-wrap { position: relative; z-index: 2; margin-top: -84px; padding: 0 48px 48px; }
.board { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .95fr) minmax(0, .8fr); gap: 20px; align-items: start; }
.board .col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.board-single { display: grid; gap: 20px; }
.board-note { margin-top: var(--s4); }
.hcard { display: block; background: var(--paper); border-radius: 22px; padding: 22px 24px; color: var(--ink); text-decoration: none; text-align: left; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.06); }
a.hcard:hover, button.hcard:hover { color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 12px 32px rgba(0,0,0,.1); }
button.hcard { width: 100%; height: auto; border: 0; font: inherit; white-space: normal; cursor: pointer; }
button.hcard:hover { background: var(--paper); border: 0; }
.hcard h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.4px; display: flex; align-items: center; gap: var(--s2); }
.hcard-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.hero-page .n { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--canvas); border-radius: 6px; padding: 1px 7px; letter-spacing: 0; }
.soft-btn { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--canvas); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.soft-btn:hover { background: var(--soft); border: 0; color: var(--ink); }
.dark-btn { display: flex; align-items: center; justify-content: center; gap: var(--s2); width: 100%; height: 44px; border-radius: 12px; background: #000; color: #fff; font-weight: 600; text-decoration: none; }
.dark-btn:hover { background: #222; color: #fff; }
.dark-btn .n { background: #333; color: #fff; }
.hrow { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.hcard-head + .hrow { border-top: 0; }
.ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.ico svg { width: 20px; height: 20px; }
.hrow .name { flex: 1; min-width: 0; font-weight: 600; }
.hrow small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.hrow .val { text-align: right; font-weight: 700; white-space: nowrap; }
.hero-page .up { color: var(--hp-up); font-weight: 600; }
.hero-page .delta.up { color: var(--hp-up); } .hero-page .delta.down { color: var(--hp-down); }
.mini-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--canvas); }
.mini-seg button { height: 28px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; }
.mini-seg button:hover { background: var(--paper); border: 0; color: var(--ink); }
.mini-seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.quality { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); }
.quality small { display: block; color: var(--muted); font-size: 12px; }
.quality b { font-size: 20px; font-weight: 700; letter-spacing: -.4px; margin-right: 6px; }
.kv { display: flex; justify-content: space-between; padding: 13px 0; border-top: 1px solid var(--line); }
.hcard-head + .kv { border-top: 0; }
.kv b { font-weight: 700; }
.hero-page .alert { margin: var(--s3) 0; padding: 9px var(--s3); border-radius: 10px; background: #fdecea; color: #b2352b; font-size: 12.5px; font-weight: 500; }
.total-box { margin-top: var(--s3); background: var(--canvas); border-radius: 16px; padding: 14px; text-align: center; }
.total-box small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.total-box b { display: block; font-size: 24px; font-weight: 700; margin: 2px 0 var(--s1); letter-spacing: -.5px; }
.total-box .muted { display: block; margin-bottom: var(--s3); }
.total-box b + .dark-btn { margin-top: var(--s3); }
.now-card .big { display: flex; align-items: center; gap: 14px; }
.now-card .big > b { font-size: 46px; font-weight: 700; letter-spacing: -1.5px; line-height: 1; }
.now-card .big > span { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.3; }
.pulse { margin-left: auto; width: 96px; height: 82px; padding: 0; border: 0; border-radius: 14px; background: #fff7c2; color: #6b5a00; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11.5px; font-weight: 600; }
.pulse:hover { background: #fff1a0; border: 0; color: #6b5a00; }
.pulse svg { width: 46px; height: 22px; fill: none; stroke: #c9a400; stroke-width: 2; }
.hero-page .mini-list li { font-size: 13px; }
.action { display: flex; align-items: center; gap: 14px; }
.action .sq { width: 46px; height: 46px; border-radius: 12px; background: #000; color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.action .sq svg { width: 20px; height: 20px; }
.action b { font-size: 17px; font-weight: 700; line-height: 1.2; letter-spacing: -.3px; }
.short small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.short p { margin: 6px 0 var(--s2); font-weight: 700; line-height: 1.3; }
.short .inline { display: flex; gap: var(--s2); margin-top: var(--s3); }
.short .field { flex: 1; min-width: 0; background: var(--canvas); border-radius: 10px; padding: 9px var(--s3); font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.short .go { width: 38px; height: 38px; border-radius: 10px; background: #000; color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.board-single > .seg-tabs { justify-self: start; margin: 0; }
.board-single > .scroll-x { margin: 0; border-radius: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.06); }
.board-single > .scroll-x > table { border-radius: 22px; }
.board-single .kpis { margin: 0; }
.board-single .kpi, .board-single .card { border-radius: 22px; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.06); }
.board-single .traffic-split .card { margin-bottom: 0; }
.hero-page .back-link { font-size: 13px; }
@media (max-width: 1199px) {
    .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .board .col:last-child { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
    .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .hkpi:nth-child(4) { border-left: 0; }
    .hkpi:nth-child(n+4) { border-top: 1px solid rgba(255,255,255,.18); }
}
@media (max-width: 767px) {
    .rail-app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .rail { position: sticky; top: 0; z-index: 50; height: auto; flex-direction: row; justify-content: flex-start; padding: var(--s2) var(--s3); overflow-x: auto; gap: 2px; }
    .rail-logo { margin: 0 var(--s2) 0 0; width: 34px; height: 34px; }
    .rail-link { width: auto; min-width: 64px; padding: 6px var(--s1); }
    .rail-sep { width: 1px; height: 28px; margin: 0 var(--s1); }
    .rail-foot { flex-direction: row; margin: 0 0 0 auto; padding: 0 0 0 var(--s2); }
    .hero { padding: var(--s5) var(--s4) 96px; }
    .hero-top { flex-direction: column; }
    .hero h1 { font-size: 28px; }
    .period-pop { min-width: 0; width: calc(100vw - 32px); }
    .wp-panel { position: fixed; left: var(--s3); right: var(--s3); top: 120px; width: auto; }
    .wp-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 20px; scrollbar-width: none; }
    .hero-tabs button { font-size: 15px; flex-shrink: 0; }
    .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hkpi:nth-child(odd) { border-left: 0; }
    .hkpi:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.18); }
    .hkpi:nth-child(4) { border-left: 1px solid rgba(255,255,255,.18); }
    .hkpi b { font-size: 24px; }
    .board-wrap { padding: 0 var(--s4) var(--s5); margin-top: -64px; }
    .board, .board .col:last-child { grid-template-columns: minmax(0, 1fr); }
    .hcard { padding: 18px; border-radius: 18px; }
    .quality { grid-template-columns: 1fr 1fr; }
    .hrow { gap: var(--s3); }
    .hrow .val { white-space: normal; }
    .hrow .name small { display: none; }
    .hcard-head { flex-wrap: wrap; }
}

/* ---------- Все страницы в новом виде: полоса с обоями сверху, белый заголовок, карточки с тенью (layouts/app) ---------- */
:root { --shadow-card: 0 1px 2px rgba(0,0,0,.04), 0 8px 28px rgba(0,0,0,.06); }
.page-main { position: relative; }
.page-band { position: absolute; top: 0; left: 0; right: 0; height: 230px; overflow: hidden; background: #111; }
.page-band .paint { position: absolute; inset: 0; }
.page-band .paint svg { width: 100%; height: 100%; display: block; }
.page-band::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(0,0,0,.45) 0%, rgba(0,0,0,.15) 50%, rgba(0,0,0,.05) 100%), linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,.18)); }
.page-body { position: relative; padding: 36px 48px 48px; max-width: 1340px; }
.page-main.wide .page-body { max-width: none; }
.page-body > .crumbs { color: rgba(255,255,255,.75); font-size: 12.5px; margin: 0 0 var(--s1); }
.page-body h1 { color: #fff; font-size: 36px; line-height: 1.15; font-weight: 700; letter-spacing: -1px; margin: 0 0 28px; }
/* То, что стоит сразу под заголовком, лежит ещё на обоях — светлым. */
.page-body h1 + :is(p, .muted), .page-body h1 + p + h2, .page-body h1 + h2 { color: rgba(255,255,255,.9); }
.page-body h1 + p + h2, .page-body h1 + h2 { margin-top: var(--s5); }
.page-body .site-head :is(.back-link, .muted, .site-domains) { color: rgba(255,255,255,.85); }
.page-body .site-head .back-link:hover { color: #fff; }
.page-body .page-head { margin-bottom: var(--s5); }
.page-body h2 { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.page-body :is(.card, .kpi, .srv-card, .widget, .wa, .secret, .report-tabs, .seg-tabs, .srv-periods) { box-shadow: var(--shadow-card); }
.page-body :is(.card, .widget, .wa) { border-radius: 22px; }
.page-body table:not(.card table):not(.widget table) { box-shadow: var(--shadow-card); border-radius: 22px; }
.page-body .scroll-x { border-radius: 22px; }
.page-body .notice, .page-body p.ok { box-shadow: var(--shadow-card); }
@media (max-width: 767px) {
    .page-band { height: 190px; }
    .page-body { padding: var(--s5) var(--s4) var(--s5); }
    .page-body h1 { font-size: 28px; margin-bottom: var(--s5); }
}

/* ---------- Окно диалогов: список слева, переписка «пузырями» справа (как WhatsApp) ---------- */
.wa { --wa-out: #e7f6ec; --wa-bot: var(--coral-soft); --wa-line: var(--line); --wa-sub: var(--muted);
      display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 190px); min-height: 520px;
      border-radius: var(--r-panel); overflow: hidden; background: var(--paper); color: var(--ink); }
.wa-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--wa-line); }
.wa-side-head { padding: 14px 14px 10px; }
.wa-filters { background: var(--canvas); }
.wa-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.wa-item { display: flex; gap: 12px; align-items: center; width: 100%; height: auto; padding: 10px; margin-bottom: 2px; border: 0; border-radius: 16px;
           background: transparent; color: inherit; text-align: left; font-weight: 400; white-space: normal; cursor: pointer; }
.wa-item:hover { background: var(--soft); color: inherit; border: 0; }
.wa-item.current { background: var(--coral-softest); }
.wa-item-body { flex: 1; min-width: 0; }
.wa-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wa-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-time { font-size: 11.5px; color: var(--wa-sub); flex-shrink: 0; font-weight: 400; }
.wa-item.unread .wa-time { color: var(--coral-ink); }
.wa-sub { font-size: 12.5px; color: var(--wa-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.wa-badge { background: var(--coral); color: #fff; border-radius: 10px; min-width: 20px; padding: 0 6px; font-size: 11px; font-weight: 600; text-align: center; line-height: 20px; flex-shrink: 0; }
.wa-empty { padding: 24px 16px; color: var(--wa-sub); text-align: center; }
.wa-avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; font-weight: 600; font-size: 16px; }
.wa-avatar.anon { background: var(--soft) !important; color: #b0b0b0; }
.wa-avatar svg { width: 24px; height: 24px; fill: currentColor; }
.wa-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.wa-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--wa-line); min-height: 66px; }
.wa-head-text { flex: 1; min-width: 0; }
.wa-head-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-head-sub { font-size: 12.5px; color: var(--wa-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.wa-thread { flex: 1; overflow-y: auto; padding: 18px 6% 14px; display: flex; flex-direction: column; gap: 2px; background: var(--canvas); }
.wa-placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--paper); color: var(--wa-sub); text-align: center; padding: 24px; }
.wa-placeholder strong { color: var(--ink); font-size: 24px; font-weight: 400; letter-spacing: -.8px; }
.wa-day { align-self: center; margin: 10px 0 6px; padding: 4px 12px; border-radius: 999px; background: var(--paper); color: var(--muted); font-size: 11.5px; }
.wa-msg { position: relative; max-width: min(65%, 560px); margin-top: 6px; padding: 8px 12px 9px; border-radius: 16px; background: var(--paper);
          font-size: 14px; line-height: 19px; word-break: break-word; align-self: flex-start; border-top-left-radius: 4px; }
.wa-text { white-space: pre-wrap; }
.wa-msg.out { align-self: flex-end; background: var(--wa-out); border-top-left-radius: 16px; border-top-right-radius: 4px; }
.wa-msg.out.bot { background: var(--wa-bot); }
.wa-msg.system { align-self: center; background: var(--warn-soft); border-radius: 12px; font-size: 13px; }
.wa-by { font-size: 12px; font-weight: 500; margin-bottom: 2px; }
.wa-by.bot { color: var(--coral-ink); }
.wa-by.operator { color: var(--ok); }
.wa-attach { color: var(--wa-sub); font-size: 13px; }
.wa-meta { float: right; margin: 6px 0 -4px 12px; font-size: 11px; color: var(--wa-sub); white-space: nowrap; display: inline-flex; gap: 3px; align-items: center; }
.wa-ticks { font-size: 12px; letter-spacing: -3px; padding-right: 3px; }
.wa-ticks.read { color: #3b9edb; }
.wa-ticks.failed { color: var(--bad); letter-spacing: 0; }
.wa-fail { display: block; clear: both; color: var(--bad); font-size: 12px; margin-top: 4px; }
.wa-compose { display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--wa-line); }
.wa-compose textarea { flex: 1; resize: none; border: 1px solid var(--line-ctl); border-radius: 20px; padding: 10px 16px; font-size: 14px; line-height: 20px; max-height: 120px; min-height: 42px; background: var(--paper); }
.wa-send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--coral); color: #fff; padding: 0; flex-shrink: 0; }
.wa-send:hover { background: var(--coral-hover); color: #fff; }
.wa-send svg { width: 19px; height: 19px; fill: currentColor; }
.wa-note { padding: 12px 16px; border-top: 1px solid var(--wa-line); color: var(--wa-sub); text-align: center; font-size: 13px; margin: 0; }
.wa-main .error { margin: 8px 16px 0; }

/* ---------- Вход: слева о сервисе на холсте, справа форма на белой панели ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; min-height: 100vh; padding: 12px; }
.auth-hero { display: flex; flex-direction: column; padding: 32px 40px; }
.auth-hero h2 { font-size: 40px; line-height: 1.12; font-weight: 400; letter-spacing: -1.8px; margin: 48px 0 14px; max-width: 420px; }
.auth-hero .tagline { margin: 0; color: var(--muted); font-size: 14px; max-width: 360px; }
.auth-features { display: flex; flex-direction: column; max-width: 460px; margin: auto 0; }
.auth-feature { display: flex; gap: 14px; align-items: flex-start; padding: 16px 4px; border-bottom: 1px solid #e3e3e1; }
.auth-feature svg { color: var(--coral); margin-top: 1px; }
.auth-feature b { display: block; font-size: 13px; font-weight: 500; }
.auth-feature span { color: var(--muted); font-size: 12.5px; }
.auth-copy { color: var(--muted); font-size: 12px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--paper); border-radius: 32px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { margin-bottom: 6px; }
.auth-box .lead { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-box button[type=submit] { width: 100%; height: 44px; }

/* ---------- Узкие экраны ---------- */
@media (max-width: 1023px) {
    .topbar { padding: 14px 16px; }
    .app { grid-template-columns: 1fr; gap: 12px; padding: 0 16px 32px; }
    .sidebar { position: static; max-height: none; }
    .nav-toggle { display: inline-flex; height: 34px; padding: 0 14px; font-size: 12.5px; }
    .sidebar nav { display: none; }
    .sidebar.open nav { display: block; margin-top: 6px; }
    .sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 2px 12px; font-size: 13px; color: var(--muted); }
    .nav-group { display: flex; flex-wrap: wrap; gap: 4px; }
    .nav-group-title { flex-basis: 100%; padding: 6px 4px 2px; }
    .nav-link { min-height: 36px; padding: 0 12px; gap: 7px; font-size: 12.5px; margin: 0; }
    .nav-link svg.ic { width: 16px; height: 16px; }
    .nav-chat { display: contents; }
    .nav-sub { flex-basis: 100%; }
    h1 { font-size: 26px; }
    /* Широкие таблицы прокручиваются сами, а не растягивают страницу. */
    table { display: block; overflow-x: auto; }
    .wa { grid-template-columns: 1fr; height: auto; }
    .wa-side { max-height: 45vh; border-right: 0; border-bottom: 1px solid var(--wa-line); }
    .wa-main { min-height: 70vh; }
    .auth { grid-template-columns: 1fr; padding: 8px; }
    .auth-hero { display: none; }
}
@media (min-width: 1024px) { .sidebar-head { display: none; } }
@media (max-width: 639px) {
    .brand-text span, .me-text { display: none; }
    .card { padding: 18px; border-radius: 20px; }
}
