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

:root {
    --ink: #1a1a1a;
    --ink-soft: #555;
    --ink-faint: #999;
    --rule: #e8e4df;
    --surface: #faf8f5;
    --white: #ffffff;
    --accent: #2f6b4f;
    --accent-light: #e8f4ee;
    --accent-hover: #225239;
    --danger: #c0392b;
    --warning: #e67e22;
    --font-display: 'DM Serif Display', serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --r: 8px;
    --r-lg: 14px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

body {
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
}

/* HEADER */
header {
    background: var(--white);
    border-bottom: 1px solid var(--rule);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--accent);
}

nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-soft);
    padding: 8px 14px;
    border-radius: var(--r);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn:hover {
    background: var(--surface);
    color: var(--ink);
}

.nav-btn.active {
    background: var(--accent-light);
    color: var(--accent);
}

.cart-badge {
    background: var(--accent);
    color: white;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    min-width: 18px;
    text-align: center;
}

.btn-primary {
    background: var(--ink);
    color: white;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 9px 18px;
    border-radius: var(--r);
    transition: all 0.15s;
}

.btn-primary:hover {
    background: #333;
}

.btn-accent {
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 9px 18px;
    border-radius: var(--r);
    transition: all 0.15s;
}

.btn-accent:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: none;
    border: 1px solid var(--rule);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--r);
    color: var(--ink-soft);
    transition: all 0.15s;
}

.btn-ghost:hover {
    border-color: var(--ink-soft);
    color: var(--ink);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.15s;
}

.btn-danger:hover {
    opacity: 0.85;
}

.btn-sm {
    padding: 5px 10px !important;
    font-size: 0.78rem !important;
}

/* MAIN */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* PAGE TRANSITIONS */
.page {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* HERO */
.hero {
    background: var(--ink);
    color: white;
    border-radius: var(--r-lg);
    padding: 60px 48px;
    margin-bottom: 48px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 3rem;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero h1 em {
    font-style: italic;
    color: #a8d5b8;
}

.hero p {
    color: #aaa;
    font-size: 1rem;
    margin-bottom: 28px;
}

.hero-visual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.hero-card {
    background: #2a2a2a;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #333;
}

.hero-card-label {
    font-size: 0.7rem;
    color: #666;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.hero-card-val {
    font-size: 1.4rem;
    font-weight: 600;
    color: #e8e8e8;
}

.hero-card-sub {
    font-size: 0.75rem;
    color: #777;
    margin-top: 2px;
}

/* FILTERS */
.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    align-items: center;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}

.search-wrap input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid var(--rule);
    border-radius: var(--r);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--white);
    outline: none;
    transition: border-color 0.15s;
}

.search-wrap input:focus {
    border-color: var(--accent);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-faint);
    font-size: 14px;
}

select {
    padding: 9px 32px 9px 12px;
    border: 1px solid var(--rule);
    border-radius: var(--r);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--white);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.15s;
}

select:focus {
    border-color: var(--accent);
}

/* PRODUCT GRID */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.shop-benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 18px 0 28px;
}

.shop-benefit {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r);
    padding: 14px;
    text-align: center;
}

.shop-benefit strong {
    display: block;
    font-size: .86rem;
    margin-top: 5px;
}

.shop-benefit span {
    color: var(--ink-soft);
    font-size: .72rem;
}

.product-card {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.product-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: linear-gradient(135deg, #f0ede8, #e8e4df);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--ink-faint);
}

.product-body {
    padding: 16px;
}

.product-cat {
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.product-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
    line-height: 1.3;
}

.product-desc {
    font-size: 0.8rem;
    color: var(--ink-soft);
    margin-bottom: 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
}

.product-stock {
    font-size: 0.72rem;
    color: var(--ink-faint);
}

.stock-low {
    color: var(--warning);
}

.stock-out {
    color: var(--danger);
}

.add-to-cart {
    background: var(--ink);
    color: white;
    border: none;
    cursor: pointer;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s;
    font-family: var(--font-body);
}

.add-to-cart:hover {
    background: var(--accent);
}

.add-to-cart:disabled {
    background: var(--rule);
    color: var(--ink-faint);
    cursor: not-allowed;
}

/* CART SIDEBAR */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.cart-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.cart-drawer {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 400px;
    max-width: 95vw;
    background: var(--white);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    transform: none;
}

.cart-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-header h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
}

.cart-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--ink-faint);
    padding: 4px;
}

.cart-close:hover {
    color: var(--ink);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.cart-empty {
    text-align: center;
    padding: 48px 0;
    color: var(--ink-faint);
}

.cart-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.cart-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--rule);
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.cart-item-price {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.cart-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.qty-btn {
    background: var(--surface);
    border: 1px solid var(--rule);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}

.qty-btn:hover {
    border-color: var(--ink-soft);
}

.qty-val {
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.remove-item {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink-faint);
    font-size: 0.75rem;
    margin-left: auto;
    align-self: flex-start;
    padding: 2px;
}

.remove-item:hover {
    color: var(--danger);
}

.cart-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--rule);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 14px;
}

.cart-total-label {
    color: var(--ink-soft);
    font-weight: 400;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--white);
    border-radius: var(--r-lg);
    padding: 32px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.open .modal {
    transform: scale(1);
}

.modal h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    margin-bottom: 20px;
}

.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--rule);
}

.modal-tab {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 10px 20px;
    color: var(--ink-faint);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.modal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* FORMS */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--rule);
    border-radius: var(--r);
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: var(--white);
    outline: none;
    transition: border-color 0.15s;
    color: var(--ink);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--r);
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.form-success {
    background: var(--accent-light);
    border: 1px solid #a8d5b8;
    color: var(--accent-hover);
    padding: 10px 14px;
    border-radius: var(--r);
    font-size: 0.85rem;
    margin-bottom: 14px;
}

/* TOAST */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--ink);
    color: white;
    padding: 12px 20px;
    border-radius: var(--r);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success {
    background: var(--accent);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* PRODUCT DETAIL */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.detail-img {
    aspect-ratio: 1;
    border-radius: var(--r-lg);
    background: linear-gradient(135deg, #f0ede8, #e8e4df);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: var(--ink-faint);
}

.product-gallery {
    min-width: 0;
}

.gallery-main {
    overflow: hidden;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--r-lg);
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.gallery-thumb {
    aspect-ratio: 1;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 9px;
    overflow: hidden;
    background: var(--white);
    cursor: pointer;
}

.gallery-thumb.active {
    border-color: var(--accent);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.detail-cat {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.detail-name {
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 12px;
}

.detail-price {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.detail-desc {
    color: var(--ink-soft);
    line-height: 1.7;
    margin-bottom: 24px;
}

.detail-stock {
    font-size: 0.8rem;
    margin-bottom: 20px;
    padding: 8px 12px;
    background: var(--surface);
    border-radius: 6px;
    display: inline-block;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.qty-control .qty-btn {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
}

.qty-control .qty-val {
    font-size: 1.1rem;
}

.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-body);
}

.back-btn:hover {
    text-decoration: underline;
}

/* ORDERS PAGE */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-card {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    padding: 20px;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 8px;
}

.order-id {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink-faint);
}

.order-date {
    font-size: 0.78rem;
    color: var(--ink-faint);
}

.order-status {
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-shipped {
    background: #d1fae5;
    color: #065f46;
}

.status-delivered {
    background: var(--accent-light);
    color: var(--accent-hover);
}

.status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.order-items-list {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin-bottom: 12px;
}

.order-item-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid var(--surface);
}

.order-total {
    font-weight: 600;
    font-size: 0.95rem;
    text-align: right;
}

/* CHECKOUT */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
    align-items: start;
}

.checkout-summary {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    padding: 24px;
}

.checkout-summary h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 0.875rem;
}

.summary-item:last-child {
    border: none;
}

.summary-total {
    font-weight: 600;
    font-size: 1rem;
}

.telegram-order-btn {
    display: flex;
    width: 100%;
    margin-top: 4px;
    padding: 14px 20px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: none;
    border-radius: 10px;
    background: #229ed9;
    color: white;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}

.telegram-order-btn:hover {
    background: #168ac1;
}

.telegram-order-btn:disabled {
    opacity: .65;
    cursor: wait;
}

.telegram-order-btn strong {
    white-space: nowrap;
}

.telegram-order-note {
    margin-top: 9px;
    color: var(--ink-faint);
    font-size: .74rem;
    line-height: 1.5;
    text-align: center;
}

.admin-order-card {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.admin-order-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 28px;
    margin: 16px 0;
}

.admin-order-label {
    color: var(--ink-faint);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.admin-order-value {
    margin-top: 3px;
    color: var(--ink);
    font-size: .88rem;
}

.admin-order-items {
    margin-top: 14px;
    border-top: 1px solid var(--rule);
}

.admin-order-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--surface);
    font-size: .85rem;
}

/* ADMIN */
.admin-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    align-items: start;
}

.admin-nav {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    padding: 12px;
}

.admin-nav-item {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-soft);
    padding: 10px 14px;
    border-radius: var(--r);
    text-align: left;
    transition: all 0.15s;
    display: block;
}

.admin-nav-item:hover {
    background: var(--surface);
    color: var(--ink);
}

.admin-nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
}

.admin-content {
    min-width: 0;
}

.admin-section-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    padding: 20px;
}

.stat-label {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.stat-val {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--ink);
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--ink-faint);
    margin-top: 4px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--rule);
}

.admin-table th {
    background: var(--surface);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--rule);
}

.admin-table td {
    padding: 12px 16px;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--rule);
}

.admin-table tr:last-child td {
    border: none;
}

.admin-table tr:hover td {
    background: var(--surface);
}

.admin-actions {
    display: flex;
    gap: 6px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* PRODUCT FORM */
.product-form {
    background: var(--white);
    border: 1px solid var(--rule);
    border-radius: var(--r-lg);
    padding: 24px;
}

.image-upload-note {
    font-size: .76rem;
    color: var(--ink-faint);
    margin-top: 6px;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 12px 0 16px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border: 1px solid var(--rule);
    border-radius: 9px;
    overflow: hidden;
    background: var(--surface);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-preview-item .cover-label {
    position: absolute;
    left: 5px;
    bottom: 5px;
    background: var(--accent);
    color: white;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: .62rem;
}

.image-preview-item .remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .72);
    color: white;
    cursor: pointer;
}

/* PAGE HEADERS */
.page-title {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 4px;
}

.page-sub {
    color: var(--ink-soft);
    font-size: 0.9rem;
    margin-bottom: 28px;
}

/* EMPTY STATES */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--ink-faint);
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 14px;
}

.empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.empty-desc {
    font-size: 0.875rem;
}

/* LOADER */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--rule);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* SECTION LABEL */
.section-label {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .hero {
        grid-template-columns: 1fr;
        padding: 32px 24px;
    }

    .hero-visual {
        display: none;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .product-detail {
        grid-template-columns: 1fr;
    }

    .checkout-grid {
        grid-template-columns: 1fr;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .header-inner {
        padding: 0 16px;
    }

    main {
        padding: 20px 16px;
    }

    .products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
    }

    .product-body {
        padding: 8px;
    }

    .product-cat {
        font-size: .52rem;
        margin-bottom: 3px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-name {
        font-size: .68rem;
        margin-bottom: 5px;
        min-height: 1.8em;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-desc,
    .product-stock {
        display: none;
    }

    .product-footer {
        display: block;
    }

    .product-price {
        font-size: .72rem;
        margin-bottom: 5px;
        white-space: nowrap;
    }

    .add-to-cart {
        width: 100%;
        padding: 5px 2px;
        font-size: .55rem;
    }

    .product-img {
        aspect-ratio: 1/1;
        font-size: 1.5rem;
    }

    .shop-benefits {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .shop-benefit {
        padding: 9px 4px;
    }

    .shop-benefit span {
        display: none;
    }

    .shop-benefit strong {
        font-size: .62rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    main {
        padding-left: 8px;
        padding-right: 8px;
    }

    .products-grid {
        gap: 5px;
    }

    .product-body {
        padding: 6px 4px;
    }

    .add-to-cart {
        font-size: .5rem;
    }
}

/* Mahsulot kartalarini bir xil tekislikda joylashtirish */
.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-footer {
    margin-top: auto;
}

/* Telefon va planshet ekranlari */
@media (max-width: 768px) {
    .product-name {
        min-height: 2.6em;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-footer {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        margin-top: auto;
    }

    .product-price {
        min-height: 1.2em;
    }

    .add-to-cart {
        margin-top: 5px;
    }
}


/* Barcha mahsulot rasmlarining balandligini tenglashtirish */
.product-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    flex: 0 0 auto;
    overflow: hidden;
}

.product-img img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* Telefon ekranida rasmlar kvadrat bo‘ladi */
@media (max-width: 480px) {
    .product-img {
        aspect-ratio: 1 / 1;
    }
}

/* Mahsulotning savatchaga uchish animatsiyasi */
.flying-product {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    will-change: left, top, width, height, transform, opacity;
}

#cart-btn.cart-pop {
    animation: cartPop 0.45s ease;
}

@keyframes cartPop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.22) rotate(-5deg);
    }

    70% {
        transform: scale(0.92) rotate(3deg);
    }

    100% {
        transform: scale(1) rotate(0);
    }
}

/* ============================================================
       COMPLETE MOBILE LAYOUT
       These rules intentionally come last so they override the
       earlier desktop and responsive declarations safely.
    ============================================================ */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
video {
    max-width: 100%;
}

button,
input,
select,
textarea {
    touch-action: manipulation;
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    header {
        position: sticky;
        top: 0;
    }

    .header-inner {
        width: 100%;
        height: auto;
        min-height: 58px;
        padding: 8px 10px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .logo {
        font-size: 1.22rem;
        line-height: 1;
        padding: 7px 2px;
        flex: 0 0 auto;
    }

    nav {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: flex-end;
        gap: 2px;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    nav::-webkit-scrollbar {
        display: none;
    }

    .nav-btn {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 7px 8px;
        gap: 3px;
        font-size: .72rem;
        white-space: nowrap;
    }

    #cart-btn {
        background: var(--ink);
        color: white;
    }

    .cart-badge {
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        font-size: .62rem;
    }

    main {
        width: 100%;
        padding: 12px 10px 30px;
    }

    .page {
        width: 100%;
        min-width: 0;
    }

    .hero {
        padding: 22px 16px;
        margin-bottom: 14px;
        border-radius: 12px;
    }

    .hero h1 {
        font-size: clamp(1.55rem, 7vw, 2rem);
        line-height: 1.12;
    }

    .hero p {
        font-size: .82rem;
        line-height: 1.5;
        margin-bottom: 16px;
    }

    .shop-benefits {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
        margin: 10px 0 16px;
    }

    .shop-benefit {
        min-width: 0;
        padding: 8px 3px;
    }

    .shop-benefit strong {
        font-size: .58rem;
        line-height: 1.25;
    }

    .shop-benefit span {
        display: none;
    }

    .filters {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 7px;
        margin-bottom: 14px;
    }

    .search-wrap {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .filters select {
        width: 100%;
        min-width: 0;
        padding: 9px 26px 9px 9px;
        font-size: .76rem;
    }

    .search-wrap input {
        min-height: 42px;
        font-size: 16px;
    }

    .products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        align-items: stretch;
        gap: 6px;
    }

    .product-card {
        min-width: 0;
        border-radius: 10px;
    }

    .product-img {
        aspect-ratio: 1 / 1;
        flex: 0 0 auto;
        font-size: 1.35rem;
    }

    .product-body {
        min-width: 0;
        padding: 6px 5px;
    }

    .product-cat {
        margin-bottom: 3px;
        font-size: .47rem;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .product-name {
        min-height: 2.7em;
        margin-bottom: 5px;
        font-size: .63rem;
        line-height: 1.35;
        word-break: break-word;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-desc,
    .product-stock {
        display: none;
    }

    .product-footer {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        margin-top: auto;
    }

    .product-price {
        min-height: 1.25em;
        margin-bottom: 4px;
        font-size: .68rem;
        line-height: 1.2;
        white-space: nowrap;
    }

    .add-to-cart {
        width: 100%;
        min-height: 25px;
        margin-top: 0;
        padding: 4px 1px;
        border-radius: 5px;
        font-size: .48rem;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
    }

    .product-detail {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .detail-img {
        width: 100%;
        max-height: 72vh;
    }

    .gallery-thumbs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .detail-name {
        font-size: 1.55rem;
        line-height: 1.2;
    }

    .detail-price {
        font-size: 1.35rem;
    }

    .checkout-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .product-form,
    .checkout-summary {
        padding: 15px;
        border-radius: 12px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
    }

    .telegram-order-btn {
        min-height: 50px;
        padding: 12px;
        font-size: .88rem;
    }

    .orders-list,
    .order-card {
        min-width: 0;
    }

    .order-card {
        padding: 14px;
    }

    .order-header {
        gap: 8px;
        align-items: flex-start;
    }

    .order-item-row,
    .admin-order-item {
        gap: 10px;
    }

    .order-item-row span:first-child,
    .admin-order-item span:first-child {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .cart-drawer {
        width: 100%;
        max-width: 100vw;
    }

    .cart-header {
        padding: 14px 16px;
    }

    .cart-items {
        padding: 12px;
    }

    .cart-footer {
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    }

    .cart-item {
        gap: 9px;
    }

    .cart-item-info {
        min-width: 0;
    }

    .modal {
        width: calc(100vw - 20px);
        max-width: 440px;
        max-height: calc(100vh - 20px);
        overflow-y: auto;
        padding: 18px;
    }

    .admin-layout {
        display: block;
        min-width: 0;
    }

    .admin-nav {
        display: flex;
        width: 100%;
        margin-bottom: 14px;
        padding: 6px;
        overflow-x: auto;
        border-radius: 10px;
        scrollbar-width: none;
    }

    .admin-nav::-webkit-scrollbar {
        display: none;
    }

    .admin-nav-item {
        flex: 0 0 auto;
        width: auto;
        padding: 8px 11px;
        white-space: nowrap;
    }

    .admin-content {
        width: 100%;
        min-width: 0;
        overflow-x: auto;
    }

    .admin-section-title {
        font-size: 1.3rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .stat-card {
        min-width: 0;
        padding: 13px;
    }

    .stat-val {
        font-size: 1.35rem;
    }

    .section-head {
        gap: 10px;
        align-items: flex-start;
    }

    .section-head .btn-accent {
        flex: 0 0 auto;
    }

    .admin-table {
        min-width: 680px;
    }

    .admin-order-card {
        padding: 14px;
    }

    .admin-order-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .toast-container {
        left: 10px;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .toast {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 420px) {
    .header-inner {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .logo {
        font-size: 1.05rem;
    }

    .nav-btn {
        padding: 7px 6px;
        font-size: .66rem;
    }

    main {
        padding-left: 6px;
        padding-right: 6px;
    }

    .products-grid {
        gap: 4px;
    }

    .product-body {
        padding: 5px 3px;
    }

    .product-name {
        font-size: .58rem;
    }

    .product-price {
        font-size: .62rem;
    }

    .add-to-cart {
        font-size: .43rem;
    }
}

@media (max-width: 340px) {
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .product-name {
        font-size: .72rem;
    }

    .product-price {
        font-size: .76rem;
    }

    .add-to-cart {
        min-height: 30px;
        font-size: .58rem;
    }
}

/* K-BEAUTY VISUAL THEME — all application features remain unchanged */
:root {
    --accent: #a8cf2d;
    --accent-light: #f1f8dc;
    --accent-hover: #8caf1c;
    --surface: #f7f7f3;
    --rule: #e7e8df;
    --r: 12px;
    --r-lg: 18px;
}

html {
    max-width: 100%;
    overflow-x: clip;
}

body {
    max-width: 100%;
    overflow-x: clip;
    background: #fff;
}

header {
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    z-index: 1000;
    background: var(--accent);
    border: 0;
    box-shadow: 0 4px 20px rgba(40, 55, 10, .10);
}

.header-inner {
    max-width: 1280px;
}

.logo {
    color: #fff;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.logo span {
    color: rgba(255, 255, 255, .65);
}

.nav-btn,
.nav-btn:hover,
.nav-btn.active {
    color: #fff;
}

.nav-btn:hover,
.nav-btn.active {
    background: rgba(255, 255, 255, .18);
}

#cart-btn {
    color: #172000;
    background: #fff;
    box-shadow: 0 4px 14px rgba(50, 70, 0, .13);
}

.cart-badge {
    background: #ff4d76;
}

main {
    max-width: 1280px;
}

.kbeauty-hero {
    min-height: 470px;
    position: relative;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    align-items: center;
    overflow: hidden;
    margin-bottom: 18px;
    padding: 58px 64px;
    border-radius: 0 0 28px 28px;
    color: #fff;
    background:
        radial-gradient(circle at 72% 25%, rgba(255, 255, 255, .22), transparent 24%),
        linear-gradient(125deg, #a8cf2d 0%, #7fae21 48%, #d9e96c 100%);
}

.kbeauty-hero::after {
    content: '';
    position: absolute;
    width: 340px;
    height: 340px;
    right: -100px;
    bottom: -170px;
    border: 55px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
}

.kbeauty-copy {
    position: relative;
    z-index: 2;
    max-width: 580px;
}

.kbeauty-kicker {
    display: inline-block;
    margin-bottom: 14px;
    font-family: var(--font-mono);
    font-size: .72rem;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.kbeauty-copy h1 {
    margin-bottom: 15px;
    font-family: var(--font-display);
    font-size: clamp(2.7rem, 5vw, 5rem);
    line-height: .98;
    font-weight: 400;
}

.kbeauty-copy p {
    max-width: 480px;
    margin-bottom: 24px;
    color: rgba(255, 255, 255, .88);
    font-size: .95rem;
}

.kbeauty-cta {
    min-height: 48px;
    padding: 0 25px;
    border: 1px solid rgba(255, 255, 255, .75);
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 255, 255, .10);
    font-weight: 600;
    cursor: pointer;
}

.kbeauty-visual {
    position: relative;
    z-index: 2;
    width: min(380px, 90%);
    aspect-ratio: 1;
    justify-self: center;
    padding: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), 0 30px 70px rgba(55, 75, 0, .20);
}

.kbeauty-visual img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
    background: #fff;
}

.kbeauty-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    font-size: 5rem;
}

.category-strip {
    display: flex;
    gap: 9px;
    padding: 4px 2px 18px;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-strip::-webkit-scrollbar {
    display: none;
}

.category-chip {
    flex: 0 0 auto;
    min-height: 39px;
    padding: 0 18px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: #fff;
    color: var(--ink-soft);
    cursor: pointer;
    font-family: var(--font-body);
}

.category-chip.active {
    color: #fff;
    border-color: var(--accent);
    background: var(--accent);
}

.collection-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin: 24px 0 18px;
}

.collection-heading span {
    color: var(--accent-hover);
    font-family: var(--font-mono);
    font-size: .72rem;
    letter-spacing: .15em;
}

.collection-heading h2 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 400;
}

.filters {
    padding: 12px;
    border: 1px solid var(--rule);
    border-radius: 16px;
    background: #fafbf7;
}

.product-card {
    border-color: #ebede5;
    border-radius: 18px;
    box-shadow: none;
    background: #fff;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: #dce9b4;
    box-shadow: 0 14px 34px rgba(62, 78, 20, .11);
}

.product-img {
    background: #f2f2ee;
}

.product-cat {
    color: #86aa20;
}

.product-price {
    color: #1a1a1a;
    font-weight: 700;
}

.add-to-cart,
.btn-accent {
    border-radius: 999px;
    background: #161b0d;
}

.add-to-cart:hover,
.btn-accent:hover {
    background: var(--accent-hover);
}

.shop-benefit {
    border: 0;
    border-radius: 16px;
    background: #f4f8e7;
}

.product-detail,
.checkout-summary,
.product-form,
.order-card,
.admin-order-card {
    border-radius: 20px;
}

.cart-drawer {
    box-shadow: -20px 0 55px rgba(20, 25, 10, .16);
}

@media (max-width: 768px) {
    .header-inner {
        flex-wrap: nowrap;
    }

    .logo {
        font-size: 1rem;
    }

    .kbeauty-hero {
        min-height: 360px;
        grid-template-columns: 1fr .65fr;
        padding: 34px 22px;
        border-radius: 0 0 20px 20px;
    }

    .kbeauty-copy h1 {
        font-size: clamp(2rem, 9vw, 3.4rem);
    }

    .kbeauty-copy p {
        font-size: .76rem;
    }

    .kbeauty-visual {
        width: min(230px, 100%);
        padding: 10px;
    }

    .category-strip {
        padding-bottom: 12px;
    }

    .category-chip {
        min-height: 35px;
        padding: 0 13px;
        font-size: .72rem;
    }
}

@media (max-width: 520px) {
    .kbeauty-hero {
        min-height: 405px;
        display: block;
        padding: 30px 20px 150px;
    }

    .kbeauty-copy h1 {
        max-width: 310px;
    }

    .kbeauty-copy p {
        max-width: 290px;
        margin-bottom: 16px;
    }

    .kbeauty-visual {
        position: absolute;
        right: 12px;
        bottom: -28px;
        width: 175px;
    }

    .kbeauty-cta {
        min-height: 42px;
        padding: 0 18px;
        font-size: .75rem;
    }

    .collection-heading {
        margin: 17px 0 12px;
    }

    .collection-heading h2 {
        font-size: 1.55rem;
    }
}

.search-wrap {
    max-width: 460px;
}

.search-wrap input {
    padding-right: 90px;
}

.search-submit-btn {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);

    height: 34px;
    padding: 0 14px;

    border: none;
    border-radius: 999px;

    background: var(--accent);
    color: white;

    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;

    cursor: pointer;
}

.search-submit-btn:hover {
    background: var(--accent-hover);
}


/* Narx va sana bo‘yicha saralash tugmalari */
.sort-chips {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.sort-chip {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 15px;

    border: 1px solid var(--rule);
    border-radius: 999px;

    background: var(--white);
    color: var(--ink-soft);

    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;

    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
}

.sort-chip:hover {
    border-color: var(--accent);
    color: var(--accent-hover);
}

.sort-chip.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

/* Katta ekranda qidiruv yonida */
@media (min-width: 769px) {
    .filters {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .search-wrap {
        flex: 1;
        max-width: none;
    }

    .sort-chips {
        flex: 0 0 auto;
    }
}

/* Telefon va planshetda qidiruvning pastida */
@media (max-width: 768px) {
    .filters {
        display: block;
    }

    .search-wrap {
        width: 100%;
        max-width: none;
    }

    .sort-chips {
        width: 100%;
        margin-top: 9px;

        overflow-x: auto;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sort-chips::-webkit-scrollbar {
        display: none;
    }

    .sort-chip {
        min-height: 36px;
        padding: 0 12px;
        font-size: 0.68rem;
    }
}


.gallery-main {
    position: relative;
}

.gallery-share-btn,
.gallery-arrow {
    position: absolute;
    z-index: 5;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.92);
    color: #24351f;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.13);
    cursor: pointer;

    transition:
        transform 0.15s,
        background 0.15s;
}

.gallery-share-btn:hover,
.gallery-arrow:hover {
    transform: scale(1.08);
    background: white;
}

.gallery-share-btn {
    top: 14px;
    right: 14px;
}

.gallery-arrow {
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
}

.gallery-arrow:hover {
    transform: translateY(-50%) scale(1.08);
}

.gallery-arrow.prev {
    left: 14px;
}

.gallery-arrow.next {
    right: 14px;
}

.gallery-counter {
    position: absolute;
    z-index: 4;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);

    padding: 5px 11px;
    border-radius: 999px;

    background: rgba(0, 0, 0, 0.62);
    color: white;

    font-size: 0.7rem;
    font-weight: 600;
}

.gallery-main img {
    transition: opacity 0.25s ease;
}

@media (max-width: 480px) {

    .gallery-share-btn,
    .gallery-arrow {
        width: 38px;
        height: 38px;
    }

    .gallery-share-btn {
        top: 10px;
        right: 10px;
    }

    .gallery-arrow.prev {
        left: 8px;
    }

    .gallery-arrow.next {
        right: 8px;
    }
}

/* Mahsulot nomi va ulashish tugmasi */
.product-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.product-title-row .detail-name {
    flex: 1;
    min-width: 0;
}

.product-share-btn {
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;

    border: 1px solid var(--rule);
    border-radius: 50%;

    background: var(--white);
    color: #24351f;

    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    cursor: pointer;

    transition:
        transform 0.15s,
        border-color 0.15s;
}

.product-share-btn:hover {
    transform: scale(1.07);
    border-color: var(--accent);
}

/* Mahsulot sahifasining pastki xarid paneli */
.product-detail {
    margin-bottom: 96px;
}

.product-bottom-actions.durim-purchase-bar {
    position: fixed;
    z-index: 900;

    left: 50%;
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: translateX(-50%);

    display: grid;
    grid-template-columns: minmax(150px, 0.85fr) minmax(0, 1.35fr);
    align-items: stretch;
    gap: 10px;

    width: min(720px, calc(100% - 20px));
    margin: 0;
    padding: 9px;

    border: 1px solid var(--rule);
    border-radius: 20px;

    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.16);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.durim-detail-qty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    width: 100%;
    min-width: 0;
    height: 54px;
    margin: 0;
    padding: 5px;

    background: #f2f3f7;
    border-radius: 14px;
}

.durim-detail-qty .qty-btn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 11px;
    background: var(--white);
}

.durim-detail-qty .qty-val {
    flex: 1 1 auto;
    min-width: 20px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
}

.product-back-action,
.product-cart-action {
    min-height: 54px;
    padding: 10px 14px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.product-back-action {
    border: 1px solid var(--rule);
    background: var(--white);
    color: var(--ink);
}

.product-bottom-actions.durim-purchase-bar .product-cart-action {
    width: 100%;
    min-width: 0;
    margin: 0;
    border: 0;
    background: var(--ink);
    color: #fff;
}

.product-cart-action:hover {
    background: var(--accent-hover);
}

.product-cart-action:disabled {
    background: var(--rule);
    color: var(--ink-faint);
    cursor: not-allowed;
}

.product-bottom-actions.durim-purchase-bar .product-cart-action:disabled {
    grid-column: 1 / -1;
}

/* Telefon va Telegram Mini App: panel ekranning chap/o‘ng/past chetiga to‘liq yopishadi. */
@media (max-width: 768px) {
    .product-title-row {
        gap: 8px;
    }

    .product-share-btn {
        width: 40px;
        height: 40px;
    }

    .product-detail {
        margin-bottom: 92px;
    }

    .product-bottom-actions.durim-purchase-bar {
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;

        width: 100%;
        max-width: none;
        gap: 10px;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));

        grid-template-columns: minmax(126px, 0.9fr) minmax(0, 1.35fr);

        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        border-radius: 0;
    }
}

@media (max-width: 380px) {
    .product-bottom-actions.durim-purchase-bar {
        gap: 8px;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        grid-template-columns: minmax(112px, 0.9fr) minmax(0, 1.1fr);
    }

    .durim-detail-qty,
    .product-bottom-actions.durim-purchase-bar .product-cart-action {
        min-height: 52px;
        height: 52px;
    }

    .durim-detail-qty .qty-btn {
        flex-basis: 42px;
        width: 42px;
        height: 42px;
    }

    .product-cart-action {
        font-size: 0.74rem;
    }
}


@media (max-width: 480px) {
    .product-gallery {
        width: 100%;
    }

    .detail-img {
        width: 100%;
        max-height: 52vh;
        aspect-ratio: 1 / 1;
    }

    .gallery-main img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        background: #f4f7f5;
    }

    .product-detail {
        gap: 14px;
    }

    .detail-name {
        font-size: 1.45rem;
    }

    .detail-price {
        margin-top: 5px;
        font-size: 1.3rem;
    }

    .detail-desc {
        margin-top: 12px;
    }

    .qty-control {
        margin-top: 14px !important;
    }
}

/* Savat oynasi pastki mahsulot tugmalaridan yuqorida turadi */
.cart-overlay {
    z-index: 1200 !important;
}

.cart-drawer {
    z-index: 1201 !important;
}

/* Savat ochilganda mahsulotning pastki tugmalarini yashirish */
.cart-overlay.open~main .product-bottom-actions {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

@media (max-width: 768px) {
    .cart-overlay.open~main .product-bottom-actions.durim-purchase-bar {
        transform: translateY(20px);
    }
}

/* Pastki tugmalarning ochilib-yopilishi */
.product-bottom-actions {
    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease;
}

/* Bildirishnoma hamma narsadan yuqorida chiqadi */
.toast-container {
    z-index: 3000 !important;
}

.toast {
    position: relative;
    z-index: 3001;
}

/* Savatchaga uchadigan rasm eng yuqorida qoladi */
.flying-product {
    z-index: 9999 !important;
}