/* Панель «Директ-центр» — docs/ui-spec-panel.md. Mobile-first, без сборщика.
   Сырые цвета — только в блоке токенов; в компонентах только var(--…). */

:root {
    color-scheme: light;
    --bg: #FAFAFA;
    --surface: #FFFFFF;
    --surface-2: #F4F4F4;
    --border: #E4E4E4;
    --border-strong: #D0D0D0;
    --text: #171717;
    --text-2: #525252;
    --text-3: #6B6B6B;
    --accent: #2453FF;
    --green: #166534;
    --yellow: #8A5A00;
    --orange: #C2410C;
    --red: #B91C1C;
    --spark: #8A8A8A;
}

/* Тёмная тема: системная (если вручную не выбрана светлая) или выбранная вручную.
   Два одинаковых блока — цена отсутствия препроцессора. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0A0A0A;
        --surface: #141414;
        --surface-2: #1C1C1C;
        --border: #2A2A2A;
        --border-strong: #3A3A3A;
        --text: #EDEDED;
        --text-2: #A1A1A1;
        --text-3: #8A8A8A;
        --accent: #7AA2FF;
        --green: #3FB950;
        --yellow: #E3B341;
        --orange: #F0883E;
        --red: #F85149;
        --spark: #6B6B6B;
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0A0A0A;
    --surface: #141414;
    --surface-2: #1C1C1C;
    --border: #2A2A2A;
    --border-strong: #3A3A3A;
    --text: #EDEDED;
    --text-2: #A1A1A1;
    --text-3: #8A8A8A;
    --accent: #7AA2FF;
    --green: #3FB950;
    --yellow: #E3B341;
    --orange: #F0883E;
    --red: #F85149;
    --spark: #6B6B6B;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    /* Фокус не прячется под закреплёнными шапкой таблицы и «Итого». */
    scroll-padding: 72px 0 56px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font: 400 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-variant-numeric: tabular-nums;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a,
button,
select,
summary,
input {
    transition: color 120ms, background-color 120ms, border-color 120ms;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

h2 {
    margin: 24px 0 8px;
    font-size: 14px;
    font-weight: 500;
}

p {
    margin: 0;
}

abbr[title] {
    text-decoration: underline dotted var(--border-strong);
    text-underline-offset: 3px;
    cursor: help;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.muted,
.lbl,
.period-line {
    color: var(--text-2);
}

.lbl {
    font-size: 12px;
    font-weight: 500;
}

.period-line {
    font-size: 12px;
    margin-top: 4px;
}

.na {
    color: var(--text-3);
}

.tip {
    position: relative; /* выше растянутой ссылки строки — чтобы показалась подсказка */
    z-index: 1;
}

.tag {
    font-size: 12px;
    color: var(--text-2);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 0 4px;
    white-space: nowrap;
}

/* ---------- Шапка ---------- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-in {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 16px;
}

.brand {
    font-weight: 600;
    color: var(--text);
    margin-right: auto;
    padding: 12px 0;
}

.btn,
.theme button,
.sort-form select {
    font: inherit;
    font-size: 13px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
}

.btn:hover,
.theme button:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.btn-primary {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface);
}

.btn-primary:hover {
    background: var(--text-2);
}

.theme {
    display: flex;
}

.theme[hidden] {
    display: none;
}

/* На телефоне видна одна кнопка — текущая тема; нажатие листает (panel.js). */
.theme button[aria-pressed="false"] {
    display: none;
}

.logout-form {
    margin: 0;
}

/* ---------- Каркас страницы ---------- */

.content {
    max-width: 1440px;
    margin: 0 auto;
    padding: 16px;
}

.page-head {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.head-status {
    margin-top: 4px;
}

.crumbs {
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crumbs a {
    display: inline-block;
    padding: 13px 0;
}

.period {
    display: flex;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
}

.period a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 12px;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    border-left: 1px solid var(--border-strong);
}

.period a:first-child {
    border-left: 0;
}

.period a:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.period a[aria-current] {
    background: var(--text);
    color: var(--surface);
    font-weight: 500;
}

.period a:focus-visible {
    outline-offset: -3px;
}

/* ---------- Состояния ---------- */

.state,
.banner {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-2);
}

.state p + p {
    margin-top: 12px;
}

.state-error {
    border-color: var(--red);
    color: var(--text);
}

.state-actions {
    display: flex;
    gap: 8px;
}

.banner {
    border-color: var(--border-strong);
    color: var(--text);
    margin-bottom: 8px;
}

/* ---------- Статус и дельта ---------- */

.status {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-size: 12px;
    color: var(--text-3);
}

.glyph {
    flex: none;
    fill: currentColor;
    align-self: center;
}

.glyph .ring {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-dasharray: 2 1.5;
}

.glyph .ring-solid {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
}

.status-red {
    color: var(--red);
}

.status-orange {
    color: var(--orange);
}

.status-yellow {
    color: var(--yellow);
}

.status-green {
    color: var(--green);
}

.delta {
    display: block;
    font-size: 12px;
    white-space: nowrap;
}

.delta-good {
    color: var(--green);
}

.delta-bad {
    color: var(--red);
    font-weight: 600;
}

.delta-neutral,
.delta-none {
    color: var(--text-3);
}

.pending {
    color: var(--text-2);
    white-space: nowrap;
}

.pending-glyph {
    margin-left: 4px;
    vertical-align: -1px;
    position: relative;
    z-index: 1;
}

/* ---------- Алерты ---------- */

.alerts h2 {
    margin-top: 0;
}

.alert-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.alert {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    border-left: 3px solid transparent;
}

.alert:first-child {
    border-top: 0;
}

.alert-project {
    font-weight: 500;
    overflow-wrap: anywhere;
    display: inline-flex;
    align-items: center;
    min-height: 44px; /* зона касания на телефоне */
}

.alert-text,
.alert-time {
    grid-column: 1 / -1;
}

.alert-time {
    font-size: 12px;
    color: var(--text-2);
}

.edge-red {
    border-left-color: var(--red);
}

.edge-orange {
    border-left-color: var(--orange);
}

/* ---------- KPI ---------- */

.kpi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.kpi-cell {
    padding: 12px;
    min-width: 0;
    border: 0 solid var(--border);
    border-width: 0 1px 1px 0;
    margin: 0 -1px -1px 0;
}

.kpi-val {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
}

/* Телефон: сетка 2×3, «Показы» скрыты, порядок по важности. */
.kpi-impressions {
    display: none;
}

.kpi-cost {
    order: 1;
}

.kpi-leads {
    order: 2;
}

.kpi-cpl {
    order: 3;
}

.kpi-qual {
    order: 4;
}

.kpi-cpql {
    order: 5;
}

.kpi-clicks {
    order: 6;
}

/* ---------- Сортировка на телефоне ---------- */

.sort-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 8px;
    font-size: 13px;
    color: var(--text-2);
}

.sort-form select {
    flex: 1;
    min-width: 0;
    background: var(--surface);
}

/* ---------- Карточки кабинетов (телефон) ---------- */

.cabinets {
    display: none;
}

.cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.card {
    display: block;
    padding: 12px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    line-height: 1.35;
}

.card.edge-red {
    border-left-color: var(--red);
}

.card.edge-orange {
    border-left-color: var(--orange);
}

.card:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.card-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.card-name {
    font-size: 16px;
    font-weight: 600;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.chev {
    color: var(--text-3);
    font-size: 16px;
}

.card .sub {
    display: block;
    margin-top: 4px;
}

.card-grid {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.card-grid.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card-grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-grid > span {
    min-width: 0;
}

.card-grid .lbl,
.card-grid .v {
    display: block;
    white-space: nowrap;
}

.card-grid .v {
    font-size: 14px;
}

.card-grid.cols-3 .v {
    font-size: 16px;
}

.card-spark {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.card-spark .spark {
    flex: 1;
    min-width: 0;
    width: auto;
}

.spark-legend {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 28px;
    font-size: 12px;
    line-height: 12px;
    color: var(--text-2);
    white-space: nowrap;
}

.is-off {
    color: var(--text-2);
}

.is-stale .v,
.is-stale td,
.is-stale .step-val {
    color: var(--text-2);
}

/* ---------- Спарклайн и графики (цвета SVG — только здесь) ---------- */

.spark {
    display: block;
}

.spark-cost {
    fill: var(--spark);
}

.spark-leads {
    fill: var(--accent);
}

.spark .hollow {
    fill: none;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.spark-cost.hollow {
    stroke: var(--spark);
}

.spark-leads.hollow {
    stroke: var(--accent);
}

.charts {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 12px;
}

.chart-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 4px 8px;
    margin-bottom: 16px;
}

.chart-label {
    grid-column: 1 / -1;
    font-size: 12px;
    font-weight: 500;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    font-weight: 400;
    color: var(--text-2);
}

.legend li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chart-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 12px;
    line-height: 1;
    color: var(--text-2);
    white-space: nowrap;
}

.chart-plot {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
}

.chart {
    display: block;
    width: 100%;
    height: 96px;
    overflow: visible;
}

.chart * {
    vector-effect: non-scaling-stroke;
}

.chart .grid,
.chart .axis {
    fill: none;
    stroke: var(--border);
    stroke-width: 1;
}

.chart .axis {
    stroke: var(--border-strong);
}

.chart .hit {
    fill: transparent;
}

.bar-cost {
    fill: var(--spark);
}

.bar-cost.hollow {
    fill: none;
    stroke: var(--spark);
    stroke-width: 1.5;
}

.bar-leads {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.5;
}

.bar-leads.dashed {
    stroke-dasharray: 3 2;
}

.bar-qual {
    fill: var(--accent);
}

.bar-qual.pending {
    fill: url(#qual-hatch);
    stroke: var(--accent);
    stroke-width: 1;
    stroke-dasharray: 2 2;
}

.hatch {
    stroke: var(--accent);
    stroke-width: 1.5;
}

.legend .bar-qual.pending {
    fill: none;
}

.cpl-line,
.cpl-tick {
    fill: none;
    stroke: var(--text);
    stroke-width: 1.5;
}

.cpl-dot {
    fill: none;
    stroke: var(--text);
    stroke-width: 7;
    stroke-linecap: round;
}

.cpl-dot-hole {
    fill: none;
    stroke: var(--surface);
    stroke-width: 3.5;
    stroke-linecap: round;
}

.chart-days {
    display: grid;
    grid-template-columns: repeat(var(--days), minmax(0, 1fr));
    font-size: 12px;
    line-height: 1.2;
    color: var(--text-2);
    text-align: center;
}

.chart-days span {
    grid-row: 1;
    justify-self: center;
    white-space: nowrap;
}

.chart-note span {
    justify-self: end;
    color: var(--text-3);
    padding-bottom: 2px;
}

.chart-x {
    margin-bottom: 0;
}

.chart-x .chart-label {
    display: none;
}

/* ---------- Воронка проекта ---------- */

.funnel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.step {
    padding: 12px;
    min-width: 0;
    border: 0 solid var(--border);
    border-width: 0 1px 1px 0;
    margin: 0 -1px -1px 0;
    line-height: 1.35;
}

.step-val {
    font-size: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.step-cost {
    margin-top: 8px;
}

.step-cost .delta {
    display: inline;
    margin-left: 4px;
}

.conv {
    display: none;
}

.funnel-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 24px;
    margin-top: 12px;
}

.funnel-extra .delta {
    display: inline;
}

/* ---------- Таблицы данных ---------- */

.data {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 14px;
    line-height: 1.35;
}

.data th,
.data td {
    padding: 8px 12px;
    text-align: left;
    border-top: 1px solid var(--border);
    white-space: nowrap;
    font-weight: 400;
}

.data thead th {
    border-top: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
}

.data .num,
.cabinets .num {
    text-align: right;
}

/* Колонка названия забирает остаток ширины и обрезается — таблица не шире экрана. */
.data .col-name {
    width: 100%;
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal; /* телефон: название переносится, ≥ 768 — одна строка */
    overflow-wrap: anywhere;
}

.share {
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-bar {
    width: 120px;
    height: 6px;
    flex: none;
}

.share-bg {
    fill: var(--surface-2);
    stroke: var(--border-strong);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.share-fill {
    fill: var(--spark);
}

.share-num {
    min-width: 56px;
    text-align: right;
}

.daily {
    margin-top: 24px;
}

.daily summary {
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.daily summary::before {
    content: "▸";
    color: var(--text-3);
}

.daily[open] summary::before {
    content: "▾";
}

.daily summary::-webkit-details-marker {
    display: none;
}

.freshness {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.freshness li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
}

.fresh-source {
    font-weight: 500;
    min-width: 64px;
}

.table-note {
    margin-top: 8px;
    font-size: 12px;
}

.m-hide,
.w1024,
.w1200,
.w1360 {
    display: none;
}

/* ---------- Вход ---------- */

.login-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
    margin-top: 16px;
}

.login-form input {
    font: inherit;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
}

.login-form .btn {
    justify-content: center;
    margin-top: 8px;
}

/* ================= ≥ 768: таблица вместо карточек ================= */

@media (min-width: 768px) {
    h1 {
        font-size: 24px;
    }

    .content {
        padding: 24px;
    }

    .topbar-in {
        padding: 0 24px;
    }

    .btn,
    .theme button {
        min-height: 32px;
    }

    .theme button {
        border-radius: 0;
        margin-left: -1px;
    }

    .theme button[aria-pressed="false"] {
        display: block;
    }

    .theme button:first-child {
        border-radius: 6px 0 0 6px;
        margin-left: 0;
    }

    .theme button:last-child {
        border-radius: 0 6px 6px 0;
    }

    .theme button[aria-pressed="true"] {
        background: var(--text);
        border-color: var(--text);
        color: var(--surface);
    }

    .page-head {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 24px;
        margin-bottom: 24px;
    }

    .page-head > div {
        min-width: 0;
    }

    .period {
        flex: none;
    }

    .period a {
        min-height: 32px;
    }

    .crumbs a {
        padding: 0;
    }

    .alert {
        grid-template-columns: 120px minmax(120px, 220px) 1fr auto;
        gap: 12px;
        align-items: baseline;
    }

    .alert-text,
    .alert-time {
        grid-column: auto;
    }

    .alert-project {
        display: inline;
    }

    .kpi {
        grid-template-columns: repeat(4, 1fr);
        margin-top: 24px;
    }

    .kpi-cell,
    .kpi-impressions {
        display: block;
        order: 0;
    }

    .sort-form,
    .cards {
        display: none;
    }

    .m-hide {
        display: table-cell;
    }

    .data .col-name {
        white-space: nowrap;
    }

    /* Таблица кабинетов. Обёртки с overflow нет намеренно: иначе не закрепятся
       шапка и «Итого». Колонки, которые не помещаются, скрываются по ширине. */
    .cabinets {
        display: table;
        width: 100%;
        margin-top: 24px;
        border-collapse: separate;
        border-spacing: 0;
        font-size: 13px;
        line-height: 1.35;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
    }

    .cabinets th,
    .cabinets td {
        padding: 8px 12px;
        font-weight: 400;
        text-align: left;
        white-space: nowrap;
        vertical-align: top;
        border-top: 1px solid var(--border);
    }

    .cabinets tbody tr {
        position: relative;
        height: 48px;
    }

    .cabinets tbody tr:hover {
        background: var(--surface-2);
    }

    .cabinets thead th,
    .cabinets thead td {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--surface-2);
        border-top: 0;
        border-bottom: 1px solid var(--border-strong);
        font-size: 12px;
        font-weight: 500;
        color: var(--text-2);
        vertical-align: bottom;
    }

    .cabinets thead tr:first-child > :first-child {
        border-top-left-radius: 8px;
    }

    .cabinets thead tr:first-child > :last-child {
        border-top-right-radius: 8px;
    }

    .cabinets .groups {
        display: none;
    }

    .cabinets thead a {
        color: inherit;
        display: inline-flex;
        gap: 4px;
        padding: 4px 0;
    }

    .cabinets thead th[aria-sort] {
        color: var(--text);
    }

    .cabinets tbody tr:first-child > * {
        border-top: 0;
    }

    .cabinets tfoot th,
    .cabinets tfoot td {
        position: sticky;
        bottom: 0;
        z-index: 2;
        background: var(--surface-2);
        border-top: 1px solid var(--border-strong);
        font-weight: 500;
        vertical-align: middle;
        height: 40px;
    }

    .cabinets tfoot tr > :first-child {
        border-bottom-left-radius: 8px;
    }

    .cabinets tfoot tr > :last-child {
        border-bottom-right-radius: 8px;
    }

    .cabinets .col-name {
        width: 220px;
        max-width: 220px;
        border-left: 3px solid transparent;
    }

    .cabinets .edge-red .col-name {
        border-left-color: var(--red);
    }

    .cabinets .edge-orange .col-name {
        border-left-color: var(--orange);
    }

    .row-link {
        flex: 0 1 auto;
        min-width: 0;
        font-weight: 500;
        color: var(--text);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .row-link.is-off {
        color: var(--text-2);
    }

    /* Вся строка кликабельна: ссылка из первой ячейки растянута на строку. */
    .row-link::after {
        content: "";
        position: absolute;
        inset: 0;
    }

    .row-link:focus-visible {
        outline: none;
    }

    .row-link:focus-visible::after {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
    }

    .cabinets .name-line {
        display: flex;
        align-items: baseline;
        gap: 8px;
    }

    .cabinets .status {
        display: flex;
    }

    .cabinets .status-text {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cabinets thead th > abbr {
        display: inline-block;
        padding: 4px 0;
    }

    .cabinets .group-start {
        border-left: 1px solid var(--border);
    }

    .col-spark {
        width: 144px;
    }

    .cabinets td.col-spark {
        vertical-align: middle;
    }

    .funnel {
        grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    }

    .step {
        border-width: 0;
        margin: 0;
        padding: 16px;
    }

    .conv {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0 8px;
        min-width: 72px;
        border: 0 solid var(--border);
        border-width: 0 1px;
        background: var(--surface-2);
        line-height: 1.35;
        white-space: nowrap;
    }

    .conv-val {
        font-weight: 600;
    }

    .conv-arrow {
        color: var(--text-3);
    }

    .m-only {
        display: none;
    }

    .charts {
        padding: 16px;
    }

    .chart-row {
        grid-template-columns: 180px 56px minmax(0, 1fr);
        gap: 12px;
    }

    .chart-label {
        grid-column: auto;
    }

    .legend {
        flex-direction: column;
    }

    .chart {
        height: 120px;
    }

    .chart-x .chart-label {
        display: block;
    }

}

@media (min-width: 1024px) {
    .w1024 {
        display: table-cell;
    }
}

@media (min-width: 1200px) {
    .w1200 {
        display: table-cell;
    }

    .kpi {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 1360px) {
    .w1360 {
        display: table-cell;
    }

    /* Все 13 колонок на месте — можно показать строку групп. */
    .cabinets .groups {
        display: table-row;
    }

    .cabinets .groups th,
    .cabinets .groups td {
        height: 28px;
        padding-top: 4px;
        padding-bottom: 4px;
        border-bottom: 0;
        border-left: 1px solid var(--border);
        color: var(--text-3);
    }

    .cabinets .groups td {
        border-left: 0;
    }

    .cabinets .cols th {
        top: 28px;
    }

    .cabinets .cols th:first-child {
        border-top-left-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
