/* ============================================================
   Кабінет партнера INMACH — дизайн-система (редизайн 08.2026)

   Токени і спільні компоненти. Підключається лише з partners/base.html.
   ============================================================ */

:root {
    /* Поверхні й текст */
    --ink: #14181f;
    --ink-2: #3c4654;
    --muted: #5f6b7a;
    --muted-2: #8894a4;
    --line: #e3e7ec;
    --line-soft: #eef1f5;
    --row-line: #f1f4f7;
    --bg: #f2f4f7;
    --surface: #fff;
    --surface-alt: #f7f9fb;
    --row-hover: #fbfcfd;
    --input-border: #d8dee6;

    /* Фірмовий синій */
    --primary: #0000ff;
    --primary-hover: #0000c2;
    --primary-bg: #eef3ff;

    /* Ціна / успіх */
    --ok: #0b7a53;
    --ok-bg: #e7f6ef;
    --ok-row: #f6fbf8;

    /* Попередження */
    --warn: #8a5a00;
    --warn-bg: #fdf1d6;
    --warn-border: #ecd39a;
    --warn-accent: #c98a1a;

    /* Помилка */
    --danger: #a51f1f;
    --danger-bg: #fdeceb;
    --danger-border: #f0bcb8;

    /* Нейтральний бейдж */
    --neutral-bg: #eef1f5;
    --neutral-border: #e0e5eb;

    --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-brand: "Manrope", var(--font-ui);
    /* Числа й артикули — тільки моно: колонки цін вирівнюються по розряду. */
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --container: 1280px;
}

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

body {
    font-family: var(--font-ui);
    font-size: 13.5px;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

/* --- Шапка: логотип, вкладки й компанія одним рядком ------------ */
.p-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    min-height: 56px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 28px;
}
.p-header-logo { height: 26px; width: 98px; object-fit: contain; display: block; }
.p-header-divider { width: 1px; height: 22px; background: var(--line); }
.p-header-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.p-header-company { text-align: right; line-height: 1.3; }
.p-header-company .name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    display: block;
}
.p-header-company .rates {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    display: block;
}
.p-logout {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
}
.p-logout:hover { color: var(--ink); text-decoration: underline; }
.p-logout-form { display: inline; margin: 0; }

/* --- Вкладки (усередині шапки) --------------------------------- */
.p-tabs {
    align-self: stretch;
    display: flex;
    align-items: stretch;
    gap: 2px;
}
.p-tabs a {
    padding: 0 14px;
    min-height: 56px;
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    transition: color .15s, box-shadow .15s;
}
.p-tabs a:hover { color: var(--ink); text-decoration: none; }
.p-tabs a.active {
    color: var(--ink);
    font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--primary);
}
.p-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1;
    border-radius: 10px;
    padding: 3px 7px;
}
.p-tab-badge[hidden] { display: none; }

/* --- Каркас сторінки ------------------------------------------ */
.p-main {
    flex: 1;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 24px 32px 36px;
}
.p-title {
    font-family: var(--font-brand);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin-bottom: 16px;
}
.p-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.p-card-pad { padding: 20px; }

/* --- Кнопки --------------------------------------------------- */
.p-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.p-btn:hover { text-decoration: none; }
.p-btn-primary { background: var(--primary); color: #fff; }
.p-btn-primary:hover { background: var(--primary-hover); color: #fff; }
.p-btn-primary:disabled,
.p-btn-primary[disabled] { background: #9aa5b4; cursor: not-allowed; }
.p-btn-ghost {
    background: var(--surface);
    border-color: var(--input-border);
    color: var(--ink-2);
}
.p-btn-ghost:hover { border-color: var(--muted-2); color: var(--ink); }
/* Ghost на темному фоні (hero «Огляду», ліва панель входу). */
.p-btn-ghost-dark {
    background: transparent;
    border-color: var(--ink-2);
    color: #e7eaef;
}
.p-btn-ghost-dark:hover { border-color: var(--muted-2); color: #fff; }
.p-btn-lg { padding: 12px 20px; font-size: 15px; }
.p-btn-block { width: 100%; }

/* --- Поля форм ------------------------------------------------ */
.p-field { margin-bottom: 14px; }
.p-field label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
}
.p-field input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--input-border);
    border-radius: 9px;
    background: var(--surface);
    font-family: var(--font-ui);
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.p-field input::placeholder,
.p-textarea::placeholder { color: var(--muted-2); }
.p-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 255, .1);
}
.p-field input.has-error { border-width: 1.5px; border-color: var(--danger); }
/* Селект тієї ж форми, що й поле .p-field (рахунок на організацію в кошику). */
.p-select {
    width: 100%;
    height: 42px;
    padding: 0 36px 0 12px;
    border: 1px solid var(--input-border);
    border-radius: 9px;
    background: var(--surface);
    font-family: var(--font-ui);
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: border-color .15s, box-shadow .15s;
}
.p-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 255, .1);
}
.p-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--input-border);
    border-radius: 9px;
    font-family: var(--font-ui);
    font-size: 13.5px;
    color: var(--ink);
    resize: vertical;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.p-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 255, .1);
}

/* --- Банери --------------------------------------------------- */
.p-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 16px;
}
.p-banner-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.p-banner-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.p-banner-ok { background: var(--ok-bg); border-color: #b8e2ce; color: var(--ok); }
.p-banner-info { background: var(--primary-bg); border-color: #c9d6ff; color: var(--primary-hover); }

/* --- Бейджі --------------------------------------------------- */
.p-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.4;
    border-radius: 5px;
    padding: 3px 8px;
    white-space: nowrap;
}
.p-badge-ok { background: var(--ok-bg); color: var(--ok); }
.p-badge-warn { background: var(--warn-bg); color: var(--warn); }
.p-badge-neutral { background: var(--neutral-bg); color: var(--muted); }

/* Pill-статуси (журнал рахунків) */
.p-pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    padding: 4px 11px;
    white-space: nowrap;
}
.p-pill-ok { background: var(--ok-bg); color: var(--ok); }
.p-pill-warn { background: var(--warn-bg); color: var(--warn); }
.p-pill-danger { background: var(--danger-bg); color: var(--danger); }
.p-pill-info { background: var(--primary-bg); color: var(--primary-hover); }

/* --- Утиліти -------------------------------------------------- */
.p-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.p-muted { color: var(--muted); }
.p-muted-2 { color: var(--muted-2); }

/* --- Порожній стан -------------------------------------------- */
.p-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}
.p-empty h3 {
    font-family: var(--font-brand);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 8px;
}
.p-empty p { font-size: 13.5px; line-height: 1.5; max-width: 460px; margin: 0 auto 16px; }

/* --- Тости ---------------------------------------------------- */
@keyframes toastIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}
.p-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 300;
    display: none;
    align-items: center;
    gap: 12px;
    max-width: 360px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.4;
    box-shadow: 0 16px 34px -18px rgba(20, 24, 31, .6);
}
.p-toast.show { display: flex; animation: toastIn .18s ease-out; }
.p-toast-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.p-toast-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.p-toast-neutral { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.p-toast button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    white-space: nowrap;
}

/* --- Модалка -------------------------------------------------- */
.p-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(20, 24, 31, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}
.p-modal-overlay.show { opacity: 1; pointer-events: auto; }
.p-modal {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 18px 40px -26px rgba(20, 24, 31, .6);
    max-width: 420px;
    width: 100%;
    padding: 22px 24px 18px;
    transform: translateY(8px);
    transition: transform .15s;
}
.p-modal-overlay.show .p-modal { transform: none; }
.p-modal-title {
    font-family: var(--font-brand);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 8px;
}
.p-modal-message {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--muted);
    margin-bottom: 20px;
}
.p-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.p-btn-danger { background: var(--danger); color: #fff; }
.p-btn-danger:hover { background: #8a1a1a; color: #fff; }

/* ============================================================
   Вхід / встановлення пароля — двопанельний екран
   ============================================================ */
.p-auth-page {
    /* .p-main уже flex:1, але це блок — без власної висоти вертикальне
       центрування не спрацює. 60px — паддинги .p-main зверху й знизу. */
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}
.p-auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 900px;
    min-height: 520px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--surface);
}
.p-auth-brand {
    background: var(--ink);
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
}
/* Виворотка просто на темному тлі — біла плашка більше не потрібна. */
.p-auth-brand-logo {
    height: 30px;
    width: 113px;
    object-fit: contain;
    display: block;
    align-self: flex-start;
}
.p-auth-brand h1 {
    font-family: var(--font-brand);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #fff;
    line-height: 1.15;
    margin-bottom: 12px;
}
.p-auth-brand p {
    font-size: 13.5px;
    line-height: 1.55;
    color: #a9b3c0;
    max-width: 300px;
}
.p-auth-form { padding: 32px; display: flex; flex-direction: column; justify-content: center; }
.p-auth-form h2 {
    font-family: var(--font-brand);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
}
.p-auth-form .p-hint {
    font-size: 12.5px;
    line-height: 1.55;
    color: #7a8695;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--row-line);
}
.p-auth-form .p-link-sm { font-size: 12px; font-weight: 500; }
/* Мітка поля + посилання поруч («Пароль · Забули пароль?»): посилання не
   всередині <label>, інакше воно стає частиною назви поля (PP-18). */
.p-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}
.p-field .p-label-row label { margin-bottom: 0; }

/* Індикатор надійності пароля */
.p-strength { display: flex; gap: 5px; margin-top: 8px; }
.p-strength span {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--line);
    transition: background .15s;
}
.p-strength[data-score="1"] span:nth-child(1) { background: var(--danger); }
.p-strength[data-score="2"] span:nth-child(-n+2) { background: var(--warn-accent); }
.p-strength[data-score="3"] span { background: var(--ok); }
.p-strength-label { font-size: 11.5px; color: var(--muted); margin-top: 6px; display: block; }

/* --- Мобільний ------------------------------------------------ */
@media (max-width: 900px) {
    /* Телефон: логотип і компанія — перший рядок, вкладки — другий на
       всю ширину. */
    .p-header { padding: 8px 16px 0; gap: 0 12px; }
    .p-header-logo { height: 22px; width: 83px; }
    .p-header-divider { display: none; }
    .p-header-company .name { font-size: 11.5px; }
    .p-header-company .rates { font-size: 10.5px; }
    .p-logout { font-size: 11.5px; }
    .p-tabs {
        order: 3;
        flex: 0 0 calc(100% + 16px);
        margin: 4px -8px 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .p-tabs::-webkit-scrollbar { display: none; }
    .p-tabs a { padding: 0 10px; min-height: 44px; font-size: 13.5px; }
    .p-main { padding: 16px 12px 28px; }
    .p-title { font-size: 17px; }
    .p-card-pad { padding: 16px; }

    .p-auth { grid-template-columns: 1fr; min-height: 0; }
    .p-auth-brand {
        min-height: 120px;
        padding: 20px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .p-auth-brand h1 { font-size: 20px; margin-bottom: 0; }
    .p-auth-brand p { display: none; }
    .p-auth-brand-logo { align-self: center; height: 24px; width: 90px; }
    .p-auth-form { padding: 24px 20px 28px; }
    .p-toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
/* 360–420 px: чотири вкладки мусять влазити без прокрутки — інакше
   «Огляд» ховається за краєм, і його ніхто не знаходить. */
@media (max-width: 420px) {
    .p-tabs { flex-basis: calc(100% + 24px); margin: 4px -12px 0; }
    .p-tabs a { padding: 0 7px; font-size: 13px; }
}

/* ============================================================
   «Товари» — панель фільтрів, таблиця, степер
   ============================================================ */

.p-stock { position: relative; }
.p-stock-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.p-stock-layout [hidden] { display: none !important; }
.p-stock-main { min-width: 0; }

/* --- Список розділів: «розділ — знижка — товарів» --------------- */
/* Один компонент на дві сторінки: навігація «Товарів» (кнопки) і «Мої
   знижки» на «Огляді» (посилання). Порядок сталий, обирається один. */
.p-sections {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 8px;
}
.p-sections-head, .p-sections-backdrop { display: none; }
.p-section-cols, .p-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px 32px;
    gap: 8px;
    align-items: center;
}
.p-section-cols {
    padding: 8px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
}
.p-section-cols span + span { text-align: right; }
.p-section {
    width: 100%;
    min-height: 40px;
    padding: 7px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 13.5px;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.p-section:hover { background: var(--surface-alt); color: var(--ink); text-decoration: none; }
.p-section.selected { background: var(--primary-bg); color: var(--primary-hover); font-weight: 600; }
.p-section .disc {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ok);
}
.p-section .disc.none { color: var(--muted); font-weight: 400; }
.p-section .cnt {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}
.p-sections-sep { height: 1px; background: var(--line-soft); margin: 6px 12px; }
.p-sections-foot {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 4px 0;
    padding: 12px 8px 6px;
    border-top: 1px solid var(--line-soft);
    font-size: 12.5px;
    color: var(--muted);
}
.p-sections-foot a { font-weight: 600; }

/* --- Заголовок розділу ------------------------------------------ */
.p-stock-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 2px 0 12px;
}
.p-stock-title h1 {
    font-family: var(--font-brand);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.01em;
}
.p-stock-disc {
    padding: 2px 9px;
    border-radius: 6px;
    background: var(--ok-bg);
    color: var(--ok);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.p-stock-sub { font-size: 13px; color: var(--muted); }

/* --- Пошук і «Лише в наявності» (липка панель) ------------------- */
.p-stock-tools {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 0 12px;
    background: var(--bg);
}
.p-section-btn { display: none; }
.p-search { position: relative; flex: 1; max-width: 520px; min-width: 200px; }
.p-search input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--surface);
    font-family: var(--font-ui);
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.p-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 255, .1);
}
.p-search svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--muted);
}
.p-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 40px;
    padding: 0 13px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .12s, background .12s, color .12s;
}
.p-toggle .knob {
    width: 30px;
    height: 18px;
    padding: 2px;
    border-radius: 9px;
    background: var(--muted-2);
    display: flex;
    transition: background .12s;
}
.p-toggle .knob::after {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform .12s;
}
.p-toggle[aria-pressed="true"] {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary-hover);
}
.p-toggle[aria-pressed="true"] .knob { background: var(--primary); }
.p-toggle[aria-pressed="true"] .knob::after { transform: translateX(12px); }
.p-toggle .lbl-m { display: none; }

/* --- Таблиця --------------------------------------------------- */
.p-stock-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.p-stock-table thead th {
    position: sticky;
    top: var(--p-filters-h, 52px);
    z-index: 4;
    background: var(--surface-alt);
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    vertical-align: bottom;
}
.p-stock-table thead th:first-child { padding-left: 20px; }
.p-stock-table thead th:last-child { padding-right: 20px; }
.p-stock-table th.sortable { cursor: pointer; user-select: none; }
.p-stock-table th.sortable:hover { color: var(--ink); }
.p-stock-table th .sub {
    display: block;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted-2);
}
.p-stock-table th .arrow { margin-left: 4px; color: #c3ccd7; font-size: 10px; }
.p-stock-table th.sorted .arrow { color: var(--primary); }
.p-stock-table th.num, .p-stock-table td.num { text-align: right; }
.p-stock-table th.center, .p-stock-table td.center { text-align: center; }

.p-stock-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--row-line);
    vertical-align: middle;
}
.p-stock-table tbody td:first-child { padding-left: 20px; }
.p-stock-table tbody td:last-child { padding-right: 20px; }
.p-stock-table tbody tr:hover { background: var(--row-hover); }
.p-stock-table tbody tr.in-cart { background: var(--ok-row); }
.p-stock-table tbody tr.hidden-row { display: none; }

.c-name { line-height: 1.35; }
.p-name { display: flex; align-items: center; gap: 12px; }
.p-name .txt { min-width: 0; }
.p-thumb-none { flex: none; width: 36px; height: 36px; }
.p-cat { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 1px; }
/* Обрано розділ — підпис у рядку зайвий, він повторює заголовок. */
.p-stock-layout.single-cat .p-cat { display: none; }

.p-my-price {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--ok);
    white-space: nowrap;
}
.p-rrc {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}
.p-rrc-m { display: none; }

.p-thumb-btn {
    display: block;
    flex: none;
    padding: 0;
    border: 0;
    background: none;
    border-radius: 5px;
    cursor: zoom-in;
}
.thumb {
    display: block;
    width: 36px;
    height: 36px;
    margin: 0 auto;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    cursor: zoom-in;
}
.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 350;
    background: rgba(20, 24, 31, .75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    cursor: zoom-out;
}
.img-lightbox[hidden] { display: none; }
.img-lightbox img {
    max-width: min(90vw, 700px);
    max-height: 85vh;
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    object-fit: contain;
}

/* --- Степер ---------------------------------------------------- */
.p-step {
    display: inline-flex;
    align-items: stretch;
    width: 104px;
    border: 1.5px solid var(--input-border);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
    transition: border-color .15s, background .15s;
}
.p-step button {
    width: 28px;
    flex: none;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    padding: 0;
    transition: background .1s;
}
.p-step button:hover { background: var(--neutral-bg); }
.p-step input {
    flex: 1;
    min-width: 0;
    height: 28px;
    border: 0;
    background: transparent;
    outline: none;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    -moz-appearance: textfield;
}
.p-step input::-webkit-outer-spin-button,
.p-step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.p-step input::placeholder { color: var(--muted-2); font-weight: 400; }
.p-step.saving { border-color: var(--warn-accent); }
.p-step.in-cart { border-color: var(--ok); background: var(--ok-bg); }
.p-step.err { border-color: var(--danger); background: var(--danger-bg); }

/* --- Футер картки ---------------------------------------------- */
.p-stock-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 20px;
    background: var(--surface-alt);
    border-top: 1px solid var(--line-soft);
    border-radius: 0 0 12px 12px;
}
.p-stock-foot .note { font-size: 12.5px; color: var(--muted); }
.p-stock-foot .sum { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.p-stock-foot .sum .amount { font-size: 13.5px; color: var(--ink-2); }
.p-stock-foot .sum .amount b { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }

/* --- Липка нижня панель кошика (мобільний) --------------------- */
.p-cart-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--ink);
    color: #fff;
}
.p-cart-bar .info { line-height: 1.3; }
.p-cart-bar .info .cnt { font-size: 12px; color: #a9b3c0; display: block; }
.p-cart-bar .info .amount { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }

/* --- Мобільна версія «Товарів» --------------------------------- */
@media (max-width: 900px) {
    .p-stock-layout { display: block; }
    /* Список розділів стає нижньою шторкою; відкриває кнопка «Розділ». */
    .p-sections {
        display: none;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        z-index: 60;
        max-height: 82vh;
        border: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -8px 32px rgba(20, 24, 31, .18);
        padding: 8px 8px 20px;
    }
    .p-sections.open { display: block; }
    .p-sections-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 4px 2px 12px;
    }
    .p-sections-head .ttl { font-family: var(--font-brand); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
    .p-sections-close {
        width: 44px;
        height: 44px;
        border: 0;
        background: none;
        font-size: 22px;
        line-height: 1;
        color: var(--ink-2);
        cursor: pointer;
    }
    .p-section { min-height: 46px; font-size: 14.5px; }
    .p-sections-backdrop.open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(20, 24, 31, .42);
    }
    body.p-sheet-open { overflow: hidden; }

    .p-stock-title { margin: 0 0 10px; }
    .p-stock-title h1 { font-size: 18px; }
    /* Обраний розділ і знижку показує кнопка «Розділ» — бейдж у заголовку
       на вузькому екрані був би третім повтором. */
    .p-stock-title .p-stock-disc { display: none; }
    /* Уся панель липка, тому кожен зайвий піксель тут — це мінус рядок
       товару на екрані. */
    .p-stock-tools { gap: 8px; padding-bottom: 10px; }
    .p-section-btn {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 0 0 100%;
        min-height: 48px;
        padding: 5px 12px;
        border: 1px solid var(--input-border);
        border-radius: 8px;
        background: var(--surface);
        color: var(--ink);
        font-family: var(--font-ui);
        text-align: left;
        cursor: pointer;
    }
    .p-section-btn .lines { flex: 1; min-width: 0; }
    .p-section-btn .lbl { display: block; font-size: 11.5px; color: var(--muted); }
    .p-section-btn .val { display: block; font-size: 14px; font-weight: 600; }
    .p-search { max-width: none; min-width: 0; }
    .p-search input, .p-toggle { height: 44px; }
    .p-toggle .knob, .p-toggle .lbl-d { display: none; }
    .p-toggle .lbl-m { display: inline; }

    .p-stock-table thead { display: none; }
    .p-stock-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name  name"
            "price step"
            "avail step";
        align-items: center;
        gap: 4px 10px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--row-line);
    }
    .p-stock-table tbody td { display: block; padding: 0; border: 0; }
    .p-stock-table tbody td:first-child, .p-stock-table tbody td:last-child { padding-left: 0; padding-right: 0; }
    /* Тисячі рядків каталогу одним DOM: браузер не верстає й не малює
       рядки поза екраном, доки до них не догорнули (PP-11). Діє лише тут,
       де рядок — grid: до рядка таблиці (`table-row`) containment не
       застосовується. 104px — приблизна висота триповерхового рядка. */
    .p-stock-table tbody tr { content-visibility: auto; contain-intrinsic-size: auto 104px; }
    .p-stock-table tbody td.c-name { grid-area: name; padding-bottom: 4px; }
    .p-name { align-items: flex-start; gap: 10px; }
    .p-stock-table tbody td.c-avail { grid-area: avail; }
    .p-stock-table tbody td.c-price { grid-area: price; text-align: left; }
    .p-stock-table tbody td.c-qty { grid-area: step; justify-self: end; }
    /* РРЦ не ховається — вона переїжджає в комірку ціни. */
    .p-stock-table tbody td.c-rrc { display: none; }
    .p-rrc-m {
        display: inline;
        margin-left: 6px;
        font-family: var(--font-mono);
        font-size: 11px;
        color: var(--muted);
    }
    /* Поруч із ціною друге число без підпису читалося б як ще одна ціна. */
    .p-rrc-m::before { content: "РРЦ "; font-family: var(--font-ui); }
    .p-my-price { font-size: 15px; }
    .thumb, .p-thumb-none { width: 40px; height: 40px; }
    /* 44×44 — мінімальний таргет: зі складу працюють однією рукою. */
    .p-step { width: 128px; }
    .p-step button { width: 44px; height: 44px; font-size: 18px; }
    .p-step input { height: 44px; font-size: 15px; }

    .p-stock-foot { display: none; }
    .p-cart-bar.has-items { display: flex; }
    body.has-cart-bar { padding-bottom: 68px; }
}

/* ============================================================
   «Новий рахунок» — таблиця позицій + зведення справа
   ============================================================ */

.p-cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
    align-items: start;
}

.p-cart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-soft);
}
.p-cart-head .hint { font-size: 12.5px; color: var(--muted); }

.p-cart-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.p-cart-table thead th {
    background: var(--surface-alt);
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.p-cart-table th.num, .p-cart-table td.num { text-align: right; }
.p-cart-table th.center, .p-cart-table td.center { text-align: center; }
.p-cart-table th:first-child, .p-cart-table td:first-child { padding-left: 20px; }
.p-cart-table th:last-child, .p-cart-table td:last-child { padding-right: 20px; }
.p-cart-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--row-line);
    vertical-align: middle;
}
.p-cart-table tbody tr:last-child td { border-bottom: 0; }
.p-cart-name { line-height: 1.35; }
.p-cart-note {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    font-style: italic;
    color: var(--warn);
}
.p-line-price, .p-line-total {
    font-family: var(--font-mono);
    font-size: 13.5px;
    white-space: nowrap;
}
.p-line-total { font-weight: 600; }
.p-remove {
    background: transparent;
    border: 0;
    border-radius: 5px;
    padding: 3px 7px;
    font-size: 15px;
    line-height: 1;
    color: var(--muted-2);
    cursor: pointer;
}
.p-remove:hover { color: var(--danger); background: var(--danger-bg); }

/* --- Зведення --------------------------------------------------- */
.p-summary {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
    position: sticky;
    top: 16px;
}
.p-summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 10px;
}
.p-summary-row b { font-family: var(--font-mono); font-weight: 600; color: var(--ink-2); }
.p-summary-row.saving b { color: var(--ok); }
.p-summary-total {
    border-top: 1px solid var(--line);
    padding-top: 12px;
    margin-top: 4px;
}
.p-summary-total .label { font-size: 12.5px; color: var(--muted); display: block; }
.p-summary-total .value {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -.01em;
}
.p-limit { margin-top: 14px; }
.p-limit-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--line);
    overflow: hidden;
}
.p-limit-bar span {
    display: block;
    height: 100%;
    background: var(--ok);
    transition: width .2s;
}
.p-limit-bar.near span { background: var(--warn-accent); }
.p-limit-note { display: block; margin-top: 6px; font-size: 11.5px; color: var(--muted); }

.p-cart-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 16px;
}

@media (max-width: 900px) {
    .p-cart-layout { grid-template-columns: minmax(0, 1fr); }
    .p-summary { position: static; }
    .p-cart-table thead { display: none; }
    .p-cart-table tbody tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name  name"
            "price step"
            "total total";
        gap: 6px 10px;
        padding: 12px;
        border-bottom: 1px solid var(--row-line);
        /* «×» стоїть у куті, а не забирає цілу колонку завширшки зі
           степер: інакше назва ламалася на три рядки. */
        position: relative;
    }
    .p-cart-table tbody td { display: block; padding: 0; border: 0; text-align: left; }
    .p-cart-table td.c-name { grid-area: name; padding-right: 34px; }
    .p-cart-table td.c-price { grid-area: price; text-align: left; align-self: center; }
    .p-cart-table td.c-qty { grid-area: step; justify-self: end; }
    .p-cart-table td.c-total { grid-area: total; }
    .p-cart-table td.c-del { position: absolute; top: 8px; right: 6px; }
    /* Кнопки одна під одною, головна зверху: поруч обидві ламалися на
       два рядки. */
    .p-cart-actions { flex-direction: column-reverse; }
    .p-cart-actions .p-btn { width: 100%; justify-content: center; }
    .p-cart-limit-note { flex-basis: 100%; order: -1; }
}

/* ============================================================
   «Мої рахунки»
   ============================================================ */

.p-inv-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-soft);
}
.p-inv-head .meta { font-size: 12.5px; color: var(--muted); }
.p-inv-head .meta b { font-family: var(--font-mono); font-weight: 600; color: var(--ink-2); }
.p-filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.p-filter-pill {
    border: 1px solid var(--input-border);
    background: var(--surface);
    border-radius: 20px;
    padding: 5px 12px;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
}
.p-filter-pill:hover { border-color: var(--muted-2); }
.p-filter-pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.p-filter-pill .n { font-family: var(--font-mono); font-size: 11px; opacity: .75; }

.p-inv-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.p-inv-table thead th {
    background: var(--surface-alt);
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.p-inv-table th.num, .p-inv-table td.num { text-align: right; }
.p-inv-table th:first-child, .p-inv-table td:first-child { padding-left: 20px; }
.p-inv-table th:last-child, .p-inv-table td:last-child { padding-right: 20px; }
.p-inv-table tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--row-line);
    vertical-align: middle;
}
.p-inv-table tbody tr.hidden-row { display: none; }
.p-inv-num {
    display: block;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.p-inv-date {
    display: block;
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}
/* Організація рахунку під номером — лише в партнера з кількома юрособами. */
.p-inv-org { margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.p-inv-sum { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
/* Склад рахунку згорнуто — кнопка «N позицій» каже про це словами. */
.p-inv-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--input-border);
    background: var(--surface);
    border-radius: 8px;
    padding: 6px 10px;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    white-space: nowrap;
    cursor: pointer;
}
.p-inv-toggle:hover { border-color: var(--muted-2); }
.p-inv-toggle svg { transition: transform .15s; }
.p-inv-toggle[aria-expanded="true"] {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary-hover);
}
.p-inv-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.p-inv-note { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); max-width: 340px; }
.p-inv-resync { display: block; margin-top: 4px; font-size: 11px; color: var(--primary-hover); }
.p-inv-pdf { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.p-inv-pending, .p-inv-expired { font-size: 12px; color: var(--muted); }
.p-inv-table td.c-act { text-align: right; white-space: nowrap; }
.p-inv-table td.c-act form { display: inline-block; margin: 0; vertical-align: middle; }
.p-inv-table td.c-act form + form { margin-left: 6px; }
.p-inv-del { width: 36px; height: 36px; padding: 0; color: var(--muted); }
.p-inv-del:hover { color: var(--danger); border-color: var(--danger-border); }
.p-inv-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: 1px;
}
.p-inv-dot.ok { background: var(--ok); }
.p-inv-dot.wait { background: var(--warn-accent); }
.p-inv-dot.err { background: var(--danger); }

.p-inv-detail td {
    background: var(--surface-alt);
    padding: 14px 20px 16px !important;
}
.p-inv-detail-inner { border-left: 2px solid var(--line); padding-left: 16px; }
.p-inv-comment { font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.p-inv-items {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.p-inv-items th {
    text-align: left;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}
.p-inv-items td { padding: 6px 10px; border-bottom: 1px solid var(--row-line); }
.p-inv-items tr:last-child td { border-bottom: 0; }
.p-inv-items th.num, .p-inv-items td.num {
    text-align: right;
    font-family: var(--font-mono);
    white-space: nowrap;
}
.p-inv-repeat {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.p-inv-repeat .why { font-size: 11.5px; color: var(--muted); }

.p-inv-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--line-soft);
    background: var(--surface-alt);
    border-radius: 0 0 12px 12px;
    font-size: 12.5px;
    color: var(--muted);
}
.p-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    flex: none;
}

.p-inv-m { display: none; }

/* Телефон: рядок стає карткою «номер і сума → стан → головна кнопка →
   смуга дій (склад, PDF, видалити)». Комірка дій розчиняється
   (display: contents), щоб її дві форми стали окремими клітинками. */
@media (max-width: 900px) {
    .p-inv-table thead { display: none; }
    .p-inv-table tbody tr:not(.p-inv-detail) {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        grid-template-areas:
            "num     num     num     sum     sum     sum"
            "status  status  status  status  status  status"
            "confirm confirm confirm confirm confirm confirm"
            "items   items   pdf     pdf     hide    hide";
        gap: 10px 12px;
        padding: 14px 12px;
        border-bottom: 1px solid var(--row-line);
    }
    .p-inv-table tbody tr:not(.p-inv-detail) td {
        display: block;
        padding: 0;
        border: 0;
        text-align: left;
    }
    .p-inv-table tbody td.c-num { grid-area: num; }
    .p-inv-table tbody td.c-sum { grid-area: sum; justify-self: end; }
    .p-inv-table tbody td.c-status { grid-area: status; }
    .p-inv-table tbody tr:not(.p-inv-detail) td.c-act { display: contents; }
    .p-inv-table td.c-act form.f-confirm { grid-area: confirm; display: block; }
    .p-inv-table td.c-act form.f-confirm .p-btn { width: 100%; min-height: 44px; }
    .p-inv-table tbody td.c-items { grid-area: items; }
    .p-inv-table tbody td.c-pdf { grid-area: pdf; align-self: center; text-align: center; }
    .p-inv-table td.c-act form.f-hide { grid-area: hide; display: block; margin: 0; justify-self: end; }
    .p-inv-toggle, .p-inv-table td.c-act form.f-hide .p-btn { min-height: 40px; }
    .p-inv-del { width: auto; height: auto; padding: 0 10px; }
    .p-inv-note { max-width: none; }

    .p-inv-detail td { padding: 12px !important; }
    .p-inv-detail-inner { padding-left: 10px; }
    .p-inv-items { font-size: 12.5px; }
    .p-inv-items thead { display: none; }
    .p-inv-items tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "name name"
            "qty  total";
        gap: 2px 10px;
        padding: 8px 0;
        border-bottom: 1px solid var(--row-line);
    }
    .p-inv-items tr:last-child { border-bottom: 0; }
    .p-inv-items td { display: block; padding: 0; border: 0; }
    .p-inv-items td.i-name { grid-area: name; }
    .p-inv-items td.i-qty { grid-area: qty; text-align: left; }
    .p-inv-items td.i-price { display: none; }
    .p-inv-items td.i-total { grid-area: total; font-weight: 600; }
    .p-inv-m { display: inline; color: var(--muted); }
}

/* ============================================================
   «Огляд»
   ============================================================ */

.p-hero {
    background: var(--ink);
    border-radius: 12px;
    padding: 24px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.p-hero .greet {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .06em;
    color: #8894a4;
    display: block;
    margin-bottom: 6px;
}
.p-hero h2 {
    font-family: var(--font-brand);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #fff;
    line-height: 1.15;
}
.p-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.p-dash-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}
.p-dash-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #7a8695;
    margin-bottom: 14px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.p-dash-title a { font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }

.p-big-sum {
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -.01em;
    line-height: 1.1;
}
.p-big-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.p-big-sub .ok { color: var(--ok); font-family: var(--font-mono); font-weight: 600; }

.p-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 60px;
    margin-top: 18px;
}
.p-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.p-bar .fill {
    width: 100%;
    background: var(--line);
    border-radius: 3px 3px 0 0;
    margin-top: auto;
    min-height: 2px;
}
.p-bar.prev .fill { background: #c3ccd7; }
.p-bar.current .fill { background: var(--primary); }
.p-bar .tick { font-family: var(--font-mono); font-size: 10px; color: var(--muted-2); }
.p-bars-note { font-size: 11.5px; color: var(--muted-2); margin-top: 10px; }

/* «Мої знижки» — рядок на рівень знижки, а не плитка на категорію:
   категорій може бути 50, рівнів — три-пʼять. */
.p-dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.p-dash-sections { padding: 20px 8px 8px; }
.p-dash-sections .p-dash-title { padding: 0 12px; }
.p-dash-sections .p-section + .p-section { border-top: 1px solid var(--row-line); border-radius: 0; }

.p-recent { width: 100%; border-collapse: collapse; font-size: 13px; }
.p-recent td { padding: 7px 4px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
.p-recent tr:last-child td { border-bottom: 0; }
.p-recent .num { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }
.p-recent .date, .p-recent .sum {
    font-family: var(--font-mono);
    color: var(--muted);
    white-space: nowrap;
}
.p-recent .sum { text-align: right; color: var(--ink-2); }
.p-recent .state { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.p-recent .state.act { color: var(--primary-hover); font-weight: 600; }

.p-rates { display: flex; gap: 10px; }
.p-rate {
    flex: 1;
    text-align: center;
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 8px;
}
.p-rate .ccy {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .08em;
    color: var(--muted);
    display: block;
    margin-bottom: 4px;
}
.p-rate .val { font-family: var(--font-mono); font-size: 19px; font-weight: 600; color: var(--ink); }

.p-contact { display: flex; align-items: center; gap: 12px; }
.p-avatar {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-brand);
    font-size: 15px;
    font-weight: 700;
}
.p-contact .lines { min-width: 0; line-height: 1.5; }
.p-contact .lines a { font-size: 13px; }
.p-contact .lines .muted { font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
    .p-hero { padding: 18px; }
    .p-hero h2 { font-size: 20px; }
    /* На вузькому екрані кнопки в стовпчик: інакше «Перейти до
       рахунків» ламається на три рядки поруч із довгим номером у
       «Повторити». Форма теж мусить розтягуватися — flex тримає її,
       а не кнопку всередині. */
    .p-hero-actions { width: 100%; flex-direction: column; }
    .p-hero-actions form { display: flex; }
    .p-hero-actions .p-btn { width: 100%; justify-content: center; }
    .p-dash-grid { grid-template-columns: minmax(0, 1fr); }

    /* «Останні замовлення»: чотири колонки в рядок не влазять — рядок
       стає двоповерховим «номер · сума / дата · статус». */
    .p-recent, .p-recent tbody { display: block; }
    .p-recent tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "num sum" "date state";
        gap: 2px 12px;
        padding: 9px 0;
        border-bottom: 1px solid var(--row-line);
    }
    .p-recent tr:last-child { border-bottom: 0; }
    .p-recent td { display: block; padding: 0; border: 0; }
    .p-recent .num { grid-area: num; }
    .p-recent .sum { grid-area: sum; }
    .p-recent .date { grid-area: date; font-size: 12px; padding-left: 18px; }
    .p-recent .state { grid-area: state; white-space: normal; }
}

/* ============================================================
   Доступність і мобільні поля (аудит 2026-09, PP-15 / PP-18)
   ============================================================ */

.p-cart-limit-note { font-size: 12.5px; color: var(--warn); align-self: center; }
.p-btn:disabled { opacity: .55; cursor: not-allowed; }

/* Фокус з клавіатури видно скрізь; мишею — ні (:focus-visible). Поля
   мають власне синє кільце — їм другого контуру не треба. */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* iOS Safari наближає сторінку при фокусі на полі зі шрифтом < 16px і
   лишає її збільшеною. !important — свідомо: правило про пристрій, воно
   має перебити кожен компонент (пошук, степер, коментар, вхід). */
@media (max-width: 900px) {
    input, select, textarea { font-size: 16px !important; }
}
