/* ============================================================
   Бутоново — базовые токены и общие компоненты
   Загружается и на витрине, и в панели управления.
   ============================================================ */

/* Golos Text: только кириллица + латиница */
@font-face {
    font-family: 'Golos Text';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/golos-text-400-cyrillic-ext.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
    font-family: 'Golos Text';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/golos-text-400-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Golos Text';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/golos-text-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Golos Text';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/golos-text-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Golos Text';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/golos-text-600-cyrillic-ext.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
    font-family: 'Golos Text';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/golos-text-600-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Golos Text';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/golos-text-600-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Golos Text';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/golos-text-600-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2215, U+FEFF, U+FFFD;
}

/* Playfair Display: заголовки витрины (h1/h2) и цена товара */
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/playfair-display-600-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/playfair-display-600-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/playfair-display-600-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/playfair-display-700-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/playfair-display-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/playfair-display-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* палитра «садовая редакционная» */
    --bg: #FAF7F2;            /* страница */
    --bg-soft: #F3EDE3;       /* мягкие подложки */
    --surface: #FFFFFF;       /* поднимающиеся поверхности: формы, корзина */
    --card: #FFFFFF;          /* синоним surface (историческое имя) */
    --ink: #1F2A22;           /* основной текст */
    --text: #1F2A22;
    --ink-soft: #5E665F;      /* вторичный текст, контраст на фоне >= 4.5:1 */
    --muted: #5E665F;
    --line: #E6E0D6;
    --brand: #2F5D43;         /* главные кнопки, ссылки */
    --green: #2F5D43;
    --brand-deep: #234733;
    --green-dark: #234733;
    --brand-tint: #E7EFE8;
    --green-soft: #E7EFE8;
    --accent: #B8523F;        /* цены, «Хит», опасное */
    --accent-dark: #93402F;
    --accent-soft: #F6E7E3;
    --gold: #E3B341;          /* только опт-бейдж и уведомления */
    --sun: #E3B341;
    --danger: #8C2E24;        /* текст ошибок */
    --radius: 16px;           /* картинки и карточки */
    --radius-s: 12px;         /* поля ввода */
    --shadow: 0 2px 10px rgba(31, 42, 34, 0.06);
    --font-body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --font-head: 'Playfair Display', Georgia, 'Times New Roman', serif;
    /* шаг отступов: 4/8/12/16/24/32/48/72 */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html, body { overflow-x: clip; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
}

img { max-width: 100%; height: auto; display: block; }

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

h1, h2 { font-family: var(--font-head); line-height: 1.25; margin: 0 0 0.6em; }
h3 { font-family: var(--font-body); line-height: 1.3; margin: 0 0 0.6em; }
h1 { font-size: 30px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0 0 0.75em; }
ul { margin: 0; padding: 0; list-style: none; }

/* видимый фокус — на каждом интерактивном элементе */
:is(a, button, input, select, textarea, summary, .chip):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.muted-note { color: var(--muted); font-size: 15px; margin-bottom: 0.75em; }
.small-note { font-size: 14px; margin: 10px 0 0; }
.empty-note { color: var(--muted); background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-align: center; }

.page-title { margin: 18px 0 16px; }
.page-content { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; max-width: 820px; }
.page-content a { text-decoration: underline; }

.demo-bar { background: var(--gold); color: #4A3B10; text-align: center; font-size: 14px; padding: 6px 12px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.demo-bar-close { background: none; border: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; width: 32px; height: 32px; }

/* сообщения */
.flash { border-radius: var(--radius-s); padding: 12px 16px; margin: 12px 0; font-size: 15px; }
.flash-error { background: #FBE5E3; color: var(--danger); border: 1px solid #EFC4BF; }
.flash-success { background: var(--brand-tint); color: var(--brand-deep); border: 1px solid #C9DECD; }
.flash-info { background: var(--brand-tint); border: 1px solid var(--brand); border-radius: var(--radius-s); padding: 14px 16px; margin: 0 0 20px; font-size: 16px; }

/* ---------- Кнопки: три вида (primary / outline / danger) + размеры ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    border-radius: 999px;
    padding: 14px 24px;
    min-height: 48px;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
/* вторичная: общий вид для outline/ghost/secondary */
.btn-outline, .btn-ghost, .btn-secondary {
    background: var(--surface);
    color: var(--brand);
    border-color: var(--brand);
}
.btn-outline:hover, .btn-ghost:hover, .btn-secondary:hover {
    background: var(--brand-tint);
    color: var(--brand-deep);
}
.btn-danger { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger:hover { background: var(--accent-dark); color: #fff; }
.btn-small { padding: 10px 16px; min-height: 44px; font-size: 14px; }
.btn-big { padding: 16px 32px; min-height: 56px; font-size: 18px; }
.btn-wide, .btn-block { width: 100%; }

.link-remove {
    background: none; border: none; padding: 12px 4px; cursor: pointer;
    color: var(--muted); font-size: 15px; text-decoration: underline;
    min-height: 44px;
}
.link-remove:hover { color: var(--accent-dark); }

/* ---------- Чипы ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
    display: inline-flex; align-items: center;
    padding: 10px 18px; min-height: 44px;
    border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink);
    font-size: 15px; cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.chip-active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip-active:hover { color: #fff; }
.chip-mini { padding: 5px 12px; font-size: 14px; min-height: 0; white-space: nowrap; }
.chip-big { padding: 12px 22px; font-size: 17px; }
.chip-reset { border-style: dashed; color: var(--muted); }
.chip-reset:hover { color: var(--accent-dark); border-color: var(--accent); }

/* ---------- Бейджи ---------- */
.badge { font-size: 14px; font-weight: 700; padding: 4px 12px; border-radius: 999px; color: #fff; background: var(--muted); }
.badge-hit { background: var(--accent); }
.badge-new { background: var(--brand); }
.badge-opt { background: var(--gold); color: #4A3B10; }
.badge-order { background: rgba(31, 42, 34, 0.75); }
.badge-paid { background: var(--brand); }
.badge-wait { background: var(--gold); color: #4A3B10; }
.badge-pickup { background: var(--accent-soft); color: var(--accent-dark); }
.badge-courier { background: #DDE8F0; color: #33556E; }
.badge-ready { background: var(--brand-tint); color: var(--brand-deep); }

/* ---------- Поля формы ---------- */
.form { display: grid; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 15px; font-weight: 600; }
.field label { font-size: 15px; font-weight: 600; color: var(--ink); }
.field input, .field select, .field textarea,
.input {
    width: 100%; min-height: 48px; padding: 12px 14px;
    border: 1px solid var(--line); border-radius: var(--radius-s);
    background: var(--surface); font-size: 17px; color: var(--ink); font-family: var(--font-body);
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
    outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
.field-invalid input, .field-invalid select, .field-invalid textarea { border-color: var(--danger); }
.field-error { margin: 0; font-size: 14px; color: var(--danger); }
.req { color: var(--accent); }

.field-radios { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-pill {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    border: 2px solid var(--line); border-radius: var(--radius-s);
    padding: 12px 18px; min-height: 48px; font-size: 16px; font-weight: 600;
    background: var(--surface);
}
.radio-pill input { margin: 0; accent-color: var(--brand); width: 20px; height: 20px; }
.radio-active { border-color: var(--brand); background: var(--brand-tint); }
.radio-pill:has(input:checked) { background: var(--brand); color: #fff; border-color: var(--brand); }
.radio-pill:has(input:checked) input { accent-color: #fff; }

.form-section {
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); padding: 18px 16px; margin: 0;
    display: flex; flex-direction: column; gap: 14px;
}
.form-section legend { font-family: var(--font-head); font-size: 20px; padding: 0 8px; }

.qty-input {
    width: 92px; min-height: 48px; padding: 6px 10px;
    border: 1px solid var(--line); border-radius: var(--radius-s);
    background: var(--surface); font-size: 17px; text-align: center; color: var(--ink);
}
.qty-big { width: 110px; }

.check-label {
    display: flex; align-items: center; gap: 12px;
    font-size: 17px; padding: 8px 0; cursor: pointer; min-height: 48px;
}
.check-label input { width: 26px; height: 26px; accent-color: var(--brand); flex: 0 0 auto; margin: 0; }

/* ---------- Сводки и таблицы заказов ---------- */
.summary-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.summary-box form { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: 16px; }
.summary-total {
    display: flex; justify-content: space-between; gap: 12px; margin: 4px 0 0;
    font-size: 20px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 12px;
}
.empty-state { text-align: center; padding: 40px 0; display: flex; flex-direction: column; gap: 16px; align-items: center; }

.order-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.order-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); font-size: 16px; vertical-align: top; }
.order-table-sum { text-align: right; white-space: nowrap; font-weight: 600; }
.order-table-total td { font-weight: 700; }
.order-state { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 14px; }
.order-state-label { margin: 0 0 4px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.order-state-value { margin: 0; font-size: 18px; font-weight: 700; color: var(--brand-deep); }

.breadcrumbs { font-size: 14px; color: var(--muted); margin: 6px 0 16px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs span { margin: 0 2px; }
.crumb-current { color: var(--ink); }

/* таблица-прайс (витрина «Оптом» и список товаров в панели) */
.optom-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.optom-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.optom-table th, .optom-table td { padding: 12px 10px; text-align: left; font-size: 15px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.optom-table th { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--bg-soft); }
.optom-table tr:last-child td { border-bottom: none; }
.optom-table th:first-child, .optom-table td:first-child { min-width: 170px; }
.optom-price { font-weight: 700; white-space: nowrap; }
.optom-discounts { display: flex; flex-wrap: wrap; gap: 6px; }

.row-flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 10px; }
.row-flex > .field { margin-bottom: 10px; }
.row-flex input[type=text], .row-flex input[type=number], .row-flex select { min-width: 120px; }

.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; justify-content: center; }
.page-num { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 14px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
.page-num:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.page-num-active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.page-num-active:hover { color: #fff; }

/* ---------- Экраны входа/оплаты (минимальный лейаут) ---------- */
.center-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: var(--bg-soft); padding: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; width: 100%; max-width: 400px; }
.login-title { text-align: center; margin-bottom: 4px; }
.password-wrap { max-width: 460px; }

/* ---------- Диалог подтверждения и тосты ---------- */
.uy-dialog {
    border: none; border-radius: var(--radius); padding: 22px 20px 18px;
    max-width: 360px; width: calc(100vw - 40px);
    box-shadow: 0 12px 40px rgba(31, 42, 34, 0.25);
}
.uy-dialog::backdrop { background: rgba(31, 42, 34, 0.45); }
.uy-dialog-text { font-size: 17px; margin: 0 0 16px; line-height: 1.5; }
.uy-dialog-actions { display: grid; gap: 10px; }
.uy-toast-host {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 90;
    display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px));
    pointer-events: none;
}
.uy-toast {
    pointer-events: auto;
    background: var(--ink); color: #fff; border-radius: var(--radius);
    padding: 14px 18px; font-size: 16px; box-shadow: 0 6px 20px rgba(31, 42, 34, 0.3);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    opacity: 1; transition: opacity 0.3s ease;
}
.uy-toast-out { opacity: 0; }
.uy-toast-action {
    background: none; border: none; color: var(--gold); font-weight: 700; font-size: 16px;
    cursor: pointer; padding: 8px; min-height: 44px; white-space: nowrap;
}

/* ---------- Утилиты ---------- */
.hidden { display: none !important; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}
.zone-single { pointer-events: none; }

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

@media (min-width: 960px) {
    .form-section { padding: 20px 24px; }
}
