:root {
    --primary: #1e3a8a; --primary-accent: #2563eb; --bg-app: #f8fafc; --bg-surface: #ffffff;
    --text-main: #1e293b; --text-muted: #64748b; --border: #e2e8f0; --success: #10b981; --danger: #ef4444;
    --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, sans-serif; background-color: var(--bg-app); color: var(--text-main); height: 100vh; overflow: hidden; }
.app-layout { display: grid; grid-template-columns: 260px 1fr 340px; height: 100vh; }
.sidebar { background: var(--gradient-primary); color: white; padding: 2rem 1.5rem; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 3rem; }
.brand-logo { width: 45px; height: 45px; object-fit: contain; border-radius: 50%; background: white; padding: 4px; }
.brand-text { font-size: 1.8rem; font-weight: 900; letter-spacing: 2px; }
.nav-links { list-style: none; }
.nav-links li { padding: 1rem; margin-bottom: 0.5rem; border-radius: 8px; cursor: pointer; transition: 0.3s; color: rgba(255,255,255,0.8); }
.nav-links li:hover, .nav-links li.active { background: rgba(255,255,255,0.2); color: white; }
.main-content { padding: 2rem; overflow-y: auto; }
.content-header { margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 2px solid var(--border); }
.content-header h1 { font-size: 1.8rem; color: var(--primary); }
.subtitle { color: var(--text-muted); margin-top: 0.5rem; }
.cart-panel { background: var(--bg-surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.cart-header { padding: 1.5rem; border-bottom: 2px solid var(--border); background: #f0f9ff; }
.cart-body { flex: 1; overflow-y: auto; padding: 1.5rem; }
.cart-footer { padding: 1.5rem; border-top: 2px solid var(--border); background: #f8fafc; }
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.5rem; transition: 0.3s; }
.card:hover { border-color: var(--primary-accent); box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1); transform: translateY(-2px); }
.card h3 { color: var(--primary); margin-bottom: 0.5rem; }
.status { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; margin-top: 0.5rem; }
.status.open { background: #dcfce7; color: #166534; }
.status.closed { background: #fee2e2; color: #991b1b; }
.table-container { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 1rem; background: #eff6ff; color: var(--primary); font-weight: 700; border-bottom: 2px solid var(--primary-accent); }
.data-table td { padding: 1rem; border-bottom: 1px solid var(--border); }
.btn-primary { width: 100%; background: var(--gradient-primary); color: white; border: none; padding: 0.9rem; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.3s; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { background: var(--text-muted); cursor: not-allowed; }
.btn-outline { background: transparent; border: 2px solid var(--primary-accent); padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; color: var(--primary-accent); font-weight: 600; margin-right: 1rem; }
.qty-control { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }
.qty-btn { width: 32px; height: 32px; border: 1px solid var(--border); background: white; border-radius: 6px; cursor: pointer; font-weight: bold; }
.qty-btn:hover { background: var(--primary-accent); color: white; border-color: var(--primary-accent); }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.cart-item-name { font-weight: 600; }
.cart-item-price { font-size: 0.9rem; color: var(--text-muted); }
.total-row { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; color: var(--primary); }
.empty-state { text-align: center; color: var(--text-muted); margin-top: 2rem; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(30, 58, 138, 0.6); backdrop-filter: blur(4px); z-index: 1000; justify-content: center; align-items: center; }
.modal.active { display: flex; }
.modal-content { background: white; border-radius: 16px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: #f0f9ff; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1.5rem; border-top: 1px solid var(--border); background: #f8fafc; }
.order-summary { background: #f0f9ff; padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; }
.summary-row { display: flex; justify-content: space-between; padding: 0.5rem 0; }
.summary-row.total { border-top: 2px solid var(--primary-accent); margin-top: 0.5rem; padding-top: 0.5rem; font-size: 1.1rem; color: var(--primary); }
.payment-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.pay-method { background: white; border: 2px solid var(--border); border-radius: 8px; padding: 1rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; transition: 0.3s; }
.pay-method:hover { border-color: var(--primary-accent); }
.pay-method.selected { border-color: var(--primary-accent); background: #eff6ff; }
.method-icon { font-size: 1.5rem; }
.modal-content.success { text-align: center; padding: 2rem; }
.success-icon { font-size: 4rem; margin-bottom: 1rem; }
.success-sub { color: var(--text-muted); margin: 0.5rem 0 1.5rem 0; }
.status-badge { padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; }
.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge.paid { background: #dcfce7; color: #166534; }
.btn-pay { background: var(--success); color: white; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.btn-delete { background: var(--danger); color: white; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; }

/* =========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ========================================= */

@media (max-width: 1024px) {
    .app-layout { 
        grid-template-columns: 1fr;
    }
    .sidebar { 
        flex-direction: row; 
        justify-content: space-between; 
        align-items: center; 
        padding: 1rem;
        position: sticky;
        top: 0;
        z-index: 100;
    }
    .brand { margin-bottom: 0; }
    .brand-logo { width: 35px; height: 35px; }
    .brand-text { font-size: 1.4rem; }
    .nav-links { display: flex; gap: 1rem; margin: 0; }
    .nav-links li { margin-bottom: 0; padding: 0.5rem 1rem; font-size: 0.9rem; }
    .cart-panel { display: none; }
}

@media (max-width: 768px) {
    .main-content { padding: 1rem; }
    .content-header h1 { font-size: 1.4rem; }
    .cards-grid { grid-template-columns: 1fr; gap: 1rem; }
    .table-container { overflow-x: auto; border-radius: 8px; }
    .data-table { min-width: 600px; }
    
    .mobile-cart-fab {
        display: flex !important;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
        color: white;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
        z-index: 999;
        cursor: pointer;
    }
    
    .mobile-cart-badge {
        position: absolute;
        top: -2px;
        right: -2px;
        background: #ef4444;
        color: white;
        font-size: 0.75rem;
        font-weight: bold;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid white;
    }

    .cart-panel.mobile-active {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        background: #f8fafc;
    }
    
    .mobile-cart-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.5rem;
        background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
        color: white;
    }
    
    .mobile-cart-close {
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }
}

.mobile-cart-fab { display: none; }
.mobile-cart-header { display: none; }
