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

   Токени і спільні компоненти. Підключається з partners/base.html
   і ОКРЕМО з partners/_stock_table.html — той партіал живе ще й в
   адмінці («вигляд кабінету партнера»), де base.html немає.
   Дубльований <link> на той самий URL браузер бере з кешу.
   ============================================================ */

: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);
    height: 60px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.p-header-left { display: flex; align-items: center; gap: 14px; }
.p-header-logo { height: 26px; width: 98px; object-fit: contain; display: block; }
.p-header-divider { width: 1px; height: 22px; background: var(--line); }
.p-header-caption {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #7a8695;
    white-space: nowrap;
}
.p-header-right { display: flex; align-items: center; gap: 14px; }
.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: #7a8695;
    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 {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 2px;
}
.p-tabs a {
    padding: 12px 14px;
    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,
.p-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-input::placeholder,
.p-textarea::placeholder { color: var(--muted-2); }
.p-field input:focus,
.p-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-input (рахунок на організацію в кошику). */
.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); }
.p-badge-danger { background: var(--danger-bg); color: var(--danger); }

/* 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-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.p-muted { color: var(--muted); }
.p-muted-2 { color: var(--muted-2); }
.p-price { color: var(--ok); font-weight: 600; }
.p-num { text-align: right; }
.p-center { text-align: center; }
.p-nowrap { white-space: nowrap; }

/* --- Порожній стан -------------------------------------------- */
.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; }

/* Індикатор надійності пароля */
.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 { height: auto; padding: 12px 16px; }
    .p-header-logo { height: 22px; width: 83px; }
    .p-header-caption { display: none; }
    .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 { padding: 0 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .p-tabs::-webkit-scrollbar { display: none; }
    .p-tabs a { padding: 11px 10px; 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; }
}

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

.p-stock { position: relative; }

/* --- Панель фільтрів (шапка картки, липка) --------------------- */
.p-stock-head {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--surface);
    border-bottom: 1px solid var(--line-soft);
    border-radius: 12px 12px 0 0;
    padding: 16px 20px;
}
.p-chips-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.p-chips-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #7a8695;
    white-space: nowrap;
}
.p-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.p-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 6px 11px;
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .12s, background .12s, color .12s;
}
.p-chip:hover { border-color: var(--muted-2); }
.p-chip .disc {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--ok);
}
.p-chip .cnt { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); }
.p-chip .tick { display: none; }
.p-chip.selected {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary-hover);
}
.p-chip.selected .tick { display: inline; }
.p-chip.selected .cnt { color: var(--muted); }
.p-chip-all.selected {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}
.p-chip-all .tick { display: none !important; }
.p-chip-all.selected .cnt { color: #a9b3c0; }
/* Ряд чипів рівно один: те, що не вмістилося (міряє layoutChips у
   партіалі), ховається — інакше 50 категорій з'їдають пів екрана ще
   до того, як партнер побачить першу ціну. Хвіст живе в попапі. */
.p-chip.is-extra { display: none; }
.p-stock [hidden] { display: none !important; }

/* --- Попап «Усі категорії» --------------------------------------- */
.p-catpick { position: relative; display: inline-flex; }
.p-chip-cats { color: var(--ink-2); gap: 6px; }
.p-chip-cats .n { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); }
.p-chip-cats.open { border-color: var(--primary); color: var(--primary-hover); background: var(--primary-bg); }
.p-chip-cats .lbl-m { display: none; }
.p-catpop {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 440px;
    max-width: calc(100vw - 48px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(20, 24, 31, .14), 0 2px 6px rgba(20, 24, 31, .06);
    z-index: 20;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-align: left;
    font-weight: 400;
    white-space: normal;
}
.p-catpop-head { display: none; }
.p-catpop-search {
    position: relative;
    display: block;
    padding: 12px 12px 8px;
}
.p-catpop-search input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
}
.p-catpop-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 0, 255, .1); }
.p-catpop-search svg {
    position: absolute;
    left: 23px;
    top: 22px;
    pointer-events: none;
    color: var(--muted-2);
}
.p-catpop-list { max-height: 372px; overflow: auto; padding: 0 6px 6px; }
.p-catpop-group-head {
    position: sticky;
    top: 0;
    background: var(--surface);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 8px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #7a8695;
}
.p-catpop-group-head .pct {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--ok);
    text-transform: none;
    letter-spacing: 0;
    margin-right: 6px;
}
.p-catpop-group-head .pct.no-disc { color: var(--muted-2); }
.p-catpop-all {
    border: 0;
    background: none;
    padding: 0;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    white-space: nowrap;
}
.p-catpop-all:hover { text-decoration: underline; }
.p-catpop-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 8px;
    border: 0;
    border-radius: 8px;
    background: none;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.p-catpop-row:hover { background: var(--surface-alt); }
.p-catpop-row .box {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--input-border);
    border-radius: 4px;
    flex: none;
    background: #fff;
    position: relative;
}
.p-catpop-row.on { background: var(--primary-bg); color: var(--primary-hover); font-weight: 600; }
.p-catpop-row.on .box { background: var(--primary); border-color: var(--primary); }
.p-catpop-row.on .box::after {
    content: "";
    position: absolute;
    left: 4.5px;
    top: 1.5px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.p-catpop-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-catpop-row .cnt { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); }
.p-catpop-empty { padding: 18px 12px 14px; font-size: 13px; color: var(--muted); text-align: center; }
.p-catpop-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--line-soft);
    font-size: 12.5px;
    color: var(--muted);
}
.p-catpop-foot b { font-family: var(--font-mono); font-weight: 600; color: var(--ink-2); }
.p-catpop-foot .acts { display: flex; align-items: center; gap: 12px; }
.p-catpop-reset {
    border: 0;
    background: none;
    padding: 0;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}
.p-catpop-foot .p-btn { padding: 6px 12px; font-size: 12.5px; }
.p-catpop-backdrop { display: none; }

.p-stock-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}
.p-search { position: relative; flex: 1; max-width: 420px; min-width: 200px; }
.p-search input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    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-2);
}
.p-shown { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.p-shown b { font-family: var(--font-mono); font-weight: 600; color: var(--ink-2); }
.p-reset {
    border: 1px solid var(--input-border);
    background: var(--surface);
    border-radius: 8px;
    padding: 5px 10px;
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
}
.p-reset:hover { border-color: var(--muted-2); }
.p-reset[hidden] { display: none; }
.p-stock-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12.5px;
    color: #7a8695;
    white-space: nowrap;
}
.p-stock-meta a { font-weight: 600; }

/* --- Таблиця --------------------------------------------------- */
.p-stock-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.p-stock-table thead th {
    position: sticky;
    top: var(--p-filters-h, 116px);
    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-sku { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.c-name { line-height: 1.35; }
.p-cat {
    display: block;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--muted-2);
    margin-bottom: 1px;
}
/* Вибрано одну категорію — підпис у рядку зайвий, він повторює фільтр. */
.p-stock.single-cat .p-cat { display: none; }
.p-sku-m, .p-cat-sep { display: none; }

.p-my-price {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--ok);
    white-space: nowrap;
}
.p-disc-chip {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--ok-bg);
    color: var(--ok);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
}
.p-rrc { font-family: var(--font-mono); font-size: 13px; color: var(--muted-2); white-space: nowrap; }
.p-rrc-m { display: none; }

.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-head { padding: 12px; border-radius: 12px 12px 0 0; }
    /* nowrap обовʼязковий: колонковий flex із переносом бере ширину
       рядка від вмісту, і стрічка чипів розтягувала всю сторінку на
       кілька екранів замість скролитися всередині себе. */
    .p-chips-row { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; }
    .p-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
    .p-chips::-webkit-scrollbar { display: none; }
    /* Горизонтальна стрічка не має що ховати — показуємо всі чипи, а
       кнопка «Категорії» стоїть першою: вона єдина, що не зникає за
       край. Попап стає нижньою шторкою. */
    .p-chip.is-extra { display: inline-flex; }
    .p-catpick { order: -1; position: static; }
    .p-chip-cats .lbl-d { display: none; }
    .p-chip-cats .lbl-m { display: inline; }
    .p-catpop {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: auto;
        max-width: none;
        max-height: 82vh;
        border-radius: 16px 16px 0 0;
        border-bottom: 0;
        box-shadow: 0 -8px 32px rgba(20, 24, 31, .18);
        z-index: 60;
    }
    .p-catpop-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 14px 16px 6px;
    }
    .p-catpop-head .ttl { font-family: var(--font-brand); font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
    .p-catpop-head .p-btn { min-height: 40px; }
    .p-catpop-search input { height: 44px; }
    .p-catpop-search svg { top: 26px; }
    .p-catpop-list { max-height: none; flex: 1; padding: 0 8px; }
    .p-catpop-row { min-height: 44px; }
    .p-catpop-foot { padding: 12px 16px 22px; }
    .p-catpop-foot .p-btn { display: none; }
    .p-catpop-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(20, 24, 31, .42);
        z-index: 55;
    }
    body.p-sheet-open { overflow: hidden; }
    .p-search { max-width: none; flex-basis: 100%; }
    .p-stock-tools { gap: 8px; margin-top: 8px; }
    /* Уся шапка липка, тому кожен зайвий піксель тут — це мінус рядок
       товару на екрані: лічильник і метадані тиснемо в один рядок. */
    .p-stock-meta {
        margin-left: auto;
        white-space: normal;
        font-size: 11.5px;
        gap: 10px;
        text-align: right;
    }
    /* Відсоток знижки вже стоїть у підписі над назвою — чип біля ціни
       на вузькому екрані лише переносить рядок навпіл. */
    .p-disc-chip { display: none; }

    .p-stock-table thead { display: none; }
    .p-stock-table tbody tr {
        display: grid;
        /* Перша колонка тримає і фото, і бейдж наявності: фіксовані 40px
           під фото — і «118 шт» наїжджає на ціну. */
        grid-template-columns: minmax(40px, auto) minmax(0, 1fr) auto;
        grid-template-areas:
            "photo name  name"
            "avail price step";
        align-items: center;
        gap: 8px 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.c-photo { grid-area: photo; }
    .p-stock-table tbody td.c-name { grid-area: name; }
    .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-sku,
    .p-stock-table tbody td.c-rrc { display: none; }
    .p-sku-m, .p-cat-sep { display: inline; }
    .p-stock.single-cat .p-cat { display: block; }
    .p-stock.single-cat .p-cat-name,
    .p-stock.single-cat .p-cat-sep { display: none; }
    .p-rrc-m {
        display: inline;
        margin-left: 6px;
        font-family: var(--font-mono);
        font-size: 11px;
        color: var(--muted-2);
        text-decoration: line-through;
    }
    .p-my-price { font-size: 15px; }
    .thumb { 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  del"
            "price step"
            "total total";
        gap: 6px 10px;
        padding: 12px;
        border-bottom: 1px solid var(--row-line);
    }
    .p-cart-table tbody td { display: block; padding: 0; border: 0; text-align: left; }
    .p-cart-table td.c-sku { display: none; }
    /* Артикул не зникає, а переїжджає підписом над назвою. */
    .p-cart-name .p-sku-m { display: block; }
    .p-cart-table td.c-name { grid-area: name; }
    .p-cart-table td.c-price { grid-area: price; }
    .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 { grid-area: del; justify-self: end; }
    .p-cart-actions { justify-content: stretch; }
    .p-cart-actions .p-btn { flex: 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: top;
}
.p-inv-table tbody tr.hidden-row { display: none; }
.p-inv-num {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: 0;
    padding: 0;
    font-family: var(--font-mono);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}
.p-inv-num .chev { color: var(--muted-2); font-size: 10px; transition: transform .15s; }
.p-inv-num[aria-expanded="true"] .chev { transform: rotate(90deg); }
.p-inv-date, .p-inv-sum { font-family: var(--font-mono); white-space: nowrap; }
/* Організація рахунку під номером — лише в партнера з кількома юрособами. */
.p-inv-org { margin-top: 2px; font-family: var(--font-ui); font-size: 11.5px; color: var(--muted); font-weight: 400; white-space: normal; }
.p-inv-sum { font-weight: 600; }
.p-inv-err { display: block; margin-top: 4px; font-size: 11.5px; color: var(--danger); }
.p-inv-resync { display: block; margin-top: 4px; font-size: 11px; color: var(--primary-hover); }
.p-inv-pending { font-size: 12.5px; color: var(--muted-2); }
.p-inv-expired { font-size: 12.5px; color: var(--warn); max-width: 220px; display: inline-block; }
.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-sales-ok { font-size: 13px; color: var(--ok); font-weight: 600; }
.p-inv-sales-ok small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }

.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;
}

@media (max-width: 900px) {
    .p-inv-table thead { display: none; }
    .p-inv-table tbody tr:not(.p-inv-detail) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px 10px;
        padding: 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 tr:not(.p-inv-detail) td.c-sum { text-align: right; }
    .p-inv-detail td { padding: 12px !important; }
    .p-inv-detail-inner { padding-left: 10px; }
    .p-inv-items { font-size: 11.5px; }
}

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

.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-tiers-sum { font-size: 12.5px; color: var(--muted); margin: -6px 0 12px; }
.p-tiers-sum b { font-family: var(--font-mono); font-weight: 600; color: var(--ink-2); }
.p-tiers { display: flex; flex-direction: column; }
.p-tier {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 11px 0;
    border-top: 1px solid var(--row-line);
    color: var(--ink);
    text-decoration: none;
    transition: background .12s;
}
.p-tier:first-child { border-top: 0; padding-top: 2px; }
.p-tier:hover { text-decoration: none; color: var(--ink); }
.p-tier:hover .names { color: var(--ink); }
.p-tier:hover .more { text-decoration: underline; }
.p-tier .pct {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 600;
    color: var(--ok);
    line-height: 1.1;
    letter-spacing: -.01em;
}
.p-tier .pct.no-disc { font-size: 12px; font-weight: 500; color: var(--muted-2); padding-top: 4px; white-space: nowrap; }
.p-tier .body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.p-tier .meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted-2); }
.p-tier .names { font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.p-tier .names .more { color: var(--primary); font-weight: 600; white-space: nowrap; }

.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-tier { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
}
