/* ==========================================
   Modern Wine Inventory - Styles
   Mobile-First Design for iPhone
   ========================================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --wine-red: #722F37;
    --wine-red-dark: #5a252c;
    --wine-red-light: rgba(114, 47, 55, 0.08);
    --gold: #D4AF37;
    --dark-wine: #2C2416;
    --white: #FFFFFF;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --shadow-wine: 0 4px 14px rgba(114, 47, 55, 0.15);
    
    /* Glass morphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(12px);
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow: hidden;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    letter-spacing: -0.011em;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ==========================================
   Header
   ========================================== */
.header {
    background: linear-gradient(135deg, var(--wine-red) 0%, var(--wine-red-dark) 100%);
    color: var(--white);
    padding: var(--spacing-md) 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: saturate(180%) blur(5px);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.header-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    min-height: 44px; /* iOS touch target */
    white-space: nowrap;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--white);
    color: var(--wine-red);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.btn-icon {
    font-size: 20px;
    line-height: 1;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    min-height: 36px;
}

/* ==========================================
   Search Bar
   ========================================== */
.search-container {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--glass-blur);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 68px;
    z-index: 90;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: var(--spacing-md);
    font-size: 18px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 15px;
    transition: all var(--transition-base);
    background: var(--gray-50);
}

.search-input:focus {
    outline: none;
    border-color: var(--wine-red);
    box-shadow: 0 0 0 4px rgba(114, 47, 55, 0.08);
    background: var(--white);
}

/* ==========================================
   Main Content
   ========================================== */


/* ==========================================
   Wine Grid
   ========================================== */
.wine-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
}

@media (min-width: 640px) {
    .wine-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .wine-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================
   Wine Card
   ========================================== */
.wine-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
    border: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
}

.wine-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Priority sell card — internal staff indicator */
.wine-card.wine-card-priority {
    border: 2px solid #EF4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

.wine-card.wine-card-priority:hover {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.35);
}

.wine-priority-badge {
    position: absolute;
    top: 42px;
    left: var(--spacing-sm);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    letter-spacing: 0.5px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wine-card:active {
    transform: scale(0.98);
}

.wine-image-container {
    position: relative;
    width: 100%;
    padding-top: 75%; /* 4:3 Aspect Ratio */
    background: var(--gray-100);
    overflow: hidden;
}

.wine-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wine-image-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    opacity: 0.3;
}

/* Zoom Button on Wine Image */
.wine-zoom-btn {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity var(--transition-base), background var(--transition-base);
    z-index: 5;
}

.wine-zoom-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.75);
}

/* Image Zoom Overlay */
.image-zoom-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.image-zoom-overlay.active {
    display: flex;
}

.image-zoom-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.image-zoom-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-base);
    z-index: 10001;
}

.image-zoom-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.wine-badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    color: var(--white);
}

.badge-low {
    background: var(--error);
    animation: pulse 2s infinite;
}

.badge-medium {
    background: var(--warning);
}

.badge-high {
    background: var(--success);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.wine-content {
    padding: var(--spacing-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wine-header {
    margin-bottom: var(--spacing-sm);
}

.wine-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-xs);
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.wine-vintage {
    display: inline-block;
    font-size: 13px;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.wine-quantity {
    font-size: 24px;
    font-weight: 700;
    color: var(--wine-red);
    margin: var(--spacing-sm) 0;
}

.wine-notes {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wine-staff-notes {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: var(--spacing-md);
    font-size: 13px;
    line-height: 1.4;
}

.wine-staff-notes p {
    color: #92400e;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.staff-notes-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b45309;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.staff-notes-label i {
    font-size: 10px;
}

.wine-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--spacing-md);
}

.wine-info-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--gray-700);
    background: var(--gray-50);
    padding: 5px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    font-weight: 500;
    border: 1px solid var(--gray-100);
}

.wine-info-item i {
    font-size: 11px;
    opacity: 0.8;
}

.wine-info-item.wine-price {
    background: var(--wine-red);
    color: white;
    font-weight: 600;
}

.wine-info-item.wine-by-glass {
    background: #10b981;
    color: white;
    font-weight: 500;
}

.wine-info-item.wine-beer {
    background: #F59E0B;
    color: white;
    font-weight: 500;
}

.wine-info-item.wine-priority-sell {
    background: #EF4444;
    color: white;
    font-weight: 600;
    animation: priority-pulse 2s ease-in-out infinite;
}

@keyframes priority-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.priority-sell-label {
    color: #EF4444;
    font-weight: 500;
}

.wine-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: auto;
    padding-top: var(--spacing-sm);
}

.wine-actions .btn {
    flex: 1;
}

/* ==========================================
   Bulk Selection & Delete
   ========================================== */
.btn-danger {
    background: #dc2626;
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-danger:disabled {
    background: #fca5a5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.bulk-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    border: 1.5px solid #fecaca;
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    margin-bottom: var(--spacing-md);
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bulk-toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.bulk-toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.bulk-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.bulk-select-all input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #dc2626;
    cursor: pointer;
}

.selected-count {
    font-size: 13px;
    font-weight: 600;
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

/* Wine card in selection mode */
.wine-card.selectable {
    cursor: pointer;
    position: relative;
}

.wine-card.selectable:hover {
    border-color: #fca5a5;
}

.wine-card.selectable.selected {
    border-color: #dc2626;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.2), var(--shadow);
}

.wine-card .wine-select-checkbox {
    display: none;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    width: 22px;
    height: 22px;
    accent-color: #dc2626;
    cursor: pointer;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.wine-card.selectable .wine-select-checkbox {
    display: block;
}

/* Delete button in edit modal */
#deleteWineBtn {
    margin-right: auto;
}

@media (max-width: 768px) {
    .bulk-toolbar {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: stretch;
    }
    
    .bulk-toolbar-left,
    .bulk-toolbar-right {
        justify-content: center;
    }
}

/* ==========================================
   Empty State
   ========================================== */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
}

.empty-icon {
    font-size: 80px;
    margin-bottom: var(--spacing-md);
    opacity: 0.3;
}

.empty-state h2 {
    font-size: 24px;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.empty-state p {
    color: var(--gray-600);
    margin-bottom: var(--spacing-lg);
}

/* ==========================================
   Modal
   ========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    padding: var(--spacing-md);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--gray-100);
}

@keyframes modalSlideUp {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-100);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -0.02em;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.modal-actions .btn {
    flex: 1;
}

/* ==========================================
   Forms
   ========================================== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--spacing-sm);
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-family: var(--font-sans);
    transition: all var(--transition-base);
    background: var(--white);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--wine-red);
    box-shadow: 0 0 0 4px rgba(114, 47, 55, 0.08);
}

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

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-700);
    padding: var(--spacing-sm);
    margin: calc(var(--spacing-sm) * -1);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    position: relative;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    cursor: pointer;
    touch-action: manipulation;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid var(--gray-600);  /* Bordo più scuro per visibilità su iPhone */
    border-radius: 4px;
    background: white;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--wine-red);
    border-color: var(--wine-red);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    font-weight: bold;
}

@media (max-width: 768px) {
    .checkbox-label input[type="checkbox"] {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }
    
    .checkbox-label input[type="checkbox"]:checked::after {
        font-size: 20px;
    }
}

/* ==========================================
   Image Upload
   ========================================== */
.image-upload-container {
    margin-bottom: var(--spacing-md);
}

.image-input {
    display: none;
}

.image-upload-label {
    display: block;
    cursor: pointer;
}

.image-preview {
    width: 100%;
    height: 200px;
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    transition: all var(--transition-base);
    overflow: hidden;
}

.image-preview:hover {
    border-color: var(--wine-red);
    background: var(--wine-red-light);
}

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

.upload-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-sm);
}

.upload-text {
    color: var(--gray-600);
    font-size: 14px;
}

/* ==========================================
   Image Cropper Modal
   ========================================== */
.crop-modal {
    max-width: 600px;
    width: 95vw;
    padding-bottom: var(--spacing-lg);
}

.crop-container {
    width: 100%;
    max-height: 55vh;
    overflow: hidden;
    background: var(--gray-900);
    margin: 0 0 var(--spacing-md) 0;
}

.crop-modal .modal-actions {
    padding: 0 var(--spacing-lg);
}

.crop-container img {
    display: block;
    max-width: 100%;
}

.crop-toolbar {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px var(--spacing-lg);
    flex-wrap: wrap;
}

.crop-tool-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-700);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.crop-tool-btn:hover {
    background: var(--wine-red);
    color: var(--white);
    border-color: var(--wine-red);
}

.crop-tool-btn:active {
    transform: scale(0.92);
}

/* Cropper.js overrides for consistent look */
.cropper-view-box,
.cropper-face {
    border-radius: 0;
}

.cropper-view-box {
    outline: 2px solid var(--wine-red);
    outline-color: rgba(114, 47, 55, 0.75);
}

.cropper-point {
    background-color: var(--wine-red);
    width: 8px !important;
    height: 8px !important;
    opacity: 1;
}

.cropper-line {
    background-color: var(--wine-red);
    opacity: 0.4;
}

@media (max-width: 480px) {
    .crop-modal {
        width: 100vw;
        max-width: 100vw;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    .crop-container {
        max-height: 50vh;
    }
    .crop-tool-btn {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
}

/* ==========================================
   Sell Modal Specific
   ========================================== */
.sell-wine-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-xs);
}

.sell-wine-stock {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: var(--spacing-lg);
}

/* ==========================================
   Toast Notifications
   ========================================== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-900);
    color: var(--white);
    padding: 14px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all var(--transition-slow);
    max-width: 90%;
    text-align: center;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

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

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

/* ==========================================
   Loading
   ========================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--gray-100);
    border-top-color: var(--wine-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: var(--spacing-md);
}

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

/* ==========================================
   Utility Classes
   ========================================== */
.text-center {
    text-align: center;
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

/* ==========================================
   iPhone Specific Optimizations
   ========================================== */
@supports (-webkit-touch-callout: none) {
    /* iOS specific styles */
    body {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
    
    .btn {
        -webkit-appearance: none;
    }
    
    input,
    textarea {
        -webkit-appearance: none;
        border-radius: var(--radius-md);
    }
}

/* Prevent zoom on input focus */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    textarea {
        font-size: 16px;
    }
}

/* ==========================================
   Online/Offline Indicator
   ========================================== */
.online-indicator {
    position: fixed;
    top: 70px;
    right: 16px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    z-index: 1001;
    box-shadow: 0 4px 12px var(--shadow-lg);
    transition: all 0.3s ease;
    animation: slideInRight 0.3s ease;
}

.online-indicator.online {
    background: var(--success);
    color: var(--white);
}

.online-indicator.offline {
    background: var(--warning);
    color: var(--white);
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* PWA Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 80px;
    left: 16px;
    right: 16px;
    background: linear-gradient(135deg, var(--wine-red), var(--wine-red-dark));
    color: var(--white);
    padding: 16px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.install-prompt.show {
    display: flex;
}

.install-prompt-text {
    flex: 1;
}

.install-prompt-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.install-prompt-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.install-prompt-btn {
    background: var(--white);
    color: var(--wine-red);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==========================================
   AUTHENTICATION SCREENS
   ========================================== */

.auth-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: linear-gradient(135deg, var(--wine-red) 0%, #3D1518 50%, var(--wine-red-dark) 100%);
    padding: var(--spacing-lg);
    position: fixed;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 2000;
}

.auth-screen::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 50%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.04) 0%, transparent 40%);
    pointer-events: none;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    background: var(--white);
    border-radius: var(--radius-2xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
    margin: auto 0;
    flex-shrink: 0;
}

/* Wider container when register form is visible */
.auth-container.register-mode {
    max-width: 680px;
}

.auth-header {
    background: linear-gradient(135deg, var(--wine-red) 0%, var(--wine-red-dark) 100%);
    color: var(--white);
    padding: var(--spacing-xl);
    text-align: center;
}

.auth-header h1 {
    font-size: 30px;
    font-weight: 800;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.03em;
}

.auth-header p {
    opacity: 0.9;
    font-size: 14px;
}

.auth-form {
    padding: var(--spacing-xl);
}

.auth-form h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    letter-spacing: -0.02em;
}

/* Register form two-column grid (desktop/tablet) */
.register-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 var(--spacing-lg);
}

.register-grid .form-group {
    margin-bottom: var(--spacing-md);
}

.register-full-width {
    grid-column: 1 / -1;
}

.auth-switch {
    text-align: center;
    margin-top: var(--spacing-lg);
    font-size: 14px;
    color: var(--gray-600);
}

.auth-switch a {
    color: var(--wine-red);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.form-help {
    display: block;
    font-size: 12px;
    color: var(--gray-600);
    margin-top: var(--spacing-xs);
}

.btn-block {
    width: 100%;
    margin-top: var(--spacing-md);
}

/* Header with user menu */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--gray-900);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-menu {
    position: absolute;
    top: 70px;
    right: var(--spacing-md);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 240px;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--gray-100);
    animation: modalSlideUp 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.user-menu-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--gray-200);
}

.user-menu-header strong {
    display: block;
    color: var(--gray-900);
    font-size: 16px;
    margin-bottom: var(--spacing-xs);
}

.user-menu-header small {
    display: block;
    color: var(--gray-600);
    font-size: 13px;
}

.user-menu-item {
    width: 100%;
    padding: var(--spacing-md);
    border: none;
    background: none;
    text-align: left;
    color: var(--gray-900);
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.user-menu-item:hover {
    background: var(--gray-50);
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .auth-container {
        max-width: 100%;
        border-radius: 0;
    }
    
    .auth-container.register-mode {
        max-width: 100%;
    }
    
    .auth-screen {
        padding: 0;
        align-items: flex-start;
    }
    
    .register-grid {
        grid-template-columns: 1fr;
    }
    
    .register-full-width {
        grid-column: auto;
    }
    
    .header-actions {
        gap: var(--spacing-xs);
    }
    
    .btn-primary {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .user-menu {
        right: var(--spacing-sm);
        left: var(--spacing-sm);
        min-width: auto;
    }
}

/* Tablet: still two columns but tighter */
@media (min-width: 481px) and (max-width: 768px) {
    .auth-container.register-mode {
        max-width: 580px;
    }
    
    .register-grid {
        gap: 0 var(--spacing-md);
    }
}

/* Security indicator for HTTPS */
.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--gray-600);
    margin-top: var(--spacing-sm);
}

.security-badge::before {
    content: "\f023";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}
/* ==========================================
   SIDEBAR LAYOUT (SaaS Style)
   ========================================== */
#mainApp {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--gray-900) 0%, #0C1222 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-slow);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.03em;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-md);
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    font-size: 14px;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
}

.sidebar-link.active {
    background: var(--wine-red);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(114, 47, 55, 0.4);
    border-left: 3px solid var(--gold);
}

.sidebar-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    color: var(--gold);
}

.sidebar-link.active .sidebar-icon {
    color: var(--white);
}

.sidebar-text {
    font-size: 14px;
    font-weight: 500;
}

/* Sidebar Submenu */
.sidebar-submenu-wrapper {
    position: relative;
}

.sidebar-submenu-wrapper > .sidebar-link {
    justify-content: flex-start;
}

.sidebar-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s ease;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-submenu-wrapper.open > .sidebar-link .sidebar-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 12px;
}

.sidebar-submenu.open {
    max-height: 200px;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.50);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin-bottom: 1px;
    font-size: 13px;
    border-left: 2px solid transparent;
}

.sidebar-sublink:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-sublink.active {
    background: rgba(114, 47, 55, 0.5);
    color: var(--white);
    border-left-color: var(--gold);
}

.sidebar-sublink .sidebar-icon {
    font-size: 13px;
    width: 20px;
}

.sidebar-sublink .sidebar-text {
    font-size: 13px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: var(--spacing-md);
}

.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-info strong {
    display: block;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info small {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    whitespace: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--white);
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: var(--error);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--gray-50);
}

.content-header {
    background: var(--white);
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* Section content headers (inside sections, not the main header) */
.content-section > .content-header {
    display: block;
    background: transparent;
    border-bottom: none;
    padding: 0 0 var(--spacing-lg) 0;
}

.content-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.03em;
    margin: 0;
}

.content-header h1 i {
    color: var(--gold);
    margin-right: 8px;
}

.content-header p {
    font-size: 14px;
    color: var(--gray-400);
    margin: 4px 0 0 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.btn-mobile-menu {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    color: var(--gray-800);
}

.page-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    color: var(--gray-900);
    letter-spacing: -0.03em;
}

.header-restaurant-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-700);
    letter-spacing: 0.02em;
}

.sidebar-restaurant-name {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: -4px;
    padding: 0 var(--spacing-md);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .header-restaurant-name {
        display: none;
    }
}

/* Content Sections */
.content-section {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.content-section.active {
    display: block;
}

.action-bar {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.search-box-inline {
    flex: 1;
    min-width: 250px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box-inline .search-icon {
    position: absolute;
    left: 12px;
    font-size: 18px;
    color: var(--gray-600);
}

.search-box-inline .search-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.content-body {
    background: transparent;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .btn-mobile-menu {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .action-bar {
        flex-direction: column;
    }
    
    .search-box-inline {
        min-width: 100%;
    }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ==========================================
   Settings Section
   ========================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-xl);
    margin-top: var(--spacing-lg);
}

.settings-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow);
    transition: all var(--transition-base);
}

.settings-card:hover {
    border-color: var(--gray-200);
    box-shadow: var(--shadow-md);
}

.settings-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.02em;
}

.card-description {
    color: var(--gray-600);
    font-size: 14px;
    margin-bottom: var(--spacing-lg);
}

/* Logo Preview */
.logo-preview-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-lg);
}

.logo-preview {
    width: 200px;
    height: 200px;
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    overflow: hidden;
    position: relative;
    transition: all var(--transition-base);
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-placeholder {
    color: var(--gray-400);
    font-size: 14px;
    text-align: center;
    padding: var(--spacing-md);
}

.logo-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.logo-actions .btn {
    flex: 1;
    min-width: 120px;
}

.helper-text {
    display: block;
    text-align: center;
    color: var(--gray-500);
    font-size: 12px;
    margin-top: var(--spacing-sm);
}

/* Settings Form */
.settings-form {
    margin-top: var(--spacing-md);
}

.settings-form .form-group {
    margin-bottom: var(--spacing-lg);
}

.settings-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--spacing-sm);
}

.settings-form input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 15px;
    transition: all var(--transition-base);
}

.settings-form input[type="text"]:focus {
    outline: none;
    border-color: var(--wine-red);
    box-shadow: 0 0 0 4px rgba(114, 47, 55, 0.08);
}

/* Color Picker */
.color-picker-container {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.color-input {
    width: 80px;
    height: 50px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
}

.color-input:hover {
    border-color: var(--wine-red);
    box-shadow: var(--shadow-md);
}

.color-hex-input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all var(--transition-base);
    letter-spacing: 0.05em;
}

.color-hex-input:focus {
    outline: none;
    border-color: var(--wine-red);
    box-shadow: 0 0 0 4px rgba(114, 47, 55, 0.08);
}

.color-preview {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.color-preview p {
    margin-bottom: var(--spacing-md);
    font-weight: 600;
    color: var(--gray-700);
}

.color-preview-samples {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.sample-btn {
    cursor: default;
}

.sample-card {
    padding: var(--spacing-md);
    background: var(--white);
    border: 2px solid var(--wine-red);
    border-radius: var(--radius-md);
    color: var(--wine-red);
    font-weight: 600;
    text-align: center;
}

/* Settings Buttons */
.settings-form .btn {
    margin-top: var(--spacing-md);
    margin-right: var(--spacing-sm);
}

/* ==========================================
   Admin Dashboard
   ========================================== */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    background: white;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: var(--gray-200);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border-radius: var(--radius-lg);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-tabs {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-100);
}

.admin-tab {
    padding: var(--spacing-md) var(--spacing-lg);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-400);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

.admin-tab:hover {
    color: var(--gray-700);
}

.admin-tab.active {
    color: var(--wine-red);
    border-bottom-color: var(--wine-red);
}

.admin-tab-content {
    animation: fadeIn 0.3s ease;
}

.table-container {
    background: white;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    overflow: hidden;
    overflow-x: auto;
    box-shadow: var(--shadow-xs);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table thead {
    background: var(--gray-50);
}

.admin-table th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.admin-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-900);
}

.admin-table tbody tr:hover {
    background: var(--gray-50);
}

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

.text-center {
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

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

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

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

.status-badge.expired {
    background: #fecaca;
    color: #991b1b;
}

.license-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.license-badge.valid { background: #d1fae5; color: #065f46; }
.license-badge.expiring { background: #fef3c7; color: #92400e; }
.license-badge.expired { background: #fecaca; color: #991b1b; }

.table-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.btn-icon {
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1;
    min-width: auto;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    margin-top: var(--spacing-xs);
}

@media (max-width: 768px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: scroll;
    }
    
    .admin-table {
        min-width: 800px;
    }
}

/* ==========================================
   Statistics Section
   ========================================== */
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.summary-card {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.summary-icon {
    font-size: 24px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wine-red-light);
    border-radius: var(--radius-md);
    color: var(--wine-red);
}

.summary-content {
    flex: 1;
}

.summary-label {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: var(--spacing-xs);
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

/* Section title icon accent */
.section-title i {
    color: var(--gold);
    margin-right: 6px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--spacing-xl);
}

.chart-container {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
}

.chart-container h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-md);
}

.chart-container canvas {
    max-height: 300px;
}

@media (max-width: 768px) {
    .stats-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
}
/* ==========================================
   MOBILE FIX - Previene sovrapposizioni
   ========================================== */

@media (max-width: 768px) {
    /* Assicura che il body non vada sotto la sidebar */
    body {
        overflow-x: hidden;
    }
    
    /* Header responsive */
    .header-title {
        font-size: 16px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Bottoni più compatti */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    
    /* Form groups con margini ridotti */
    .form-group {
        margin-bottom: var(--spacing-md);
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: var(--spacing-xs);
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Previene zoom su iOS */
        padding: 12px;
    }
    
    /* Wine cards responsive */
    .wines-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .wine-card {
        padding: var(--spacing-md);
    }
    
    .wine-card-header h3 {
        font-size: 16px;
    }
    
    .wine-card-info {
        font-size: 13px;
    }
    
    /* Modal responsive */
    .modal-content {
        width: 95%;
        max-width: 95%;
        max-height: 90vh;
        overflow-y: auto;
        margin: 20px auto;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    /* Admin tables */
    .admin-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-table {
        min-width: 600px; /* Scroll orizzontale per tabelle larghe */
    }
    
    /* Statistics cards */
    .stats-summary-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .summary-card {
        padding: var(--spacing-md);
    }
    
    .summary-card .stat-value {
        font-size: 24px;
    }
    
    .summary-card .stat-label {
        font-size: 12px;
    }
    
    /* Charts responsive */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .chart-container {
        max-height: 250px;
    }
    
    /* Settings responsive */
    .settings-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .settings-card {
        padding: var(--spacing-md);
    }
    
    .logo-preview {
        width: 150px;
        height: 150px;
    }
    
    /* Toast notifications */
    .toast {
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 90%;
    }
    
    /* Content sections padding */
    .content-section {
        padding: var(--spacing-md);
    }
    
    .content-header h1 {
        font-size: 24px;
    }
    
    .content-header p {
        font-size: 14px;
    }
    
    /* Evita overflow del testo */
    h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Immagini responsive */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Tabelle scroll */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Fix per schermi molto piccoli (< 380px) */
@media (max-width: 380px) {
    .header-title {
        font-size: 14px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .wine-card {
        padding: var(--spacing-sm);
    }
    
    .modal-content {
        width: 98%;
        margin: 10px auto;
    }
}

/* ==========================================
   SALES ANALYTICS - Chart full width
   ======================================== */

.sales-analytics-section {
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.section-title {
    font-size: 1.5rem;
    color: var(--wine-red);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--gray-100);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.chart-container-full {
    background: white;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-xs);
}

.chart-container-full h3 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--gray-800);
    font-size: 1.1rem;
}

.chart-container-full canvas {
    max-height: 400px;
    width: 100% !important;
}

@media (max-width: 768px) {
    .sales-analytics-section {
        margin-top: var(--spacing-lg);
        margin-bottom: var(--spacing-lg);
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .chart-container-full {
        padding: var(--spacing-md);
    }
    
    .chart-container-full h3 {
        font-size: 1rem;
    }
    
    .chart-container-full canvas {
        max-height: 300px;
    }
}

/* === SIDEBAR ONLINE STATUS === */
.sidebar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.08);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.sidebar-status.offline {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10B981;
    animation: pulse 2s ease-in-out infinite;
}

.sidebar-status.offline .status-dot {
    background: #EF4444;
    animation: none;
}

.status-text {
    font-size: 12px;
    font-weight: 500;
    color: #10B981;
}

.sidebar-status.offline .status-text {
    color: #EF4444;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === MARGIN COMPARISON CARD === */
.margin-comparison-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 20px;
    box-shadow: var(--shadow);
}

.margin-item {
    text-align: center;
    flex: 1;
}

.margin-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
    font-weight: 500;
}

.margin-value {
    font-size: 34px;
    font-weight: 800;
    margin: 8px 0;
    letter-spacing: -0.03em;
}

.margin-value.current {
    color: var(--wine-red);
}

.margin-value.target {
    color: #10B981;
}

.margin-separator {
    font-size: 24px;
    font-weight: 600;
    color: #9ca3af;
    padding: 0 16px;
}

.margin-status {
    flex: 1;
    text-align: center;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
}

.margin-status.good {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
    border: 2px solid rgba(16, 185, 129, 0.3);
}

.margin-status.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
    border: 2px solid rgba(245, 158, 11, 0.3);
}

.margin-status.low {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 2px solid rgba(239, 68, 68, 0.3);
}

.summary-sublabel {
    font-size: 11px;
    color: #10B981;
    margin-top: 4px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .margin-comparison-card {
        flex-direction: column;
        gap: 16px;
    }
    
    .margin-separator {
        transform: rotate(90deg);
        padding: 8px 0;
    }
    
    .margin-value {
        font-size: 28px;
    }
}

/* === STATISTICS TABLES === */
.stats-tables-section {
    margin-top: 32px;
}

.stats-table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.stats-table thead {
    background: linear-gradient(135deg, var(--wine-red) 0%, var(--wine-red-dark) 100%);
    color: white;
}

.stats-table th {
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
}

.stats-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background-color var(--transition-fast);
}

.stats-table tbody tr:hover {
    background: var(--gray-50);
}

.stats-table tbody tr:last-child {
    border-bottom: none;
}

.stats-table td {
    padding: 16px 20px;
    color: #374151;
}

.stats-table td:nth-child(1) {
    font-weight: 600;
    color: var(--wine-red);
}

.stats-table td:nth-child(n+2) {
    text-align: right;
}

.stats-table th:nth-child(n+2) {
    text-align: right;
}

/* Badge per percentuali */
.percentage-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(114, 47, 55, 0.1);
    color: var(--wine-red);
}

@media (max-width: 768px) {
    /* Stats tables → mobile card layout */
    .stats-table thead {
        display: none;
    }
    .stats-table,
    .stats-table tbody,
    .stats-table tr,
    .stats-table td {
        display: block;
        width: 100%;
    }
    .stats-table tr {
        background: var(--white);
        border: 1px solid var(--gray-100);
        border-radius: 12px;
        padding: 14px 16px;
        margin-bottom: 10px;
    }
    .stats-table tbody tr:hover {
        background: var(--gray-50);
    }
    .stats-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid var(--gray-50);
        font-size: 13px;
        text-align: right;
    }
    .stats-table td:last-child {
        border-bottom: none;
    }
    .stats-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray-500);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex-shrink: 0;
        margin-right: 12px;
        text-align: left;
    }
    .stats-table td:nth-child(1) {
        font-weight: 700;
        font-size: 14px;
        color: var(--wine-red);
    }
    .stats-table td:nth-child(n+2) {
        text-align: right;
    }
    .percentage-badge {
        font-size: 11px;
        padding: 3px 10px;
    }
}

/* === PRICING CALCULATOR === */
.pricing-calculator {
    max-width: 1200px;
    margin: 0 auto;
}

.pricing-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.pricing-section h2 {
    color: var(--wine-red);
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-100);
}

.pricing-actions {
    text-align: center;
    margin: 32px 0;
}

.pricing-actions .btn {
    padding: 16px 48px;
    font-size: 16px;
}

.pricing-results {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl);
    padding: 32px;
    margin-top: 32px;
}

.pricing-results h2 {
    color: var(--wine-red);
    font-size: 20px;
    margin-bottom: 24px;
    text-align: center;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.result-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.result-card.primary {
    background: linear-gradient(135deg, var(--wine-red) 0%, #8B3A45 100%);
    color: white;
    border-color: var(--wine-red);
}

.result-label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    opacity: 0.9;
}

.result-card.primary .result-label {
    color: rgba(255,255,255,0.9);
}

.result-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--wine-red);
}

.result-card.primary .result-value {
    color: white;
}

.pricing-breakdown {
    background: white;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 24px;
}

.pricing-breakdown h3 {
    color: var(--wine-red);
    font-size: 16px;
    margin-bottom: 16px;
}

.pricing-breakdown h3 i {
    margin-right: 6px;
    color: var(--gold);
}

/* New Pricing Section Styles */
.pricing-guide {
    background: var(--gray-900);
    color: var(--white);
    padding: 25px;
    border-radius: var(--radius-xl);
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.pricing-guide-title {
    color: var(--white);
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
}

.pricing-guide-title i {
    margin-right: 8px;
    color: var(--gold);
}

.pricing-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.pricing-step-card {
    background: rgba(255, 255, 255, 0.06);
    padding: 15px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, 0.04);
    position: relative;
    padding-left: 50px;
}

.pricing-step-num {
    position: absolute;
    left: 12px;
    top: 14px;
    width: 28px;
    height: 28px;
    background: var(--wine-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--white);
    border: 1px solid var(--gold);
}

.pricing-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.pricing-section-header h2 {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.pricing-section-header h2 i {
    margin-right: 6px;
    color: var(--gold);
}

.step-number {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: var(--wine-red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 15px;
    border: 2px solid var(--gold);
}

.pricing-hint {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--gray-50);
    border-left: 3px solid var(--gold);
    padding: 14px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
}

.pricing-hint > i {
    color: var(--gold);
    margin-top: 2px;
    font-size: 16px;
    flex-shrink: 0;
}

.pricing-input {
    font-size: 16px !important;
    padding: 12px !important;
}

.pricing-select {
    font-size: 15px !important;
    padding: 12px !important;
}

.pricing-range {
    width: 100%;
    accent-color: var(--wine-red);
}

.margin-slider-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.margin-label-low,
.margin-label-high {
    font-size: 12px;
    color: var(--gray-400);
}

.margin-input-wrapper {
    text-align: center;
}

.margin-input {
    width: 80px;
    padding: 8px;
    border: 2px solid var(--wine-red);
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 700;
    font-size: 20px;
    color: var(--wine-red);
}

.margin-display {
    text-align: center;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 700;
    color: var(--wine-red);
}

.pricing-calc-btn {
    padding: 16px 40px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    letter-spacing: 0.02em;
}

.pricing-calc-btn i {
    margin-right: 8px;
}

/* Pricing Results */
.pricing-result-hero {
    background: var(--wine-red);
    color: var(--white);
    padding: 32px;
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    text-align: center;
    border: 1px solid var(--gold);
}

.pricing-result-hero h2 {
    color: var(--white);
    margin: 0 0 8px 0;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.pricing-result-hero h2 i {
    color: var(--gold);
    margin-right: 6px;
}

.pricing-result-price {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 8px;
}

.pricing-result-hero p {
    font-size: 15px;
    margin: 0;
    opacity: 0.9;
}

.pricing-result-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.pricing-result-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.pricing-result-icon {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--gold);
}

.pricing-result-label {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.pricing-result-value {
    font-size: 26px;
    font-weight: 700;
}

.pricing-result-value.result-margin {
    color: var(--success);
}

.pricing-result-value.result-profit {
    color: var(--wine-red);
}

.pricing-result-value.result-base {
    color: var(--gray-800);
}

.pricing-breakdown-table {
    width: 100%;
    border-collapse: collapse;
}

.pricing-breakdown-table td {
    padding: 12px 0;
}

.pricing-breakdown-table td:last-child {
    text-align: right;
    font-weight: 600;
}

.breakdown-row-main {
    border-bottom: 2px solid var(--gray-200);
}

.breakdown-row-main td {
    font-weight: 600;
    color: var(--gray-900);
}

.breakdown-row-main i {
    color: var(--gold);
    margin-right: 6px;
}

.breakdown-row-sub {
    border-bottom: 1px solid var(--gray-100);
}

.breakdown-row-sub td:first-child {
    color: var(--gray-600);
}

.breakdown-row-sub i {
    color: var(--gold);
    margin-right: 4px;
}

.breakdown-row-total {
    border-bottom: 2px solid var(--wine-red);
    background: var(--wine-red-light);
}

.breakdown-row-total td {
    font-weight: 700;
    color: var(--wine-red);
    font-size: 16px;
}

.breakdown-row-final {
    background: var(--wine-red);
    color: var(--white);
}

.breakdown-row-final td {
    padding: 16px 12px;
    font-weight: 700;
    color: var(--white);
}

.breakdown-row-final td:first-child {
    font-size: 15px;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.breakdown-row-final td:first-child i {
    color: var(--gold);
    margin-right: 6px;
}

.breakdown-row-final td:last-child {
    font-size: 22px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.pricing-result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.pricing-result-actions .btn i {
    margin-right: 6px;
}

.breakdown-table {
    width: 100%;
    font-size: 14px;
}

.breakdown-table tr {
    border-bottom: 1px solid #f3f4f6;
}

.breakdown-table tr.separator {
    height: 12px;
    border: none;
}

.breakdown-table tr.total-row {
    border-top: 2px solid var(--wine-red);
    border-bottom: none;
}

.breakdown-table td {
    padding: 12px 8px;
}

.breakdown-table td:first-child {
    color: #6b7280;
}

.breakdown-table td:last-child {
    text-align: right;
    color: #111827;
    font-weight: 500;
}

.pricing-recommendations {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--gold);
    border-radius: var(--radius-md);
    padding: 20px;
}

.pricing-recommendations h3 {
    color: var(--gray-900);
    font-size: 16px;
    margin-bottom: 12px;
}

.recommendation-item {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 6px;
    font-size: 14px;
    color: var(--gray-700);
    border-left: 3px solid var(--wine-red);
}

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .result-value {
        font-size: 24px;
    }
}

/* Pricing Calculator — Mobile responsive */
@media (max-width: 640px) {
    .pricing-guide {
        padding: 16px;
    }
    .pricing-steps-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .pricing-step-card {
        padding: 10px 10px 10px 42px;
        font-size: 12px;
    }
    .pricing-step-num {
        width: 24px;
        height: 24px;
        font-size: 11px;
        left: 10px;
        top: 10px;
    }
    .pricing-section {
        padding: 16px;
    }
    .pricing-section-header h2 {
        font-size: 15px;
    }
    .step-number {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 13px;
    }
    .pricing-hint {
        font-size: 12px;
        padding: 10px 12px;
    }
    .pricing-calc-btn {
        padding: 14px 24px !important;
        font-size: 15px !important;
    }

    /* Result hero */
    .pricing-result-hero {
        padding: 20px 16px;
    }
    .pricing-result-price {
        font-size: 38px;
    }
    .pricing-result-hero p {
        font-size: 13px;
    }

    /* Result cards */
    .pricing-result-cards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .pricing-result-card {
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: left;
        padding: 14px 16px;
    }
    .pricing-result-icon {
        font-size: 18px;
        margin-bottom: 0;
    }
    .pricing-result-label {
        margin-bottom: 0;
        font-size: 11px;
    }
    .pricing-result-value {
        font-size: 20px;
        margin-left: auto;
    }

    /* Breakdown table — card layout on mobile */
    .pricing-breakdown {
        padding: 16px;
    }
    .pricing-breakdown h3 {
        font-size: 14px;
    }
    .pricing-breakdown-table,
    .pricing-breakdown-table tbody,
    .pricing-breakdown-table tr,
    .pricing-breakdown-table td {
        display: block;
        width: 100%;
    }
    .pricing-breakdown-table tr {
        padding: 10px 0;
        border-bottom: 1px solid var(--gray-100);
    }
    .pricing-breakdown-table td {
        padding: 2px 0;
    }
    .pricing-breakdown-table td:first-child {
        font-size: 13px;
    }
    .pricing-breakdown-table td:last-child {
        text-align: left;
        font-size: 18px;
        font-weight: 700;
        color: var(--gray-900);
    }
    .breakdown-row-total {
        border-radius: var(--radius-sm);
        padding: 12px;
        margin: 8px 0;
    }
    .breakdown-row-total td:last-child {
        color: var(--wine-red);
        font-size: 20px;
    }
    .breakdown-row-final {
        border-radius: var(--radius-md);
        padding: 14px 12px;
        margin-top: 8px;
    }
    .breakdown-row-final td {
        padding: 2px 0;
    }
    .breakdown-row-final td:first-child {
        font-size: 13px;
        border-radius: 0;
    }
    .breakdown-row-final td:last-child {
        font-size: 24px;
        border-radius: 0;
        color: var(--white);
    }

    /* Action buttons */
    .pricing-result-actions {
        flex-direction: column;
    }
    .pricing-result-actions .btn {
        width: 100%;
        justify-content: center;
    }
    .pricing-actions .btn {
        width: 100%;
    }

    /* Margin slider */
    .margin-slider-labels {
        flex-wrap: wrap;
        gap: 8px;
    }
    .margin-input {
        width: 65px;
        font-size: 18px;
        padding: 6px;
    }
}

/* === PERIOD SELECTOR === */
.chart-header-with-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.chart-header-with-controls h3 {
    margin: 0;
}

.period-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-selector label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.period-selector select {
    padding: 8px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: white;
    color: var(--gray-700);
    cursor: pointer;
    transition: all var(--transition-base);
}

.period-selector select:hover {
    border-color: var(--gray-300);
}

.period-selector select:focus {
    outline: none;
    border-color: var(--wine-red);
    box-shadow: 0 0 0 4px rgba(114, 47, 55, 0.08);
}

@media (max-width: 768px) {
    .chart-header-with-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==========================================
   QR CODE & CUSTOMER MENU SECTION
   ========================================== */
.qr-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.qr-preview-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.qr-preview-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.qr-preview-header h2 {
    font-size: 30px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.qr-preview-header p {
    color: var(--gray-600);
    font-size: 16px;
}

.qr-code-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
}

.qr-code-display {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
    min-height: 280px;
    min-width: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-display canvas,
.qr-code-display img {
    display: block;
    max-width: 100%;
    height: auto;
}

.qr-url-display {
    width: 100%;
    max-width: 600px;
}

.qr-url-display label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--spacing-sm);
}

.url-copy-box {
    display: flex;
    gap: var(--spacing-sm);
}

.url-copy-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--gray-50);
    color: var(--gray-900);
}

.btn-copy {
    padding: 12px 16px;
    background: var(--wine-red);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

.btn-copy:hover {
    background: var(--wine-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px var(--shadow);
}

.qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

.qr-actions .btn {
    min-width: 200px;
}

/* QR Info Cards */
.qr-info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.qr-info-card {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    text-align: center;
    transition: all var(--transition-base);
}

.qr-info-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-200);
}

.info-icon {
    font-size: 28px;
    margin-bottom: var(--spacing-md);
    color: var(--gold);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    background: var(--wine-red-light);
    border-radius: var(--radius-md);
}

.qr-info-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.qr-info-card p {
    color: var(--gray-600);
    line-height: 1.6;
    font-size: 14px;
}

/* QR Usage Guide */
.qr-usage-guide {
    background: linear-gradient(135deg, var(--wine-red) 0%, #3D1518 100%);
    color: var(--white);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-wine);
}

.qr-usage-guide h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.usage-steps {
    list-style: none;
    counter-reset: step-counter;
    display: grid;
    gap: var(--spacing-md);
}

.usage-steps li {
    counter-increment: step-counter;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.usage-steps li::before {
    content: counter(step-counter);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--white);
    color: var(--wine-red);
    border-radius: 50%;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.usage-steps li strong {
    display: block;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

/* QR Stats Preview */
.qr-stats-preview {
    background: var(--white);
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.qr-stats-preview h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
}

.qr-stats-preview .stat-card {
    background: var(--gray-50);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--gray-100);
    transition: all var(--transition-base);
}

.qr-stats-preview .stat-card:hover {
    border-color: var(--gray-200);
    box-shadow: var(--shadow-md);
}

.qr-stats-preview .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--wine-red);
    margin-bottom: var(--spacing-xs);
}

.qr-stats-preview .stat-label {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 600;
}

/* Responsive QR Section */
@media (max-width: 768px) {
    .qr-preview-card {
        padding: var(--spacing-lg);
    }
    
    .qr-code-display {
        min-width: 240px;
        min-height: 240px;
        padding: var(--spacing-md);
    }
    
    .qr-actions {
        flex-direction: column;
    }
    
    .qr-actions .btn {
        width: 100%;
        min-width: auto;
    }
    
    .qr-info-cards {
        grid-template-columns: 1fr;
    }
    
    .qr-stats-preview .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================
   2026 MODERN REFINEMENTS
   ========================================== */

/* Smooth entrance animations */
.content-section.active {
    animation: contentFadeIn 0.3s ease;
}

@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Wine card stagger animation */
.wine-card {
    animation: cardIn 0.4s ease both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modern scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Subtle selection color */
::selection {
    background: rgba(114, 47, 55, 0.15);
    color: var(--gray-900);
}

/* Focus-visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--wine-red);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Smooth transitions for all interactive elements */
a, button, input, select, textarea {
    transition-property: color, background-color, border-color, box-shadow, transform, opacity;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================
   STAFF MANAGEMENT
   ========================================== */

.staff-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    margin-bottom: 12px;
    background: white;
    transition: all 0.2s ease;
}

.staff-card:hover {
    border-color: var(--gray-300);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.staff-card.staff-inactive {
    opacity: 0.55;
    background: var(--gray-50);
}

.staff-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.staff-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--wine-red, #722F37);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.staff-inactive .staff-avatar {
    background: var(--gray-400);
}

.staff-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.staff-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--gray-900);
}

.staff-username {
    font-size: 13px;
    color: var(--gray-500);
    font-family: 'SF Mono', monospace;
}

.staff-meta {
    font-size: 12px;
    color: var(--gray-400);
}

.staff-status {
    flex-shrink: 0;
}

.staff-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.badge-manager {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.badge-staff {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.staff-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.staff-actions .btn-sm {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
}

.staff-actions .btn-danger {
    background: transparent;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.staff-actions .btn-danger:hover {
    background: #dc2626;
    color: white;
}

/* Staff responsive */
@media (max-width: 640px) {
    .staff-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .staff-status {
        align-self: flex-start;
    }

    .staff-actions {
        align-self: stretch;
        justify-content: flex-end;
    }

    .staff-actions .btn-sm {
        flex: 1;
        max-width: 60px;
    }
}

/* ==========================================
   CEO DASHBOARD — Market Intelligence
   ========================================== */

/* Dashboard Link highlight */
.sidebar-dashboard-link {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(114, 47, 55, 0.1)) !important;
    border-left: 3px solid var(--gold) !important;
}
.sidebar-dashboard-link:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(114, 47, 55, 0.15)) !important;
}

/* Overview Cards Grid */
.ceo-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.ceo-card {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--gray-300);
    transition: transform 0.2s, box-shadow 0.2s;
}
.ceo-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.ceo-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.ceo-card-tenants { border-left-color: #6366f1; }
.ceo-card-tenants .ceo-card-icon { background: rgba(99,102,241,0.12); color: #6366f1; }

.ceo-card-revenue { border-left-color: #10b981; }
.ceo-card-revenue .ceo-card-icon { background: rgba(16,185,129,0.12); color: #10b981; }

.ceo-card-bottles { border-left-color: var(--wine-red); }
.ceo-card-bottles .ceo-card-icon { background: var(--wine-red-light); color: var(--wine-red); }

.ceo-card-sold { border-left-color: #f59e0b; }
.ceo-card-sold .ceo-card-icon { background: rgba(245,158,11,0.12); color: #f59e0b; }

.ceo-card-avg { border-left-color: #8b5cf6; }
.ceo-card-avg .ceo-card-icon { background: rgba(139,92,246,0.12); color: #8b5cf6; }

.ceo-card-events { border-left-color: #06b6d4; }
.ceo-card-events .ceo-card-icon { background: rgba(6,182,212,0.12); color: #06b6d4; }

.ceo-card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
}
.ceo-card-label {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
    margin-top: 2px;
}
.ceo-card-sub {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
    font-weight: 500;
}

/* Section blocks */
.ceo-section {
    margin-bottom: 32px;
}
.ceo-section h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ceo-section h2 i {
    color: var(--wine-red);
}

.ceo-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.ceo-section-header h2 {
    margin-bottom: 0;
}

.ceo-select {
    padding: 8px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 13px;
    color: var(--gray-700);
    background: var(--white);
    cursor: pointer;
}

/* Two columns layout */
.ceo-two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Chart wrapper — constrains Chart.js canvas height */
.ceo-chart-wrapper {
    position: relative;
    width: 100%;
}

/* Panel */
.ceo-panel {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}
.ceo-panel.ceo-full-width {
    width: 100%;
}
.ceo-panel-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tables inside dashboard */
.ceo-table-container {
    overflow-x: auto;
}
.ceo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ceo-table thead th {
    background: var(--gray-50);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-200);
}
.ceo-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.ceo-table tbody tr:hover {
    background: var(--gray-50);
}
.ceo-table .rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    color: white;
}
.ceo-table .rank-1 { background: #f59e0b; }
.ceo-table .rank-2 { background: #94a3b8; }
.ceo-table .rank-3 { background: #b45309; }
.ceo-table .rank-default { background: var(--gray-300); color: var(--gray-600); }

/* Disclaimer text */
.ceo-disclaimer {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ceo-disclaimer i {
    color: var(--gold);
}

/* Export section */
.ceo-export-section {
    background: linear-gradient(135deg, rgba(114,47,55,0.04), rgba(212,175,55,0.06));
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(212,175,55,0.2);
}
.ceo-export-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Empty state for tables */
.ceo-empty {
    text-align: center;
    padding: 32px;
    color: var(--gray-400);
    font-size: 14px;
}
.ceo-empty i {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

/* Responsive */
@media (max-width: 1024px) {
    .ceo-overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ceo-two-columns {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 640px) {
    .ceo-overview-grid {
        grid-template-columns: 1fr;
    }
    .ceo-card-value {
        font-size: 22px;
    }
    .ceo-export-buttons {
        flex-direction: column;
    }
    .ceo-export-buttons .btn {
        width: 100%;
    }

    /* Prevent CEO panels from overflowing */
    .ceo-panel {
        padding: 14px;
        overflow-x: auto;
    }
    .ceo-section {
        max-width: 100%;
        overflow: hidden;
    }
    .ceo-section h2 {
        font-size: 16px;
    }
    .ceo-chart-wrapper {
        min-height: 200px;
        height: auto !important;
    }

    /* CEO tables in admin-table class → responsive */
    .ceo-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -14px;
        padding: 0 14px;
    }
    .ceo-table-container .admin-table {
        min-width: 500px;
        font-size: 12px;
    }
    .ceo-table-container .admin-table th,
    .ceo-table-container .admin-table td {
        padding: 8px 10px;
    }

    /* CEO tables → mobile card layout */
    .ceo-table thead {
        display: none;
    }
    .ceo-table,
    .ceo-table tbody,
    .ceo-table tr,
    .ceo-table td {
        display: block;
        width: 100%;
    }
    .ceo-table tr {
        background: var(--white);
        border: 1px solid var(--gray-200);
        border-radius: 12px;
        padding: 12px 16px;
        margin-bottom: 10px;
    }
    .ceo-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid var(--gray-50);
        font-size: 13px;
    }
    .ceo-table td:last-child {
        border-bottom: none;
    }
    .ceo-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray-500);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex-shrink: 0;
        margin-right: 12px;
    }
    .ceo-table td[data-label="#"] {
        justify-content: flex-start;
        gap: 8px;
    }
}

/* ==========================================
   Low Stock & Service Cellar Feature
   ========================================== */

/* Button: Warning (Low Stock) */
.btn-warning {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: var(--white);
    border: none;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #D97706, #B45309);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.btn-warning.active {
    background: linear-gradient(135deg, var(--wine-red), var(--wine-red-dark));
    box-shadow: 0 2px 8px rgba(114, 47, 55, 0.3);
}

/* Button: Info (Transfer) */
.btn-info {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: var(--white);
    border: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.btn-info:hover {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

/* Badge: Service Cellar */
.badge-service {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
}

.badge-out {
    background: var(--error);
    animation: pulse 2s infinite;
}

/* Low Stock Cards */
.low-stock-card {
    border: 2px solid transparent;
    transition: all var(--transition-base);
}

.low-stock-card.low-stock-warning {
    border-color: rgba(245, 158, 11, 0.3);
    background: linear-gradient(180deg, rgba(255, 247, 237, 0.5), var(--white));
}

.low-stock-card.low-stock-out {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(180deg, rgba(254, 242, 242, 0.5), var(--white));
}

.low-stock-content {
    text-align: center;
    padding: var(--spacing-md);
}

.low-stock-content .wine-name {
    font-size: 15px;
    margin-bottom: var(--spacing-xs);
}

.low-stock-content .wine-info-item {
    font-size: 13px;
    color: var(--gray-600);
    display: block;
    margin-bottom: var(--spacing-sm);
}

.low-stock-content .wine-actions {
    margin-top: var(--spacing-sm);
}

/* Service Cellar Section */
.service-cellar-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(37, 99, 235, 0.04));
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    color: #1E40AF;
    font-size: 14px;
}

.service-cellar-info i {
    font-size: 18px;
    color: #3B82F6;
}

.service-cellar-card {
    border: 2px solid transparent;
    transition: all var(--transition-base);
}

.service-cellar-card.service-low {
    border-color: rgba(245, 158, 11, 0.3);
}

.service-stock-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--gray-600);
    font-size: 13px;
    margin: var(--spacing-xs) 0 var(--spacing-sm);
}

.service-stock-info i {
    color: var(--gray-400);
}

/* Feature Toggle (Settings) */
.feature-toggle-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.feature-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-base);
    position: relative;
}

.feature-toggle:hover {
    background: var(--gray-100);
}

.toggle-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toggle-label strong {
    font-size: 14px;
    color: var(--gray-800);
}

.toggle-label small {
    font-size: 12px;
    color: var(--gray-600);
}

/* Toggle Switch */
.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    transition: background var(--transition-base);
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    transition: transform var(--transition-base);
    box-shadow: var(--shadow);
}

input[type="checkbox"]:checked + .toggle-slider {
    background: var(--success);
}

input[type="checkbox"]:checked + .toggle-slider::after {
    transform: translateX(22px);
}

input[type="checkbox"].toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Threshold Setting */
.threshold-setting {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.threshold-setting label {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    flex: 1;
}

.threshold-setting input[type="number"] {
    width: 70px;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
    background: var(--white);
}

.threshold-setting .btn {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
}

/* Transfer Modal */
.transfer-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
    flex-wrap: wrap;
}

.transfer-stock-box {
    text-align: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    min-width: 120px;
}

.transfer-stock-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.transfer-stock-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.transfer-arrow {
    font-size: 24px;
    color: var(--gray-400);
}

/* Hide text on small screens */
@media (max-width: 375px) {
    .low-stock-btn-text,
    .transfer-btn-text {
        display: none;
    }
}

/* =============================================
   DAILY SALES (Vendite del Giorno)
   ============================================= */

.daily-sales-controls {
    margin-bottom: var(--spacing-lg);
}

.date-picker-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.date-picker-group label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-picker-group input[type="date"] {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--gray-900);
    background: var(--white);
}

.date-picker-group input[type="date"]:focus {
    outline: none;
    border-color: var(--wine-red);
    box-shadow: 0 0 0 3px rgba(114, 47, 55, 0.1);
}

.daily-sales-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.daily-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.daily-status.status-ok {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.daily-status.status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.wine-name-cell {
    font-weight: 500;
    color: var(--gray-900);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seller-cell {
    font-size: 13px;
    color: var(--gray-700);
    white-space: nowrap;
}

.seller-cell i {
    color: var(--wine-red);
    margin-right: 2px;
    font-size: 11px;
}

.totals-row {
    background: var(--gray-50) !important;
    border-top: 2px solid var(--gray-300) !important;
}

.totals-row td {
    font-weight: 700 !important;
    font-size: 14px !important;
}

/* Mobile responsive for daily sales tables */
@media (max-width: 768px) {
    .daily-sales-summary {
        grid-template-columns: 1fr;
    }
    
    .date-picker-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-picker-group input[type="date"] {
        width: 100%;
    }
}

/* =============================================
   SUPPLIERS SECTION
   ============================================= */
.suppliers-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.supplier-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.supplier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.supplier-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wine-red, #722F37);
    color: white;
    border-radius: 12px;
    font-size: 20px;
    flex-shrink: 0;
}

.supplier-card-content {
    flex: 1;
}

.supplier-card-content h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900, #0F172A);
}

.supplier-card-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-500, #64748B);
}

.supplier-card-stats i {
    margin-right: 4px;
}

.supplier-card-arrow {
    color: var(--gray-400, #94A3B8);
    font-size: 16px;
}

.supplier-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.supplier-detail-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--gray-900, #0F172A);
}

.restock-log-section {
    margin-top: 30px;
}

/* Btn Success */
.btn-success {
    background: #10b981;
    color: white;
    border: none;
}

.btn-success:hover {
    background: #059669;
}

.btn-success:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* ── Iubenda-style Cookie Consent ──────────── */
.iub-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(29, 29, 29, 0.98);
    color: #f0f0f0;
    z-index: 10000;
    padding: 1.2rem 1.5rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
}
.iub-banner-inner {
    max-width: 900px;
    margin: 0 auto;
}
.iub-banner-text { margin-bottom: 0.8rem; }
.iub-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.3rem;
}
.iub-banner-text p {
    font-size: 0.82rem;
    line-height: 1.55;
    margin: 0;
    color: #ccc;
}
.iub-banner-text strong { color: #fff; }
.iub-banner-actions {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}
.iub-btn {
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.iub-btn-accept {
    background: #1a73e8;
    color: #fff;
}
.iub-btn-accept:hover { filter: brightness(1.15); }
.iub-btn-reject {
    background: transparent;
    color: #ccc;
    border: 1px solid #555;
}
.iub-btn-reject:hover { border-color: #999; color: #fff; }
.iub-btn-manage {
    background: transparent;
    color: #ccc;
    border: 1px solid #555;
}
.iub-btn-manage:hover { border-color: #999; color: #fff; }
.iub-banner-links {
    font-size: 0.72rem;
}
.iub-banner-links a {
    color: #C5A55A;
    text-decoration: underline;
}
.iub-banner-links a:hover { color: #e0c77a; }
.iub-sep { color: #555; margin: 0 0.4rem; }

/* Preferences overlay */
.iub-pref-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}
.iub-pref-panel {
    background: #fff;
    border-radius: 10px;
    max-width: 520px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.iub-pref-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid #e5e5e5;
}
.iub-pref-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1d1d1d;
    margin: 0;
}
.iub-pref-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.3rem;
}
.iub-pref-close:hover { color: #333; }
.iub-pref-body { padding: 1rem 1.2rem; }
.iub-pref-desc {
    font-size: 0.82rem;
    color: #555;
    line-height: 1.55;
    margin-bottom: 1rem;
}
.iub-cookie-category {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 0.8rem;
    margin-bottom: 0.6rem;
}
.iub-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.iub-cat-info { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.iub-cat-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1d1d1d;
}
.iub-cat-badge {
    font-size: 0.68rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    background: #e8f5e9;
    color: #2e7d32;
}
.iub-badge-none {
    background: #f5f5f5;
    color: #999;
}
.iub-cat-desc {
    font-size: 0.78rem;
    color: #777;
    line-height: 1.5;
    margin-top: 0.4rem;
}
.iub-cat-empty { opacity: 0.7; }
.iub-pref-footer {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    padding: 0.8rem 1.2rem;
    border-top: 1px solid #e5e5e5;
}

/* Privacy widget (floating shield icon) */
.iub-widget {
    position: fixed;
    bottom: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    background: rgba(29, 29, 29, 0.9);
    color: #C5A55A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
    transition: transform 0.2s;
}
.iub-widget:hover { transform: scale(1.1); }
.iub-widget svg {
    width: 20px;
    height: 20px;
}

/* === Commission Mode Cards === */
.commission-mode-card {
    display: block;
    cursor: pointer;
    flex: 1;
    min-width: 140px;
}
.commission-mode-card input[type="radio"] { display: none; }
.mode-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    transition: all 0.2s;
    text-align: center;
}
.mode-card-inner i { font-size: 1.5rem; color: var(--gray-400); }
.mode-card-inner strong { font-size: 0.9rem; }
.mode-card-inner small { font-size: 0.75rem; color: var(--gray-500); }
.commission-mode-card input:checked + .mode-card-inner {
    border-color: var(--primary-color, #722F37);
    background: rgba(114, 47, 55, 0.05);
    box-shadow: 0 0 0 1px var(--primary-color, #722F37);
}
.commission-mode-card input:checked + .mode-card-inner i {
    color: var(--primary-color, #722F37);
}

.commission-tier-row, .commission-goal-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.commission-tier-row input, .commission-goal-row select, .commission-goal-row input {
    flex: 1;
    min-width: 80px;
}

/* === Casino Sale Feedback Overlay === */
@keyframes saleFeedbackPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes saleFeedbackFade {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-30px); }
}
.sale-feedback-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: saleFeedbackPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sale-feedback-card {
    background: white;
    border-radius: 20px;
    padding: 32px 40px;
    text-align: center;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.sale-feedback-card.tier-jackpot {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffd700;
}
.sale-feedback-card.tier-gold {
    background: linear-gradient(135deg, #2c1810 0%, #4a2c1a 100%);
    color: #D4AF37;
}
.sale-feedback-card.tier-silver {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #333;
}
.sale-feedback-card.tier-bronze {
    background: white;
    color: #333;
}
.sale-feedback-emoji {
    font-size: 3rem;
    margin-bottom: 12px;
    animation: saleFeedbackPop 0.5s 0.2s both;
}
.sale-feedback-message {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.sale-feedback-streak {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 8px;
}
.sale-feedback-commission {
    font-size: 0.85rem;
    margin-top: 12px;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-block;
}
.tier-jackpot .sale-feedback-commission { background: rgba(255,215,0,0.15); }
.tier-gold .sale-feedback-commission { background: rgba(212,175,55,0.15); }
.tier-silver .sale-feedback-commission { background: rgba(0,0,0,0.05); }
.tier-bronze .sale-feedback-commission { background: rgba(0,0,0,0.03); }

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-switch .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--gray-300);
    border-radius: 26px;
    transition: 0.3s;
}
.toggle-switch .toggle-slider:before {
    content: "";
    position: absolute;
    height: 20px; width: 20px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color, #722F37);
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Leaderboard highlight */
.leaderboard-me { background: rgba(212, 175, 55, 0.1) !important; font-weight: 600; }

/* Onboarding wizard */
.onboarding-progress {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    margin-bottom: 8px;
    overflow: hidden;
}
.onboarding-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #722F37), var(--secondary-color, #D4AF37));
    border-radius: 3px;
    transition: width 0.4s ease;
}
.onboarding-step h3 {
    margin-bottom: 12px;
    font-size: 1.1rem;
    color: var(--text-primary);
}
.ob-supplier-row, .ob-staff-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.ob-supplier-row input, .ob-staff-row input, .ob-staff-row select {
    flex: 1;
    min-width: 80px;
}
