/* ============================================
   MESTOLO — CSS Globale
   Restyling professionale admin panel
   ============================================ */

/* --- 1. RESET E BASE --- */
/* :root spostato in tokens.css */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: var(--font-size-base);
    line-height: 1.5;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    text-decoration: underline;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Kiosk mode --- */
.kiosk-mode {
    font-size: var(--font-size-kiosk);
    overflow: hidden;
    height: 100vh;
}

/* --- Header (non-admin) --- */
.app-header {
    background: var(--sidebar-bg);
    color: #fff;
    padding: 12px 16px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
}

.app-logo {
    color: #fff;
    font-size: 1.3em;
    font-weight: 700;
}

.app-nav {
    display: flex;
    gap: 8px;
}

.app-nav .btn {
    padding: 8px 16px;
    font-size: 0.85em;
}

/* --- Footer --- */
.app-footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}


/* ============================================
   2. LAYOUT ADMIN
   ============================================ */

.admin-layout .admin-wrapper {
    min-height: 100vh;
}

.admin-main {
    margin-left: 260px;
}

/* --- Sidebar --- */
.admin-sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.admin-sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-sidebar-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--sidebar-text);
    margin: 4px 0;
    transition: 0.2s;
    border-radius: 1px;
}

.admin-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.nav-group-label {
    padding: 16px 24px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffe8dc;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    min-height: 40px;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.admin-nav-link:hover {
    color: var(--sidebar-text-hover);
    background: rgba(255,255,255,0.05);
    text-decoration: none;
}

.admin-nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.16);
    border-left-color: var(--accent);
}

.nav-separator {
    height: 1px;
    background: var(--sidebar-border);
    margin: 8px 16px;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.admin-nav-link.active .nav-icon {
    opacity: 1;
}

.nav-text {
    flex: 1;
}

/* --- Main content area --- */
.admin-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.admin-header {
    background: var(--card-bg);
    padding: 16px 40px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    min-height: 64px;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.user-role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #e8ded8;
    color: var(--primary-tint-text);
}

.admin-content {
    flex: 1;
    padding: 5px 20px;
    max-width: 1400px;
    width: 100%;
}


/* ============================================
   3. COMPONENTI
   ============================================ */

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.5px;
}

.admin-page {
    /* container for all admin pages */
}

/* Card */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

/* Stat grid / stat cards */
.stat-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 32px;
}

.stat-grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid-5 { grid-template-columns: repeat(5, 1fr); }

.stat-box, .stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.stat-box-primary {
    border-color: var(--primary);
    background: var(--primary-tint);
}

.stat-box-success {
    border-color: var(--success);
    background: #f0fdf4;
}

.stat-box-warning {
    border-color: var(--warning);
    background: #fffbeb;
}

.stat-box-danger {
    border-color: var(--danger);
    background: #fef2f2;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-detail {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Section titles */
.section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
    color: var(--text);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-text {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 20px 0;
}


/* ============================================
   4. TABELLE
   ============================================ */

.admin-table-wrapper {
    overflow-x: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.admin-table thead {
    background: var(--bg);
}

.admin-table th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text);
}

.admin-table tbody tr:hover {
    background: var(--bg);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tfoot td {
    padding: 14px 16px;
    border-top: 2px solid var(--border);
    font-weight: 600;
    background: var(--bg);
}

.admin-table .actions-col {
    width: 180px;
    white-space: nowrap;
}

.admin-table .action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}


/* ============================================
   5. FORM
   ============================================ */

.form-container {
    max-width: 800px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label,
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
    min-height: 44px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-focus);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%2364748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3e%3cpolyline points="6 9 12 15 18 9"%3e%3c/polyline%3e%3c/svg%3e');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-checkboxes {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin: 20px 0;
    padding: 16px 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.form-checkboxes .form-group {
    margin-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

.prezzo-preview {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--primary-tint);
    border: 1px solid var(--primary-tint-border);
    border-radius: var(--radius);
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-tint-text);
}

.filter-bar {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-bar label {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    color: var(--text-secondary);
}

.filter-bar .form-control {
    max-width: 400px;
    flex: 1;
}


/* ============================================
   6. PULSANTI
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    transition: background var(--transition), box-shadow var(--transition);
    text-align: center;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover {
    background: var(--success-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}
.btn-warning:hover {
    background: var(--warning-hover);
}

.btn-secondary {
    background: var(--border-light);
    color: #374151;
    border: 1px solid #d1d5db;
}
.btn-secondary:hover {
    background: var(--border);
}

.btn-dark {
    background: var(--sidebar-bg);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: var(--bg);
    color: var(--text);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    min-height: auto;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius);
}


/* ============================================
   7. BADGE
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.5;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: var(--border-light);
    color: #475569;
}

.badge-muted {
    background: #f1f5f9;
    color: #94a3b8;
}


/* ============================================
   8. ALERT / FLASH
   ============================================ */

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #f0fdf4;
    border-color: var(--success);
    color: #166534;
}

.alert-danger {
    background: #fef2f2;
    border-color: var(--danger);
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: var(--primary-tint);
    border-color: var(--primary);
    color: var(--primary-tint-text);
}


/* ============================================
   9. TOGGLE SWITCH
   ============================================ */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: background var(--transition);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ============================================
   10. TOAST
   ============================================ */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: auto;
    transform: translateY(100px);
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    min-width: 240px;
    max-width: 420px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    background: var(--sidebar-bg);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info    { border-left: 4px solid var(--primary); }

/* --- Confirm dialog --- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.confirm-dialog {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.confirm-dialog p {
    font-size: 16px;
    margin: 0 0 24px;
    color: var(--text);
}

.confirm-dialog .confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}


/* ============================================
   11. RESPONSIVE
   ============================================ */

.mobile-only {
    display: none;
}

/* Tablet */
@media (max-width: 1024px) {
    .admin-content {
        padding: 24px 20px;
    }

    .admin-header {
        padding: 16px 20px;
    }

    .stat-grid-5 { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --touch-min-size: 56px;
    }

    .admin-layout .admin-wrapper {
        display: block;
    }

    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        transform: translateX(-100%);
        z-index: 2000;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .mobile-only {
        display: block;
    }

    .admin-header {
        justify-content: space-between;
    }

    .admin-content {
        padding: 20px 16px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .stat-grid-4,
    .stat-grid-5 { grid-template-columns: repeat(2, 1fr); }
    .stat-grid-3 { grid-template-columns: 1fr; }
    .stat-value { font-size: 22px; }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .form-checkboxes {
        flex-direction: column;
        gap: 12px;
    }

    .header-inner {
        flex-direction: column;
        gap: 8px;
    }

    .app-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Table card-view */
    .admin-table {
        font-size: 14px;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        overflow: hidden;
        background: var(--card-bg);
    }

    .admin-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px;
        border-bottom: 1px solid var(--border-light);
    }

    .admin-table td:last-child {
        border-bottom: none;
    }

    .admin-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        margin-right: 12px;
        flex-shrink: 0;
    }

    .admin-table td.actions-col {
        width: 100%;
    }

    .admin-table .action-buttons {
        width: 100%;
        justify-content: flex-end;
    }
}


/* ============================================
   12. UTILITY
   ============================================ */

.text-muted { color: var(--text-secondary); }
.text-right { text-align: right; }
.text-center { text-align: center; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }


/* ============================================
   COMPONENT EXTRAS
   ============================================ */

/* Image preview (product form) */
.image-preview-container {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border);
}

.image-preview {
    max-width: 280px;
    max-height: 280px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.image-preview-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Ricette form */
.ricetta-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition);
}

.btn-add-row:hover {
    background: var(--success-hover);
}

.btn-add-row::before {
    content: '+';
    font-size: 18px;
    font-weight: bold;
}

.ricetta-row.empty { opacity: 0.5; }
.ricetta-row.error {
    background: #fffbeb;
    border-left: 4px solid var(--warning);
}

/* Checkbox grid (varianti) */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.checkbox-grid-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    cursor: pointer;
}

.checkbox-grid-item:hover {
    border-color: var(--primary);
    background: var(--primary-tint);
}

.checkbox-grid-item input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-grid-item.checked {
    border-color: var(--primary);
    background: var(--primary-tint);
}

.checkbox-grid-label {
    flex: 1;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.checkbox-grid-header {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

/* Scarico section (product form) */
.scarico-section {
    margin: 32px 0 24px;
    padding: 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.scarico-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--text);
}

.scarico-cards {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.scarico-card {
    cursor: pointer;
    margin: 0;
}

.scarico-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.scarico-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    transition: all var(--transition);
    min-height: 160px;
    justify-content: center;
}

.scarico-card input[type="radio"]:checked + .scarico-card-inner {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-focus);
    background: var(--primary-tint);
}

.scarico-card-inner:hover {
    border-color: var(--primary-tint-border);
}

.scarico-card-icon {
    font-size: 36px;
    line-height: 1;
    margin-bottom: 12px;
}

.scarico-card-label {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.scarico-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.scarico-detail {
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-top: 4px;
}

.scarico-match-box {
    padding: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-lg);
    color: #166534;
}

.scarico-info {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.scarico-info-box {
    padding: 16px;
    background: var(--primary-tint);
    border: 1px solid var(--primary-tint-border);
    border-radius: var(--radius-lg);
    color: var(--primary-tint-text);
    font-size: 14px;
    text-align: center;
}

.scarico-info-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.scarico-loading {
    padding: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.scarico-btn-ricetta {
    display: inline-block;
    font-size: 16px;
    padding: 14px 28px;
}

.scarico-ricetta-riepilogo {
    margin-bottom: 16px;
}

.scarico-ricetta-riepilogo ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.scarico-ricetta-riepilogo li {
    padding: 4px 0;
    font-size: 14px;
}

/* Inline bar (analytics) */
.inline-bar-wrap {
    background: var(--border-light);
    border-radius: var(--radius);
    height: 20px;
    overflow: hidden;
}

.inline-bar {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius);
    min-width: 2px;
    transition: width 0.3s;
}

/* Fasce orarie (chiusura) */
.fasce-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 32px;
}

.fascia-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.fascia-row + .fascia-row {
    border-top: 1px solid var(--border-light);
}

.fascia-label {
    width: 160px;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    color: var(--text);
}

.fascia-bar-wrap {
    flex: 1;
    background: var(--border-light);
    border-radius: var(--radius);
    height: 24px;
    overflow: hidden;
}

.fascia-bar {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius);
    min-width: 2px;
    transition: width 0.3s;
}

.fascia-value {
    width: 36px;
    text-align: right;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    color: var(--text);
}

/* Analytics filtri */
.analytics-filtri {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 12px;
}

.filtri-periodo {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-filtro {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    min-height: 40px;
    transition: all var(--transition);
}

.btn-filtro:hover {
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

.btn-filtro-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.filtri-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filtri-custom label {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    color: var(--text-secondary);
}

.filtri-custom .form-control {
    width: auto;
    min-height: 40px;
}

.analytics-range {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 24px;
}

/* Chiusura */
.chiusura-data-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.data-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.data-form label {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    color: var(--text-secondary);
}

.data-form .form-control {
    width: auto;
}

.chiusura-data-label {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0 0 24px;
    font-weight: 600;
}

/* Storico */
.storico-filtri {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.filtri-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filtro-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filtro-group label {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filtro-group .form-control {
    min-height: 40px;
    min-width: 120px;
}

.filtro-actions {
    flex-direction: row;
    gap: 8px;
    align-items: flex-end;
}

.filtro-actions .btn {
    min-height: 40px;
}

.storico-counter {
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.paginazione {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 0;
}

.pag-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Storico dettaglio */
.page-header-actions {
    display: flex;
    gap: 8px;
}

.dettaglio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dettaglio-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.info-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 12px;
    margin: 0;
}

.info-list dt {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
}

.info-list dd {
    margin: 0;
    font-size: 14px;
}

.totale-finale {
    font-size: 20px;
    color: var(--success);
    font-weight: 700;
}

.comanda-label {
    background: var(--sidebar-bg);
    color: #fff;
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-weight: 600;
    font-size: 12px;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.variante-tag {
    display: inline-block;
    background: var(--border-light);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    margin: 2px;
    color: var(--text-secondary);
}

.reparti-stato-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.reparto-stato-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.reparto-ora {
    font-size: 12px;
    color: var(--text-muted);
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Print */
@media print {
    .admin-sidebar, .admin-header, .page-header-actions, .btn {
        display: none !important;
    }
    .admin-layout .admin-wrapper {
        display: block;
    }
    .admin-content {
        padding: 0 !important;
    }
}

/* Mobile extras */
@media (max-width: 768px) {
    .scarico-cards {
        grid-template-columns: 1fr;
    }

    .scarico-card-inner {
        min-height: auto;
        padding: 16px;
        flex-direction: row;
        gap: 16px;
        text-align: left;
    }

    .scarico-card-icon {
        font-size: 28px;
        margin-bottom: 0;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .image-preview {
        max-width: 100%;
    }

    .dettaglio-grid {
        grid-template-columns: 1fr;
    }

    .info-list {
        grid-template-columns: 100px 1fr;
    }

    .fascia-label { width: 100px; font-size: 12px; }

    .filtri-row {
        flex-direction: column;
    }

    .filtro-group {
        width: 100%;
    }

    .filtro-group .form-control {
        width: 100%;
    }

    .filtro-actions {
        flex-direction: row;
        width: 100%;
    }

    .filtro-actions .btn {
        flex: 1;
    }
}


/* ============================================
   INVENTARIO — Classi aggiuntive
   ============================================ */

.page-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.table-footer {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-secondary);
}

.alert-list {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

/* Badge per tipo movimento */
.badge-tipo-carico { background: #dcfce7; color: #166534; }
.badge-tipo-scarico_vendita { background: #dbeafe; color: #1e40af; }
.badge-tipo-scarico_manuale { background: #fef3c7; color: #92400e; }
.badge-tipo-rettifica { background: var(--border-light); color: #475569; }

/* Inventario fisico — classi gestite da JS */
.riga-modificata {
    background-color: #fef3c7 !important;
}

.cella-differenza {
    font-weight: 700;
}

.diff-positiva { color: #16a34a; }
.diff-negativa { color: #dc2626; }
.diff-zero { color: var(--text-muted); }

.hidden { display: none; }


/* ============================================
   LOGIN PAGE
   ============================================ */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.login-box h1 {
    text-align: center;
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.login-box h2 {
    text-align: center;
    margin: 0 0 32px;
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    min-height: 48px;
    margin-top: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
}

.login-footer a {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-footer a:hover {
    color: var(--text);
}


/* ============================================
   DASHBOARD — Action cards
   ============================================ */

.action-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.action-card:hover {
    text-decoration: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    color: var(--primary);
}

.action-card svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

/* ============================================
   CATALOGO — Toolbar ricerca
   ============================================ */

.catalogo-toolbar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.catalogo-toolbar .toolbar-search {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.catalogo-toolbar .toolbar-search input {
    width: 100%;
}

.catalogo-toolbar .toolbar-info {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ============================================
   VARIANTI — Collega Prodotti
   ============================================ */

.categoria-section {
    margin-bottom: 1.5rem;
}

.categoria-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    padding: 10px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.categoria-prodotti {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: var(--card-bg);
    overflow: hidden;
}

.prodotto-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition);
    font-size: 14px;
}

.prodotto-check-item:hover {
    background: var(--primary-tint);
}

.prodotto-check-item.checked {
    background: var(--primary-tint);
}

.prodotto-check-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.prodotto-check-item label {
    cursor: pointer;
    margin: 0;
    flex: 1;
    user-select: none;
}

.collega-summary {
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.collega-summary strong {
    color: var(--primary);
    font-size: 16px;
}

/* Quick links */
.quick-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* ============================================
   TAVOLI — Griglia card
   ============================================ */

.tavoli-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 1.5rem;
}

.tavolo-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), border-color var(--transition);
    position: relative;
}

.tavolo-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.tavolo-card.tavolo-inattivo {
    opacity: 0.5;
}

.tavolo-card.tavolo-occupato {
    border-color: var(--warning);
    background: #fffbeb;
}

.tavolo-numero {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: 6px;
}

.tavolo-posti {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.tavolo-stato {
    margin-bottom: 12px;
}

.tavolo-ordini-badge {
    position: absolute;
    top: 10px;
    right: 10px;
}

.tavolo-card-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
}

.tavoli-summary {
    display: flex;
    gap: 1.5rem;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tavoli-summary strong {
    color: var(--text);
}

/* ============================================
   DASHBOARD — Classi specifiche
   ============================================ */

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
    min-height: 18px;
}

.dash-up   { color: var(--success); font-weight: 600; }
.dash-down { color: var(--danger);  font-weight: 600; }

/* Layout 2 colonne centrale (ordini 60% / prodotti 40%) */
.dash-main-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* Tabelle compatte dashboard */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.dash-table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 0 10px 8px 0;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    white-space: nowrap;
}

.dash-table td {
    padding: 8px 10px 8px 0;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text);
}

.dash-table tr:last-child td {
    border-bottom: none;
}

/* Barre fasce orarie */
.dash-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12px;
}

.dash-bar-row:last-child {
    margin-bottom: 0;
}

.dash-bar-label {
    width: 130px;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.dash-bar-track {
    flex: 1;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
}

.dash-bar-fill {
    height: 6px;
    border-radius: 3px;
    background: var(--primary);
    min-width: 2px;
    transition: width 0.3s ease;
}

.dash-bar-val {
    width: 60px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
}

/* Righe statistiche nelle card inferiori */
.dash-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text);
}

.dash-stat-row:last-child {
    border-bottom: none;
}

.dash-stat-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

/* ============================================
   SIDEBAR — Bottoni lancio Cassa / Cameriere
   ============================================ */

.sidebar-launch-group {
    display: flex;
    gap: 8px;
    padding: 12px 16px 20px;
}

.sidebar-launch-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.sidebar-launch-btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.sidebar-launch-primary {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

.sidebar-launch-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.sidebar-launch-secondary {
    background: var(--brand-cream);
    color: var(--brand-green-dark);
    border: 1px solid var(--brand-cream);
}

.sidebar-launch-secondary:hover {
    background: #f4c9b9;
    color: var(--brand-green-dark);
    border-color: #f4c9b9;
}

/* ============================================
   CHIUSURA GIORNATA
   ============================================ */

.chiusura-data-badge {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 12px;
}

.chiusura-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chiusura-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Layout 2 colonne riga centrale */
.chiusura-mid-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* Layout 2 colonne riga inferiore (prodotti più larga) */
.chiusura-bottom-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* Barre metodi/tipo */
.chiusura-bar-row {
    margin-bottom: 16px;
}

.chiusura-bar-row:last-child {
    margin-bottom: 0;
}

.chiusura-bar-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 5px;
}

.chiusura-bar-label {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

.chiusura-bar-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.chiusura-bar-track {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    margin-bottom: 4px;
}

.chiusura-bar-fill {
    height: 6px;
    border-radius: 3px;
    background: var(--primary);
    min-width: 2px;
}

.chiusura-bar-fill-alt {
    background: var(--success);
}

.chiusura-bar-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================
   ANALYTICS
   ============================================ */

.analytics-header-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.analytics-range {
    font-size: 13px;
    color: var(--text-secondary);
    margin: -16px 0 20px;
}

/* Layout 2 colonne (3fr + 2fr) */
.analytics-main-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* Colonna destra: due card impilate */
.analytics-side-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Reparti inline */
.analytics-reparti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.analytics-reparto-item {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.analytics-reparto-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.analytics-reparto-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.analytics-reparto-meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   STORICO ORDINI
   ============================================ */

.storico-filtri-card {
    padding: 16px 20px;
    margin-bottom: 12px;
}

.storico-summary {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.storico-summary strong {
    color: var(--text);
}

/* Dettaglio: 3 colonne info */
.storico-det-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

/* ============================================
   PRODOTTI
   ============================================ */

/* Toolbar lista */
.prodotti-toolbar {
    padding: 12px 16px;
    margin-bottom: 12px;
}

.prodotti-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Form: card spaziatura */
.prodotti-form-card {
    margin-bottom: 16px;
    max-width: 860px;
}

/* Form: griglia impostazioni (2 col) */
.prodotti-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ============================================
   CATEGORIE — Modal
   ============================================ */

.cat-modale-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.cat-modale {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    animation: catModaleIn 0.15s ease;
}

@keyframes catModaleIn {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cat-modale-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.cat-modale-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.cat-modale-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: color var(--transition);
}

.cat-modale-close:hover {
    color: var(--text);
}

.cat-modale-body {
    padding: 20px 24px;
}

.cat-modale-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* ========== HOME PAGE ========== */
/* Restyling v26 (23 set 2026): pannello accessi a tutto schermo per tablet 14".
   Classi con prefisso .hm- (le vecchie .home-card / .card-* sono state rimosse). */

.home-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #171413;
    color: #f4efe9;
    font-family: var(--font-base);
}

.home-page footer,
.home-page .site-header,
.home-page .site-footer {
    display: none !important;
}

.home-page main {
    padding: 0;
    margin: 0;
}

.hm {
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 1440px;
    margin: 0 auto;
    padding: clamp(20px, 3vw, 40px) clamp(16px, 3.5vw, 48px);
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 3.5vh, 36px);
}

.hm-top { margin-bottom: auto; }

.hm a { text-decoration: none; }

/* --- Barra in alto: marchio + orologio --- */
.hm-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.hm-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hm-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 4px 14px rgba(224, 85, 46, 0.45));
}

.hm-brand-nome {
    font-size: 22px;
    font-weight: 700;
    color: #f4efe9;
    line-height: 1.2;
}

.hm-brand-sub {
    font-size: 14px;
    color: #a7b3ad;
}

.hm-orologio { text-align: right; }

.hm-ora {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: #f4efe9;
}

.hm-data {
    font-size: 14px;
    color: #a7b3ad;
}

.hm-flash { margin: 0; }

/* --- Sezioni --- */
.hm-sezione {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hm-sezione-operazioni { flex-grow: 1; max-height: 500px; }
.hm-sezione:last-child { margin-bottom: auto; }

.hm-etichetta {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #a7b3ad;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* --- Card grandi: Cassa / Cameriere / Gestione --- */
.hm-griglia-op {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    flex-grow: 1;
}

.hm-op {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 24px;
    min-height: 260px;
    padding: 32px;
    border-radius: 24px;
    color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.hm-op:hover { transform: translateY(-3px); }
.hm-op:active { transform: scale(0.98); }
.hm-op:focus-visible { outline: 3px solid #ffe8dc; outline-offset: 3px; }

.hm-op-icona {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hm-op-icona svg { width: 34px; height: 34px; }

.hm-op-testi {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hm-op-titolo {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.1;
}

.hm-op-desc {
    font-size: 17px;
    line-height: 1.4;
}

.hm-op-azione {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 600;
}

.hm-op-azione svg { width: 28px; height: 28px; flex-shrink: 0; }

.hm-op-cassa {
    background: #e0552e;
    box-shadow: 0 12px 32px rgba(224, 85, 46, 0.35);
}
.hm-op-cassa .hm-op-desc { color: #fbe3da; }
.hm-op-cassa .hm-op-azione { color: #ffe8dc; }

.hm-op-cameriere {
    background: #5a4639;
    box-shadow: 0 12px 32px rgba(59, 47, 40, 0.35);
}
.hm-op-cameriere .hm-op-desc,
.hm-op-cameriere .hm-op-azione { color: #ebe2dc; }

.hm-op-gestione {
    background: #25211e;
    border: 1.5px solid #3c3530;
    color: #f4efe9;
}
.hm-op-gestione .hm-op-icona { background: #312b27; }
.hm-op-gestione .hm-op-desc,
.hm-op-gestione .hm-op-azione { color: #a7b3ad; }

/* --- Card monitor reparti --- */
.hm-griglia-rep {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.hm-rep {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 88px;
    box-sizing: border-box;
    padding: 20px 24px;
    border-radius: 18px;
    background: #25211e;
    border: 1.5px solid #3c3530;
    color: #f4efe9;
    transition: background 0.15s ease, border-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.hm-rep:hover { background: #2d2824; border-color: #4c433e; }
.hm-rep:active { transform: scale(0.98); }
.hm-rep:focus-visible { outline: 3px solid #ffe8dc; outline-offset: 3px; }

.hm-rep-icona {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hm-rep-icona svg { width: 26px; height: 26px; }

/* Colori funzionali dei reparti (NON brand, non cambiare) */
.hm-rep-pizzeria { background: #e74c3c; color: #fff; }
.hm-rep-cucina   { background: #f39c12; color: #1d1305; }
.hm-rep-bevande  { background: #3498db; color: #06121c; }

.hm-rep-testi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
    min-width: 0;
}

.hm-rep-titolo {
    font-size: 20px;
    font-weight: 700;
}

.hm-rep-desc {
    font-size: 14px;
    color: #a7b3ad;
}

.hm-rep-chevron { color: #6f7d76; display: flex; }
.hm-rep-chevron svg { width: 24px; height: 24px; }

/* --- Tablet in verticale e schermi stretti: card grandi a righe --- */
@media (max-width: 1000px), (orientation: portrait) {
    .hm-griglia-op {
        grid-template-columns: 1fr;
        flex-grow: 0;
    }
    .hm-op {
        flex-direction: row;
        align-items: center;
        min-height: 120px;
        padding: 24px;
        gap: 20px;
    }
    .hm-sezione-operazioni { flex-grow: 0; }
    .hm-op-testi { flex-grow: 1; }
    .hm-op-azione { margin-top: 0; }
    .hm-op-titolo { font-size: 28px; }
    .hm-op-azione span { display: none; }
    .hm-griglia-rep { grid-template-columns: 1fr; gap: 12px; }
}

/* --- Telefono --- */
@media (max-width: 600px) {
    .hm-brand-sub { display: none; }
    .hm-brand-nome { font-size: 18px; white-space: nowrap; }
    .hm-data { font-size: 13px; white-space: nowrap; }
    .hm-ora { font-size: 26px; }
    .hm-logo { width: 48px; height: 48px; }
    .hm-op { padding: 20px; gap: 16px; }
    .hm-op-icona { width: 52px; height: 52px; border-radius: 14px; }
    .hm-op-icona svg { width: 28px; height: 28px; }
    .hm-op-titolo { font-size: 24px; }
    .hm-op-desc { font-size: 15px; }
}

/* Badge "DA PAGARE" per ordini banco */
.ordine-badge.badge-da-pagare {
    background: #e67e22;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Badge tipo ordine nella sidebar cassa */
.ordine-tipo {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ordine-tipo.ordine-tipo-totem {
    background: #2ecc71;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.ordine-tipo.ordine-tipo-cassa {
    background: #3498db;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.ordine-tipo.ordine-tipo-asporto {
    background: #e67e22;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.ordine-tipo.ordine-tipo-delivery {
    background: #9b59b6;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.ordine-tipo.ordine-tipo-tavolo {
    background: #1e293b;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* Riga coperto nel dettaglio ordine cassa */
.dettaglio-coperto { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; margin-top: 8px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; font-size: 0.85rem; font-weight: 600; color: #92400e; }
.dettaglio-coperto .coperto-totale { font-weight: 700; font-size: 0.95rem; }

/* ============================================
   BLOCCO 4A — ADMIN SU TABLET (22 set 2026)
   Vale sotto i 1366px OPPURE su qualsiasi schermo touch
   (pointer: coarse), a prescindere dalla risoluzione del tablet.
   Tutto limitato a .admin-layout: cassa, cameriere, totem e KDS
   non usano questo layout e non vengono toccati.
   ============================================ */
@media (max-width: 1366px), (pointer: coarse) {
    /* Sidebar a scomparsa: il contenuto prende tutta la larghezza */
    .admin-layout .admin-main {
        margin-left: 0;
    }
    .admin-layout .admin-sidebar {
        width: 280px;
        transform: translateX(-100%);
        z-index: 2000;
        box-shadow: none;
    }
    .admin-layout .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    /* Velo scuro sul contenuto quando il menu è aperto (tocco = chiude) */
    .admin-layout .admin-sidebar.open + .admin-main::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.35);
        z-index: 1500;
    }
    /* Pulsante ☰ visibile, scuro su header bianco, area tocco 44px */
    .admin-layout .mobile-only {
        display: block;
    }
    .admin-layout .admin-header {
        justify-content: space-between;
        padding: 8px 20px;
    }
    .admin-layout .admin-header .sidebar-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: var(--radius-sm);
    }
    .admin-layout .admin-header .sidebar-toggle span {
        width: 22px;
        background: var(--text);
    }
    .admin-layout .admin-content {
        padding: 8px 20px 24px;
        max-width: none;
    }
    /* Voci del menu più alte per il dito */
    .admin-layout .admin-nav-link {
        min-height: 48px;
    }
}

/* Touch target 44px su pulsanti e campi dell'admin (solo schermi touch) */
@media (pointer: coarse) {
    .admin-layout .admin-content .btn,
    .admin-layout .admin-content .btn-sm {
        min-height: 44px;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .admin-layout .admin-table .action-buttons {
        gap: 8px;
    }
    .admin-layout .admin-content input:not([type=checkbox]):not([type=radio]),
    .admin-layout .admin-content select {
        min-height: 44px;
    }
}

/* ============================================
   BLOCCO 4B — FILTRO A PILLOLE NELLE LISTE ADMIN
   ============================================ */
.filtro-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.filtro-pill {
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card-bg);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.filtro-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
@media (pointer: coarse) {
    .filtro-pill { min-height: 44px; }
}

/* Interruttore "Disponibile" nelle liste: area di tocco 44px senza ingrandirlo (Blocco 4B) */
@media (pointer: coarse) {
    .admin-layout .admin-table .toggle-switch::after {
        content: '';
        position: absolute;
        inset: -10px -6px;
    }
}

/* ============================================
   BLOCCO 4C — SCHEDE DI MODIFICA
   ============================================ */
/* Pulsante x "Rimuovi" nelle righe ricetta/semilavorato: 44px, rosso al tocco */
.admin-layout .btn-remove {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.admin-layout .btn-remove:hover,
.admin-layout .btn-remove:active {
    border-color: var(--danger);
    color: var(--danger);
    background: #fef2f2;
}
/* Campo non valido + messaggio SOTTO il campo, non in cima alla pagina */
.admin-layout .form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}
.admin-layout .campo-errore {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--danger);
    line-height: 1.3;
}

/* Campo in sola lettura (es. costo di un semilavorato, calcolato dalla ricetta): si vede che non si scrive */
.admin-layout .campo-decimale[readonly] {
    background: #f1f5f9;
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Scheda prodotto (Blocco 4C): avviso "non attivo" e opzione "Rimuovi immagine" */
.admin-layout .text-danger { color: var(--danger); }
.admin-layout .rimuovi-immagine { margin-top: 10px; }

/* ============================================
   BLOCCO 4D — FINESTRE INTERNE (conferme e avvisi) al posto di confirm()/alert()
   ============================================ */
.dlg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 10000;
}
.dlg-box {
    background: var(--card-bg);
    border-radius: 12px;
    border-top: 5px solid var(--primary);
    padding: 28px 28px 22px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.dlg-box.dlg-errore   { border-top-color: var(--danger); }
.dlg-box.dlg-successo { border-top-color: var(--success); }
.dlg-testo {
    margin: 0 0 22px;
    font-size: 17px;
    line-height: 1.45;
    color: var(--text);
    white-space: pre-line;
}
.dlg-azioni {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.dlg-azioni .btn {
    min-height: 48px;
    min-width: 120px;
    font-size: 16px;
}

/* ============================================
   BLOCCO 4D — AVVISI (flash) fluttuanti in alto al centro, sopra il contenuto
   ============================================ */
.admin-layout .avviso-flash {
    position: fixed;
    top: 76px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    width: calc(100% - 32px);
    max-width: 640px;
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 16px 16px 20px;
    font-size: 16px;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
    cursor: pointer;
    animation: avvisoEntra 0.25s ease-out;
    transition: opacity 0.3s, transform 0.3s;
}
.admin-layout .avviso-flash-testo { flex: 1; }
.admin-layout .avviso-flash-chiudi {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin: -6px -4px -6px 0;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}
.admin-layout .avviso-flash-via {
    opacity: 0;
    transform: translate(-50%, -12px);
}
@keyframes avvisoEntra {
    from { opacity: 0; transform: translate(-50%, -12px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================
   BLOCCO 4D — INTESTAZIONI DELLE TABELLE BLOCCATE IN ALTO durante lo scroll
   Da 769px in su (sotto, le tabelle diventano schede e l'intestazione non c'è).
   Il contenitore deve lasciare "overflow" libero, altrimenti position:sticky non funziona.
   ============================================ */
@media (min-width: 769px) {
    .admin-layout .admin-table-wrapper,
    .admin-layout .card:has(> .admin-table) {
        overflow: visible !important;
    }
    .admin-layout .admin-table thead th {
        position: sticky;
        top: var(--sticky-top, 0px);
        z-index: 5;
        background: var(--bg);
        box-shadow: 0 1px 0 var(--border);
    }
    .admin-layout .admin-table thead th:first-child { border-top-left-radius: var(--radius-lg); }
    .admin-layout .admin-table thead th:last-child  { border-top-right-radius: var(--radius-lg); }
}
/* Barra con il pulsante Salva, bloccata in cima alla pagina sopra la tabella */
.admin-layout .barra-salva {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

/* Riga appena modificata, ritrovata al ritorno sulla lista (Blocco 4D "restare sul punto") */
.admin-layout .admin-table tr.riga-sul-punto td {
    background: #fef3c7 !important;
    transition: background 0.6s;
}

/* ============================================
   RESTYLING v26 — CORNICE ADMIN (23 set 2026)
   Stessa grafica di Home, Cassa e Cameriere: barra verde scura, sfondo crema,
   schede bianche arrotondate, pulsante "Elimina" come icona cestino.
   Tutto limitato a .admin-layout: cassa, cameriere, totem, KDS e home NON cambiano.
   ============================================ */

.admin-layout {
    --bg: #f3f1ee;
    --border: #e4e0da;
    --border-light: #f0ede8;
    --text: #292420;
    --text-secondary: #6b645b;
    --text-muted: #8a8378;
    --radius-lg: 16px;
    --radius: 10px;
    background: #f3f1ee;
    color: #292420;
}

/* --- Barra in alto --- */
.admin-layout .admin-header {
    background: #42332a;
    color: #fff;
    border-bottom: none;
    min-height: 64px;
    padding: 8px 20px;
    justify-content: space-between;
}

.admin-layout .adm-marchio {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #fff;
}

.admin-layout .adm-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.admin-layout .adm-marchio-testi {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.admin-layout .adm-marchio-nome { font-size: 17px; font-weight: 800; color: #fff; }
.admin-layout .adm-marchio-sub { font-size: 12px; color: #d3c3b9; }

.admin-layout .adm-btn-cassa {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    background: #e0552e;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.admin-layout .adm-btn-cassa:hover { background: #c2441f; color: #fff; text-decoration: none; }

.admin-layout .adm-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #5a4639;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
}

.admin-layout .admin-header .user-name { color: #fff; font-size: 15px; }

.admin-layout .adm-btn-esci {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.admin-layout .adm-btn-esci:hover { background: rgba(255, 255, 255, 0.1); color: #fff; text-decoration: none; }

/* Pulsante ☰ chiaro su barra scura */
.admin-layout .admin-header .sidebar-toggle {
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
}

.admin-layout .admin-header .sidebar-toggle span { background: #fff; }

/* --- Menu laterale --- */
.admin-layout .admin-sidebar {
    background: #fff;
    color: #292420;
    border-right: 1px solid #e4e0da;
}

.admin-layout .admin-nav { padding: 8px 12px 16px; }

.admin-layout .nav-group-label {
    padding: 14px 14px 6px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.2px;
    color: #8a8378;
}

.admin-layout .admin-nav-link {
    min-height: 46px;
    padding: 0 14px;
    margin-bottom: 2px;
    border-radius: 12px;
    border-left: none;
    color: #292420;
    font-size: 15px;
    font-weight: 600;
}

.admin-layout .admin-nav-link:hover { background: #f3f1ee; color: #292420; }

.admin-layout .admin-nav-link.active {
    background: #42332a;
    color: #fff;
    font-weight: 700;
}

.admin-layout .nav-icon { opacity: 0.6; }
.admin-layout .admin-nav-link.active .nav-icon { opacity: 1; }

.admin-layout .nav-separator { background: #f0ede8; margin: 8px 6px; }

.admin-layout .sidebar-launch-btn {
    border-radius: 12px;
    min-height: 44px;
}

/* --- Titoli di pagina --- */
.admin-layout .page-header { margin-bottom: 20px; }

.admin-layout .page-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: #292420;
    letter-spacing: 0;
}

/* --- Schede e riquadri numerici --- */
.admin-layout .card {
    border: 1.5px solid #e4e0da;
    border-radius: 18px;
    box-shadow: none;
}

.admin-layout .card-header {
    font-size: 17px;
    font-weight: 800;
    border-bottom-color: #f0ede8;
}

.admin-layout .stat-box,
.admin-layout .stat-card {
    border: 1.5px solid #e4e0da;
    border-radius: 18px;
    padding: 18px 20px;
    text-align: left;
    background: #fff;
}

.admin-layout .stat-label {
    font-size: 13px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    color: #6b645b;
}

.admin-layout .stat-value {
    font-size: 30px;
    font-weight: 800;
    color: #292420;
    font-variant-numeric: tabular-nums;
}

.admin-layout .stat-box-primary {
    background: #42332a;
    border-color: #42332a;
}

.admin-layout .stat-box-primary .stat-label,
.admin-layout .stat-box-primary .stat-detail,
.admin-layout .stat-box-primary .kpi-sub,
.admin-layout .stat-box-primary .text-muted { color: #d3c3b9; }

.admin-layout .stat-box-primary .stat-value { color: #fff; }

.admin-layout .stat-box-success { background: #f7f2ef; border-color: #bfe3cf; }
.admin-layout .stat-box-warning { background: #fff6ea; border-color: #f2c27a; }
.admin-layout .stat-box-danger  { background: #fcefed; border-color: #f0c9c4; }

/* --- Tabelle --- */
.admin-layout .admin-table-wrapper {
    border: 1.5px solid #e4e0da;
    border-radius: 18px;
    box-shadow: none;
}

.admin-layout .admin-table thead,
.admin-layout .admin-table th { background: #f7f5f2; }

.admin-layout .admin-table th {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #6b645b;
    border-bottom: 1px solid #e4e0da;
}

.admin-layout .admin-table td {
    border-bottom-color: #f0ede8;
    font-size: 15px;
}

.admin-layout .admin-table tbody tr:hover { background: #faf8f5; }

/* --- Pulsanti --- */
.admin-layout .btn {
    border-radius: 10px;
    font-weight: 700;
}

.admin-layout .btn-primary,
.admin-layout .btn-success { background: #5a4639; color: #fff; }

.admin-layout .btn-primary:hover,
.admin-layout .btn-success:hover { background: #42332a; }

.admin-layout .btn-secondary,
.admin-layout .btn-outline {
    background: #fff;
    border: 1.5px solid #d6d0c7;
    color: #292420;
}

.admin-layout .btn-secondary:hover,
.admin-layout .btn-outline:hover { background: #f7f5f2; color: #292420; }

.admin-layout .btn-danger { background: #e0552e; }
.admin-layout .btn-danger:hover { background: #c2441f; }

/* "Elimina" nelle righe e nelle schede: diventa un'icona cestino (la conferma resta).
   Il testo rimane nel pulsante per i lettori di schermo: è solo nascosto alla vista. */
.admin-layout .btn.btn-sm.btn-danger {
    font-size: 0;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    background: #fff;
    border: 1.5px solid #e4e0da;
    color: transparent;
    flex-shrink: 0;
}

.admin-layout .btn.btn-sm.btn-danger::before {
    content: '';
    width: 20px;
    height: 20px;
    background: #d14b26;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.admin-layout .btn.btn-sm.btn-danger:hover { background: #fcefed; border-color: #f0c9c4; }

@media (pointer: coarse) {
    .admin-layout .admin-content .btn.btn-sm.btn-danger {
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 0;
    }
}

/* --- Etichette, campi, avvisi --- */
.admin-layout .badge { border-radius: 6px; font-weight: 700; }

.admin-layout .form-control {
    border: 1.5px solid #e4e0da;
    border-radius: 10px;
}

.admin-layout .form-control:focus {
    border-color: #5a4639;
    box-shadow: 0 0 0 3px rgba(59, 47, 40, 0.15);
}

.admin-layout .alert { border-radius: 14px; }
.admin-layout .alert-info { background: #f6f1ee; border-color: #e3d7cf; color: #403229; }

/* Pulsanti affiancati nelle celle: stessa linea */
.admin-layout .admin-table td .btn { vertical-align: middle; }

/* Tavoli: schede della lista */
.admin-layout .admin-content .tavolo-card,
.admin-layout .admin-content .tavolo-item { border-radius: 16px; }

/* Reparti aggiunti dal ristoratore: colore di base */
.hm-rep-icona:not(.hm-rep-pizzeria):not(.hm-rep-cucina):not(.hm-rep-bevande) { background: #e0552e; color: #fff; }
