* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Цвета — только через эти токены: тёмная тема (ниже) переопределяет их, а не страницы.
       Светлая — по умолчанию; тёмная — html[data-theme="dark"] или системная, если тема не выбрана
       явно (переключатель в шапке, личная настройка theme). Выход в рынок, 03.10.2026. */
    color-scheme: light;
    --bg: #f7f6f3;
    --surface: #ffffff;
    --surface-2: #f5f5f8;
    --surface-3: #eeeef3;
    --border: #eceaf2;
    --border-strong: #dcd9e6;
    --text: #17171f;
    --text-mid: #5d5d72;
    --text-muted: #68687c;
    --nav-text: #3b3b4a;            /* пункты меню: тёмно-серый */
    --on-accent: #ffffff;           /* текст на заливке --primary / цветных кнопках */

    --primary: #5452e8;
    --primary-dark: #4340d4;
    --primary-soft: #ecebfd;

    --green: #0f9d6b;
    --green-soft: #e1f5ec;
    --red: #e0383e;
    --red-soft: #fdeaea;
    --amber: #d9820a;
    --amber-soft: #fdf2e0;
    --orange: #ea580c;
    --orange-soft: #ffedd5;
    --yellow-soft: #fff6c7;         /* подсветка «на грани», хайлайты */
    --ink-amber: #8a5a00;           /* тёмный текст на жёлтом */
    --ink-red: #b42323;             /* тёмный текст на красном фоне */
    --ink-green: #0f7a58;

    /* площадки — фирменные цвета */
    --mp-wb: #cb11ab;
    --mp-ozon: #005bff;
    --mp-ym: #fc2;

    /* у каждого раздела меню свой цвет иконки (палитра согласована 03.10.2026) */
    --c-alerts: #e5484d;
    --c-rnp: #5452e8;
    --c-plan: #0f9f8c;
    --c-market: #8b5cf6;
    --c-demand: #0ea5e9;
    --c-forecast: #e08a0b;
    --c-loc: #e2468d;
    --c-logistics: #f2700f;
    --c-finance: #16a35a;
    --c-stocks: #0891b2;
    --c-managers: #3b7ff2;
    --c-refs: #64748b;
    --c-learn: #a24de8;
    --c-settings: #6b7280;
    --tile-mix: 12%;                /* сила подложки иконки */

    /* графики */
    --chart-grid: rgba(23, 23, 31, .07);
    --chart-text: #68687c;

    --overlay: rgba(20, 20, 40, .35);       /* затемнение под окнами и меню */
    --glass: rgba(255, 255, 255, .94);      /* полупрозрачные липкие панели */
    --tooltip-bg: #17171f;
    --tooltip-text: #ffffff;

    /* добавлено при переводе style.css на токены (03.10.2026) */
    --surface-alt: #fbfbfd;         /* почти белый: боковая панель карточки, подстроки и разделители таблиц */
    --green-tint: #e1f5ec;          /* непрозрачные «мягкие» подложки — для липких ячеек (в тёмной *-soft полупрозрачные) */
    --red-tint: #fdeaea;
    --amber-tint: #fdf2e0;
    --yellow-tint: #fff6c7;
    --sky: #1a8fd6;                 /* алерты-«возможности» */
    --sky-soft: #e5f3fc;
    --heat-lo: #e67c73;             /* подсветка РНП: минимум → поверхность → максимум */
    --heat-hi: #57bb8a;
    --accent-grad: linear-gradient(160deg, #6a6ae0 0%, #4f4fc4 100%);   /* карточка алертов в меню, кнопка чата; текст #fff */
    --shadow-lg: 0 18px 48px rgba(20, 20, 60, .22);                      /* большие всплывающие окна */

    --radius: 18px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(23, 23, 31, 0.04), 0 8px 24px rgba(23, 23, 31, 0.04);
    --shadow-pop: 0 10px 30px rgba(20, 20, 60, .16);

    --rail: 60px;
    --side: 208px;
}

/* Тёмная тема: та же палитра светлее, фон почти чёрный с фиолетовым подтоном */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #111116;
        --surface: #191920;
        --surface-2: #20202a;
        --surface-3: #2a2a36;
        --border: #2a2a36;
        --border-strong: #3a3a48;
        --text: #ececf3;
        --text-mid: #b4b4c6;
        --text-muted: #9292a8;
        --nav-text: #d6d6e2;        /* пункты меню: светло-серый, почти белый */
        --on-accent: #0f0f17;
        --primary: #8b8bfa;
        --primary-dark: #a5a5fc;
        --primary-soft: #26264a;
        --green: #34d399;
        --green-soft: rgba(52, 211, 153, .14);
        --red: #f87171;
        --red-soft: rgba(248, 113, 113, .15);
        --amber: #fbbf24;
        --amber-soft: rgba(251, 191, 36, .14);
        --orange: #fb923c;
        --orange-soft: rgba(251, 146, 60, .15);
        --yellow-soft: rgba(250, 204, 21, .16);
        --ink-amber: #fcd34d;
        --ink-red: #fca5a5;
        --ink-green: #6ee7b7;
        --mp-wb: #e879c9;
        --mp-ozon: #5b8dff;
        --mp-ym: #fcd34d;
        --c-alerts: #f87171;
        --c-rnp: #8b8bfa;
        --c-plan: #2dd4bf;
        --c-market: #a78bfa;
        --c-demand: #38bdf8;
        --c-forecast: #fbbf24;
        --c-loc: #f472b6;
        --c-logistics: #fb923c;
        --c-finance: #4ade80;
        --c-stocks: #22d3ee;
        --c-managers: #60a5fa;
        --c-refs: #94a3b8;
        --c-learn: #c084fc;
        --c-settings: #9ca3af;
        --tile-mix: 18%;
        --chart-grid: rgba(236, 236, 243, .08);
        --chart-text: #9a9ab0;
        --overlay: rgba(0, 0, 0, .55);
        --glass: rgba(25, 25, 32, .92);
        --tooltip-bg: #ececf3;
        --tooltip-text: #111116;
        --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);
        --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
        --surface-alt: #1c1c24;
        --green-tint: #1d3331;
        --red-tint: #3a262c;
        --amber-tint: #393021;
        --yellow-tint: #3d361e;
        --sky: #38bdf8;
        --sky-soft: rgba(56, 189, 248, .14);
        --heat-lo: #9b3b36;
        --heat-hi: #2a7052;
        --accent-grad: linear-gradient(160deg, #5b5bd6 0%, #4343b3 100%);
        --shadow-lg: 0 18px 48px rgba(0, 0, 0, .6);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111116;
    --surface: #191920;
    --surface-2: #20202a;
    --surface-3: #2a2a36;
    --border: #2a2a36;
    --border-strong: #3a3a48;
    --text: #ececf3;
    --text-mid: #b4b4c6;
    --text-muted: #9292a8;
    --nav-text: #d6d6e2;
    --on-accent: #0f0f17;
    --primary: #8b8bfa;
    --primary-dark: #a5a5fc;
    --primary-soft: #26264a;
    --green: #34d399;
    --green-soft: rgba(52, 211, 153, .14);
    --red: #f87171;
    --red-soft: rgba(248, 113, 113, .15);
    --amber: #fbbf24;
    --amber-soft: rgba(251, 191, 36, .14);
    --orange: #fb923c;
    --orange-soft: rgba(251, 146, 60, .15);
    --yellow-soft: rgba(250, 204, 21, .16);
    --ink-amber: #fcd34d;
    --ink-red: #fca5a5;
    --ink-green: #6ee7b7;
    --mp-wb: #e879c9;
    --mp-ozon: #5b8dff;
    --mp-ym: #fcd34d;
    --c-alerts: #f87171;
    --c-rnp: #8b8bfa;
    --c-plan: #2dd4bf;
    --c-market: #a78bfa;
    --c-demand: #38bdf8;
    --c-forecast: #fbbf24;
    --c-loc: #f472b6;
    --c-logistics: #fb923c;
    --c-finance: #4ade80;
    --c-stocks: #22d3ee;
    --c-managers: #60a5fa;
    --c-refs: #94a3b8;
    --c-learn: #c084fc;
    --c-settings: #9ca3af;
    --tile-mix: 18%;
    --chart-grid: rgba(236, 236, 243, .08);
    --chart-text: #9a9ab0;
    --overlay: rgba(0, 0, 0, .55);
    --glass: rgba(25, 25, 32, .92);
    --tooltip-bg: #ececf3;
    --tooltip-text: #111116;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
    --surface-alt: #1c1c24;
    --green-tint: #1d3331;
    --red-tint: #3a262c;
    --amber-tint: #393021;
    --yellow-tint: #3d361e;
    --sky: #38bdf8;
    --sky-soft: rgba(56, 189, 248, .14);
    --heat-lo: #9b3b36;
    --heat-hi: #2a7052;
    --accent-grad: linear-gradient(160deg, #5b5bd6 0%, #4343b3 100%);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .6);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

a { color: var(--primary); }

svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.shell { display: flex; min-height: 100vh; min-height: 100dvh; }   /* dvh — видимое окно: в приложении на iPhone 100vh больше */

/* ===== Sidebar: one menu, expanded (icons + labels) or collapsed (icons) ===== */
.sidebar {
    width: var(--side);
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 14px 12px;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: width .18s ease, padding .18s ease;
}

.brand { display: flex; align-items: center; gap: 9px; padding: 2px 2px 18px; }
/* Логотип PULS в меню: знак пульса и имя в тонкой рамке, без заливки —
   как карточка приложения. В свёрнутом меню рамка сжимается до квадрата
   со знаком. Полный логотип с линией пульса — на странице входа. */
.brand-home {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 9px;
    height: 44px; padding: 0 12px 0 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}
.brand-home:hover { border-color: var(--border-strong); box-shadow: 0 1px 2px rgba(23, 23, 31, .04), 0 4px 12px rgba(23, 23, 31, .05); }
.brand-mark {
    width: 30px; height: 30px; flex: none;
    display: grid; place-items: center;
    border-right: 1px solid var(--border);
    padding-right: 7px; box-sizing: content-box;
}
.brand-mark img { display: block; width: 22px; height: auto; }
.brand-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.brand-word { display: block; width: 55px; height: auto; }
.brand-org {
    font-size: 9px; line-height: 1; font-weight: 600;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--text-muted);
}
/* Тёмная тема: логотип PULS нарисован тёмными линиями — светлеет фильтром (светлых файлов для меню нет) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .brand-mark img, :root:not([data-theme="light"]) .brand-word,
    :root:not([data-theme="light"]) .login-brand img { filter: invert(1) hue-rotate(180deg); }
}
:root[data-theme="dark"] .brand-mark img, :root[data-theme="dark"] .brand-word,
:root[data-theme="dark"] .login-brand img { filter: invert(1) hue-rotate(180deg); }
.nav-toggle {
    width: 28px; height: 28px; flex: none;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 8px;
    display: grid; place-items: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.nav-toggle:hover { background: var(--surface-2); color: var(--text); }
.nav-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }

.nav-group { display: flex; flex-direction: column; gap: 2px; }

.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    color: var(--nav-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.nav-link svg { width: 17px; height: 17px; opacity: .75; flex: none; }
/* Цвет раздела (--ic в base.html): иконка его цвета на мягкой подложке того же цвета */
.nav-link[style*="--ic"] svg { opacity: 1; color: var(--ic); box-sizing: content-box; padding: 5px; margin: -5px 0;
                               border-radius: 8px; background: color-mix(in srgb, var(--ic) var(--tile-mix), transparent); }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-link.on svg { opacity: 1; }

.side-card {
    margin-top: auto;
    background: var(--accent-grad);
    border-radius: var(--radius);
    padding: 18px 16px;
    color: #fff;
    text-align: center;
}

.side-card-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    display: grid; place-items: center;
    margin: 0 auto 10px;
}
.side-card-icon svg { width: 19px; height: 19px; }
.side-card-title { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.side-card-text { font-size: 11.5px; opacity: .8; line-height: 1.45; }
a.side-card { display: block; text-decoration: none; }
a.side-card:hover { filter: brightness(1.06); }
.side-alerts .side-card-title { margin-bottom: 10px; }
.side-al-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.side-al { display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 12px; padding: 8px 4px;
           background: rgba(255, 255, 255, .14); }
.side-al b { font-size: 22px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.side-al small { font-size: 10.5px; opacity: .85; }
.side-al.fire b { color: #ffb3b5; }
.side-al.warn b { color: #ffe08a; }

/* ===== Main ===== */
.main {
    flex: 1;
    margin-left: var(--side);
    transition: margin-left .18s ease;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(10px);
    z-index: 12;
}

.crumbs { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.crumbs a { color: var(--text-mid); text-decoration: none; }
.crumbs a:hover { color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 14px; }

.icon-btn {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 11px;
    display: grid; place-items: center;
    color: var(--text-mid);
    cursor: pointer;
    transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }

.user { display: flex; align-items: center; gap: 9px; }
.avatar {
    width: 36px; height: 36px; border-radius: 11px;
    background: var(--primary); color: var(--on-accent);
    display: grid; place-items: center;
    font-weight: 700; font-size: 12.5px;
}
.user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-muted); }

.content { padding: 4px 26px 32px; }
/* Пока новая область данных едет: блок тускнеет, под шапкой идёт короткая полоска.
   Она на отдельном слое в 2px, а не на всей странице — иначе браузер замирает анимацию. */
.puls-nav-error { margin: 8px 26px 0; color: var(--ink-red); font-size: 13px; font-weight: 600; }
html.puls-busy .content > * { opacity: 0.45; }
.puls-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    overflow: hidden;
    pointer-events: none;
    display: none;
}
html.puls-busy .puls-bar { display: block; }
.puls-bar::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 34%;
    background: var(--primary);
    animation: puls-bar 1.05s linear infinite;
}
@keyframes puls-bar {
    from { transform: translateX(-110%); }
    to { transform: translateX(320%); }
}
@media (prefers-reduced-motion: reduce) {
    .puls-bar::before {
        animation: puls-bar-fade 1.2s ease-in-out infinite;
        width: 100%;
        transform: none;
        opacity: 1;
    }
}
@keyframes puls-bar-fade {
    50% { opacity: .25; }
}
@media (max-width: 900px) {
    .puls-nav-error { margin-left: 12px; margin-right: 12px; }
}

h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 4px; }
.page-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
h3 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }

/* ===== KPI cards ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    position: relative;
}

.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }

.kpi-icon {
    width: 40px; height: 40px;
    border-radius: 13px;
    display: grid; place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
}
.kpi-icon.g { background: var(--green-soft); color: var(--green); }
.kpi-icon.a { background: var(--amber-soft); color: var(--amber); }
.kpi-icon.r { background: var(--red-soft); color: var(--red); }

.kpi-label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 3px; font-weight: 500; }
.kpi-value { font-size: 25px; font-weight: 700; letter-spacing: -0.6px; }

.pill {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 8px;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 600;
}
.pill.up { background: var(--green-soft); color: var(--green); }
.pill.down { background: var(--red-soft); color: var(--red); }
.pill.flat { background: var(--surface-2); color: var(--text-muted); }

/* ===== Generic card ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.card-sub { font-size: 12px; color: var(--text-muted); }

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }

/* ===== Funnel ===== */
.funnel { display: flex; flex-direction: column; gap: 13px; }
.funnel-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.funnel-label { font-size: 12.5px; color: var(--text-mid); font-weight: 500; }
.funnel-value { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.funnel-track { height: 9px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.funnel-bar { height: 100%; background: var(--primary); border-radius: 5px; }
.funnel-step:nth-child(2) .funnel-bar { background: color-mix(in srgb, var(--primary) 82%, var(--surface)); }
.funnel-step:nth-child(3) .funnel-bar { background: color-mix(in srgb, var(--primary) 66%, var(--surface)); }
.funnel-step:nth-child(4) .funnel-bar { background: color-mix(in srgb, var(--primary) 50%, var(--surface)); }
.funnel-step:nth-child(5) .funnel-bar { background: var(--green); }
.funnel-cr { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== Tables ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.data-table th {
    background: var(--surface-2);
    padding: 11px 14px;
    text-align: left;
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.data-table td { padding: 11px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.data-table tbody tr:hover { background: var(--surface-2); }
.positive { color: var(--ink-green); font-weight: 600; }
.negative { color: var(--ink-red); font-weight: 600; }

/* ===== Recommendations ===== */
.rec-list { display: flex; flex-direction: column; gap: 9px; }
.rec-item { display: flex; gap: 9px; align-items: center; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.rec-item:last-child { border-bottom: 0; }
.rec-type { background: var(--surface-2); padding: 2px 8px; border-radius: 6px; font-size: 11px; color: var(--text-muted); font-weight: 500; }

.rec-cards { display: flex; flex-direction: column; gap: 12px; }
.rec-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--text-muted);
    border-radius: var(--radius);
    padding: 17px 19px;
    box-shadow: var(--shadow);
}
.rec-card.priority-high { border-left-color: var(--red); }
.rec-card.priority-medium { border-left-color: var(--amber); }
.rec-card.priority-low { border-left-color: var(--green); }
.rec-header { display: flex; gap: 8px; align-items: center; margin-bottom: 7px; }
.rec-card h3 { margin-bottom: 3px; }
.rec-card p { color: var(--text-mid); font-size: 13px; line-height: 1.5; }
.rec-impact { margin-top: 8px; color: var(--green); font-size: 12.5px; font-weight: 500; }
.rec-sku { color: var(--text-muted); font-size: 12px; font-family: ui-monospace, Menlo, monospace; }

.badge { padding: 2px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.badge-high { background: var(--red-soft); color: var(--red); }
.badge-medium { background: var(--amber-soft); color: var(--amber); }
.badge-low { background: var(--green-soft); color: var(--green); }
.badge-type { background: var(--surface-2); color: var(--text-muted); }

.empty-state {
    text-align: center;
    padding: 56px;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ===== Pivot report ===== */
.pivot-head { margin-bottom: 16px; }

/* Общая панель поиска и фильтров: РНП, справочники и аналитика. */
.pivot-filters {
    display:flex; flex-wrap:wrap; align-items:flex-end; gap:12px 14px;
    background:var(--surface); border:1px solid var(--border); box-shadow:var(--shadow);
    padding:15px 17px; border-radius:var(--radius); min-width:0; max-width:100%;
}
.pivot-filters label, .pivot-filters .flt {
    display:flex; flex-direction:column; justify-content:flex-end; gap:6px;
    min-width:0; max-width:100%; font-size:11.5px; line-height:14px;
    color:var(--text-muted); font-weight:600; text-transform:uppercase; letter-spacing:.3px;
}
.pivot-filters label.grow { flex:1 1 260px; min-width:min(260px,100%); }
.pivot-filters .hint { text-transform:none; letter-spacing:0; font-weight:400; }
.pivot-filters input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.pivot-filters select {
    height:38px; min-width:0; max-width:100%; box-sizing:border-box;
    background:var(--surface); color:var(--text); border:1px solid var(--border);
    border-radius:var(--radius-sm); padding:0 10px; font-family:inherit;
    font-size:13px; font-weight:400; outline:none;
}
.pivot-filters input:focus, .pivot-filters select:focus { border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); }
.pivot-filters input[type=text], .pivot-filters input[type=search] { width:100%; }
/* Если нативный список нужен в форме, не превращаем multiple в одну строку. */
.pivot-filters select[multiple] { height:auto; min-width:0; padding:5px; }
.pivot-filters button {
    min-height:38px; max-width:100%; box-sizing:border-box;
    background:var(--primary); color:var(--on-accent); border:0; border-radius:var(--radius-sm);
    padding:8px 20px; font-size:13px; line-height:20px;
    font-weight:600; font-family:inherit; cursor:pointer; transition:background .15s;
}
.pivot-filters button:hover { background:var(--primary-dark); }
.pivot-filters .reset, .pivot-filters .save-btn, .pivot-filters a.fc3-btn {
    display:inline-flex; align-items:center; justify-content:center; min-height:38px; max-width:100%;
    box-sizing:border-box; font-size:13px; line-height:18px;
}
.pivot-filters .reset { color:var(--text-muted); text-decoration:none; padding:0 2px; }
.pivot-filters .reset:hover { color:var(--text); }
.pivot-filters .flt-row { align-items:stretch; min-width:0; max-width:100%; }
.pivot-filters .check { min-height:38px; padding:0; white-space:normal; }
.pivot-filters .check input { flex:none; margin:0; }
.pivot-filters .flt-title { line-height:14px; }
@media(max-width:720px) {
    .pivot-filters { padding:12px; }
    .pivot-filters > label:not(.flt-chk), .pivot-filters > .flt { flex:1 1 150px; min-width:0; }
    .pivot-filters > label.grow { flex-basis:100%; }
    .pivot-filters > label > input:not([type=checkbox]), .pivot-filters > label > select { width:100%; }
    .pivot-filters .flt-row { flex-wrap:wrap; }
    .pivot-filters .flt-row select:first-child { flex-basis:100%; width:100%; }
}

.pivot-wrap {
    overflow: auto;
    max-height: calc(100vh - 210px);
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

table.pivot {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

table.pivot th, table.pivot td { padding: 5px 11px; border-bottom: 1px solid var(--border); }

table.pivot thead th {
    position: sticky; top: 0; z-index: 3;
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-align: right;
    padding-top: 10px; padding-bottom: 10px;
}

table.pivot .c-label {
    position: sticky; left: 0; z-index: 2;
    background: var(--surface);
    text-align: left;
    min-width: 214px;
    color: var(--text-mid);
}
table.pivot thead .c-label { z-index: 4; background: var(--surface-2); }

table.pivot .c-total {
    position: sticky; left: 214px; z-index: 2;
    background: var(--surface);
    text-align: right;
    font-weight: 700;
    min-width: 96px;
    color: var(--text);
    border-right: 1px solid var(--border);
}
table.pivot thead .c-total { z-index: 4; background: var(--surface-2); }
table.pivot .c-day { text-align: right; min-width: 80px; color: var(--text-mid); }
table.pivot th.num, table.pivot td.num { text-align: right; }
table.pivot th.txt, table.pivot td.txt { text-align: left; }

table.pivot tr.grp td {
    background: var(--surface-3);
    font-weight: 700;
    padding: 10px 11px;
    font-size: 13px;
    color: var(--text);
}
table.pivot tr.grp-account td { background: var(--accent-grad); color: #fff; }
table.pivot tr.grp-brand td { background: var(--primary-soft); color: var(--primary); }

.sku-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.sku-name { color: var(--text-muted); font-weight: 400; margin-left: 10px; font-size: 12px; }
.sku-brand { margin-left: 10px; font-size: 10.5px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .3px; }

table.pivot tr.block td {
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 6px 11px;
}

table.pivot tr.m:hover td,
table.pivot tr.m:hover .c-label,
table.pivot tr.m:hover .c-total { background: var(--primary-soft); }

/* ===== Unit economics reference ===== */
.formula {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin: 16px 0;
    padding: 13px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12.5px;
}
.formula-step {
    background: var(--surface-2);
    color: var(--text-mid);
    padding: 5px 10px;
    border-radius: 7px;
    white-space: nowrap;
}
.formula-step.res { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.formula-op { color: var(--text-muted); font-weight: 600; }

table.unitref th { text-align: right; white-space: nowrap; }
table.unitref th.c-label { text-align: left; }
table.unitref td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.unitref td.dim { color: var(--text-muted); font-size: 11.5px; }
table.unitref td.neg { color: color-mix(in srgb, var(--red) 50%, var(--text-mid)); }
table.unitref td.outside { color: var(--text-muted); font-style: italic; }
table.unitref .strong { font-weight: 700; color: var(--text); }
table.unitref .sep { border-left: 1px solid var(--border); }
table.unitref .c-label { min-width: 190px; }
table.unitref tbody tr:hover td,
table.unitref tbody tr:hover .c-label { background: var(--primary-soft); }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .content, .topbar { padding-left: 14px; padding-right: 14px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .user-meta { display: none; }
}

table.unitref td.pc { color: var(--text-muted); font-size: 11px; }
table.unitref th.dimhead { color: var(--text-muted); font-weight: 500; }

table.unitref thead th a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}
table.unitref thead th a:hover { color: var(--primary); }
table.unitref thead th .arr { opacity: 0; font-size: 9px; }
table.unitref thead th a:hover .arr { opacity: .45; }
table.unitref thead th.sorted { color: var(--primary); }
table.unitref thead th.sorted .arr { opacity: 1; }

/* ===== Cost price editor ===== */
table.cogs-table td { vertical-align: middle; }
table.cogs-table .c-label { min-width: 250px; }
.cell-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    padding: 5px 8px;
    font-size: 12.5px;
    font-family: inherit;
    width: 92px;
    text-align: right;
    outline: none;
}
.cell-input.date { width: 128px; text-align: left; }
.cell-input.note { width: 120px; text-align: left; }
.cell-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.save-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-mid);
    border-radius: 7px;
    padding: 5px 11px;
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}
.save-btn:hover { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
tr.just-saved td { background: var(--green-tint) !important; }
tr.missing .c-label { border-left: 3px solid var(--amber); }
.check { display: flex; align-items: center; gap: 6px; text-transform: none; font-weight: 400; font-size: 12.5px; color: var(--text-mid); padding: 8px 0; }
.check input { width: 15px; height: 15px; accent-color: var(--primary); }

/* ===== РНП: SKU cards ===== */
.sku-card {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}
.sku-side {
    padding: 16px;
    border-right: 1px solid var(--border);
    background: var(--surface-alt);
}
.sku-photo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 12px;
    background: var(--surface-2);
    display: block;
    margin-bottom: 12px;
}
.sku-photo.empty { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, var(--surface-3) 6px, var(--surface-3) 12px); }
.sku-article { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 700; margin-bottom: 6px; word-break: break-all; }
.sku-title { font-size: 11.5px; color: var(--text-mid); line-height: 1.4; margin: 6px 0 8px; }
.sku-facts .fact { font-size: 11.5px; color: var(--text); margin-top: 5px; line-height: 1.35; }
.sku-facts .fact span { display: block; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; }
.sku-facts .fact a { color: var(--primary); text-decoration: none; }
.sku-facts .fact.cost { font-weight: 700; font-size: 13px; }
.sku-table-wrap { overflow-x: auto; }
table.rnp { width: 100%; }
table.rnp .c-label { min-width: 176px; }
table.rnp .c-total { left: 176px; min-width: 90px; }
table.rnp thead th { top: 0; }
table.rnp tr.gap td { height: 8px; padding: 0; background: var(--surface-alt); border: 0; }
table.rnp td.neg { color: var(--red); }
/* РНП по неделям и месяцам (app.rnp_group): шире колонки, пометка «идёт» / «N из M дн.» */
table.rnp.u-week .c-day { min-width: 108px; }
table.rnp.u-month .c-day { min-width: 96px; }
table.rnp th.c-day .c-note { display: block; font-size: 10.5px; font-weight: 500; color: var(--amber); }
table.rnp th.c-part { background: color-mix(in srgb, var(--amber) 7%, var(--surface)); }
@media (max-width: 720px) { table.rnp.u-week .c-day { min-width: 88px; } }
/* РНП WB: показы и переходы по источникам трафика (app.rnp_sources) — раскрывашка */
table.rnp tr.src-row { display: none; }
body.rnp-src-open table.rnp tr.src-row { display: table-row; }
table.rnp tr.src-row td { color: var(--text-muted); font-size: 12px; background: var(--surface-alt); }
table.rnp tr.src-row .c-label { padding-left: 26px; }
table.rnp tr.src-row .c-label::before { content: "↳ "; }
table.rnp .src-tg { margin-left: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--primary);
    font: inherit; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; cursor: pointer; }
table.rnp .src-tg::after { content: " ▸"; }
body.rnp-src-open table.rnp .src-tg::after { content: " ▾"; }
/* остатки по складам (app.rnp_stocks) — те же строки под катом, своя раскрывашка «склады» */
table.rnp tr.stk-row { display: none; }
body.rnp-stk-open table.rnp tr.stk-row { display: table-row; }
table.rnp tr.stk-row td { color: var(--text-muted); font-size: 12px; background: var(--surface-alt); }
table.rnp tr.stk-row .c-label { padding-left: 26px; }
table.rnp tr.stk-row .c-label::before { content: "↳ "; }
body.rnp-stk-open table.rnp [data-stk-tg]::after { content: " ▾"; }
body:not(.rnp-stk-open) table.rnp [data-stk-tg]::after { content: " ▸"; }
table.rnp tr.k-buyout_sum td, table.rnp tr.k-margin_rub td, table.rnp tr.k-ordered_sum td { font-weight: 600; }
table.rnp tr.k-margin_rub .c-total, table.rnp tr.k-buyout_sum .c-total { color: var(--primary); }
.flt-row { display: flex; gap: 6px; }
.flt-row select.op { width: 56px; }
.flt-row input.val { width: 84px; }

/* ===== РНП: levels (cabinet → brands → SKU) ===== */
details.lvl { margin-bottom: 22px; }
details.lvl > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 0 12px;
    user-select: none;
}
details.lvl > summary::-webkit-details-marker { display: none; }
details.lvl > summary::before {
    content: "";
    width: 8px; height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(-45deg) translateY(-2px);
    transition: transform .15s ease;
    align-self: center;
}
details.lvl[open] > summary::before { transform: rotate(45deg) translateY(-3px); }
details.lvl .lvl-name { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
details.lvl .lvl-meta { font-size: 12.5px; color: var(--text-muted); }
details.lvl-cabinet > summary .lvl-name { color: var(--primary); }
.agg-side { background: color-mix(in srgb, var(--primary-soft) 25%, var(--surface)); }
.agg-card .sku-article { font-family: inherit; font-size: 16px; letter-spacing: -.2px; word-break: normal; }
.breakdown { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.breakdown-title { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 2px; }
.breakdown .fact { font-variant-numeric: tabular-nums; }
.breakdown .fact.inc { color: var(--green); }
.breakdown .fact.exp { color: var(--text); }
table.rnp tr.k-cab_ads .c-label { padding-left: 24px; color: var(--text-muted); font-weight: 400; }
table.rnp tr.k-cab_ads td { color: var(--text-muted); }
table.rnp tr.k-cab_costs td, table.rnp tr.k-compensations td { color: var(--primary-dark, var(--primary)); }

/* ===== РНП: chart under a card ===== */
.sku-card > details.chart-cat { grid-column: 1 / -1; border-top: 1px solid var(--border); background: var(--surface-alt); }
details.chart-cat > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--primary);
    user-select: none;
}
details.chart-cat > summary::-webkit-details-marker { display: none; }
details.chart-cat > summary:hover { background: var(--primary-soft); }
details.chart-cat > summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
details.chart-cat > summary::after {
    content: "";
    margin-left: auto;
    width: 8px; height: 8px;
    border-right: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    transform: rotate(45deg) translateY(-2px);
    transition: transform .15s ease;
}
details.chart-cat[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.chart-cat > summary .chart-cat-hint { font-weight: 400; font-size: 12px; color: var(--text-muted); }
.chart-body { padding: 4px 16px 16px; background: var(--surface); border-top: 1px solid var(--border); }
.chart-picks { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0; }
.chart-picks .sep { flex-basis: 100%; height: 2px; }
.chart-picks .pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-mid);
    cursor: pointer;
    white-space: nowrap;
}
.chart-picks .pick:hover { border-color: var(--primary); }
.chart-picks .pick:has(input:checked) { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.chart-picks .pick input { accent-color: var(--primary); margin: 0; width: 13px; height: 13px; }
.chart-canvas { position: relative; height: 340px; }

/* ===== sidebar: folded group ===== */
.nav-cat { display: flex; flex-direction: column; gap: 2px; }
.nav-cat > summary { list-style: none; cursor: pointer; user-select: none; }
.nav-cat > summary::-webkit-details-marker { display: none; }
.nav-cat > summary::after {
    content: "";
    margin-left: auto;
    width: 7px; height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    opacity: .6;
    transition: transform .15s ease;
}
.nav-cat[open] > summary::after { transform: rotate(45deg) translateY(-2px); }
.nav-cat > summary.in { color: var(--nav-text); font-weight: 600; }
.nav-cat > summary.in svg { opacity: 1; }
.nav-link.sub { padding-left: 24px; font-size: 13px; }
.nav-link.sub svg { width: 15px; height: 15px; }

/* ===== sidebar: collapsed state ===== */
html.nav-collapsed .sidebar { width: var(--rail); padding: 14px 11px; }
html.nav-collapsed .main { margin-left: var(--rail); }
html.nav-collapsed .brand { flex-direction: column; gap: 8px; padding-bottom: 12px; }
html.nav-collapsed .brand-text,
html.nav-collapsed .nav-text,
html.nav-collapsed .side-card { display: none; }
html.nav-collapsed .brand-home { flex: none; width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 11px; }
html.nav-collapsed .brand-mark { border-right: 0; padding-right: 0; width: 26px; height: 26px; }
html.nav-collapsed .brand-mark img { width: 20px; }
html.nav-collapsed .nav-toggle svg { transform: rotate(180deg); }
html.nav-collapsed .nav-group { align-items: center; }
html.nav-collapsed .nav-link { justify-content: center; padding: 0; width: 38px; height: 38px; }
html.nav-collapsed .nav-link.sub { padding: 0; }
html.nav-collapsed .nav-link.sub svg { width: 17px; height: 17px; }
html.nav-collapsed .nav-cat { align-items: center; }
html.nav-collapsed .nav-cat > summary { display: none; }

/* ===== sign-in, forms, admin tables ===== */
.login-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.login-card {
    width: 100%; max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 30px 26px;
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand {
    justify-content: center;
    padding: 18px 0 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
}
.login-brand img { width: 128px; height: auto; display: block; }
.login-card h1 { margin-bottom: 2px; }
.login-sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 18px; }

.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row .field { min-width: 170px; flex: 1; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; color: var(--text-muted); }
.field .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.field input, .field select {
    font: inherit; font-size: 14px; color: var(--text);
    padding: 10px 12px;
    border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
    outline: none;
}
.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.btn-primary {
    font: inherit; font-size: 14px; font-weight: 600; color: var(--on-accent);
    background: var(--primary); border: 0; border-radius: 10px;
    padding: 11px 18px; cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-small {
    font: inherit; font-size: 12px; font-weight: 600; color: var(--on-accent);
    background: var(--primary); border: 0; border-radius: 8px;
    padding: 6px 10px; cursor: pointer; white-space: nowrap;
}
.btn-small.ghost { background: var(--surface); color: var(--text-mid); border: 1px solid var(--border); }
.btn-small:hover { filter: brightness(.95); }
.btn { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 8px; border: 0; background: var(--primary);
       color: var(--on-accent); cursor: pointer; }
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: var(--surface); color: var(--text-mid); border: 1px solid var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
input[type=file] { color: var(--text-mid); font: inherit; font-size: 12.5px; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 8px; padding: 5px 12px; border-radius: 8px;
                                        border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; }
.form-error { background: var(--red-soft); color: var(--ink-red); border: 1px solid color-mix(in srgb, var(--red) 25%, transparent); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.notice { background: var(--primary-soft); color: var(--primary); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.notice.ok { background: var(--green-soft); color: var(--ink-green); }
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; max-width: 980px; margin-bottom: 18px; }
.form-card h3 { margin-bottom: 12px; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline input[type="password"] { font: inherit; font-size: 12.5px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 8px; width: 150px; background: var(--surface); color: var(--text); }
form.inline select { font: inherit; font-size: 12.5px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; margin-bottom: 18px; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); background: var(--surface-2); }
table.data-table tr.off td { color: var(--text-muted); }
table.data-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
table.data-table .nowrap { white-space: nowrap; }
table.data-table .muted { color: var(--text-muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-mid); }
.tag.green { background: var(--green-soft); color: var(--ink-green); }
.tag.amber { background: var(--amber-soft); color: var(--ink-amber); }
.tag.red { background: var(--red-soft); color: var(--ink-red); }

table.audit tr.a-login_failed td { color: var(--ink-red); }
.diff { display: flex; flex-direction: column; gap: 3px; }
.diff-row { font-size: 12.5px; }
.diff-field { display: inline-block; min-width: 110px; color: var(--text-muted); font-size: 11.5px; }
.diff-old { color: var(--ink-red); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-red) 50%, transparent); }
.diff-new { color: var(--ink-green); font-weight: 600; }
.topbar-right .user { text-decoration: none; color: inherit; border-radius: 11px; padding: 3px 6px 3px 3px; }
.topbar-right .user:hover { background: var(--surface-2); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== РНП: highlight picker ===== */
details.hl-cat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: -6px 0 18px;
}
details.hl-cat > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--primary);
    user-select: none;
}
details.hl-cat > summary::-webkit-details-marker { display: none; }
details.hl-cat > summary:hover { background: var(--primary-soft); border-radius: var(--radius); }
details.hl-cat > summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
details.hl-cat > summary .hl-count { font-weight: 500; font-size: 12.5px; color: var(--text-mid); }
details.hl-cat > summary .hl-legend { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
details.hl-cat > summary .hl-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
details.hl-cat > summary .hl-legend i.lo { background: linear-gradient(90deg, var(--heat-lo), var(--surface)); border: 1px solid var(--border); }
details.hl-cat > summary .hl-legend i.hi { background: linear-gradient(90deg, var(--surface), var(--heat-hi)); border: 1px solid var(--border); }
details.hl-cat > summary::after {
    content: "";
    width: 8px; height: 8px;
    border-right: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
    transform: rotate(45deg) translateY(-2px);
    transition: transform .15s ease;
}
details.hl-cat[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.hl-cat .hl-picks { padding: 4px 16px 14px; border-top: 1px solid var(--border); }
.pick-dir { color: var(--text-muted); font-size: 11px; }
table.rnp td.c-day { transition: background-color .2s ease; }

/* ===== РНП: filters + highlights pinned under the top bar ===== */
.rnp-sticky {
    position: sticky;
    top: 62px;                      /* the top bar's height */
    z-index: 11;
    background: var(--bg);
    margin: 0 -26px 18px;
    padding: 4px 26px 10px;
    box-shadow: 0 10px 14px -12px rgba(20, 20, 40, .18);
}
.rnp-sticky .pivot-filters { margin-bottom: 8px; }
/* Keep the metric help on its own row so its height cannot lift the controls. */
.rnp-sticky .pivot-filters > .rnp-metric-hint {
    flex: 0 0 100%; min-width: 0; font-size: 11.5px; line-height: 1.4; white-space: normal;
}
.rnp-sticky details.hl-cat { margin: 0; }
@media (max-width: 640px) {
    .rnp-sticky { margin: 0 -14px 18px; padding: 4px 14px 10px; }
}

table.rnp tr.k-ads_f .c-label { padding-left: 24px; color: var(--text-muted); font-weight: 400; }
table.rnp tr.k-ads_f td { color: var(--text-muted); }
/* план артикула из «План/факт» (РНП WB): подчинённые строки под «Заказали, шт» */
table.rnp tr.k-plan_qty .c-label, table.rnp tr.k-plan_speed .c-label { padding-left: 24px; color: var(--text-muted); font-weight: 400; }
table.rnp tr.k-plan_qty td, table.rnp tr.k-plan_speed td { color: var(--text-muted); }

/* ===== copy-to-clipboard next to the seller's SKU ===== */
.sku-article { display: flex; align-items: center; gap: 6px; }
.sku-article > span { min-width: 0; word-break: break-all; }
.copy-btn {
    flex: none;
    width: 22px; height: 22px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-muted);
    display: grid; place-items: center;
    cursor: pointer;
    padding: 0;
    transition: color .15s, border-color .15s, background .15s;
}
.copy-btn:hover { color: var(--primary); border-color: var(--primary); }
.copy-btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.copy-btn .i-done { display: none; }
.copy-btn.done { color: var(--on-accent); background: var(--green); border-color: var(--green); }
.copy-btn.done .i-copy { display: none; }
.copy-btn.done .i-done { display: block; }

/* ===== РНП: pinned dates + highlighted row labels ===== */
.dates-strip { position: relative; height: 30px; margin-top: 6px; overflow: hidden; visibility: hidden; }
.dates-strip.on { visibility: visible; }
.dates-inner { position: absolute; top: 0; height: 30px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; }
.dates-inner span {
    position: absolute; top: 0; height: 100%;
    box-sizing: border-box;
    padding: 0 11px;
    display: flex; align-items: center; justify-content: flex-end;
    font-size: 11px; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .3px;
    background: var(--surface-2);
    white-space: nowrap;
}
.dates-inner span.c-label { justify-content: flex-start; z-index: 2; border-right: 1px solid var(--border); }
.dates-inner span.c-total { z-index: 2; border-right: 1px solid var(--border); }
table.rnp tr.hl-on .c-label { background: var(--yellow-tint); }
table.rnp tr.hl-on:hover .c-label { background: color-mix(in srgb, var(--amber) 12%, var(--yellow-tint)); }

/* ===== Финансы: weekly P&L ===== */
.fin-card { display: block; }
table.fin .c-label { min-width: 250px; }
table.fin .c-total { left: 250px; }
table.fin .c-day { min-width: 108px; }
table.fin tr.sub .c-label { padding-left: 26px; color: var(--text-muted); font-weight: 400; }
table.fin tr.sub td { color: var(--text-muted); }
table.fin tr.bold td { font-weight: 700; }
table.fin tr.k-profit td, table.fin tr.k-revenue .c-total { color: var(--primary); }
table.fin th.current { color: var(--primary); }
table.fin th .wip { display: block; font-size: 9px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--amber); }
.fin-notes { max-width: 980px; font-size: 12.5px; color: var(--text-mid); line-height: 1.5; }
.fin-notes p { margin: 8px 0; }

/* ===== Финансы: fold under a line ===== */
table.fin tr.foldable { cursor: pointer; }
table.fin tr.foldable .c-label { color: var(--primary); }
table.fin tr.foldable:hover td { background: var(--primary-soft); }
.fold-arrow { display: inline-block; width: 7px; height: 7px; margin: 0 8px 1px 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; }
tr.open .fold-arrow { transform: rotate(45deg) translateY(-2px); }
.fold-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 6px; }
table.fin tr.fold-row td { background: var(--surface-alt); font-size: 12px; }
table.fin tr.fold-row .c-label { padding-left: 30px; font-weight: 400; color: var(--text); background: var(--surface-alt); }
table.fin tr.fold-row .c-total { background: var(--surface-alt); }
table.fin tr.fold-row .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
table.fin tr.fold-row .fold-brand { color: var(--text-muted); font-size: 11px; margin-left: 6px; }

/* ===== phones: compact bar, folded filters, stacked cards ===== */
.flt-toggle { display: none; }
@media (max-width: 900px) {
    /* выдвижное меню: не помещается по высоте (iPhone SE, альбомная, приложение) — прокручивается */
    .sidebar, html.nav-collapsed .sidebar { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
    .content { padding: 4px 12px 24px; }
    .topbar { padding: 0 12px; height: 54px; }
    h1 { font-size: 19px; }
    .page-sub { font-size: 12px; margin-bottom: 12px; }

    .rnp-sticky { top: 54px; margin: 0 -12px 12px; padding: 4px 12px 6px; }
    .flt-toggle {
        display: flex; align-items: center; justify-content: space-between; gap: 10px;
        width: 100%;
        font: inherit; font-size: 13px;
        background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow);
        padding: 10px 14px; margin-bottom: 8px;
        cursor: pointer; text-align: left;
    }
    .flt-toggle-range { font-weight: 700; }
    .flt-toggle-label { color: var(--primary); font-weight: 600; }
    .flt-toggle-label::after { content: " ▾"; }
    .flt-toggle.on .flt-toggle-label::after { content: " ▴"; }
    .rnp-sticky .pivot-filters { display: none; padding: 12px; gap: 10px; }
    .rnp-sticky .pivot-filters.open { display: flex; }
    .pivot-filters label { min-width: 0; }
    .pivot-filters select[multiple] { min-width: 120px; }

    details.hl-cat > summary { padding: 9px 12px; font-size: 13px; }
    details.hl-cat > summary .hl-legend { display: none; }
    .dates-strip { height: 26px; margin-top: 4px; }
    .dates-inner { height: 26px; }

    /* a card stacks: the side panel on top, the grid below */
    .sku-card { grid-template-columns: 1fr; }
    .sku-side { display: flex; gap: 12px; align-items: flex-start; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px; }
    .sku-photo { width: 64px; margin-bottom: 0; flex: none; }
    .sku-facts { min-width: 0; }
    .sku-title { display: none; }
    .sku-facts .fact { display: inline-block; margin: 4px 12px 0 0; }
    .agg-side .sku-facts .fact { display: block; margin: 4px 0 0; }

    table.pivot th, table.pivot td { padding: 4px 8px; font-size: 12px; }
    table.rnp .c-label { min-width: 132px; }
    table.rnp .c-total { left: 132px; min-width: 76px; }
    table.rnp .c-day { min-width: 66px; }
    .chart-canvas { height: 260px; }
    .chart-picks .pick { font-size: 11px; padding: 3px 8px 3px 6px; }

    table.fin .c-label { min-width: 170px; }
    table.fin .c-total { left: 170px; }
    table.fin .c-day { min-width: 88px; }
}

/* ===== phones: the menu is a drawer, the page takes the full width ===== */
.nav-burger { display: none; }
.nav-backdrop { display: none; }
@media (max-width: 900px) {
    .main, html.nav-collapsed .main { margin-left: 0; }
    .sidebar, html.nav-collapsed .sidebar {
        width: var(--side);
        padding: 14px 12px;
        transform: translateX(-102%);
        transition: transform .2s ease;
        z-index: 40;
    }
    html.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(20, 20, 40, .25); }
    /* whatever the saved state, the drawer shows icons with labels */
    html.nav-collapsed .brand { flex-direction: row; gap: 9px; padding: 2px 2px 18px; }
    html.nav-collapsed .nav-text, html.nav-collapsed .side-card { display: block; }
    html.nav-collapsed .nav-text { display: inline; }
    html.nav-collapsed .brand-text { display: flex; }
    html.nav-collapsed .brand-home { flex: 1; width: auto; height: 44px; padding: 0 12px 0 6px; justify-content: flex-start; border-radius: 12px; }
    html.nav-collapsed .brand-mark { border-right: 1px solid var(--border); padding-right: 7px; width: 30px; height: 30px; }
    html.nav-collapsed .brand-mark img { width: 22px; }
    html.nav-collapsed .nav-group, html.nav-collapsed .nav-cat { align-items: stretch; }
    html.nav-collapsed .nav-link { justify-content: flex-start; padding: 9px 11px; width: auto; height: auto; }
    html.nav-collapsed .nav-link.sub { padding-left: 24px; }
    html.nav-collapsed .nav-cat > summary { display: flex; }
    .nav-toggle { display: none; }
    .nav-burger { display: grid; flex: none; margin-right: 10px; }
    .topbar { justify-content: flex-start; }
    .topbar .crumbs { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .nav-backdrop { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .2s; }
    html.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

    table.rnp .c-label { min-width: 112px; max-width: 112px; white-space: normal; line-height: 1.15; }
    table.rnp .c-total { left: 112px; min-width: 66px; }
    table.rnp .c-day { min-width: 62px; }
    table.pivot th, table.pivot td { padding: 4px 6px; font-size: 11.5px; }
    table.rnp tr.k-ads_f .c-label, table.rnp tr.k-cab_ads .c-label, table.rnp tr.k-plan_qty .c-label, table.rnp tr.k-plan_speed .c-label { padding-left: 14px; }
}

/* Company-wide dashboard sits above per-marketplace navigation. */
.org-dashboard { display: flex; align-items: center; justify-content: center; min-height: 56px; margin: 0 0 9px; padding: 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); text-decoration: none; transition: border-color .15s, background .15s, box-shadow .15s; }
.org-dashboard:hover { border-color: var(--primary); background: var(--surface-2); }
.org-dashboard.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.org-dashboard:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.org-wordmark { display: block; width: 100%; max-width: 170px; height: auto; }
.org-mark { display: none; width: 28px; height: 30px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .org-dashboard img { filter: invert(1); } }
:root[data-theme="dark"] .org-dashboard img { filter: invert(1); }
html.nav-collapsed .org-dashboard { width: 38px; min-height: 48px; padding: 4px; border-radius: 10px; }
html.nav-collapsed .org-wordmark { display: none; }
html.nav-collapsed .org-mark { display: block; }
@media (max-width: 900px) {
    html.nav-collapsed .org-dashboard { width: auto; min-height: 56px; padding: 12px; border-radius: 12px; }
    html.nav-collapsed .org-wordmark { display: block; }
    html.nav-collapsed .org-mark { display: none; }
}

/* ===== marketplace switch in the sidebar ===== */
.mp-switch { display: flex; gap: 4px; padding: 3px; margin: 0 0 12px; background: var(--surface-2); border-radius: 10px; }
.mp-btn {
    flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center;
    height: 42px; padding: 5px 2px; border-radius: 8px;
    color: var(--text-muted); text-decoration: none; transition: background .15s, box-shadow .15s;
}
.mp-btn:hover { background: var(--surface); }
.mp-btn.on { background: var(--surface); box-shadow: inset 0 0 0 1px var(--primary), 0 1px 2px rgba(20, 20, 40, .08); }
.mp-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mp-logo { display: block; width: 26px; height: 26px; object-fit: contain; border-radius: 6px; flex: none; }
.pivot.pc thead th.grp-oz { color: color-mix(in srgb, var(--mp-ozon) 80%, var(--text)); background: color-mix(in srgb, var(--mp-ozon) 12%, var(--surface)); }
.pivot.pc th.oz, .pivot.pc td.oz { background: color-mix(in srgb, var(--mp-ozon) 5%, var(--surface)); }
.pivot.pc thead th.oz { background: color-mix(in srgb, var(--mp-ozon) 10%, var(--surface)); }
.mp-tags { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
/* Only the desktop rail stacks marketplace icons; phone menu keeps one row. */
html.nav-collapsed .mp-switch { flex-direction: column; background: transparent; padding: 0; gap: 6px; }
html.nav-collapsed .mp-btn { flex: none; width: 38px; height: 40px; padding: 0; }
@media (max-width: 900px) {
    html.nav-collapsed .mp-switch { flex-direction: row; background: var(--surface-2); padding: 3px; gap: 4px; }
    html.nav-collapsed .mp-btn { flex: 1 1 0; width: auto; height: 42px; padding: 5px 2px; }
}

/* ===== РНП: the next batch of SKU cards ===== */
.rnp-more { text-align: center; padding: 18px 0 8px; color: var(--text-muted); font-size: 12.5px; }
.rnp-more::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: rnp-spin 1s linear infinite; }
.rnp-more.failed::before { animation: none; border-color: var(--red); }
@keyframes rnp-spin { to { transform: rotate(360deg); } }

/* ===== Локализация конкурентов =====
   The table takes the whole width: the label column gets a fixed share, the
   city columns split the rest evenly, and type and padding grow with the
   screen instead of squeezing everything to a fixed size. */
.loc-filters select[multiple] { min-width: 150px; }
.loc-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0 0 8px; font-size: 12px; color: var(--text-mid); }
.loc-legend .sc { margin-left: 8px; }
.loc-legend-note { color: var(--text-muted); margin-left: 10px; }
.loc-tools { margin-left: auto; white-space: nowrap; }
.sc { display: inline-block; min-width: 26px; text-align: center; padding: 1px 5px; border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: .2px; line-height: 15px; }
.sc-FBO { background: var(--green-soft); color: var(--green); }
.sc-FBS { background: var(--amber-soft); color: var(--amber); }
.sc-DBS { background: var(--primary-soft); color: var(--primary); }
.sc-none, .sc-other { background: var(--surface-2); color: var(--text-muted); }
.sc.changed { box-shadow: 0 0 0 1.5px var(--red); }
.pivot.loc { width: 100%; table-layout: auto; font-size: 12px; }
.pivot.loc th, .pivot.loc td { padding: 4px 6px; line-height: 1.3; white-space: nowrap; }
.pivot.loc th.num, .pivot.loc td.num { text-align: center; width: 6.5%; min-width: 52px; }
.pivot.loc th.c-label, .pivot.loc td.c-label { position: sticky; left: 0; z-index: 1; background: var(--surface); width: 26%; min-width: 220px; box-shadow: 1px 0 0 var(--border); }
.pivot.loc td.c-label .loc-id { flex: 1 1 auto; }
.pivot.loc th .city-full { display: none; }
.pivot.loc tr.own td { background: var(--surface); }
.loc-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.loc-cell-col { flex-direction: column; align-items: flex-start; gap: 0; }
.pivot.loc tr.own td.c-label { cursor: default; }
.pivot.loc tr.has-sub td.c-label { cursor: pointer; }
.pivot.loc tr.sub td { background: var(--surface-2); }
.pivot.loc tr.sub td.c-label { padding-left: 42px; background: var(--surface-2); }
.loc-group:not(.open) tr.sub { display: none; }
.loc-toggle { flex: none; width: 14px; height: 14px; border: 0; padding: 0; background: none; cursor: pointer; position: relative; }
.loc-toggle::before { content: ""; position: absolute; left: 4px; top: 3px; width: 6px; height: 6px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: rotate(-45deg); transition: transform .15s; }
.loc-group.open .loc-toggle::before { transform: rotate(45deg); }
.loc-toggle.empty { cursor: default; }
.loc-toggle.empty::before { display: none; }
.loc-photo { flex: none; width: 26px; height: 34px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.loc-id { display: flex; flex-direction: column; min-width: 0; }
.loc-id .sku-id { font-weight: 600; }
.loc-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.loc-days { margin-left: 5px; font-weight: 700; }
.loc-delta { margin-left: 2px; font-size: 10px; font-weight: 700; font-style: normal; }
.loc-delta.worse { color: var(--red); }
.loc-delta.better { color: var(--green); }
.loc-sum td { background: var(--primary-soft) !important; font-size: 11.5px; }
.loc-sum-name { font-weight: 600; }
.loc-stat { color: var(--text-mid); font-size: 11.5px; }
.loc-comp { margin-top: 14px; }
.loc-comp-body { padding: 10px 14px 14px; }
.loc-list td, .loc-list th { font-size: 12px; padding: 4px 8px; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font-size: 12px; padding: 0; }
.loc-list .link-btn { color: var(--red); }
.text-red { color: var(--ink-red); }
/* Wide screens: full city names, larger type, roomier cells */
@media (min-width: 1500px) {
    .pivot.loc { font-size: 13px; }
    .pivot.loc th, .pivot.loc td { padding: 6px 10px; }
    .pivot.loc th .city-full { display: inline; }
    .pivot.loc th .city-short { display: none; }
    .sc { font-size: 11px; min-width: 30px; padding: 2px 6px; line-height: 16px; }
    .loc-photo { width: 30px; height: 40px; }
    .loc-sub { font-size: 11.5px; }
    .loc-sum td, .loc-stat { font-size: 12.5px; }
    .loc-legend { font-size: 12.5px; }
}
@media (min-width: 1900px) {
    .pivot.loc { font-size: 14px; }
    .pivot.loc th, .pivot.loc td { padding: 7px 12px; }
    .sc { font-size: 11.5px; min-width: 34px; }
    .loc-sub { font-size: 12.5px; }
    .loc-photo { width: 34px; height: 46px; }
}
/* Laptops: the table still fits, cells just get tighter */
@media (max-width: 1300px) {
    .pivot.loc th.c-label, .pivot.loc td.c-label { width: 24%; min-width: 210px; }
    .pivot.loc th, .pivot.loc td { padding: 3px 4px; }
}
@media (max-width: 900px) {
    .pivot.loc th.c-label, .pivot.loc td.c-label { min-width: 180px; max-width: 220px; }
}
.pivot-filters .reset.xlsx { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 600; }
.pivot-filters .reset.xlsx:hover { color: var(--primary-dark); }
.loc-date { display: inline-flex; align-items: center; gap: 4px; }
.loc-date-step { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 38px; border-radius: 8px; border: 1px solid var(--border); color: var(--text-mid); text-decoration: none; font-size: 16px; }
.loc-date-step:hover { background: var(--surface-2); color: var(--text); }
.loc-date-step.off { color: var(--border); cursor: default; }

/* ===== Локализация: вкладки и сводка «мы и конкуренты» ===== */
.loc-views { margin: 0 0 12px; gap: 6px; }
.loc-views a.bd-tab { text-decoration: none; font-size: 13px; padding: 5px 14px; }
.loc-nosnap { margin: 12px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--amber-soft); color: var(--ink-amber); font-size: 12.5px; }
.locsum .dim { color: var(--text-muted); }
.locsum-lead { font-size: 14px; line-height: 1.55; max-width: 1080px; margin: 16px 0 14px; color: var(--text); }
.locsum-lead b { font-weight: 700; }
.locsum .al-summary { margin-bottom: 10px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.locsum .al-sum-alt { font-size: 13px; font-weight: 700; color: var(--text-mid); margin-top: 3px; }
.locsum .al-sum.hot .al-sum-alt { color: var(--red); opacity: .8; }
.locsum .al-sum-value small { font-size: 14px; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.locsum .al-sum.hot .al-sum-value small { color: var(--red); opacity: .8; }
.locsum-cover { font-size: 12.5px; color: var(--text-mid); line-height: 1.55; max-width: 1080px; margin: 0 2px 6px; }
.locsum-block { margin: 30px 0 8px; }
.locsum-block > h2 { font-size: 18px; font-weight: 700; letter-spacing: -.2px; margin: 0 0 4px; }
.locsum-sub { font-size: 13px; color: var(--text-mid); max-width: 1080px; line-height: 1.5; margin-bottom: 12px; }
.locsum-how { font-size: 12px; color: var(--text-muted); max-width: 1080px; line-height: 1.5; margin: 8px 2px 0; }
.locsum-how b { color: var(--text-mid); font-weight: 600; }
.pivot.locsum { width: 100%; }
.pivot.locsum thead th { white-space: normal; line-height: 1.25; vertical-align: bottom; min-width: 64px; max-width: 120px; }
.pivot.locsum th.num { text-align: right; }
.pivot.locsum td.num { text-align: right; white-space: nowrap; }
.pivot.locsum th.txt, .pivot.locsum td.txt { text-align: left; white-space: normal; min-width: 170px; max-width: 340px; font-size: 12px; line-height: 1.35; }
.pivot.locsum thead th.txt { max-width: none; }
.pivot.locsum th.c-label, .pivot.locsum td.c-label { min-width: 150px; max-width: 280px; white-space: normal; }
.pivot.locsum td.c-label .loc-sub { max-width: 250px; }
.pivot.locsum .sep { border-left: 1px solid var(--border); }
.pivot.locsum tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border); }
.pivot.locsum td.locsum-bad { color: var(--red); font-weight: 600; }
.pivot.locsum tr.locsum-sep td { background: var(--surface-2); color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.pivot.locsum tr.locsum-few td { color: var(--text-muted); }
.pivot.locsum tr.locsum-cur td { background: var(--primary-soft); }
.pivot.locsum td.locsum-note-cell { text-align: left; }
.locsum-name { font-weight: 600; color: var(--text); }
a.sku-id { color: var(--primary); text-decoration: none; }
a.sku-id:hover { text-decoration: underline; }
.locsum-where { color: var(--text-muted); white-space: nowrap; }
.locsum-chart .chart-canvas { height: 340px; }
.locsum-notes { margin-top: 4px; }
.locsum-notes b { color: var(--text); }
.locsum-lead-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; max-width: 1080px; margin: -8px 2px 14px; }
.locsum .al-sum.good { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 28%, transparent); }
.locsum .al-sum.good .al-sum-label, .locsum .al-sum.good .al-sum-value { color: var(--green); }
.locsum .al-sum.good .al-sum-value small { color: var(--green); opacity: .8; }
.locsum-h3 { font-size: 15px; font-weight: 700; margin: 22px 0 4px; }
.locsum-cities { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.locsum-city-head { font-size: 12.5px; color: var(--text-mid); line-height: 1.5; max-width: 1080px; margin: 0 2px 6px; }
.locsum-city-head b { color: var(--text); font-size: 13.5px; }
.locsum-tip { display: inline-block; font-size: 11px; line-height: 1.3; padding: 1px 6px; border-radius: 6px; background: var(--amber-soft); color: var(--ink-amber); white-space: nowrap; }
.locsum-dead { font-size: 12.5px; color: var(--text-mid); line-height: 1.5; max-width: 1080px; margin: -4px 2px 12px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); }
.locsum-found { margin: 14px 0 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--primary-soft); }
.locsum-found-head { font-size: 13px; color: var(--text); line-height: 1.5; margin-bottom: 8px; }
.locsum-found .pivot.locsum { background: var(--surface); }
.pivot.locsum td.locsum-wide { max-width: none; white-space: normal; font-size: 12px; line-height: 1.4; }
.pivot.locsum td.num small { font-size: 11px; font-weight: 500; }
@media (max-width: 640px) {
    .locsum-lead { font-size: 13.5px; }
    .locsum .al-summary { grid-template-columns: 1fr; }
    .locsum-chart .chart-canvas { height: 300px; }
    .pivot.locsum th.c-label, .pivot.locsum td.c-label { min-width: 120px; max-width: 170px; }
}

/* ----- Локализация: период сводки, итог дня в ячейке, опрос карточек, эпизодический сток ----- */
.loc-period { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.loc-period-btn { display: inline-flex; align-items: center; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-mid); text-decoration: none; font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.loc-period-btn:hover { background: var(--surface-2); color: var(--text); }
.loc-period-btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.loc-dayx { margin-left: 3px; font-size: 9.5px; font-style: normal; font-weight: 600; color: var(--ink-amber); background: var(--amber-soft); border-radius: 4px; padding: 0 3px; vertical-align: 1px; }
.loc-poll-off { display: inline-block; font-size: 11px; line-height: 1.3; padding: 0 6px; border-radius: 6px; background: var(--amber-soft); color: var(--ink-amber); white-space: nowrap; }
.loc-list td.loc-poll { white-space: nowrap; }
.loc-list td.loc-poll .link-btn { color: var(--primary); margin-left: 4px; }
.loc-list td.loc-poll .link-btn.loc-poll-btn { color: var(--text-muted); }
.loc-list tr.loc-list-off td { background: var(--surface-2); }
.loc-comp-note { font-size: 12px; color: var(--text-mid); line-height: 1.5; margin: 10px 2px; max-width: 1080px; }
.locsum-period { font-size: 13px; color: var(--text-mid); line-height: 1.55; max-width: 1080px; margin: 14px 0 0; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); }
.locsum-period b { color: var(--text); }
.locsum-epi { margin: 4px 0 12px; padding: 10px 14px; border: 1px solid var(--border); border-left: 3px solid var(--amber); border-radius: 10px; background: var(--surface); max-width: 1080px; }
.locsum-epi-head { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.locsum-epi-body { font-size: 12.5px; color: var(--text-mid); line-height: 1.55; }
.locsum-epi-body b { color: var(--text); }
.locsum-epi-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; }
.locsum-epi-item { padding: 2px 8px; border-radius: 8px; background: var(--amber-soft); color: color-mix(in srgb, var(--ink-amber) 75%, var(--text)); }
.locsum-epi-item b { font-weight: 600; }
.locsum-epi-cities { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.locsum-chart-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-top: 6px; }
@media (max-width: 640px) {
    .loc-period-btn { height: 38px; padding: 0 9px; }
    .locsum-epi { padding: 9px 11px; }
}

/* ===== Логистика FBS ===== */
.logi-alerts { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.logi-alert { padding: 9px 14px; border-radius: 10px; font-size: 13px; border: 1px solid var(--border); background: var(--surface); }
.logi-alert.bad { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 25%, transparent); color: color-mix(in srgb, var(--ink-red) 75%, var(--text)); }
.logi-alert.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 25%, transparent); color: color-mix(in srgb, var(--ink-amber) 85%, var(--text)); }
.logi-alert.ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 18%, transparent); color: color-mix(in srgb, var(--ink-green) 80%, var(--text)); }
.logi-kpis { display: grid; grid-template-columns: 2fr 3fr; gap: 14px; margin-bottom: 14px; }
.logi-kgroup { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 12px; background: var(--surface-2); min-width: 0; }
.logi-kgroup.now { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 22%, var(--border)); }
.logi-khead { font-size: 13px; font-weight: 600; margin: 0 2px 8px; }
.logi-khead .hint { font-weight: 400; margin-left: 6px; }
.logi-kcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.logi-kcards .kpi-card { padding: 12px 14px; }
.logi-kcards .kpi-value { font-size: 22px; }
.pivot.logi thead tr:not(.grp) th.num { white-space: normal; min-width: 58px; max-width: 96px; line-height: 1.25; vertical-align: bottom; }
.pivot.logi thead tr.grp th { top: auto; font-size: 12px; text-transform: none; padding-top: 6px; padding-bottom: 4px; }
.pivot.logi thead th.grp-now { text-align: left; color: var(--primary-dark); background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface)); }
.pivot.logi thead th.grp-per { text-align: left; }
.pivot.logi th.now, .pivot.logi td.now { background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface)); }
.pivot.logi thead th.now { background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface)); }
.pivot.logi tfoot td.now { background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface-2)); }
@media (max-width: 900px) { .logi-kpis { grid-template-columns: 1fr; } }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.kpi-card.is-bad .kpi-value { color: var(--red); }
.logi-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--green); }
.logi-dot.warn { background: var(--amber); }
.logi-dot.bad { background: var(--red); }
.pivot.logi { width: 100%; }
.pivot.logi th.c-label, .pivot.logi td.c-label { min-width: 170px; width: 16%; white-space: normal; }
.pivot.logi td.c-label .sku-id { white-space: normal; }
.pivot.logi th.num, .pivot.logi td.num { text-align: right; white-space: nowrap; padding-left: 7px; padding-right: 7px; }
.pivot.logi tfoot td { font-weight: 600; background: var(--surface-2); border-top: 2px solid var(--border); }
@media (min-width: 1500px) {
    .pivot.logi { font-size: 13px; }
    .pivot.logi th, .pivot.logi td { padding: 7px 12px; }
}
.logi-legend { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12.5px; color: var(--text-mid); }
.logi-chart { margin-top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.logi-chart-head { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.logi-chart .chart-canvas { height: 260px; position: relative; }
.logi-fees { margin-top: 16px; }
.logi-fees .fin-note { margin-top: 6px; }
.logi-fees-table { width: 100%; }

/* ===== Динамика брендов ===== */
.pivot.bd td.bd-week, .pivot.bd th.bd-week { min-width: 58px; color: var(--text-mid); }
.pivot.bd th.c-label, .pivot.bd td.c-label { width: 22%; min-width: 200px; }
.bd-pct { font-weight: 600; }
.bd-pct.up { color: var(--green); }
.bd-pct.down { color: var(--red); }
.bd-pct.flat { color: var(--text-muted); }
.bd-small { font-size: 10.5px; }
.bd-brand { margin-top: 12px; }
.bd-brand > .pivot-wrap { margin: 0 12px 12px; }
.bd-chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.bd-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.bd-tab { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 11.5px; cursor: pointer; color: var(--text-mid); }
.bd-tab.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.bd-chart-note { margin-top: 6px; white-space: normal; }
.logi-chart .chart-canvas { height: 300px; }

/* ===== РНП: metrics picker ===== */
.mv-cat { margin-bottom: 6px; }
.mv-picks .link-btn { margin-left: 4px; font-size: 12px; }

/* ===== Цены по площадкам ===== */
.text-green { color: var(--ink-green); }
.text-amber { color: var(--ink-amber); }
.pc-kpis { margin-bottom: 14px; }
.pc-kpis .kpi-card { padding: 12px 14px; }
.pc-kpis .kpi-value { font-size: 22px; }
.pivot.pc { width: 100%; }
.pivot.pc th.num, .pivot.pc td.num { text-align: right; white-space: nowrap; padding-left: 5px; padding-right: 5px; }
.pivot.pc thead tr:not(.grp) th.num { min-width: 50px; max-width: 78px; }
.pivot.pc thead tr.grp th { top: auto; font-size: 12px; text-transform: none; text-align: left; padding-top: 6px; padding-bottom: 4px; }
.pivot.pc th.c-label, .pivot.pc td.c-label { min-width: 200px; max-width: 222px; white-space: normal; }
table.unitref.pc thead tr:not(.grp) th, table.unitref.pc thead tr:not(.grp) th a { white-space: normal; line-height: 1.25; vertical-align: bottom; overflow: visible; text-overflow: clip; }
.pivot.pc td.pc-brand { max-width: 70px; white-space: normal; font-size: 11px; line-height: 1.2; }
.pivot.pc .pc-names .sku-id { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 176px; }
.pivot.pc th.pc-where { max-width: 64px; }
.pivot.pc thead th.grp-ym, .pivot.pc th.ym, .pivot.pc td.ym { background: color-mix(in srgb, var(--amber-tint) 55%, var(--surface)); }
.pivot.pc thead th.grp-wb, .pivot.pc th.wb, .pivot.pc td.wb { background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface)); }
.pivot.pc td[colspan] { text-align: center; font-size: 12px; }
.pc-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pc-names { min-width: 0; }
.pc-sub { display: flex; gap: 8px; font-size: 11.5px; color: var(--text-muted); min-width: 0; }
.pc-sub a { color: var(--primary); text-decoration: none; white-space: nowrap; }
.pc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.pc-win { font-size: 10.5px; color: var(--text-muted); font-weight: 400; }
.pc-stale { color: var(--text-muted); }
.pc-warn { display: inline-block; width: 14px; height: 14px; line-height: 14px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); font-size: 10px; font-weight: 700; text-align: center; }
.pc-diff.is-wb { color: color-mix(in srgb, var(--mp-wb) 80%, var(--text)); font-weight: 600; }
.pc-diff.is-ym { color: color-mix(in srgb, var(--ink-amber) 85%, var(--mp-ym)); font-weight: 600; }
.badge.pc-wb { background: color-mix(in srgb, var(--mp-wb) 14%, var(--surface)); color: color-mix(in srgb, var(--mp-wb) 80%, var(--text)); }
.badge.pc-ym { background: color-mix(in srgb, var(--mp-ym) 30%, var(--surface)); color: color-mix(in srgb, var(--ink-amber) 85%, var(--text)); }

/* ===== РНП: brand / article drop-downs in the filters ===== */
.pivot-filters .flt { position:relative; }
.pivot-filters .flt-title { font-size: 11.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.pivot-filters button.dd-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    min-width: 170px; max-width: 240px; padding: 8px 10px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 400; text-align: left;
}
.pivot-filters button.dd-btn:hover { background: var(--surface); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.pivot-filters .dd.open button.dd-btn { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pivot-filters .dd.on button.dd-btn { color: var(--primary-dark); font-weight: 600; }
.dd-btn [data-dd-text] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-caret { flex: none; width: 7px; height: 7px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: rotate(45deg) translateY(-2px); }
.dd.open .dd-caret { transform: rotate(-135deg) translateY(-1px); }
.dd-panel {
    position:fixed; z-index:40; overflow:auto; overscroll-behavior:contain;
    min-width:min(220px,calc(100vw - 24px)); max-width:calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pop); padding: 8px;
    text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text);
}
.dd-sku .dd-panel { width: 400px; }
.dd-tools { display: flex; gap: 12px; align-items: center; padding: 2px 6px 6px; font-size: 12px; }
.dd-tools a { color: var(--primary); text-decoration: none; }
.dd-tools a:hover { text-decoration: underline; }
.dd-note { margin-left: auto; color: var(--text-muted); }
.dd-list { max-height: 340px; overflow-y: auto; overscroll-behavior: contain; }
.dd-item { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px !important; padding: 5px 6px; border-radius: 6px; cursor: pointer;
           font-size: 13px !important; font-weight: 400 !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--text) !important; }
.pivot-filters .dd-item { justify-content:flex-start; line-height:18px; }
.dd-item:hover { background: var(--surface-2); }
.dd-item[hidden] { display: none !important; }
.dd-item input { width: 15px; height: 15px; margin: 0; padding: 0; flex: none; accent-color: var(--primary); box-shadow: none !important; }
.dd-item img, .dd-noimg { flex: none; width: 26px; height: 34px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.dd-sku-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.dd-sku-text b { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-sku-text small { color: var(--text-muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pivot-filters .dd-find { width: 100%; margin-bottom: 6px; }
@media (max-width: 640px) {
    .pivot-filters .flt { flex: 1 1 45%; }
    .pivot-filters button.dd-btn { min-width: 0; max-width: none; width: 100%; }
    .dd-sku .dd-panel { width: min(400px, calc(100vw - 40px)); }
}

/* ===== Уведомления ===== */
.ntf-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 18px; }
.ntf-row { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; }
.ntf-text { min-width: 0; }
.ntf-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.ntf-sub { font-size: 12.5px; color: var(--text-mid); line-height: 1.5; max-width: 780px; }
.ntf-status { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.ntf-switch { flex: none; display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 4px 0; font: inherit; }
.ntf-switch .ntf-knob { position: relative; width: 44px; height: 24px; border-radius: 12px; background: var(--surface-3); transition: background .15s; }
.ntf-switch .ntf-knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .15s; }
.ntf-switch.on .ntf-knob { background: var(--green); }
.ntf-switch.on .ntf-knob::after { left: 23px; }
.ntf-label { font-size: 13px; font-weight: 600; color: var(--text-mid); min-width: 34px; text-align: left; }
.ntf-saved { margin-top: 10px; font-size: 12.5px; color: var(--green); }
/* обычный пользователь (body.ro): все «вводы» только у админа — поля видны, но неактивны; сервер отвечает 403 */
body.ro #fc2-t input, body.ro .fc2-modal .form, body.ro #fc2-add, body.ro #fc2-recalc, body.ro #fc2-fix,
body.ro .cogs-table form input, body.ro .cogs-table form button,
body.ro form[action*="/localization/competitors"] input, body.ro form[action*="/localization/competitors"] button,
body.ro form[action*="/localization/competitors"] select { pointer-events: none; opacity: .5; }
.early-note { font-size: 12.5px; color: var(--ink-amber); background: var(--amber-soft); border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; }
.ntf-mps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; }
.ntf-mp { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; color: var(--text-mid); background: var(--surface); }
.ntf-mp.on { border-color: var(--green); color: var(--text); background: var(--primary-soft); }
.ntf-mp input { margin: 0; }
.ntf-h2 { font-size: 16px; margin: 6px 0 10px; }
/* «Уведомления»: a switch per kind, then the journal of everything that was produced */
.ntf-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.ntf-switch:focus-within .ntf-knob { outline: 2px solid var(--primary); outline-offset: 2px; }
.ntf-sep { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.ntf-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; font-size: 13px; }
.ntf-foot input[type="number"] { width: 72px; margin-left: 6px; font: inherit; font-size: 13px; padding: 6px 9px; border: 1px solid var(--border-strong);
                                  border-radius: 8px; background: var(--surface); color: var(--text); }
.ntf-foot button { padding: 7px 16px; font: inherit; font-size: 13px; font-weight: 600; color: var(--on-accent); background: var(--primary); border: 0;
                   border-radius: var(--radius-sm); cursor: pointer; }
.ntf-foot button:hover { background: var(--primary-dark); }
.ntf-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ntf-chips .chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-mid); text-decoration: none; }
.ntf-chips .chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.ntf-chips .chip b { font-weight: 700; color: var(--text-muted); }
.ntf-log td.ntf-body { white-space: pre-wrap; font-size: 12px; line-height: 1.45; max-width: 620px; color: var(--text-mid); }
.ntf-log td.c-label { white-space: nowrap; }
@media (max-width: 640px) { .ntf-row { flex-direction: column; } .ntf-log td.ntf-body { max-width: 260px; } }


/* ===== Стоки ===== */
.pivot.stk { width: 100%; }
.pivot.stk thead th.grp-fbo { color: var(--primary-dark); background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface)); }
.pivot.stk thead th.grp-fbs { color: var(--amber); background: color-mix(in srgb, var(--amber-tint) 60%, var(--surface)); }
.pivot.stk tr.stk-sum td { position: sticky; top: var(--stk-sum-top, 0); z-index: 3; background: var(--surface-2); font-weight: 700; border-bottom: 2px solid var(--border); }
.pivot.stk tr.stk-sum td.c-label, .pivot.stk tr.stk-sum td.c-brand, .pivot.stk tr.stk-sum td.c-total { z-index: 5; }
.pivot.stk th.num, .pivot.stk td.num { text-align: right; white-space: nowrap; padding-left: 6px; padding-right: 6px; font-variant-numeric: tabular-nums; }
.pivot.stk thead tr:not(.grp) th.num { white-space: normal; min-width: 46px; max-width: 86px; line-height: 1.25; vertical-align: bottom; }
table.unitref.stk thead tr:not(.grp) th, table.unitref.stk thead tr:not(.grp) th a { white-space: normal; overflow: visible; text-overflow: clip; }
.pivot.stk thead tr.grp th { top: auto; font-size: 12px; text-transform: none; text-align: left; padding-top: 6px; padding-bottom: 4px; }
.pivot.stk th.c-label, .pivot.stk td.c-label { width: 206px; min-width: 206px; max-width: 206px; white-space: normal; }
.pivot.stk th.c-brand, .pivot.stk td.c-brand { position: sticky; left: 206px; z-index: 2; background: var(--surface); width: 64px; min-width: 64px; max-width: 64px; }
.pivot.stk th.c-total, .pivot.stk td.c-total { position: sticky; left: 270px; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.pivot.stk thead th.c-brand, .pivot.stk thead th.c-total { z-index: 4; background: var(--surface-2); }
.pivot.stk tfoot td.c-brand, .pivot.stk tfoot td.c-total { background: var(--surface-2); }
.pivot.stk tbody tr:hover td.c-brand, .pivot.stk tbody tr:hover td.c-total { background: var(--primary-soft); }
@media (max-width: 900px) {
    .pivot.stk th.c-label, .pivot.stk td.c-label { width: 150px; min-width: 150px; max-width: 150px; }
    .pivot.stk th.c-brand, .pivot.stk td.c-brand { display: none; }
    .pivot.stk th.c-total, .pivot.stk td.c-total { left: 150px; }
}
.pivot.stk .pc-names .sku-id { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 152px; }
.pivot.stk .pc-name { max-width: 110px; }
.pivot.stk td.pc-brand { max-width: 70px; white-space: normal; font-size: 11px; line-height: 1.2; }
.pivot.stk thead th.grp-wh { color: var(--primary-dark); background: color-mix(in srgb, var(--primary-soft) 70%, var(--surface)); }
.pivot.stk th.wh, .pivot.stk td.wh { background: color-mix(in srgb, var(--primary-soft) 30%, var(--surface)); }
.pivot.stk thead th.wh { background: color-mix(in srgb, var(--primary-soft) 60%, var(--surface)); }
.pivot.stk tr.stk-sum td.wh { background: color-mix(in srgb, var(--primary-soft) 50%, var(--surface-2)); }
.pivot.stk tr.stk-sum td.wh.fbs { background: color-mix(in srgb, var(--amber-tint) 50%, var(--surface-2)); }
.pivot.stk th.wh.fbs, .pivot.stk td.wh.fbs { background: color-mix(in srgb, var(--amber-tint) 40%, var(--surface)); }
.pivot.stk tfoot td { font-weight: 600; background: var(--surface-2); border-top: 2px solid var(--border); }
.stk-fresh { border: 0; background: var(--primary); color: var(--on-accent); border-radius: var(--radius-sm); padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.stk-fresh:hover { background: var(--primary-dark); }
/* 0 — измеренный ноль: виден, но не спорит с числами */
.pivot.stk .stk-zero { color: var(--text-muted); font-weight: 400; }
/* «за сутки» — строка под числом: мелко и серо, цвет только у «закончился» */
.pivot.stk .stk-d { display: block; margin-top: 1px; font-size: 10px; line-height: 1.15; font-weight: 400; color: var(--text-muted); letter-spacing: -0.1px; cursor: help; }
.pivot.stk .stk-d.big { color: var(--text-mid); font-weight: 600; }
.pivot.stk .stk-d.gone { color: var(--red); font-weight: 600; }
.pivot.stk .stk-d.na { color: var(--text-muted); font-weight: 400; }
.pc-kpis .stk-kpi-d { margin-top: 2px; color: var(--text-mid); cursor: help; }
.stk-note { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-mid); font-size: 12.5px; line-height: 1.4; }

/* ===== раздел «Настройки» ===== */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.set-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.set-card:hover { border-color: var(--primary); }
.set-card svg { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--primary); stroke-width: 1.6; }
.set-card b { display: block; font-size: 15px; margin-bottom: 4px; }
.set-card span { font-size: 12.5px; color: var(--text-mid); line-height: 1.45; }
.conn-card { margin-top: 16px; }
.conn-field { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.conn-field span { font-weight: 650; }
.conn-field small, .conn-field em { color: var(--text-mid); font-size: 12.5px; font-style: normal; }
.conn-field input[type="text"], .conn-field input[type="password"] {
    max-width: 520px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.conn-save { margin: 16px 0 28px; }
.conn-note { margin-top: 12px; }
.conn-bad { color: var(--bad, #b42318); }
.upd-table .c-label { min-width: 240px; }
.upd-about { display: block; font-size: 11.5px; color: var(--text-muted); line-height: 1.3; }
.upd-set { white-space: nowrap; }
.upd-set select, .upd-set input[type="time"] { margin-left: 8px; font-size: 12px; padding: 3px 6px; }
.upd-changed { margin-left: 6px; font-size: 11px; color: var(--primary); }
.upd-off { opacity: .55; }
.upd-run { padding: 2px 9px; font: inherit; font-size: 12px; line-height: 1.4; font-weight: 600; border: 1px solid var(--border-strong);
           background: var(--surface-2); color: var(--text); border-radius: 8px; cursor: pointer; }
.upd-run:hover { background: var(--surface-3); }

/* ===== Алерты ===== */
.al-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 10px; margin-bottom: 26px; }
.al-sum { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 15px 17px; box-shadow: var(--shadow); }
.al-sum.hot { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 28%, transparent); }
.al-sum-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-weight: 600; }
.al-sum.hot .al-sum-label { color: var(--red); }
.al-sum-value { font-size: 26px; font-weight: 800; letter-spacing: -.7px; margin-top: 5px; line-height: 1.1; }
.al-sum.hot .al-sum-value { color: var(--red); }
.al-sum-note { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.al-sum-note a { color: var(--primary); text-decoration: none; }
.al-sum-note a:hover { text-decoration: underline; }

.al-group { margin-bottom: 28px; }
.al-group-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 11px; }
.al-group-head h2 { font-size: 15px; font-weight: 700; margin: 0; }
.al-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red); }
.al-note { font-size: 12px; color: var(--text-muted); }

.al-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); gap: 10px; }
.al-tile {
    display: flex; flex-direction: column; gap: 6px; text-align: left; min-height: 132px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    padding: 13px 14px; cursor: pointer; font: inherit; color: inherit;
    transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.al-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.al-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.al-tile[aria-expanded="true"] { border-color: var(--primary); box-shadow: var(--shadow); }
.al-tile.fire { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 26%, transparent); }
.al-tile.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 26%, transparent); }

.al-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.al-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
          background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-mid); }
.al-tile.fire .al-ico { background: var(--surface); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); }
.al-tile.warn .al-ico { background: var(--surface); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--amber); }
.al-tile.calm .al-ico { color: var(--green); }
.al-ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.al-trend { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text-mid); white-space: nowrap; }
.al-name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.al-fig { font-size: 24px; font-weight: 800; letter-spacing: -.7px; line-height: 1; margin-top: auto; }
.al-tile.fire .al-fig { color: var(--red); }
.al-tile.warn .al-fig { color: var(--amber); }
.al-tile.calm .al-fig { color: var(--green); }
.al-sub { font-size: 11.5px; color: var(--text-muted); line-height: 1.3; }

.al-details { margin-top: 11px; background: var(--surface); border: 1px solid var(--primary); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.al-dh { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; padding: 13px 18px; border-bottom: 1px solid var(--border); background: var(--surface-alt); }
.al-dh strong { font-size: 14px; }
.al-dh span { font-size: 12px; color: var(--text-muted); }
.al-scroll { overflow-x: auto; }
.al-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.al-table th, .al-table td { padding: 8px 18px; text-align: right; white-space: nowrap; }
.al-table th:first-child, .al-table td:first-child { text-align: left; }
.al-table thead th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); font-weight: 600; }
.al-table tbody tr + tr td { border-top: 1px solid var(--border); }
.al-table tbody tr:hover td { background: var(--surface-alt); }
.al-code { display: flex; align-items: center; gap: 6px; }
.al-mini { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center;
           border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
           cursor: pointer; padding: 0; flex: none; }
.al-mini:hover { color: var(--primary); border-color: var(--primary); }
.al-mini.done { color: var(--green); border-color: var(--green); }
.al-mini svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.al-df { padding: 10px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.al-photo { flex: none; width: 26px; height: 34px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.al-photo.empty { display: inline-block; }
.al-cab { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-mid); }
.al-dh .al-xlsx { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
                  color: var(--primary); text-decoration: none; white-space: nowrap; }
.al-dh .al-xlsx:hover { text-decoration: underline; }
.al-dh .al-xlsx svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.al-filters { margin: 0 0 16px; }
.al-flt-note { font-size: 12px; color: var(--text-muted); flex: 1 1 260px; }
.al-empty { padding: 24px 18px; text-align: center; color: var(--text-muted); font-size: 13px; }

@media (max-width: 560px) {
    .al-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .al-tile { min-height: 120px; padding: 11px; }
    .al-fig { font-size: 20px; }
    .al-table th, .al-table td { padding: 8px 12px; }
}

/* ===== Алерты внутри РНП: фильтр и подсказка в карточке ===== */
.pivot-filters .flt-chk {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    align-self:flex-end; min-height:38px;
    padding:0 2px;
    color: var(--text);
    cursor: pointer;
    white-space:normal;
}
.pivot-filters .flt-chk input { flex:none; margin:0; width: 15px; height: 15px; accent-color: var(--amber); }
.rnp-note {
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--amber-soft);
    color: var(--amber);
    font-size: 12px;
}
.rnp-note a { color: inherit; font-weight: 600; }

/* Карточка обрезает всё, что вылезает за её края, поэтому список алертов
   не всплывает поверх, а раскрывается прямо под значком. */
/* «Замедление» в карточке артикула РНП (WB, Ozon): яркая оранжевая плашка внизу панели; включено — вся карточка
   обведена, в строке «Замедление» — «да» */
.sku-slow { position: relative; margin-top: 12px; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 12px; cursor: pointer;
            border: 2px dashed var(--orange); background: color-mix(in srgb, var(--orange-soft) 50%, var(--surface)); color: color-mix(in srgb, var(--orange) 60%, var(--text)); user-select: none; transition: background .15s, border-color .15s; }
.sku-slow:hover { background: var(--orange-soft); }
.sku-slow input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sku-slow .sd-box { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--orange); background: var(--surface);
                    display: grid; place-items: center; }
.sku-slow .sd-text { display: flex; flex-direction: column; line-height: 1.2; }
.sku-slow .sd-text b { font-size: 13px; font-weight: 800; letter-spacing: .01em; }
.sku-slow .sd-since { font-size: 11px; color: color-mix(in srgb, var(--orange) 80%, var(--text)); }
.sku-slow.on { border-style: solid; border-color: color-mix(in srgb, var(--orange) 85%, var(--text)); background: var(--orange); color: var(--on-accent);
               box-shadow: 0 4px 14px color-mix(in srgb, var(--orange) 35%, transparent); }
.sku-slow.on .sd-box { border-color: var(--on-accent); background: var(--on-accent); }
.sku-slow.on .sd-box::after { content: ""; width: 10px; height: 6px; border: solid var(--orange); border-width: 0 0 3px 3px; transform: rotate(-45deg) translate(1px, -1px); }
.sku-slow.on .sd-since { color: color-mix(in srgb, var(--on-accent) 85%, var(--orange)); }
.sku-slow input:focus-visible + .sd-box { outline: 2px solid var(--orange); outline-offset: 2px; }
.sku-slow.ro { cursor: default; opacity: .85; }
.sku-slow.busy { opacity: .6; pointer-events: none; }
.sku-slow .sd-since.err { color: var(--red); font-weight: 600; }
.sku-card.slow-on { border-color: var(--orange); box-shadow: 0 0 0 2px color-mix(in srgb, var(--orange) 35%, transparent), var(--shadow); }
table.rnp .yn-yes { color: var(--orange); font-weight: 800; }
table.rnp .yn-no { color: var(--text-muted); }
tr.k-slowdown td.c-label { color: color-mix(in srgb, var(--orange) 80%, var(--text)); font-weight: 700; }
.sku-alerts { margin-top: 8px; }
.sku-alerts > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--amber-soft);
    color: var(--amber);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.sku-alerts > summary::-webkit-details-marker { display: none; }
.sku-alerts > summary svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.sku-alerts > summary b { font-variant-numeric: tabular-nums; }
.sku-alerts[open] > summary { background: var(--amber); color: var(--on-accent); }
.sku-alerts-pop {
    margin-top: 6px;
    padding: 9px 11px;
    border: 1px solid var(--amber);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-pop);
}
.sku-alerts-pop ul { margin: 0; padding-left: 16px; }
.sku-alerts-pop li { font-size: 11.5px; line-height: 1.5; color: var(--text); }
.sku-alerts-pop a { display: inline-block; margin-top: 8px; font-size: 11px; color: var(--primary); text-decoration: none; }

/* ── чат с AI (static/js/assistant.js) ── */
body { --chat-panel-bottom: 90px; }
body:has(.su-fab) { --chat-panel-bottom: 158px; }
.as-fab { position: fixed; right: 22px; bottom: calc(22px + env(safe-area-inset-bottom, 0px) + var(--chat-keyboard-inset, 0px)); z-index: 60; display: flex; align-items: center; gap: 8px;
          min-height: 56px; padding: 12px 18px; border: none; border-radius: 999px; background: var(--accent-grad); color: #fff;
          font-weight: 700; font-size: 16px; box-shadow: 0 8px 24px rgba(79, 79, 196, .35); cursor: pointer; }
.as-fab svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.as-box { box-sizing: border-box; position: fixed; right: 22px; bottom: calc(var(--chat-panel-bottom) + env(safe-area-inset-bottom, 0px)); z-index: 61; width: min(680px, calc(100vw - 44px));
          height: min(760px, calc(100vh - var(--chat-panel-bottom) - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
          height: min(760px, calc(100dvh - var(--chat-panel-bottom) - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
          border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.as-box[hidden] { display: none; }
/* Limited visible height, including a phone keyboard: preserve the header and composer. */
.as-box.as-compact .as-head { padding: 4px 8px; }
.as-box.as-compact .as-title { max-height: 48px; overflow: auto; }
.as-box.as-compact .as-form { padding: 4px 8px; }
.as-box.as-compact textarea { height: 48px; min-height: 48px; }
.as-box.as-compact .as-msgs { padding-top: 0; padding-bottom: 0; }
.as-box.as-compact .as-files, .as-box.as-compact .as-step,
.as-box.as-compact .su-connection { min-height: 0; max-height: 20%; overflow: auto; flex-shrink: 1; }

.as-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.as-title { min-width: 0; display: grid; gap: 3px; }
.as-head b { font-size: 16px; line-height: 1.4; }
.as-sub { font-size: 13px; color: var(--text-muted); }
.as-grow { flex: 1; }
.as-ico { border: none; background: transparent; font-size: 17px; color: var(--text-mid); cursor: pointer; flex: none; width: 36px; height: 40px; border-radius: 8px; }
.as-ico:hover { background: var(--surface-2); }
.as-hist[hidden] { display: none; }
.as-hist { flex: 0 1 auto; max-height: 45%; overflow: auto; border-bottom: 1px solid var(--border); padding: 6px; display: grid; gap: 2px; }
.as-hist button { text-align: left; border: none; background: transparent; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 15px;
                  color: var(--text); display: flex; justify-content: space-between; gap: 8px; }
.as-hist button:hover { background: var(--surface-2); }
.as-hist small { color: var(--text-muted); white-space: nowrap; }
.as-msgs { min-height: 0; min-width: 0; flex: 1; overflow: auto; overscroll-behavior: contain; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.as-msg { box-sizing: border-box; min-width: 0; flex: none; max-width: 100%; font-size: 16px; line-height: 1.6; padding: 12px 15px; border-radius: 14px; overflow-wrap: anywhere; }
.as-msg.user { max-width: 92%; align-self: flex-end; background: var(--primary-soft); color: var(--text); border-bottom-right-radius: 4px; }
.as-msg.bot { align-self: flex-start; background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }
.as-msg.wait { color: var(--text-muted); }
.as-msg p { margin: 0 0 6px; } .as-msg p:last-child { margin-bottom: 0; }
.as-msg ul, .as-msg ol { margin: 4px 0 6px; padding-left: 20px; }
.as-msg table { border-collapse: collapse; font-size: 14px; max-width: 100%; margin: 10px 0; display: block; overflow-x: auto; }
.as-msg th, .as-msg td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; white-space: nowrap; }
.as-msg pre { max-width: 100%; overflow-x: auto; white-space: pre; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.as-msg pre code { padding: 0; background: none; }
.as-msg code { font-size: 14px; background: color-mix(in srgb, var(--text) 6%, transparent); padding: 1px 4px; border-radius: 4px; }
.as-msg a { color: var(--primary); font-weight: 600; }
.as-hello { font-size: 16px; color: var(--text-muted); line-height: 1.6; }
.as-err { color: var(--red); }
.as-step { flex: none; font-size: 14px; color: var(--text-muted); padding: 0 14px 6px; }
.as-form { flex: none; display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); }
.as-form textarea { min-width: 0; box-sizing: border-box; line-height: 1.5; flex: 1; resize: none; border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; font: inherit; font-size: 16px;
                    background: var(--bg); color: var(--text); }
.as-send { flex: none; min-height: 48px; border: none; border-radius: 12px; width: 48px; background: var(--primary); color: var(--on-accent); font-size: 16px; cursor: pointer; }
/* файлы к вопросу: скрепка, значки файлов над полем и в сообщении, подсказка при перетаскивании */
.as-att { flex: none; border: none; background: transparent; width: 40px; border-radius: 10px; cursor: pointer; color: var(--text-mid);
          display: flex; align-items: center; justify-content: center; padding: 0; }
.as-att:hover { background: var(--surface-2); color: var(--primary); }
.as-att svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.as-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; border-top: 1px solid var(--border); }
.as-files[hidden] { display: none; }
.as-files:not([hidden]) + .as-form { border-top: 0; }
.as-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; min-width: 0; padding: 3px 8px; border-radius: 9px; background: var(--surface-2);
           border: 1px solid var(--border); font-size: 12px; line-height: 1.3; color: var(--text); text-decoration: none; }
.as-chip-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.as-chip small { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.as-chip.up { opacity: .7; }
.as-chip.err { border-color: var(--red); }
.as-chip.err small { color: var(--red); }
.as-chip button { border: none; background: transparent; cursor: pointer; color: var(--text-muted); font-size: 15px; line-height: 1; padding: 0 0 0 2px; }
.as-chip button:hover { color: var(--red); }
.as-msg.user { display: block; }          /* общий .user (шапка) делает flex — значок файла вставал сбоку от текста */
.as-att-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 5px; }
.as-att-list:last-child { margin-bottom: 0; }
.as-msg a.as-chip { color: var(--text); font-weight: 500; background: var(--surface); }
.as-msg a.as-chip:hover { border-color: var(--primary); }
.as-drop { position: absolute; inset: 8px; z-index: 5; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--primary);
           border-radius: 14px; background: var(--surface); opacity: .94; color: var(--primary); font-weight: 600; font-size: 14px; pointer-events: none; }
.as-drop[hidden] { display: none; }
/* Телефон: окно чата между краями экрана (top + bottom), а не «100vh минус…»: в приложении с экрана «Домой» 100vh больше
   окна на высоту полоски с часами (iOS 26: 874 против 812), и верх окна уезжал за край. env() — если страница всё же
   заходит под полоску или вырез. Открытую клавиатуру и зазор над кнопками учитывает chat_layout.js. */
@media (max-width: 640px) {
    .as-box { right: 8px; left: 8px; width: auto; height: auto;
              top: calc(8px + env(safe-area-inset-top, 0px)); bottom: calc(var(--chat-panel-bottom) + env(safe-area-inset-bottom, 0px)); }
    .as-fab { right: 16px; }
    .as-head { gap: 3px; padding: 10px; }
    .as-head b { font-size: 15px; }
    .as-msgs { padding: 10px; }
    .as-form { padding: 10px 8px; gap: 6px; }
}

/* ── чек-лист «Как получить точный план» (static/js/forecast_checklist.js) ── */
.ck-fab { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(22px + env(safe-area-inset-bottom, 0px)); z-index: 58;
          display: flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--border); border-radius: 999px;
          background: var(--surface); color: var(--text); font-weight: 700; font-size: 13px; box-shadow: var(--shadow-pop); cursor: pointer; }
.ck-fab .ck-count { font-size: 11.5px; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 1px 8px; }
.ck-fab.ck-back { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow-pop); }
.ck-box { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 59;
          width: min(680px, calc(100vw - 32px)); max-height: min(780px, calc(100vh - 150px)); display: flex; flex-direction: column;
          background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.ck-box[hidden] { display: none; }
.ck-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.ck-head b { font-size: 14.5px; }
.ck-prog { font-size: 12px; color: var(--text-muted); }
.ck-grow { flex: 1; }
.ck-x { border: none; background: transparent; font-size: 22px; line-height: 1; color: var(--text-mid); cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.ck-x:hover { background: var(--surface-2); }
.ck-bar { height: 4px; background: var(--surface-2); flex: none; }
.ck-bar i { display: block; height: 100%; background: var(--green); transition: width .2s; }
.ck-body { overflow: auto; overscroll-behavior: contain; padding: 4px 14px 12px; }
.ck-intro { margin: 10px 2px 2px; font-size: 12.5px; line-height: 1.45; color: var(--text-mid); }
.ck-grp { display: flex; align-items: baseline; gap: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
          color: var(--text-muted); margin: 16px 2px 6px; }
.ck-grp em { font-style: normal; font-weight: 600; text-transform: none; letter-spacing: 0; }
.ck-step { border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px 8px 12px; margin-bottom: 8px; background: var(--surface); transition: background .3s, border-color .3s; }
.ck-step.on { background: var(--surface-2); }
.ck-step.open:not(.on) { border-color: var(--primary); }
.ck-step.ck-flash { border-color: var(--primary); background: var(--primary-soft); }
.ck-top { display: flex; align-items: flex-start; gap: 8px; }
.ck-cb { margin: 4px 0 0; width: 17px; height: 17px; flex: none; accent-color: var(--green); cursor: pointer; }
.ck-head-btn { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 8px; border: none; background: transparent; padding: 1px 2px;
               font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
.ck-head-btn:hover { background: var(--surface-2); }
.ck-n { flex: none; min-width: 20px; height: 20px; border-radius: 999px; background: var(--primary-soft); color: var(--primary);
        font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; margin-top: 1px; }
.ck-t { flex: 1; font-size: 13.5px; line-height: 1.4; }
.ck-chev { flex: none; color: var(--text-mid); font-size: 12px; line-height: 20px; padding: 0 4px; }
.ck-step.on .ck-t { color: var(--text-muted); text-decoration: line-through; }
.ck-step.on .ck-n { background: var(--green-soft); color: var(--green); }
.ck-main { display: none; margin: 6px 0 2px 55px; }
.ck-step.open .ck-main { display: block; }
.ck-what { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text); }
.ck-where { margin: 8px 0 0; padding: 6px 8px; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: 0 8px 8px 0;
            font-size: 12px; line-height: 1.5; color: var(--text-mid); }
.ck-step.on .ck-where { background: var(--surface); }
.ck-wl { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--primary); line-height: 1.4; margin-bottom: 2px; }
.ck-path { display: block; }
.ck-path + .ck-path { margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--border); }
.ck-crumb { display: inline-block; max-width: 100%; vertical-align: top; background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
            padding: 0 5px; margin: 2px 0; }
.ck-arr { font-style: normal; font-weight: 700; color: var(--primary); margin: 0 4px; vertical-align: top; line-height: 22px; }
.ck-shows { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ck-show { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--primary); background: var(--surface);
           color: var(--primary); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ck-show:hover { background: var(--primary-soft); }
.ck-thumb { display: block; margin-top: 10px; max-width: 100%; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
            background: var(--surface-2); cursor: zoom-in; position: relative; }
.ck-thumb img { display: block; max-width: 100%; height: auto; }
.ck-thumb.ck-tall::after { content: "⤢ крупно"; position: absolute; right: 6px; top: 6px; padding: 0 7px; height: 20px; border-radius: 6px; font-size: 11px; line-height: 20px;
                   background: var(--surface); color: var(--text-mid); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); opacity: 0; transition: opacity .15s; }
.ck-thumb.ck-tall:hover::after { opacity: 1; }
.ck-thumb:hover { border-color: var(--primary); }
.ck-thumb.ck-noimg { display: none; }
.ck-foot { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); flex: none; }
.ck-reset { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 6px 12px; font-weight: 600; cursor: pointer; }
.ck-reset:hover { background: var(--surface-2); }
.ck-tip { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(78px + env(safe-area-inset-bottom, 0px)); z-index: 59;
          width: min(540px, calc(100vw - 32px)); padding: 10px 34px 10px 14px; border-radius: 12px;
          background: var(--surface); color: var(--text); border: 1px solid var(--primary); box-shadow: var(--shadow-pop); font-size: 12.5px; line-height: 1.45; }
.ck-tip.ck-tip-top { bottom: auto; top: 72px; }
.ck-tip[hidden] { display: none; }
.ck-tip b, .ck-tip span { display: block; }
.ck-tip p { margin: 4px 0 0; }
.ck-tip span { color: var(--text-muted); margin-top: 4px; font-size: 11.5px; }
.ck-tip.bad { border-color: var(--amber); }
.ck-tip-x { position: absolute; right: 6px; top: 6px; border: none; background: transparent; font-size: 20px; line-height: 1; color: var(--text-mid);
            cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.ck-tip-x:hover { background: var(--surface-2); }
.ck-lb { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px;
         background: rgba(10, 10, 20, .72); cursor: zoom-out; }
.ck-lb[hidden] { display: none; }
.ck-lb figure { margin: 0; max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ck-lb img { max-width: 100%; max-height: calc(100vh - 110px); height: auto; object-fit: contain; border-radius: 10px; background: var(--surface);
             box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }
.ck-lb figcaption { color: #fff; font-size: 13px; font-weight: 600; text-align: center; }
.ck-lb figcaption span { display: block; font-weight: 400; opacity: .75; font-size: 12px; margin-top: 2px; }
.ck-hl { outline: 3px solid var(--primary) !important; outline-offset: 3px; animation: ck-pulse 1s ease-in-out 4; }
.ck-hl.ck-hl-in { outline-offset: -3px; }
.ck-mark { border-radius: 4px; }
@keyframes ck-pulse { 0%, 100% { outline-color: var(--primary); } 50% { outline-color: var(--red); } }
@media (max-width: 640px) {
    .ck-fab .ck-fab-t { display: none; } .ck-fab.ck-back .ck-fab-t { display: inline; }
    .ck-fab { left: 16px; transform: none; }
    .ck-box { left: 8px; right: 8px; width: auto; transform: none; max-height: calc(100vh - 146px); }
    .ck-tip { left: 12px; right: 12px; width: auto; transform: none; }
    .ck-tip.ck-tip-top { top: 70px; }
    .ck-body { padding: 4px 10px 10px; }
    .ck-main { margin-left: 0; }
    .ck-foot { flex-wrap: wrap; gap: 8px; }
}

/* ---------- Настройки → Бот (settings_bot.html) ---------- */
.bot-seg { flex: none; display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 3px; background: var(--bg); gap: 2px; flex-wrap: wrap; }
.bot-seg button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 12.5px; color: var(--text-mid); cursor: pointer; box-shadow: none; }
.bot-seg button:hover { color: var(--primary-dark); }
.bot-seg button.on { background: var(--surface); color: var(--primary-dark); font-weight: 600; box-shadow: var(--shadow); }
.bot-voice, .bot-review { flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bot-voice select, .bot-review input[type="time"] { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.bot-rate { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-mid); }
.bot-rate input[type="range"] { width: 120px; accent-color: var(--primary); }
.bot-rate span { font-weight: 600; color: var(--text); min-width: 26px; text-align: right; }

.bot-down { border-left: 3px solid var(--amber); }
.bot-down code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.bot-help ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--text-mid); }
.bot-help li + li { margin-top: 4px; }
.bot-help b { color: var(--text); }
.bot-plans td { vertical-align: top; }
.bot-plans th { text-align: left; }
.bot-plans .bot-plan-text { font-size: 12.5px; line-height: 1.45; max-width: 560px; color: var(--text-mid); white-space: normal; }
.bot-plans .bot-plan-text .dim { margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.bot-plans .nowrap { white-space: nowrap; }
.bot-st { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-mid); white-space: nowrap; }
.bot-st.st-asked, .bot-st.st-comment { background: var(--amber-soft); color: var(--ink-amber); }
.bot-st.st-approved { background: var(--primary-soft); color: var(--primary-dark); }
.bot-st.st-done { background: var(--green-soft); color: var(--green); }
.bot-st.st-failed { background: var(--red-soft); color: var(--red); }

.bot-act + .bot-act { margin-left: 6px; }
.bot-toast { position: fixed; right: 20px; bottom: 20px; padding: 10px 16px; border-radius: 12px; background: var(--tooltip-bg); color: var(--tooltip-text); font-size: 13px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .15s, transform .15s; pointer-events: none; z-index: 50; }
.bot-toast.show { opacity: 1; transform: none; }
.bot-toast.bad { background: var(--red); }
@media (max-width: 640px) { .bot-seg { border-radius: 14px; } .bot-plans .bot-plan-text { max-width: 260px; } }

/* ===== Алерты: единый каталог — возможность, «нет плана», «нет на площадке», метки строк ===== */
/* --sky, --sky-soft — в токенах вверху файла (светлая и тёмная) */
.al-tile.opp { background: var(--sky-soft); border-color: color-mix(in srgb, var(--sky) 28%, transparent); }
.al-tile.opp .al-ico { background: var(--surface); border-color: color-mix(in srgb, var(--sky) 30%, transparent); color: var(--sky); }
.al-tile.opp .al-fig { color: var(--sky); }
.al-tile.na, .al-tile.noplan { background: var(--surface-2); border-style: dashed; }
.al-tile.na .al-fig, .al-tile.noplan .al-fig { font-size: 15px; letter-spacing: 0; color: var(--text-muted); font-weight: 700; }
.al-tile.na .al-ico, .al-tile.noplan .al-ico { color: var(--text-muted); background: transparent; }
.al-tile.na .al-name, .al-tile.noplan .al-name { color: var(--text-mid); }
.al-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--text-mid); margin: -12px 0 22px; }
.al-legend span { display: inline-flex; align-items: center; gap: 6px; }
.al-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--text-muted); }
.al-dot.fire { background: var(--red); }
.al-dot.warn { background: var(--amber); }
.al-dot.opp { background: var(--sky); }
.al-dot.calm { background: var(--green); }
.al-dot.na { background: transparent; border: 1.5px dashed var(--text-muted); width: 8px; height: 8px; }
.al-table td.pos { color: var(--sky); font-weight: 600; }
.al-empty a { color: var(--primary); }
.al-table td.neg { color: var(--red); font-weight: 600; }

/* ===== Справочник МРЦ ===== */
.mrc-viol .c-label,
.mrc-viol .mrc-card {
    white-space: normal;
    width: 320px;
    max-width: 320px;
}
.mrc-table .mrc-below { color: var(--red); font-weight: 700; }
.mrc-table .mrc-seller { display: block; font-size: 11px; color: var(--text-muted); }
.mrc-table .mrc-acts { white-space: nowrap; }
.mrc-table .mrc-acts form { display: inline; }
.mrc-rm-btn { border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer; margin-left: 8px; text-decoration: underline; }
.mrc-rm-btn:hover { color: var(--red); }
.mrc-who { font-size: 11.5px; line-height: 1.35; }

/* Нарушения МРЦ: заголовок бренда и ссылка на документ рядом с ним */
.mrc-brand { margin: 22px 0 8px; font-size: 16px; display: flex; align-items: baseline; gap: 10px; }
.mrc-brand-dl { font-size: 12.5px; font-weight: 400; text-decoration: underline; }
body.ro .mrc-table input, body.ro .mrc-table button { pointer-events: none; opacity: .5; }

/* ===== Прогнозирование: «Период базы и месяцы плана» (forecast_v2.html #fc2-set, заполняет forecast_v2.js renderSettings) ===== */
.fc2-set { max-width: 1100px; margin: 0 0 10px; }
.fc2-set details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.fc2-set details[open] { box-shadow: var(--shadow); }
.fc2-set summary { list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 8px 12px; cursor: pointer;
    font-size: 12.5px; color: var(--text-mid); line-height: 1.45; user-select: none; }
.fc2-set summary::-webkit-details-marker { display: none; }
.fc2-set summary::marker { content: ""; }
.fc2-set-line { flex: 1 1 auto; min-width: 0; }
.fc2-set-line b { color: var(--text); font-weight: 600; }
.fc2-set-line .sep { color: var(--text-muted); margin: 0 6px; }
.fc2-set-tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 7px; border-radius: 999px; background: var(--amber-soft);
    color: var(--ink-amber); line-height: 17px; }
.fc2-set-edit { flex: none; color: var(--primary); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 2px; }
.fc2-set summary:hover .fc2-set-edit { color: var(--primary-dark); }
.fc2-set-body { border-top: 1px solid var(--border); padding: 4px 12px 12px; font-size: 12.5px; color: var(--text-mid); }
.fc2-set-h { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-muted); margin: 12px 0 3px; }
.fc2-set-hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; max-width: 860px; }
.fc2-set-hint:empty, .fc2-set-now:empty { display: none; }
.fc2-set-now { font-size: 12px; color: var(--text-mid); margin: 5px 0 0; line-height: 1.45; max-width: 860px; }
.fc2-set-warn { color: var(--ink-amber); }
.fc2-set-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 8px 0 0; }
.fc2-set-row label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.fc2-set input[type="radio"], .fc2-set input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; cursor: pointer; flex: none; }
.fc2-set input[type="date"] { border: 1px solid var(--border); border-radius: 7px; padding: 5px 7px; font: inherit; font-size: 12.5px;
    background: var(--surface); color: var(--text); }
.fc2-set input[type="date"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.fc2-set input[type="date"]:disabled { color: var(--text-muted); background: var(--surface-2); }
.fc2-set-days { font-size: 12px; color: var(--text-muted); }
.fc2-set-days.err { color: var(--red); font-weight: 600; }
.fc2-set-months { display: grid; grid-template-columns: repeat(6, minmax(0, 120px)); gap: 6px; margin: 6px 0 0; }
.fc2-set-m { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; cursor: pointer;
    white-space: nowrap; font-size: 12.5px; color: var(--text-mid); background: var(--surface); }
.fc2-set-m small { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.fc2-set-m.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.fc2-set-act { margin-top: 12px; }
.fc2-set-msg { font-size: 12px; font-weight: 600; line-height: 1.4; max-width: 700px; }
.fc2-set-msg.ok { color: var(--green); }
.fc2-set-msg.err { color: var(--red); }
.fc2-set-msg .w { display: block; margin-top: 3px; color: var(--ink-amber); font-weight: 500; }
/* обычный пользователь (body.ro): сводку видно, поля и кнопки блока неактивны (сервер ответит 403) */
body.ro #fc2-set .fc2-set-body input, body.ro #fc2-set .fc2-set-body button, body.ro #fc2-set .fc2-set-m { pointer-events: none; opacity: .5; }
@media (max-width: 760px) {
    /* iPhone: блок свёрнут (details без open), поля 16px — Safari не приближает страницу при фокусе, месяцы 4×3,
       «Сохранить» на всю ширину */
    .fc2-set summary { font-size: 13px; padding: 10px 12px; }
    .fc2-set-line .sep { display: block; height: 4px; overflow: hidden; color: transparent; }      /* «Месяцы плана» — с новой строки */
    .fc2-set-body { padding: 4px 12px 14px; font-size: 13px; }
    .fc2-set input, .fc2-set select, .fc2-set input[type="date"] { font-size: 16px; }
    .fc2-set input[type="radio"], .fc2-set input[type="checkbox"] { width: 18px; height: 18px; }
    .fc2-set-mode { flex-direction: column; align-items: flex-start; gap: 10px; }
    .fc2-set-dates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
    .fc2-set-dates label { flex-direction: column; align-items: stretch; gap: 3px; font-size: 12px; white-space: normal; }
    .fc2-set-dates input[type="date"] { width: 100%; box-sizing: border-box; min-height: 42px; }
    .fc2-set-days { grid-column: 1 / -1; }
    .fc2-set-months { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .fc2-set-m { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: center; gap: 1px 5px;
        min-height: 46px; padding: 5px 2px; font-size: 13px; }
    .fc2-set-m small { grid-column: 1 / -1; text-align: center; }
    .fc2-set-act { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
    .fc2-set-act .fc2-btn { padding: 11px 8px; font-size: 14px; text-align: center; white-space: normal; }
    #fc2-set-save { grid-column: 1 / -1; scroll-margin-bottom: 96px; }      /* не под плавающей кнопкой чек-листа .ck-fab */
    .fc2-set-msg { grid-column: 1 / -1; font-size: 13px; }
}

/* ===== PULS как приложение (PWA): открыто с экрана «Домой» =====
   Класс html.pwa и viewport-fit=cover ставит templates/_pwa_head.html только в установленном
   приложении; в обычном браузере правила ниже не действуют. env(safe-area-inset-*) не ноль лишь
   на телефонах с вырезом: сбоку в альбомной ориентации и снизу под полоской «домой» —
   при нулевых отступах раскладка та же, что в браузере. */
html.pwa body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
html.pwa .sidebar { left: env(safe-area-inset-left, 0px); padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
html.pwa .content { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
/* Если страница в приложении заходит под полоску с часами (env(safe-area-inset-top) > 0; со стилем «default» обычно 0,
   с «black-translucent» — высота полоски): верхняя панель, меню, фильтры РНП и окна прогноза опускаются под неё */
html.pwa .topbar { padding-top: env(safe-area-inset-top, 0px); height: calc(62px + env(safe-area-inset-top, 0px)); }
html.pwa .rnp-sticky { top: calc(62px + env(safe-area-inset-top, 0px)); }
html.pwa .sidebar { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
html.pwa .fc3-modal { padding-top: calc(30px + env(safe-area-inset-top, 0px));
                      padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
html.pwa body.login-body {
    padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px))
             max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
}
@media (min-width: 641px) {
    html.pwa .as-fab, html.pwa .as-box { right: calc(22px + env(safe-area-inset-right, 0px)); }
}
@media (max-width: 900px) {
    html.pwa .content { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
    html.pwa .topbar { height: calc(54px + env(safe-area-inset-top, 0px)); }
    html.pwa .rnp-sticky { top: calc(54px + env(safe-area-inset-top, 0px)); }
    /* выдвижное меню прячется целиком, вместе с полосой под вырезом */
    html.pwa .sidebar, html.pwa.nav-collapsed .sidebar { transform: translateX(calc(-102% - env(safe-area-inset-left, 0px))); }
    html.pwa.nav-open .sidebar { transform: none; }
}

/* Потянуть вниз — обновить (static/pwa/pwa.js): кружок сверху, только в установленном приложении.
   overscroll-behavior: contain — у Chrome на Android не срабатывает своё обновление поверх нашего;
   пружина iPhone остаётся. */
html.pwa { overscroll-behavior-y: contain; }
.ptr {
    position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 10px); z-index: 95;
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface); color: var(--text-mid); border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(23, 23, 31, .14); transform: translate(-50%, -56px); opacity: 0; pointer-events: none;
}
@media (min-width: 901px) {   /* меню слева видно — кружок над колонкой страницы, а не над всем экраном */
    .shell ~ .ptr { left: calc(50% + var(--side) / 2); }
    html.nav-collapsed .shell ~ .ptr { left: calc(50% + var(--rail) / 2); }
}
.ptr svg { width: 20px; height: 20px; stroke-width: 2.2; }
.ptr.is-ready, .ptr.is-busy { color: var(--primary); }
.ptr.is-back { transition: transform .2s ease, opacity .2s ease; }
.ptr.is-busy svg { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .ptr.is-back { transition: none; }
    .ptr.is-busy svg { animation-duration: 2.4s; }
}

/* Файл в приложении на iPhone (static/pwa/pwa.js): панель снизу вместо открытия файла поверх приложения */
.pfile { position: fixed; inset: 0; z-index: 130; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; }
.pfile-box {
    width: min(480px, 100%); box-sizing: border-box; display: grid; gap: 10px; background: var(--surface); color: var(--text);
    border-radius: 18px 18px 0 0; box-shadow: 0 -8px 32px rgba(20, 20, 60, .18);
    padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
}
.pfile-name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.pfile-st { font-size: 13px; color: var(--text-mid); }
.pfile-st.err { color: var(--red); }
.pfile-go { width: 100%; }
.pfile-go:disabled { opacity: .5; cursor: default; }
.pfile-x { font: inherit; font-size: 14px; font-weight: 600; color: var(--text-mid); background: none; border: 0; padding: 10px; cursor: pointer; }

/* iPhone: Safari сам приближает страницу, когда нажимают на поле для печати со шрифтом мельче 16px
   (чат с Claude, поиск, числа). Здесь таким полям — 16px. @supports срабатывает только на iOS/iPadOS,
   @media оставляет правило телефонам: iPad при фокусе не приближает. Выпадающие списки и поля дат
   на iOS 16+ страницу не приближают — их не трогаем, иначе разъезжаются фильтры РНП и списки прогноза.
   !important — перебить мелкие размеры из страничных стилей (forecast3.css, demand.css и др.). */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 500px), (max-height: 500px) {
        input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="hidden"]):not([type="date"]):not([type="time"]):not([type="month"]):not([type="datetime-local"]),
        textarea, [contenteditable]:not([contenteditable="false"]) { font-size: 16px !important; }
    }
}

/* Кнопка темы в шапке: видна иконка текущего режима (как в системе / светлая / тёмная) */
.theme-btn svg { display: none; }
.theme-btn[data-theme="system"] .th-system, .theme-btn:not([data-theme]) .th-system,
.theme-btn[data-theme="light"] .th-light, .theme-btn[data-theme="dark"] .th-dark { display: block; }

/* Админская техподдержка: отдельная очередь правок сайта. */
.su-fab { z-index: 62; width: 88px; min-height: 56px; box-sizing: border-box; padding: 12px 10px; gap: 6px; font-size: 14px; bottom: calc(90px + env(safe-area-inset-bottom, 0px) + var(--chat-keyboard-inset, 0px)); background: var(--surface); color: var(--primary); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.su-fab svg { width: 24px; height: 24px; flex: none; }
.su-fab:hover { background: var(--surface-2); }
.su-box { z-index: 62; }
.su-msgs { gap: 12px; }
.su-job { width: 100%; }
.su-phase { font-size: 13px; font-weight: 700; color: var(--primary); padding-bottom: 7px; }
.su-job[data-status="error"] .su-phase, .su-job[data-status="interrupted"] .su-phase { color: var(--red); }
.su-events { margin: 0 0 10px; padding-left: 22px; font-size: 14px; color: var(--text-mid); }
.su-events li { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.su-step, .su-plan { font-size: 13px; color: var(--text-muted); margin: 5px 0; }
.su-commit { margin: 7px 0; font-size: 14px; }
.su-commit code, .su-plan code { white-space: normal; overflow-wrap: anywhere; }
.su-deployed { color: var(--primary); font-size: 14px; font-weight: 700; margin: 7px 0; }
.su-answer { margin-top: 10px; }
.su-connection { flex: none; padding: 8px 12px; color: var(--red); font-size: 13px; background: var(--surface-2); }
.su-connection[hidden] { display: none; }
.su-approval { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.su-approval p { font-size: 14px; margin: 7px 0 10px; }
.su-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.su-actions button { min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2); cursor: pointer; }
.su-actions button[data-decision="approve"] { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
.su-actions button:disabled, .su-form .as-send:disabled { opacity: .55; cursor: wait; }
.su-hist button span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
    .su-fab { right: 16px; }
    .su-box .as-head b { font-size: 14px; }
    .su-box .as-sub { font-size: 11px; }
    .su-actions button { flex: 1 1 140px; }
}
/* Дата со стрелками не сжимается до обрезанного года на телефоне. */
.pivot-filters > label:has(input[type=date]) { min-width:min(160px,100%); }
.pivot-filters > label:has(.loc-date input[type=date]) { min-width:min(215px,100%); }
.pivot-filters.loc-filters .loc-date input[type=date] { min-width:145px; flex:1; }
.pivot-filters .loc-date-step { flex:none; }

/* Keep the existing chat buttons visible. Reserve enough scroll room for
   the final page actions to be brought above the fixed launcher stack. */
body:has(.as-fab) .content { padding-bottom: calc(var(--chat-panel-bottom) + 16px + env(safe-area-inset-bottom, 0px)); }
html:has(.as-fab) { scroll-padding-bottom: calc(174px + env(safe-area-inset-bottom, 0px)); }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 1; }

/* Connections: visible field boundaries before focus, in both themes. */
.conn-field input[type="text"], .conn-field input[type="password"] {
    width: 100%; max-width: 520px; min-width: 0; min-height: 42px; box-sizing: border-box;
    padding: 8px 10px; border: 1px solid var(--text-muted); border-radius: 8px;
    background: var(--surface-2); color: var(--text); font: inherit;
}
.conn-field input[type="text"]:focus, .conn-field input[type="password"]:focus {
    border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 2px;
}
