/* ==================== ГЛОБАЛЬНЫЕ ПЕРЕМЕННЫЕ ==================== */
        :root {
            --bg-primary: #e0e5ec;
            --card-bg: #e0e5ec;
            --shadow-light: 12px 12px 24px rgba(112, 144, 192, 0.5), -12px -12px 24px rgba(255, 255, 255, 0.8);
            --shadow-hover: 12px 12px 28px rgba(112, 144, 192, 0.55), -12px -12px 28px rgba(255, 255, 255, 0.85);
            --shadow-inset: inset 2px 2px 5px rgba(112,144,192,0.2), inset -3px -3px 7px rgba(255,255,255,0.7);
            --accent: #10b981;
            --accent-hover: #0ea271;
            --text-primary: #374151;
            --text-secondary: #64748b;
            --danger: #ef4444;
            --danger-hover: #dc2626;
        }

        [data-theme="dark"] {
            --bg-primary: #1f2937;
            --card-bg: #1f2937;
            --shadow-light: 12px 12px 24px rgba(0, 0, 0, 0.6), -12px -12px 24px rgba(75, 85, 99, 0.3);
            --shadow-hover: 12px 12px 28px rgba(0, 0, 0, 0.7), -12px -12px 28px rgba(75, 85, 99, 0.4);
            --shadow-inset: inset 2px 2px 5px rgba(0,0,0,0.4), inset -2px -2px 5px rgba(75,85,99,0.2);
            --accent: #34d399;
            --accent-hover: #6ee7b7;
            --text-primary: #f1f5f9;
            --text-secondary: #94a3b8;
            --danger: #f87171;
            --danger-hover: #ef4444;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            line-height: 1.6;
            padding: 20px 12px 95px 12px;
            min-height: 100vh;
            transition: all 0.4s ease;
        }

        .container {
            max-width: 1480px;
            margin: 0 auto;
        }

        /* ==================== ШАПКА ==================== */
        h1 {
            text-align: center;
            font-size: 2.2rem;
            margin-bottom: 8px;
            font-weight: 700;
            background: linear-gradient(90deg, #10b981, #34d399);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .subtitle {
            text-align: center;
            font-size: 1rem;
            color: var(--text-secondary);
            margin-bottom: 30px;
        }

        .header-controls {
            display: flex;
            justify-content: flex-end;
            margin-bottom: 12px;
        }

        .theme-toggle {
            padding: 8px 14px;
            background: var(--card-bg);
            border: none;
            border-radius: 50px;
            font-size: 1.3rem;
            cursor: pointer;
            box-shadow: var(--shadow-light);
            transition: 0.2s;
        }

        /* ==================== ПАНЕЛЬ УПРАВЛЕНИЯ ==================== */
        .controls {
            display: block;
            margin-bottom: 25px;
        }

        .tabs {
            display: flex;
            background: var(--card-bg);
            border-radius: 22px;
            padding: 5px;
            box-shadow: var(--shadow-light);
            flex-wrap: wrap;
            flex: 1;
            min-width: 260px;
            margin-bottom: 15px;
        }

        .tab-btn {
            padding: 10px 16px;
            border: none;
            background: transparent;
            border-radius: 16px;
            font-weight: 600;
            font-size: 0.9rem;
            color: var(--text-primary);
            cursor: pointer;
            flex: none;
            text-align: center;
            transition: 0.2s;
            padding: 8px 14px;
            white-space: nowrap;
            display: flex;
            align-items: center;
        }

        .tab-btn.active {
            background: var(--accent);
            color: white;
        }

        .search-box {
            flex: 1;
            min-width: 260px;
        }

        #searchInput {
            width: 100%;
            padding: 12px 20px;
            border: none;
            border-radius: 20px;
            background: var(--card-bg);
            box-shadow: var(--shadow-light);
            font-size: 1rem;
            color: var(--text-primary);
        }

        /* ==================== КАРТОЧКИ ТОВАРОВ ==================== */
        table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
        }

        thead {
            display: none;
        }

        tbody tr {
            display: block;
            background: var(--card-bg);
            box-shadow: var(--shadow-light);
            border-radius: 24px;
            transition: all 0.3s ease;
            padding: 16px 20px;
            margin-bottom: 18px;
        }

        tbody tr:last-child {
            margin-bottom: 0;
        }

        tbody tr:hover {
            transform: translateY(-4px);
            box-shadow: var(--shadow-hover);
        }

        tbody tr td {
            display: block;
            padding: 0;
        }

        /* ГЛАВНОЕ: на десктопе всё в одну строку */
        .product-layout {
            display: flex;
            gap: 20px;
            align-items: center;
            flex-wrap: wrap;
        }

        .product-photo {
            flex-shrink: 0;
            width: 100px;
            height: 100px;
            border-radius: 18px;
            overflow: hidden;
            box-shadow: var(--shadow-light);
        }

        .product-photo img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .product-info-center {
            flex: 2;
            min-width: 180px;
            text-align: left;
        }

        .product-title {
            font-size: 1.2rem;
            font-weight: 800;
            margin-bottom: 6px;
            color: var(--text-primary);
        }

        .product-desc {
            font-size: 0.85rem;
            color: var(--text-secondary);
            line-height: 1.4;
            text-align: left;
        }

        /* ЦЕНА */
        .price-value {
            font-size: 1.4rem;
            font-weight: 800;
            color: var(--accent);
            letter-spacing: -0.5px;
            white-space: nowrap;
            flex-shrink: 0;
            min-width: 110px;
            text-align: right;
        }

        /* Группа кнопок + и - */
        .qty-group {
            display: inline-flex;
            align-items: center;
            background: var(--bg-primary);
            border-radius: 40px;
            padding: 3px 10px;
            gap: 12px;
            box-shadow: var(--shadow-inset);
            flex-shrink: 0;
        }

        .qty-btn {
            width: 32px;
            height: 32px;
            border: none;
            background: transparent;
            font-size: 1.4rem;
            font-weight: 700;
            cursor: pointer;
            border-radius: 50%;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: var(--text-primary);
            transition: 0.2s;
        }

        .qty-btn:hover {
            background: rgba(16, 185, 129, 0.2);
            color: var(--accent);
        }

        .qty-display {
            font-weight: 700;
            font-size: 1.1rem;
            min-width: 28px;
            text-align: center;
        }

        /* КНОПКА В КОРЗИНУ */
        .buy-btn {
            background: var(--accent);
            color: white;
            border: none;
            padding: 8px 18px;
            border-radius: 40px;
            font-weight: 700;
            font-size: 0.85rem;
            cursor: pointer;
            box-shadow: var(--shadow-light);
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            white-space: nowrap;
            flex-shrink: 0;
        }

        .buy-btn:hover {
            transform: translateY(-2px);
            background: var(--accent-hover);
        }

        /* ДЕСКТОП: всё в одну строку */
        @media (min-width: 1024px) {
            .product-layout {
                display: grid;
                grid-template-columns: auto 1fr auto auto auto;
                gap: 20px;
                align-items: center;
            }
            
            .product-photo {
                width: 100px;
                height: 100px;
            }
            
            .product-info-center {
                min-width: 200px;
            }
            
            .price-value {
                text-align: right;
                min-width: 120px;
            }
        }

        /* Планшеты (между 769px и 1023px) */
        @media (min-width: 769px) and (max-width: 1023px) {
            .product-layout {
                display: flex;
                flex-wrap: wrap;
                justify-content: space-between;
            }
            
            .product-info-center {
                flex: 2;
                min-width: 200px;
            }
            
            .price-value {
                text-align: right;
                min-width: 110px;
            }
            
            .qty-group, .buy-btn {
                margin-left: auto;
            }
        }

        /* Мобильная версия */
        @media (max-width: 768px) {
            .product-layout {
                flex-direction: column;
                align-items: center;
                gap: 14px;
            }
            
            .product-photo {
                width: 100%;
                max-width: 200px;
                height: auto;
            }
            
            .product-info-center {
                width: 100%;
            }

            .product-title {
                text-align: center;
                line-height: 1.1;
            }
            
            .product-desc {
                text-align: left;
            }
            
            .price-value {
                text-align: center;
                white-space: normal;
            }
            
            .qty-group {
                justify-content: center;
            }
            
            .buy-btn {
                justify-content: center;
            }
        }

        /* ==================== МОДАЛЬНОЕ ОКНО КОРЗИНЫ ==================== */
        #cartModal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.75);
            backdrop-filter: blur(4px);
            z-index: 200;
            align-items: center;
            justify-content: center;
        }

        .cart-modal-content {
            background: var(--card-bg);
            color: var(--text-primary);
            border-radius: 28px;
            width: 92%;
            max-width: 600px;
            padding: 20px;
            max-height: 85vh;
            overflow: auto;
            box-shadow: var(--shadow-light);
        }

        .cart-modal-content h2 {
            font-size: 1.5rem;
            margin-bottom: 16px;
            border-bottom: 2px solid var(--accent);
            padding-bottom: 10px;
        }

        .cart-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 0;
            border-bottom: 1px solid rgba(128, 128, 128, 0.2);
            gap: 10px;
            flex-wrap: wrap;
        }

        .cart-item-info {
            flex: 2;
            min-width: 140px;
        }

        .cart-item-name {
            font-weight: 700;
            font-size: 0.95rem;
        }

        .cart-item-price {
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin-top: 3px;
        }

        .cart-item-actions {
            display: flex;
            align-items: center;
            gap: 10px;
            flex-wrap: wrap;
            justify-content: flex-end;
            flex: 2;
        }

        .cart-qty-group {
            display: inline-flex;
            align-items: center;
            background: var(--bg-primary);
            border-radius: 30px;
            padding: 3px 8px;
            gap: 10px;
            box-shadow: var(--shadow-inset);
        }

        .cart-qty-btn {
            width: 28px;
            height: 28px;
            border: none;
            background: transparent;
            font-size: 1.2rem;
            font-weight: 700;
            cursor: pointer;
            border-radius: 50%;
            color: var(--text-primary);
            transition: 0.2s;
        }

        .cart-qty-btn:hover {
            background: rgba(16, 185, 129, 0.2);
            color: var(--accent);
        }

        .cart-qty-display {
            font-weight: 700;
            min-width: 24px;
            text-align: center;
            font-size: 0.9rem;
        }

        .cart-item-total {
            font-weight: 700;
            min-width: 85px;
            text-align: right;
            color: var(--accent);
            font-size: 0.9rem;
        }

        .cart-remove-btn {
            background: transparent;
            border: none;
            font-size: 1.2rem;
            cursor: pointer;
            color: var(--danger);
            transition: 0.2s;
            padding: 4px;
            border-radius: 50%;
        }

        .cart-remove-btn:hover {
            background: rgba(239, 68, 68, 0.1);
            transform: scale(1.1);
        }

        .cart-summary-line {
            text-align: right;
            margin-bottom: 8px;
            color: var(--text-secondary);
            font-size: 0.85rem;
        }

        .cart-summary-line strong {
            color: var(--accent);
            font-size: 1rem;
        }

        .cart-total {
            font-size: 1.3rem;
            font-weight: 800;
            text-align: right;
            margin: 12px 0 15px;
            padding-top: 12px;
            border-top: 2px solid var(--accent);
        }

        .cart-total span {
            color: var(--accent);
            font-size: 1.5rem;
        }

        .modal-btn {
            width: 100%;
            padding: 12px;
            border: none;
            border-radius: 40px;
            font-weight: 700;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.2s;
            margin-bottom: 8px;
            box-shadow: var(--shadow-light);
        }

        .modal-btn:hover {
            transform: translateY(-2px);
        }

        .modal-btn-primary {
            background: var(--accent);
            color: white;
        }

        .modal-btn-danger {
            background: var(--danger);
            color: white;
        }

        .modal-btn-secondary {
            background: var(--text-secondary);
            color: white;
        }

        /* ==================== НИЖНЕЕ МЕНЮ ==================== */
        .bottom-menu {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: var(--card-bg);
            box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.15);
            display: flex;
            justify-content: space-around;
            padding: 6px 8px 8px;
            z-index: 150;
            border-top: 1px solid rgba(255, 255, 255, 0.7);
        }

        .menu-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-primary);
            text-decoration: none;
            font-size: 0.75rem;
            font-weight: 600;
            padding: 4px 8px;
            border-radius: 12px;
            position: relative;
            transition: all 0.2s;
        }

        .menu-item span {
            font-size: 1.3rem;
            margin-bottom: 2px;
        }

        .menu-item:hover {
            background: rgba(16, 185, 129, 0.15);
            color: var(--accent);
        }

        .cart-badge {
            position: absolute;
            top: 1px;
            right: 3px;
            background: linear-gradient(135deg, #ef4444, #dc2626);
            color: white;
            font-size: 0.65rem;
            font-weight: 800;
            min-width: 18px;
            height: 18px;
            border-radius: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 5px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
            border: 1.5px solid var(--card-bg);
            font-family: monospace;
            letter-spacing: 0px;
        }

        /* Если чисел много (2 цифры) — делаем чуть шире */
        .cart-badge[data-count="2"] {
            min-width: 20px;
        }

        /* Анимация при появлении */
        @keyframes badgePop {
            0% {
                transform: scale(0.5);
                opacity: 0;
            }
            80% {
                transform: scale(1.2);
            }
            100% {
                transform: scale(1);
                opacity: 1;
            }
        }

        .cart-badge {
            animation: badgePop 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
        }

        @media (max-width: 768px) {
            .cart-badge {
                padding: 10px;
                top: 3px;
                right: 3px;
                min-width: 16px;
                height: 18px;
                font-size: 0.6rem;
                border-width: 1.5px;
            }
        }
        
        /* Пока отключаю отключение нижнего меню на десктоп
        @media (min-width: 769px) {
            .bottom-menu {
                display: none;
            }
        } */

        .notification {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--accent);
            color: white;
            padding: 15px 20px;
            border-radius: 20px;
            font-weight: 600;
            box-shadow: var(--shadow-light);
            z-index: 300;
            text-align: center;
            max-width: 90vw;
            word-break: break-word;
            white-space: normal;
            font-size: 1.1rem;
            line-height: 1.4;
            animation: slideDown 0.3s ease;
        }

        @media (max-width: 480px) {
            .notification {
                padding: 10px 16px;
                font-size: 1rem;
                max-width: 85vw;
                min-width: 80vw;
            }
        }

        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateX(-50%) translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateX(-50%) translateY(0);
            }
        }