/* CoolPlay — світла спокійна тема, mobile-first */
:root {
    --bg: #f6f5f1;
    --surface: #ffffff;
    --surface-2: #f0eee8;
    --text: #1f2a2e;
    --muted: #687276;
    --border: #e3e0d8;
    --primary: #2f6b5f;
    --primary-dark: #24554b;
    --primary-soft: #e6efea;
    --accent: #b8664a;
    --accent-soft: #f6e9e3;
    --danger: #a94436;
    --danger-soft: #f7e6e3;
    --warn-soft: #f6efdc;
    --info-soft: #e7eef5;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(31, 42, 46, .04), 0 4px 16px rgba(31, 42, 46, .05);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--text);
    font: 16px/1.55 var(--font);
    display: flex; flex-direction: column; min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(47, 107, 95, .35); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 20px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.plain { list-style: none; margin: 0; padding: 0; }
.stack { display: grid; gap: 16px; align-content: start; }
.narrow { max-width: 460px; margin: 0 auto; }
.narrow-left { max-width: 620px; }
.lead { max-width: 70ch; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
/* Телефон: логотип і пошук в один рядок; кошик/кабінет — у нижній панелі */
.header-row { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "logo search"; gap: 12px; align-items: center; padding-top: 10px; padding-bottom: 10px; }
.header-actions { display: none; }
.logo { grid-area: logo; display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 1.15rem; }
.logo:hover { text-decoration: none; color: var(--text); }
.logo-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 1rem; }
.search { grid-area: search; display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 16px; outline: none; }
.search button { border: 0; background: transparent; padding: 0 14px; color: var(--muted); cursor: pointer; }
.search:focus-within { border-color: var(--primary); background: var(--surface); }
.header-actions { grid-area: actions; gap: 4px; justify-content: flex-end; align-items: center; }
.hdr-link { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; color: var(--text); font-size: .95rem; }
.hdr-link:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.hdr-label { display: none; }
.badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; }

.cat-nav { border-top: 1px solid var(--border); }
.cat-nav-row { display: flex; gap: 6px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; scrollbar-width: none; }
.cat-nav-row::-webkit-scrollbar { display: none; }
.cat-nav a { flex: none; padding: 6px 14px; border-radius: 999px; color: var(--text); font-size: .92rem; background: var(--surface-2); white-space: nowrap; }
.cat-nav a:hover { text-decoration: none; background: var(--primary-soft); }
.cat-nav a.active { background: var(--primary); color: #fff; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; line-height: 1.2; min-height: 44px; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--surface); border-color: #e6c3bd; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: .9rem; }
.btn-lg { padding: 13px 22px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 1rem; }
.icon-btn:hover { background: var(--danger-soft); color: var(--danger); }
.link { font-weight: 600; }

/* ---------- Cards / alerts ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--primary-soft); border-color: #cfe0d7; }
.alert-error { background: var(--danger-soft); border-color: #ecc9c3; color: #7d2f25; }
.alert-info { background: var(--info-soft); border-color: #d3e0ec; }
.empty { text-align: center; padding: 40px 20px; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.tag-sale { background: var(--accent); color: #fff; }
.tag-info { background: var(--info-soft); color: #2d4f6e; }

/* ---------- Hero / home ---------- */
.hero { display: grid; gap: 20px; background: linear-gradient(135deg, #eef3ef 0%, #f7f2ea 100%); border: 1px solid var(--border); border-radius: 20px; padding: 26px 20px; margin-bottom: 8px; }
.hero h1 { font-size: 1.65rem; max-width: 18ch; }
.hero p { color: #44514f; max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-points { display: grid; gap: 10px; }
.hero-points li { background: rgba(255,255,255,.7); border-radius: 12px; padding: 12px 14px; display: grid; }
.hero-points span { color: var(--muted); font-size: .9rem; }
.section { margin-top: 32px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-title { font-size: 1.3rem; }
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cat-card { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 18px 10px; color: var(--text); }
.cat-card:hover { text-decoration: none; border-color: #c9d9d0; color: var(--text); }
.cat-card .ph { width: 72px; height: 72px; border-radius: 18px; }
.cat-name { font-weight: 600; }

/* ---------- Placeholder images ---------- */
.ph { display: grid; place-items: center; width: 100%; height: 100%; background: var(--primary-soft); color: var(--primary); }
.ph-dbzh { background: #eceff5; color: #44608a; }
.ph-konstruktory { background: var(--accent-soft); color: var(--accent); }
.ph-kulery-dlia-telefoniv { background: #e6f1f3; color: #2f6f7d; }
.ph-napalchnyky { background: #f2eee5; color: #8a6d3b; }
.ph-default { background: var(--surface-2); color: var(--muted); }

/* ---------- Product grid / card ---------- */
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.product-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.product-thumb { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); display: block; }
.product-thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.product-thumb .tag { position: absolute; top: 10px; left: 10px; }
.product-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-name { font-size: .95rem; font-weight: 550; margin: 0; flex: 1; }
.product-name a { color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 1.1rem; }
.old-price { color: var(--muted); font-size: .9rem; }
.is-out .product-thumb { opacity: .6; }
.stock-out { color: var(--danger); font-size: .9rem; font-weight: 600; }
.stock-in { color: var(--primary); font-weight: 600; }

/* ---------- Catalog ---------- */
.breadcrumbs { font-size: .88rem; color: var(--muted); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs a { color: var(--muted); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 4px 0 16px; }
.toolbar input[type=search], .toolbar select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-height: 40px; }
.select-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: .9rem; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Product page ---------- */
.product-page { display: grid; gap: 20px; }
.gallery-main { padding: 0; overflow: hidden; aspect-ratio: 1 / 1; display: grid; place-items: center; background: #fff; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-main .ph svg { width: 120px; height: 120px; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumb { flex: none; width: 64px; height: 64px; padding: 0; border: 2px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.active { border-color: var(--primary); }
.price-big .price { font-size: 1.7rem; }
.buy-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 16px 0; }
.qty-label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.qty-input { width: 76px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; text-align: center; min-height: 44px; background: var(--surface); }
.perks { display: grid; gap: 6px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius-sm); margin: 16px 0; font-size: .93rem; }
.perks li::before { content: "✓ "; color: var(--primary); font-weight: 700; }
.description { margin-top: 20px; }
.description p { max-width: 70ch; }

/* ---------- Cart / checkout ---------- */
.cart-layout, .checkout-layout { display: grid; gap: 16px; align-items: start; }
.cart-list { padding: 6px 14px; }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto; grid-template-areas: "thumb info rm" "thumb qty sum"; gap: 6px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-line:last-of-type { border-bottom: 0; }
.cart-thumb { grid-area: thumb; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-thumb .ph svg { width: 32px; height: 32px; }
.cart-info { grid-area: info; display: grid; }
.cart-name { color: var(--text); font-weight: 550; }
.cart-qty { grid-area: qty; }
.cart-sum { grid-area: sum; font-weight: 700; text-align: right; white-space: nowrap; }
.cart-line .icon-btn { grid-area: rm; justify-self: end; }
.cart-actions { padding: 12px 0; display: flex; justify-content: flex-end; }
.summary { display: grid; gap: 12px; }
.summary-title { margin: 0; }
.summary-row, .summary-item { display: flex; justify-content: space-between; gap: 12px; }
.summary-item { font-size: .93rem; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.summary-item span:last-child { white-space: nowrap; }
.summary-row.total { font-size: 1.2rem; font-weight: 700; padding-top: 6px; border-top: 1px solid var(--border); }
.checkout-main { display: grid; gap: 16px; }
.fieldset { margin: 0; min-width: 0; }
.fieldset legend { font-weight: 650; font-size: 1.1rem; padding: 0; float: left; width: 100%; margin-bottom: 12px; }
.fieldset legend + * { clear: both; }
.form-grid { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; font-size: .92rem; font-weight: 550; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-weight: 400; font-size: 1rem; min-height: 46px; }
.field textarea { resize: vertical; min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); outline: 3px solid rgba(47, 107, 95, .15); }
.field-error { color: var(--danger); font-size: .85rem; font-weight: 500; }
.field:has(.field-error) input { border-color: var(--danger); }
.options { display: grid; gap: 8px; margin-bottom: 12px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.option input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.option-body { display: grid; gap: 2px; }
.option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.delivery-fields { padding-top: 4px; }
.delivery-fields[hidden] { display: none; }
.form-card { display: grid; gap: 14px; }
.form-card h1, .form-card h2 { margin: 0; }

/* ---------- Order ---------- */
.order-grid, .account-grid, .info-grid { display: grid; gap: 16px; align-items: start; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tfoot td { border-bottom: 0; }
.table tr.total td { font-weight: 700; font-size: 1.05rem; }
.details { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0; }
.details dt { color: var(--muted); font-size: .85rem; margin-top: 8px; }
.details dd { margin: 0; }
.status, .pay { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); white-space: nowrap; }
.status-new { background: var(--info-soft); color: #2d4f6e; }
.status-processing { background: var(--warn-soft); color: #7a5a17; }
.status-shipped { background: #ece8f4; color: #574a7a; }
.status-completed { background: var(--primary-soft); color: var(--primary-dark); }
.status-cancelled { background: var(--danger-soft); color: var(--danger); }
.pay-paid { background: var(--primary-soft); color: var(--primary-dark); }
.pay-failed { background: var(--danger-soft); color: var(--danger); }
.pay-pending { background: var(--warn-soft); color: #7a5a17; }
.pay-box { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; border-color: #e5d7a8; background: #fffbef; }
.pay-box p { margin: 0; }
.pay-test { text-align: center; display: grid; gap: 10px; justify-items: center; }
.pay-amount { font-size: 2rem; font-weight: 750; margin: 0; }
.pay-test-actions { display: grid; gap: 10px; width: 100%; }
.info-item { margin-bottom: 12px; }
.info-item p { margin: 2px 0 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 28px 0 16px; font-size: .93rem; }
.footer-grid { display: grid; gap: 20px; }
.footer-grid h3 { font-size: .95rem; }
.footer-grid li { margin-bottom: 4px; }
.logo-footer { margin-bottom: 8px; }
.footer-bottom { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); font-size: .85rem; }

/* ---------- Нижня панель навігації (телефон) ---------- */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: #fff; border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(31, 42, 46, .05);
}
.bottom-nav a, .bottom-nav summary {
    position: relative; display: grid; justify-items: center; gap: 2px; padding: 4px 2px;
    color: var(--muted); font-size: .72rem; font-weight: 600; border-radius: 10px; cursor: pointer; list-style: none;
}
.bottom-nav summary::-webkit-details-marker { display: none; }
.bottom-nav a:hover { text-decoration: none; color: var(--text); }
.bottom-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav .active { color: var(--primary); }
.bottom-nav .active svg { stroke-width: 2.2; }
.bottom-nav .badge { top: 0; right: calc(50% - 22px); }
.more-menu { position: relative; display: grid; }
.more-panel {
    position: absolute; right: 4px; bottom: calc(100% + 10px); min-width: 210px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 30px rgba(31,42,46,.15);
    padding: 6px; display: grid;
}
.more-panel a, .more-logout { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; color: var(--text); font-size: .95rem; font-weight: 500; grid-auto-flow: unset; justify-items: unset; }
.more-panel a:hover, .more-logout:hover { background: var(--surface-2); }
.more-panel svg { width: 20px; height: 20px; }
.more-logout { width: 100%; border: 0; background: none; cursor: pointer; color: var(--danger); text-align: left; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

/* Липка панель «У кошик» на сторінці товару (телефон) */
.buybar { display: none; }
body.has-buybar .bottom-nav { display: none; }
body.has-buybar .buybar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0;
    background: #fff; border-top: 1px solid var(--border);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(31, 42, 46, .06);
}
.buybar-price { display: grid; line-height: 1.2; }
.buybar .btn { flex: 1; max-width: 220px; }

/* ---------- Фільтри каталогу ---------- */
.catalog-layout { display: grid; gap: 16px; align-items: start; }
.filters { padding: 0; }
.filters-toggle { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 14px 18px; border: 0; background: none; font-weight: 650; cursor: pointer; }
.filters-toggle svg { transition: transform .2s; }
.filters.open .filters-toggle svg { transform: rotate(180deg); }
.filters-body { padding: 0 18px 18px; display: grid; gap: 18px; }
.js .filters:not(.open) .filters-body { display: none; }
.filter-group { display: grid; gap: 10px; }
.filter-group h3 { margin: 0; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.filter-cats { display: grid; gap: 2px; }
.filter-cats a { display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 9px; color: var(--text); }
.filter-cats a:hover { background: var(--surface-2); text-decoration: none; }
.filter-cats a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.price-range { display: flex; align-items: center; gap: 8px; }
.price-range input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-height: 42px; }
.catalog-main .toolbar { justify-content: flex-end; margin-top: 0; }

/* ---------- Admin ---------- */
body.admin { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.admin-shell { display: block; min-height: 100vh; }
.admin-sidebar { display: none; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.admin-main { padding: 18px 16px 32px; max-width: 1240px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.side-nav, .side-bottom { display: grid; gap: 2px; }
.side-nav a, .side-bottom > a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); font-weight: 500; }
.side-nav a:hover, .side-bottom > a:hover { background: var(--surface-2); text-decoration: none; }
.side-nav a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 650; }
.side-nav svg, .side-bottom svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-nav .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: .75rem; font-weight: 700; padding: 1px 8px; }
.side-user { display: grid; gap: 8px; padding: 12px; margin-top: 6px; border-top: 1px solid var(--border); overflow-wrap: anywhere; }

/* Підказки */
.hint { background: #f3f7f4; border: 1px solid #d6e4dc; border-radius: var(--radius); margin-bottom: 16px; }
.hint summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; font-weight: 600; color: var(--primary-dark); list-style: none; }
.hint summary::-webkit-details-marker { display: none; }
.hint summary::after { content: "Показати"; margin-left: auto; font-size: .82rem; font-weight: 500; color: var(--muted); }
.hint[open] summary::after { content: "Сховати"; }
.hint-body { padding: 0 18px 14px 42px; font-size: .94rem; color: #34413e; }
.hint-body ul, .hint-body ol { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 6px; }
.hint-body p { margin: 0 0 8px; }
.hint-body code, .help code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* Перші кроки */
.steps-card { margin-bottom: 16px; }
.steps { display: grid; gap: 10px; }
.steps li { display: grid; grid-template-columns: 28px 1fr; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.steps li:last-child { border-bottom: 0; }
.steps li .btn { grid-column: 2; justify-self: start; }
.step-mark { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.steps li.done .step-mark { background: var(--primary); border-color: var(--primary); color: #fff; }
.steps li.done strong { text-decoration: line-through; color: var(--muted); }
.step-text { display: grid; }
.stat-attention { border-color: #e5d7a8; background: #fffbef; }

/* Список замовлень на огляді */
.order-list li + li { border-top: 1px solid var(--border); }
.order-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px; color: var(--text); border-radius: 8px; }
.order-row:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.order-row-main, .order-row-side { display: grid; gap: 2px; }
.order-row-side { justify-items: end; }

/* Шлях замовлення */
.flow-card { margin-bottom: 16px; display: grid; gap: 16px; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); position: relative; }
.flow li { display: grid; justify-items: center; gap: 6px; text-align: center; position: relative; }
.flow li::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.flow li:first-child::before { display: none; }
.flow li.done::before, .flow li.current::before { background: var(--primary); }
.flow-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 3px solid var(--border); font-weight: 700; font-size: .85rem; position: relative; z-index: 1; color: var(--muted); }
.flow li.done .flow-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.flow li.current .flow-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.flow-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.flow li.current .flow-label { color: var(--text); }
.next-step { display: grid; gap: 12px; padding-top: 14px; border-top: 1px dashed var(--border); }
.next-hint { margin: 0; }
.next-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.manual-edit > summary { display: grid; gap: 2px; cursor: pointer; list-style: none; }
.manual-edit > summary::-webkit-details-marker { display: none; }
.manual-edit > summary h2 { margin: 0; }
.manual-edit > summary h2::after { content: " ▾"; color: var(--muted); font-size: .9rem; }
.manual-edit[open] > summary { margin-bottom: 14px; }
.pay-log li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }

/* Липка кнопка «Зберегти» у формі товару */
.savebar {
    position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 15;
    display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px;
    background: rgba(255, 255, 255, .96); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 -4px 20px rgba(31,42,46,.08);
}
.savebar .btn-primary { flex: 1; max-width: 280px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Таблиці → картки на телефоні */
.table-cards tr[data-href] { cursor: pointer; }
.table-cards tbody tr:hover { background: #fafaf7; }

/* Довідка */
.help { display: grid; gap: 16px; }
.help section { scroll-margin-top: 80px; }
.help h3 { margin-top: 16px; }
.help ol, .help ul { padding-left: 20px; display: grid; gap: 6px; }
.help-toc { margin-bottom: 16px; }
.help-toc ol { margin: 8px 0 0; padding-left: 20px; columns: 2 220px; }
.help-toc li { margin-bottom: 4px; }
.help-flow { display: grid; gap: 10px; margin: 12px 0; }
.help-flow > div { border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.help-flow p { margin: 6px 0 0; }
.code { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: .88rem; }
.faq dt { font-weight: 650; margin-top: 12px; }
.faq dd { margin: 2px 0 0; color: #44514f; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { display: grid; gap: 2px; color: var(--text); }
.stat:hover { text-decoration: none; color: var(--text); }
.stat-num { font-size: 1.5rem; font-weight: 750; }
.mini-thumb { width: 56px; }
.mini-thumb img, .mini-thumb .ph { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.mini-thumb .ph svg { width: 24px; height: 24px; }
.admin-form-layout { display: grid; gap: 16px; align-items: start; }
.admin-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.admin-image { margin: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.admin-image img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.admin-image figcaption { display: grid; gap: 6px; padding: 8px; justify-items: start; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--border); }
.inline-form select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.low-stock li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }

/* ---------- Breakpoints ---------- */
@media (max-width: 340px) {
    .header-row .logo-text { display: none; }
}
/* Таблиці адмінки на телефоні — як картки: кожен рядок окремою карткою з підписами полів */
@media (max-width: 759px) {
    .table-cards-wrap { background: none; border: 0; box-shadow: none; padding: 0; overflow: visible; }
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody { display: block; }
    .table-cards tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
    .table-cards td { display: grid; justify-items: start; gap: 1px; padding: 0; border: 0; text-align: left !important; }
    .table-cards td[data-label]::before { content: attr(data-label); font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
    .table-cards td.cell-title { grid-column: 1 / -1; font-size: 1.02rem; font-weight: 600; }
    .admin-products tr { grid-template-columns: 52px 1fr 1fr; }
    .admin-products td.mini-thumb { grid-row: span 3; }
    .admin-products td.cell-title { grid-column: 2 / -1; }
    .inline-form select { width: 100%; min-height: 40px; }
    .toolbar input[type=search] { flex: 1; min-width: 0; }
    .page-head .btn { min-height: 40px; }
}
@media (min-width: 560px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
    .cat-grid { grid-template-columns: repeat(3, 1fr); }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .field-wide { grid-column: 1 / -1; }
    .details { grid-template-columns: max-content 1fr; }
    .details dt { margin-top: 0; padding: 6px 0; }
    .details dd { padding: 6px 0; }
    .cart-line { grid-template-columns: 72px 1fr auto auto 36px; grid-template-areas: "thumb info qty sum rm"; }
    .cart-thumb { width: 72px; height: 72px; }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
@media (min-width: 560px) {
    .help-flow { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 860px) {
    h1 { font-size: 1.9rem; }
    body, body.admin { padding-bottom: 0; }
    .bottom-nav, body.has-buybar .buybar { display: none !important; }
    .header-actions { display: flex; }
    .header-row { grid-template-columns: auto minmax(240px, 520px) 1fr; grid-template-areas: "logo search actions"; gap: 24px; }
    .savebar { bottom: 12px; }
    .help-flow { grid-template-columns: repeat(4, 1fr); }
    .hdr-label { display: inline; }
    .badge { position: static; }
    .hero { grid-template-columns: 1.4fr 1fr; padding: 40px; align-items: center; }
    .hero h1 { font-size: 2.2rem; }
    .product-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    .cat-grid { grid-template-columns: repeat(5, 1fr); }
    .product-page { grid-template-columns: 1fr 1fr; gap: 36px; }
    .cart-layout, .checkout-layout { grid-template-columns: 1fr 340px; }
    .summary { position: sticky; top: 140px; }
    .order-grid { grid-template-columns: 1.3fr 1fr; }
    .account-grid { grid-template-columns: 1.5fr 1fr; }
    .info-grid { grid-template-columns: repeat(3, 1fr); }
    .stats { grid-template-columns: repeat(4, 1fr); }
    .admin-form-layout { grid-template-columns: 1.6fr 1fr; }
    .admin-form-layout .savebar { grid-column: 1 / -1; }
}
/* ПК: бічна панель фільтрів у каталозі, бічне меню в адмінці */
@media (min-width: 960px) {
    .catalog-layout { grid-template-columns: 250px 1fr; gap: 24px; }
    .filters { position: sticky; top: 130px; }
    .filters-toggle { display: none; }
    .filters-body { padding: 18px; }
    .js .filters:not(.open) .filters-body { display: grid; }
    .catalog-main .product-grid { grid-template-columns: repeat(3, 1fr); }

    .admin-shell { display: grid; grid-template-columns: 240px 1fr; }
    .admin-topbar { display: none; }
    .admin-sidebar {
        display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
        background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px;
    }
    .admin-sidebar .logo { padding: 0 8px 6px; }
    .side-bottom { margin-top: auto; }
    .admin-main { padding: 28px 32px 48px; }
    .steps li { grid-template-columns: 28px 1fr auto; }
    .steps li .btn { grid-column: auto; }
}
@media (min-width: 1280px) {
    .container { max-width: 1320px; }
    .catalog-main .product-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
