/* ================================================================
   КАТАЛОГ — ПУБЛІЧНА СІТКА
   ================================================================ */

/* ПК: 4 в ряд */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 16px;
}

/* Планшет */
@media (max-width: 1024px) {
    .catalog-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Мобіла: 2 в ряд */
@media (max-width: 640px) {
    .catalog-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* Картка */
.catalog-card {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e8ddd0;
    background: #fff;
    transition: box-shadow 0.2s, transform 0.2s;
    color: inherit;
}
.catalog-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    transform: translateY(-2px);
    opacity: 1;
}

/* Зображення */
.catalog-card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f5efe8;
}
.catalog-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.catalog-card:hover .catalog-card-img img { transform: scale(1.04); }

.catalog-card-noimg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #ccc;
}

/* Інфо */
.catalog-card-info {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.catalog-card-title {
    font-size: 14px;
    color: #2c2c2c;
    line-height: 1.4;
}

.catalog-card-price {
    font-size: 15px;
    font-weight: bold;
    color: #8B4513;
}
.catalog-card-noprice {
    font-size: 13px;
    font-weight: normal;
    color: #aaa;
}
.catalog-card-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.catalog-card-qty {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

/* Заголовки секцій */
.catalog-page-title,
.home-catalog-title {
    font-size: 22px;
    color: #2c2c2c;
    margin-bottom: 20px;
}

.catalog-page { padding-bottom: 40px; }
.home-catalog { margin-top: 48px; }
.catalog-empty { color: #aaa; font-size: 15px; }

/* Підпис-капс над секцією (груп чи товарів) + лінія-розділювач між ними */
.catalog-section-label {
    font-size: 12px;
    font-weight: bold;
    color: #9a9a94;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0 0 10px;
}
.catalog-section-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 8px 0 24px;
}

/* ================================================================
   СТОРІНКА ТОВАРУ
   ================================================================ */

.item-page { padding-bottom: 48px; }

/* Назва — мобільна версія прихована на ПК */
.item-title-mobile { display: none; }
.item-title-desktop { display: block; }

/* Двоколонковий layout */
.item-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    margin-top: 24px;
}

/* ── Галерея ── */
.item-main-photo {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #f5efe8;
    border: 1px solid #e8ddd0;
}
.item-main-photo img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}
.item-no-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 14px;
}

/* Мініатюри */
.item-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.item-thumb {
    width: 72px;
    height: 72px;
    border: 2px solid #e0d6cc;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: border-color 0.15s;
    flex-shrink: 0;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-thumb.active  { border-color: #8B4513; }
.item-thumb:hover   { border-color: #a0522d; }

/* ── Права колонка ── */
.item-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.item-title {
    font-size: 26px;
    font-weight: bold;
    color: #2c2c2c;
    line-height: 1.3;
}

.item-price {
    font-size: 28px;
    font-weight: bold;
    color: #8B4513;
}

.item-price-vat-note {
    font-size: 15px;
    font-weight: normal;
    color: #999;
}

/* Оптові умови на картці товару */
.item-wholesale {
    background: #fdf6ee;
    border: 1px solid #e8ddd0;
    border-radius: 8px;
    padding: 16px 18px;
    min-width: 0; /* флекс/грід-дитина інакше не стискається нижче вмісту — саме це й виїжджало на мобілці */
}
.item-wholesale-title {
    font-size: 14px;
    color: #8B6340;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 10px;
}
.wholesale-table { display: flex; flex-direction: column; min-width: 0; }
.wholesale-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid #ecdfd0;
    font-size: 15px;
}
.wholesale-row:last-child { border-bottom: none; }
/* БАГ-ФІКС (мобіла): рядок "Кожна наступна одиниця дешевша" — довгий текст
   без переносу в flex-дитині з justify-content:space-between штовхав увесь
   рядок (і сторінку) ширше екрана, з'являлась горизонтальна прокрутка.
   min-width:0 дозволяє тексту стискатись і переноситись замість цього;
   ціна праворуч лишається нерозривною (вона й так коротка) і не стискається. */
.wholesale-qty { color: #6b5540; min-width: 0; overflow-wrap: break-word; }
.wholesale-price { font-weight: bold; color: #8B4513; flex-shrink: 0; white-space: nowrap; }

/* Ціна "за домовленістю" — клікабельна кнопка, а не просто текст */
.wholesale-price-deal {
    background: none;
    border: none;
    border-bottom: 1px dashed #8B4513;
    padding: 0;
    font: inherit;
    font-weight: bold;
    color: #8B4513;
    cursor: pointer;
}
.wholesale-price-deal:hover { color: #a0522d; border-color: #a0522d; }

.wholesale-flex-note {
    font-size: 12px;
    color: #a0845a;
    padding: 2px 0 7px;
    font-style: italic;
}

/* Панель "За домовленістю" — список менеджерів/контактів, розгортається під
   таблицею оптових умов (не спливаюче вікно — див. map.txt, свідоме рішення).
   Розмітка в pages/item.php навмисно порожня — наповнюється лише через JS
   (get_opt_terms_public), щоб номери телефонів не потрапляли в статичний HTML */
.wholesale-deal-panel {
    margin-top: 12px;
    background: #fdf6ee;
    border: 1px solid #e8ddd0;
    border-radius: 8px;
    padding: 18px 20px;
}
.wholesale-deal-panel-title {
    font-size: 15px;
    color: #8B6340;
    margin-bottom: 12px;
}
.wholesale-deal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.wholesale-deal-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecdfd0;
    font-size: 17px;
}
.wholesale-deal-row:last-child { border-bottom: none; padding-bottom: 0; }
.wholesale-deal-name { color: #2c2c2c; font-weight: bold; }
.wholesale-deal-phone { color: #8B4513; }
.wholesale-deal-phone a { color: inherit; text-decoration: none; }
.wholesale-deal-phone a:hover { text-decoration: underline; }
.wholesale-deal-empty { font-size: 15px; color: #a0845a; }

.wholesale-deal-close {
    width: 100%;
    padding: 14px;
    background: #8B4513;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.wholesale-deal-close:hover { background: #6f3610; }

/* Степпер кількості + живий розрахунок на сторінці товару */
.item-qty-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.item-qty-label { font-size: 14px; color: #777; }
.item-qty-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
}
.item-qty-btn {
    width: 34px;
    height: 34px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}
.item-qty-btn:hover { background: #f0f0f0; }
.item-qty-max { font-size: 14px; color: #666; font-weight: 600; white-space: nowrap; }
#item-qty-input {
    width: 60px;
    height: 34px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    -moz-appearance: textfield;
}
#item-qty-input::-webkit-outer-spin-button,
#item-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.item-total-row {
    font-size: 18px;
    color: #2c2c2c;
    padding: 10px 0;
    border-top: 1px dashed #e0d6cc;
}
.item-total-row strong { color: #8B4513; font-size: 22px; }

.item-deal-cta { margin-top: -6px; }

/* Кнопка кошик */
.btn-add-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: #2c2c2c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-add-cart:hover  { background: #444; }
.btn-add-cart.added  { background: #2e7d32; }

/* "Перейти в кошик" — з'являється поруч з кнопкою тільки коли товар вже додано */
.btn-go-cart {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    text-align: center;
    text-decoration: none;
    background: none;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    color: #555;
    box-sizing: border-box;
    transition: border-color 0.2s, color 0.2s;
}
.btn-go-cart:hover { border-color: #2c2c2c; color: #2c2c2c; }

/* "Немає в наявності" — замінює степпер+кнопку "В кошик", коли available=0 */
.item-out-of-stock {
    width: 100%;
    padding: 14px;
    margin: 0;
    text-align: center;
    color: #c0392b;
    font-size: 16px;
    font-weight: 600;
    background: #fdecea;
    border-radius: 6px;
    box-sizing: border-box;
}

.item-descr {
    font-size: 15px;
    line-height: 1.7;
    color: #444;
    border-top: 1px solid #eee;
    padding-top: 16px;
}

.item-back {
    font-size: 13px;
    color: #999;
    margin-top: 8px;
}
.item-back:hover { color: #2c2c2c; opacity: 1; }

/* ── МОБІЛА ── */
@media (max-width: 768px) {
    .item-title-mobile  { display: block; font-size: 20px; margin-bottom: 4px; }
    .item-title-desktop { display: none; }

    .item-layout {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 12px;
    }

    .item-price    { font-size: 22px; }
    .item-title    { font-size: 20px; }
    .btn-add-cart  { padding: 12px; font-size: 15px; }
    .item-thumbs   { gap: 6px; }
    .item-thumb    { width: 58px; height: 58px; }
}

.item-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
}
.item-back:hover { color: #2c2c2c; opacity: 1; }

@media (max-width: 768px) {
    .item-back {
        display: flex;
        justify-content: center;
        width: 100%;
        padding: 9px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 14px;
        color: #555;
        margin-bottom: 12px;
    }
}

/* ================================================================
   КОШИК
   ================================================================ */
.cart-section { max-width: 800px; margin: 0 auto; padding-bottom: 48px; }
.cart-title   { font-size: 24px; margin-bottom: 24px; }

/* Порожній кошик */
.cart-empty { text-align: center; padding: 48px 20px; }
.cart-empty p { font-size: 16px; color: #aaa; margin-bottom: 20px; }
.cart-go-catalog { display: inline-block; text-decoration: none; }

/* Картка-рахунок — біле тло з рамкою, той же стиль, що й на чекауті */
.cart-invoice {
    background: #fff;
    border: 1px solid #e0d6cc;
    border-radius: 8px;
    padding: 20px 4px 20px 14px;
    margin-bottom: 24px;
}

/* Таблиця товарів — з обрамленням, як у рахунку-фактурі */
.cart-table-wrap { overflow-x: auto; }
.cart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.cart-table th,
.cart-table td {
    border: 1px solid #e0d6cc;
    padding: 10px 8px;
}
.cart-table thead th {
    background: #fdf6ee;
    font-weight: bold; 
    font-size: 1.1em;
    color: #8B6340;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
}
.cart-table th:nth-child(2), .cart-table tbody td:nth-child(2),
.cart-table th:nth-child(4), .cart-table tbody td:nth-child(4) { text-align: right; white-space: nowrap; }
.cart-table th:nth-child(3), .cart-table tbody td:nth-child(3),
.cart-table td:last-child { text-align: center; white-space: nowrap; }

/* Стовпець "Видалити" — структурно клітинка таблиці, але без обрамлення: рамка
   візуально закінчується на стовпці "Сума", кнопка ніби "висить" поза таблицею */
.cart-table th:last-child,
.cart-table td:last-child {
    border: none;
    background: transparent;
}

.cart-item-title  { font-size: 1.1em; color: #2c2c2c; }
.cart-item-title:hover { color: #8B4513; opacity: 1; }
.cart-item-price  { color: #666; }
.cart-line-total  { font-weight: bold; color: #2c2c2c; }

.cart-qty { display: inline-flex; align-items: center; gap: 8px; }
.cart-qty-btn {
    width: 26px; height: 26px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    line-height: 1; flex-shrink: 0;
}
.cart-qty-btn:hover { background: #f0f0f0; }
.cart-qty-val { min-width: 20px; text-align: center; font-size: 15px; }

.cart-remove {
    background: none; border: none;
    color: #c0392b; font-size: 12px;
    cursor: pointer; padding: 4px 6px;
    border-radius: 3px;
    transition: background 0.15s;
}
.cart-remove:hover { background: #fff0f0; }

/* Заголовок над таблицею при двотабличному показі (змішаний ПДВ/без ПДВ кошик) —
   помітний відступ зверху, щоб візуально відділити другу таблицю від підсумків першої */
.cart-table-title {
    font-size: 14px;
    color: #8B6340;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 28px 0 10px;
}
.cart-invoice > .cart-table-title:first-child { margin-top: 0; }

/* Підсумки — рядки в <tfoot> тієї ж таблиці. Клітинки під "Ціна / шт." і "Кількість"
   об'єднані (colspan=2) — підпис; значення — у стовпці "Сума", як і суми товарів. */
.cart-totals-label {
    text-align: right;
    color: #666;
    font-weight: normal;
}
.cart-totals-value {
    text-align: right;
    font-weight: bold;
    color: #2c2c2c;
    white-space: nowrap;
}
.cart-totals-grand td { background: #fdf6ee; }
.cart-totals-grand .cart-totals-label { font-size: 15px; color: #8B6340; }
.cart-totals-grand .cart-totals-value { font-size: 17px; color: #8B4513; }

/* Клітинка під "Товар" у рядках підсумків — порожня, без тексту, тож без
   обрамлення і без заливки (в т.ч. у "жирному" рядку "Всього з ПДВ") */
.cart-totals-tr td:first-child {
    border: none;
    background: transparent;
}

/* Футер кошика — кнопка оформлення замовлення */
.cart-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.cart-checkout {
    padding: 13px 28px;
    font-size: 15px;
    text-decoration: none;
    display: inline-block;
}

/* Заблокована кнопка оформлення — коли на якісь позиції в кошику вже не вистачає
   залишку на складі (див. cart_render_split, js/cart.js) */
.cart-checkout-blocked {
    padding: 13px 28px;
    font-size: 15px;
    display: inline-block;
    background: #ccc !important;
    color: #777 !important;
    cursor: not-allowed;
}

/* Рядок кошика, де обрана кількість перевищує живий залишок на складі */
.cart-row-shortage td { background: #fdecea !important; }
.cart-qty-shortage {
    color: #c0392b;
    font-size: 12px;
    margin-top: 4px;
    white-space: nowrap;
}

/* Кнопка "Вже в кошику" */
.btn-add-cart.added { background: #2e7d32; }
.btn-add-cart:disabled { cursor: default; }

/* Заглушка checkout */
.checkout-stub { color: #aaa; font-size: 15px; margin-bottom: 20px; }

/* Мобіла */
@media (max-width: 600px) {
    .cart-invoice { padding: 14px 14px 4px; }
    .cart-table { font-size: 13px; }
    .cart-table th, .cart-table td { padding: 8px; }
    .cart-totals-row { min-width: 0; }
    .cart-footer { flex-direction: column; align-items: stretch; }
    .cart-checkout { text-align: center; }
    .invoice-print-card { padding: 20px 16px; }
}

/* ================================================================
   ОФОРМЛЕННЯ ЗАМОВЛЕННЯ
   ================================================================ */
.checkout-section {
    max-width: 700px;
    margin: 0 auto;
    padding-bottom: 48px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ── Рахунок ── */
.checkout-invoice {
    background: #fff;
    border: 1px solid #e0d6cc;
    border-radius: 8px;
    overflow: hidden;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #2c2c2c;
    color: #fff;
}
.invoice-brand { font-size: 16px; font-weight: bold; }
.invoice-label { font-size: 13px; color: #aaa; }

/* Рядки рахунку */
.invoice-items { padding: 0 24px; }

.invoice-row {
    display: grid;
    grid-template-columns: 28px 1fr 90px 110px 110px;
    gap: 0 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0ebe5;
    align-items: center;
    font-size: 14px;
}
.invoice-row:last-child { border-bottom: none; }

.invoice-row-head {
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 0 8px;
    border-bottom: 2px solid #e0d6cc;
}

.inv-num   { color: #bbb; text-align: center; }
.inv-title { color: #2c2c2c; }
.inv-qty   { text-align: center; color: #666; }
.inv-pcs   { text-align: right; color: #888; }
.inv-total { text-align: right; font-weight: bold; color: #2c2c2c; }

/* Підсумки */
.invoice-totals { padding: 12px 24px 16px; border-top: 2px solid #e0d6cc; }

.invoice-total-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    font-size: 18px;
}
.invoice-total-row strong { color: #8B4513; font-size: 20px; }

/* Заголовок таблиці та великий підсумок при двотабличному показі (змішаний ПДВ/без ПДВ чек) */
.invoice-table-title {
    font-size: 12px;
    color: #8B6340;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 12px 0 4px;
}
.invoice-total-row.invoice-grand-total {
    border-top: 1px dashed #e0d6cc;
    margin-top: 8px;
    padding-top: 10px;
}
.invoice-total-row.invoice-grand-total strong { font-size: 22px; }

.invoice-note {
    padding: 12px 24px;
    background: #fdf6ee;
    font-size: 12px;
    color: #a08060;
    border-top: 1px solid #e0d6cc;
    line-height: 1.6;
}

/* ── Форма ── */
.checkout-form-wrap {
    background: #fff;
    border: 1px solid #e8e0d8;
    border-radius: 8px;
    padding: 24px;
}
.checkout-form-title { font-size: 18px; margin-bottom: 20px; color: #2c2c2c; }

.checkout-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.checkout-field label { font-size: 13px; color: #777; }
.field-required { font-size: 11px; color: #c0392b; margin-left: 4px; }

.checkout-field input,
.checkout-field textarea {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.checkout-field input:focus,
.checkout-field textarea:focus { border-color: #2c2c2c; }
.checkout-field textarea { resize: vertical; }

.checkout-error { color: #c0392b; font-size: 13px; min-height: 18px; margin-bottom: 8px; }

.checkout-submit { width: 100%; padding: 14px; font-size: 16px; }

/* ── Підтвердження ── */
.checkout-success {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 48px 20px;
}
.success-icon {
    width: 64px; height: 64px;
    background: #2e7d32;
    color: #fff;
    border-radius: 50%;
    font-size: 28px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.checkout-success h2 { font-size: 24px; margin-bottom: 12px; }
.success-msg { color: #666; font-size: 15px; margin-bottom: 28px; line-height: 1.6; }

.success-summary {
    text-align: left;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 24px;
}
.success-order-id { font-size: 13px; color: #aaa; margin-bottom: 14px; }

.success-items { margin-bottom: 12px; }
.success-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
    color: #555;
}
.success-total {
    font-size: 16px;
    text-align: right;
    padding-top: 10px;
    margin-bottom: 14px;
}
.success-total strong { color: #8B4513; }
.success-contacts { font-size: 14px; color: #666; display: flex; flex-direction: column; gap: 4px; }

.success-back { display: inline-block; margin-top: 4px; }

/* Мобіла */
@media (max-width: 600px) {
    .invoice-row {
        grid-template-columns: 24px 1fr 70px 80px;
    }
    .inv-pcs { display: none; }
    .invoice-header { padding: 14px 16px; }
    .invoice-items  { padding: 0 16px; }
    .invoice-totals { padding: 12px 16px; }
    .invoice-note   { padding: 10px 16px; }
    .checkout-form-wrap { padding: 16px; }
}

/* ================================================================
   ЗАМОВЛЕННЯ
   ================================================================ */
.orders-section { max-width: 700px; margin: 0 auto; padding-bottom: 48px; }
.orders-title   { font-size: 24px; margin-bottom: 24px; }
.orders-empty   { color: #aaa; font-size: 15px; }
.orders-hint    { font-size: 14px; color: #666; margin-bottom: 8px; }

/* Список (залогінений). Колонки: id/дата/поз./сума/статус — ОДНА статусна
   колонка (2026-08-25, ДРУГИЙ перегляд: пробували окрему колонку під
   оплату — вийшло дублювання, "Оплачено" в обох колонках одночасно, і
   забагато інформації для клієнта, за проханням власника). Тепер статус
   і оплата — ОДНА мітка (orders_status_display(), js/orders.js: "Оплачено"
   лише якщо гроші реально надійшли, інакше звичайна стадія обробки), а
   сума додатково підсвічується кольором (.order-total-paid нижче) —
   ПЕРЕГЛЯНУТО (2026-08-26): холд теж зелений, окремого жовтого для
   холду більше немає (менше деталей клієнту — не треба пояснювати
   колір, текст "Оплачено (холд)" сам себе пояснює). */
.orders-list { display: flex; flex-direction: column; gap: 4px; }
.order-row {
    display: grid;
    grid-template-columns: 90px 100px 80px 1fr 110px;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    font-size: 14px;
    overflow: hidden; /* підстраховка — жоден контент цієї картки не виходить за її межі */
}
.order-id    { font-weight: bold; color: #2c2c2c; }
.order-date  { color: #999; }
.order-total { font-weight: bold; color: #8B4513; }
.order-total-paid { color: #1e7e34; }
.order-status { font-size: 12px; padding: 3px 10px; border-radius: 10px; text-align: center; white-space: nowrap; }
.mgr-invoice-note {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #0d5c8a;
    background: #e3f2fb;
    padding: 3px 10px;
    border-radius: 10px;
    margin-left: 10px;
}
/* Кольори статусів — спільні .st-* класи, див. css/manager.css (там же використовує менеджерка) */

/* Форма гостя */
.orders-guest { max-width: 480px; }
.orders-hint-sub { font-size: 13px; color: #aaa; margin-bottom: 12px; }
.orders-search {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.orders-search input,
.orders-search select {
    padding: 9px 12px; border: 1px solid #ccc;
    border-radius: 4px; font-size: 14px; flex: 1; min-width: 120px;
}
.orders-register-hint { margin-top: 20px; font-size: 13px; color: #aaa; }

/* Деталі замовлення (гостьовий пошук — коробка .order-detail, всередині таблиця
   рахунку в стилі кошика, .cart-table, без окремої рамки — див. js/orders.js) */
.order-detail { margin-top: 16px; background: #fff; border: 1px solid #eee; border-radius: 6px; padding: 16px; }
.order-detail-status { margin-bottom: 12px; font-size: 14px; }
.order-search-error { color: #c0392b; font-size: 14px; margin-top: 8px; }
.orders-register-hint a { color: #8B4513; }

/* Іконка замовлень в меню */
.nav-orders {
    color: #fff; font-size: 14px;
    display: flex; align-items: center; gap: 4px;
}
.nav-orders:hover { opacity: 0.7; }
.orders-count {
    background: #8B4513; color: #fff;
    font-size: 11px; font-weight: bold;
    min-width: 18px; height: 18px;
    border-radius: 9px; display: flex;
    align-items: center; justify-content: center;
    padding: 0 4px;
}
.orders-count.has-unclaimed { background: #f0a020; }

@media (max-width: 600px) {
    .order-row { grid-template-columns: 80px 1fr 100px; }
    .order-date, .order-items { display: none; }
}

/* Архів у списку замовлень клієнта (2026-08-26) — розгортається під
   рискою, рендериться лише якщо є хоч одне завершене/відмовлене
   замовлення (ORDERS_FINAL_STATUSES, js/orders.js). */
.orders-archive-divider { border: none; border-top: 1px solid #e0e0e0; margin: 20px 0 12px; }
.orders-archive-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; cursor: pointer; color: #8B4513; font-size: 14px; font-weight: bold;
    user-select: none;
}
.orders-archive-toggle:hover { opacity: 0.75; }
.orders-archive-arrow { font-size: 12px; }
.orders-archive-list { margin-top: 4px; }

/* Промо реєстрації на сторінці замовлень */
.orders-reg-promo {
    background: #fdf6ee;
    border: 1px solid #e0c9a0;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 24px;
    font-size: 15px;
    color: #5a3e1b;
    line-height: 1.6;
}
.orders-reg-btns {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.orders-reg-btns .btn-primary  { padding: 10px 22px; text-decoration: none; display: inline-block; }
.orders-reg-btns .btn-secondary { padding: 9px 20px; text-decoration: none; display: inline-block; }

.orders-track-wrap { margin-top: 8px; }
.orders-track-title { font-size: 14px; color: #888; margin-bottom: 10px; }

.orders-unreg { max-width: 480px; }

.orders-empty-auth { text-align: center; padding: 48px 20px; }
.orders-empty-auth .orders-empty { font-size: 16px; margin-bottom: 20px; }
.orders-empty-cta { display: inline-block; text-decoration: none; padding: 12px 28px; }

/* Гостьові замовлення, що чекають підтвердження за телефоном */
#orders-unclaimed-block {
    background: #fff8e1;
    border: 1px solid #f0c060;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
}
.orders-unclaimed-hint { font-size: 14px; color: #7a5c1e; margin-bottom: 10px; }
.unclaimed-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid #f0dca0;
    font-size: 14px;
    flex-wrap: wrap;
}
.unclaimed-row:first-of-type { border-top: none; padding-top: 0; }
.unclaimed-id    { font-weight: bold; color: #2c2c2c; }
.unclaimed-date  { color: #999; }
.unclaimed-total { font-weight: bold; color: #8B4513; margin-right: auto; }
.unclaimed-actions { display: flex; gap: 8px; }
.btn-reject-order { color: #999; }
.btn-reject-order:hover { color: #c0392b; border-color: #c0392b; }

@media (max-width: 600px) {
    .unclaimed-row { gap: 8px 12px; }
    .unclaimed-actions { width: 100%; order: 5; }
    .unclaimed-actions button { flex: 1; }
}

/* Клікабельний рядок замовлення */
.order-row-link { cursor: pointer; transition: background 0.15s; }
.order-row-link:hover { background: #fdf6ee; border-color: #e0c9a0; }

/* Деталі замовлення */
.order-detail-nav    { margin-bottom: 20px; }
.order-detail-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 20px; flex-wrap: wrap;
}
.order-detail-id   { font-size: 18px; font-weight: bold; }
.order-detail-date { font-size: 14px; color: #999; }

/* #order-detail-invoice — сама таблиця рахунку в стилі кошика (.cart-invoice/
   .cart-table) генерується й вставляється JS-ом (js/orders.js), нічого свого
   тут не треба */

.order-detail-note {
    font-size: 14px; color: #666;
    background: #fdf6ee; border-radius: 4px;
    padding: 10px 14px;
}

/* .order-detail-actions — НЕРУХОМИЙ рядок кнопок "Сформувати рахунок-фактуру"
   і "Оплатити онлайн" (js/orders.js order_build_actions_buttons). Кнопки самі
   нічого не розгортають під собою — весь змінний вміст іде в ОКРЕМУ спільну
   панель нижче (#order-detail-actions-panel), тому кнопки завжди лишаються
   на місці, одна під одною вони більше не "з'їжджають" (був баг: панель
   всередині кнопкового блоку розтягувала його й зсувала сусідню кнопку).
   justify-content:center сам центрує єдину кнопку, якщо друга прихована. */
.order-detail-actions {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 16px; margin-top: 20px;
}
/* .btn-primary глобально width:100% (розраховане на вузькі форми на кшталт
   логіну) — тут кнопки прямі flex-діти без обгортки-div, тож width:100%
   ставав їхнім flex-basis і саме через це вони знову "з'їжджали" одна під
   одну (flex-wrap переносив другу кнопку, бо перша вже займала весь рядок).
   width:auto тут — фікс, не косметика. */
.order-detail-actions .btn-primary {
    width: auto; margin-bottom: 0;
}
.order-detail-actions .btn-primary.active {
    box-shadow: inset 0 0 0 2px #2c2c2c;
}
/* "Завантажити рахунок №..." (2026-08-12) — той самий .btn-primary, але
   <a>, не <button> — text-decoration:none інакше показувало б підкреслення. */
.order-detail-actions a.btn-primary { text-decoration: none; }

/* .order-invoice-panel-wrap (= #order-detail-actions-panel) — спільна панель,
   що розгортається під рядком кнопок (js/orders.js order_actions_toggle).
   Клік по іншій кнопці МИТТЄВО підміняє вміст (без подвійного слайду) —
   сама панель відкрита весь час перемикання, її висота лише перераховується.
   ВИПРАВЛЕНО (2026-08-11): раніше жила ВСЕРЕДИНІ .orders-section
   (max-width:700px, pages/orders.php) — тому "розширення" .invoice-print-card
   до 800px нижче не мало ефекту, батько все одно різав до 700px. Тепер
   винесена ПОЗА .orders-section (окремий елемент в pages/orders.php, той
   же рівень DOM, що й сама секція) — власна ширина, нікого не зсуває. */
.order-invoice-panel-wrap { max-width: 1000px; margin: 14px auto 0; }

.order-payment-stub {
    font-size: 14px; color: #666;
    background: #f5f5f5; border: 1px dashed #ccc; border-radius: 4px;
    padding: 30px 14px; text-align: center;
}
.order-payment-open {
    text-align: center; padding: 30px 14px;
    background: #f5f5f5; border-radius: 4px;
}
.order-payment-hint {
    font-size: 13px; color: #666; margin: 12px 0 0;
}

/* .order-invoice-form — форма рахунка (постачальник/покупець), перший крок
   перед .invoice-print-card нижче. Заготовка — генерація ще не реалізована,
   core/INVOICES.md. */
.order-invoice-form { display: flex; flex-wrap: wrap; gap: 20px; }
.order-invoice-side { flex: 1 1 280px; min-width: 240px; }
.order-invoice-side-title { font-size: 14px; margin-bottom: 8px; }
.order-invoice-side-text {
    font-size: 14px; color: #444; white-space: pre-wrap;
    background: #f5f5f5; border-radius: 4px; padding: 10px 12px; min-height: 100px;
}
.order-invoice-buyer-input { min-height: 100px; }
.order-invoice-form-actions {
    flex: 1 0 100%; display: flex; align-items: center; gap: 10px;
}
.order-invoice-status { font-size: 13px; }

/* .invoice-print-card — попередній перегляд рахунка-фактури після кліку
   "Сформувати" (2026-08-11, ЗАГОТОВКА). Біла картка-документ, друк буде ЧБ —
   .invoice-print нижче знімає кольорові акценти з таблиці .cart-table.
   Ширину/центрування задає БАТЬКІВСЬКИЙ .order-invoice-panel-wrap (вище) —
   тут лише сама картка (фон/рамка/відступи), заповнює 100% ширини батька. */
.invoice-print-card {
    background: #fff; border: 1px solid #ddd; border-radius: 6px;
    padding: 40px 50px 36px;
}
.invoice-print-title { font-weight: bold; font-size: 1.7em; }
.invoice-print-meta { border-collapse: collapse; margin-top: 18px; }
.invoice-print-meta td { border: none; padding: 3px 10px 3px 0; vertical-align: top; font-size: 14px; }
.invoice-print-meta-label { font-weight: bold; white-space: nowrap; }
.invoice-print-meta-value { white-space: pre-wrap; }
.invoice-print { margin-top: 20px; }
.invoice-print .cart-table thead th { background: #fff; color: #000; }
.invoice-print .cart-item-title,
.invoice-print .cart-item-title:hover { color: #000; }
.invoice-print .cart-line-total { color: #000; }
.invoice-print .cart-table th, .invoice-print .cart-table td { border-color: #000; }
.invoice-print-summary { margin-top: 20px; font-size: 14px; }
.invoice-print-summary p { margin: 4px 0; }
.invoice-print-note { white-space: pre-wrap; color: #666; }
.invoice-print-save {
    margin-top: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.invoice-save-status { font-size: 14px; }


/* ================================================================
   ГРУПИ — публічна сітка
   ================================================================ */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}
@media (max-width: 768px) {
    .groups-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* Картка групи — вертикальна. Тонований фон + акцентна смужка зверху
   візуально відділяють групи від товарних карток (ті лишаються білими) */
.group-card {
    display: flex;
    flex-direction: column;
    background: #f7ece9;
    border: 1px solid #e8ddd0;
    border-top: 3px solid #a8382e;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    color: inherit;
}
.group-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    transform: translateY(-2px);
    opacity: 1;
}

/* Картинка займає всю ширину — квадрат, бо іконка групи тепер сама квадратна (256x256) */
.group-card-img {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f0e0da;
}

/* Бейдж "категорія" — на випадок коли фото групи не відрізняється візуально від фото товару */
.group-card-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #a8382e;
    color: #fff;
    font-size: 10px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 10px;
}
.group-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.group-card:hover .group-card-img img { transform: scale(1.04); }

.group-card-noimg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #c8a882;
}

/* Підпис під картинкою */
.group-card-info {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.group-card-title {
    font-size: 1.3em;
    font-weight: bold;
    color: #2c2c2c;
    line-height: 1.3;
}
.group-card-count {
    font-size: 12px;
    color: #a08060;
}

/* ================================================================
   ПОВІДОМЛЕННЯ (/messages)
   ================================================================ */
.messages-section { max-width: 900px; margin: 0 auto; padding-bottom: 48px; }
.messages-title   { font-size: 24px; margin-bottom: 24px; }

.messages-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e5e5;
}
.messages-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #999;
    font-size: 14px;
    padding: 10px 16px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.messages-tab-btn:hover  { color: #2c2c2c; }
.messages-tab-btn.active { color: #8B4513; border-bottom-color: #8B4513; font-weight: bold; }

.msgs-table-wrap { overflow-x: auto; }
.msgs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.msgs-table th {
    text-align: left;
    padding: 10px 12px;
    color: #999;
    font-weight: normal;
    font-size: 12px;
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
}
.msgs-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}
.msgs-table tr:last-child td { border-bottom: none; }

.msgs-table tbody tr.msgs-row { cursor: pointer; transition: background 0.1s; }
.msgs-table tbody tr.msgs-row:hover { background: #faf6f0; }

/* Детальний перегляд одного повідомлення — заміняє список у #messages-list-wrap
   (окремий блок, не розсування рядка таблиці — щоб було місце під "Відповісти") */
.msgs-detail {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.msgs-detail-back { align-self: flex-start; }
.msgs-detail-from {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
}
.msgs-detail-from-name { font-weight: bold; color: #2c2c2c; margin-bottom: 4px; }
.msgs-detail-body {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 12px 14px;
}
.msgs-detail-subj { font-weight: bold; color: #2c2c2c; margin-bottom: 8px; font-size: 16px; }
.msgs-detail-text { color: #444; line-height: 1.6; white-space: pre-line; }
.msgs-detail-actions { display: flex; gap: 10px; }
.msgs-detail-actions button:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 600px) {
    .msgs-table th, .msgs-table td { padding: 8px; font-size: 13px; }
}