/* ========== GLOBAL DESIGN SYSTEM - SMART POS ========== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #60a5fa;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f8fafc;
    --background-alt: #f1f5f9;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --font-main: 'Arial', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-size-base: 11px;
    --font-size-sm: 11px;
    --font-size-lg: 14px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    overflow: auto;
    height: 100vh;
    font-size: var(--font-size-base);
}

/* ========== SHARED PAGE LAYOUTS ========== */

/* Standard Page Container (ex accounting-container) */
.std-page-container {
    padding: 15px;
    height: calc(100vh - 72px);
    /* Corrected to match header height */
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
    box-sizing: border-box;
}

.std-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    display: flex;
    flex-direction: column;
}

/* Standard Table Scroll Wrapper */
.std-table-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
    border-radius: 12px;
    background: white;
    box-shadow: var(--shadow-md);
}

/* Standard Data Table (ex entries-table) */
.std-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
}

.std-table thead {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #f1f5f9;
}

.std-table th {
    background: #f1f5f9;
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.std-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 11px;
    transition: background-color 0.2s;
}

.std-table tr:hover td {
    background-color: #f8fafc;
}

/* Common Table Elements */
.col-filter {
    width: 100%;
    padding: 6px;
    margin-top: 4px;
    font-size: 11px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.col-filter:focus {
    border-color: var(--primary);
    outline: none;
}

.std-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11px;
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

/* Modern Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background: #fff;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Standard Badge Overrides */
.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-neutral {
    background: #f1f5f9;
    color: #64748b;
}

/* Top Controls Bar (Standard) */
.std-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

/* ========== SHARED HEADER ========== */
.pos-header {
    height: 72px;
    background: var(--primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
    color: white;
}

.pos-header h1 {
    font-size: 22px;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}

/* Standardized Premium Buttons */
.btn-premium {
    height: 36px;
    padding: 0 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.btn-premium:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-premium:active {
    transform: translateY(0);
}

.btn-premium-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-premium-primary:hover {
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-premium-secondary {
    background: #64748b;
    color: white;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.2);
}

.btn-premium-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* Alias for existing hero button - using standard CSS rules */
.btn-new-hero {
    height: 36px;
    padding: 0 15px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-new-hero.btn-sm {
    padding: 0 15px;
    height: 36px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 12px;
    gap: 10px;
    letter-spacing: 0.5px;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white !important;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle-btn i {
    color: white !important;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.sidebar-toggle-btn:active {
    transform: translateY(0);
}

/* ========== PERMANENT SIDEBAR (Adapted for Drawer use in POS) ========== */
/* Renamed to generic .sidebar but handling drawer behavior via .active */
.sidebar {
    position: fixed;
    top: 0;
    left: -200px;
    /* Hide by default */
    width: 200px;
    height: 100vh;
    background: var(--primary-dark);
    /* Dark Blue */
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 5000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
}

.sidebar.active {
    left: 0;
    /* Slide in */
}

/* Static variant for Admin Pages */
.sidebar.sidebar-static {
    position: relative;
    left: 0;
    height: 100vh;
    box-shadow: none;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1;
    /* Lower z-index than drawer */
}

.brand {
    padding: 0 20px 18px;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: 0.2px;
    margin-bottom: 0;
    text-transform: uppercase;
    color: white;
    text-decoration: none;
    display: block;
}

/* ========== NAVIGAZIONE OPERATIVA SALGRADO ========== */
body.salgrado-mode {
    padding-top: 64px !important;
}

.salgrado-mode .app-container {
    height: 100%;
    min-height: 0;
}

.salgrado-mode .sidebar-toggle-btn {
    display: none !important;
}

.salgrado-global-nav {
    position: fixed;
    z-index: 8000;
    top: 0;
    right: 0;
    left: 0;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 22px;
    border-bottom: 1px solid #dbe3ef;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 5px 20px rgba(15, 23, 42, 0.07);
    backdrop-filter: blur(12px);
}

.salgrado-nav-brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.salgrado-brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    font-size: 13px;
    box-shadow: 0 7px 18px rgba(37, 99, 235, 0.22);
}

.salgrado-nav-links {
    min-width: 0;
    display: flex;
    flex: 1;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.salgrado-nav-links::-webkit-scrollbar {
    display: none;
}

.salgrado-nav-links a {
    min-height: 40px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
    transition: var(--transition);
}

.salgrado-nav-links a:hover,
.salgrado-nav-links a:focus-visible {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: var(--primary-dark);
    outline: none;
}

.salgrado-nav-links a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 7px 18px rgba(37, 99, 235, 0.2);
}

@media (max-width: 980px) {
    .salgrado-global-nav {
        gap: 10px;
        padding: 0 12px;
    }

    .salgrado-nav-brand > span:last-child {
        display: none;
    }

    .salgrado-nav-links a {
        padding: 0 9px;
        font-size: 10px;
    }
}

@media (max-width: 620px) {
    body.salgrado-mode {
        padding-top: 58px !important;
    }

    .salgrado-global-nav {
        height: 58px;
        padding: 0 8px;
    }

    .salgrado-brand-mark {
        width: 32px;
        height: 32px;
    }

    .salgrado-nav-links a {
        min-height: 38px;
    }
}

.brand span {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.2px;
    opacity: 0.75;
}

.company-selector {
    margin: 0 10px 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
}

.company-selector label {
    display: block;
    margin-bottom: 7px;
    color: rgba(255, 255, 255, 0.68);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.company-select-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
}

.company-select-wrap i {
    color: white;
    font-size: 12px;
}

.company-select-wrap select {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: white;
    font-family: inherit;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.company-select-wrap select option {
    color: #111827;
    background: white;
}

.sidebar .nav-item-dashboard {
    margin-bottom: 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .nav-item {
    padding: 12px 25px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 14px;
    border-radius: 0;
}

/* Fix for flashing: No transform, just color change */
.sidebar .nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: none;
}

.sidebar .nav-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border-left: 3px solid white;
}

.sidebar .nav-item i {
    width: 20px;
    text-align: center;
    font-size: 14px;
    min-width: 20px;
}

.nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffffff;
    font-weight: 700;
    padding: 20px 25px 10px;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 4900;
    display: none;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar .nav-item i {
    width: 20px;
    text-align: center;
    font-size: 14px;
    min-width: 20px;
}

.nav-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #ffffff;
    font-weight: 700;
    padding: 20px 25px 10px;
}

/* Keeping minimal classes if needed for JS toggles, but enforcing display none if we want permanent */
.sidebar-overlay {
    display: none !important;
    /* No overlay for permanent sidebar */
}

/* ========== SHARED UTILS ========== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    background: #333;
    color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 9999;
    font-weight: 600;
    animation: slideUp 0.3s ease-out;
}

.toast.show {
    display: block;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.info {
    background: var(--info);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin: 12px 0;
}

/* Fallback Badge */
.fallback-badge {
    background: #ff9800;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
    text-transform: uppercase;
}

.fallback-badge.active {
    display: flex;
}

.fallback-badge i {
    font-size: 14px;
}

/* ========== IN-LINE EDITING - PREMIUM STYLE ========== */
.table-compact {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.table-compact th {
    background: #f1f5f9;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    padding: 8px 12px;
    border-bottom: 2px solid var(--border);
    text-align: left;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background-clip: padding-box;
    /* Fix for borders in sticky headers */
}

.table-compact td {
    padding: 4px 8px;
    /* Ridotto drasticamente come richiesto */
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    transition: var(--transition);
}

.table-compact tr:last-child td {
    border-bottom: none;
}

.table-compact tr:hover td {
    background: #f8fafc;
    color: var(--primary);
}

.table-compact tr {
    transition: var(--transition);
}

.inline-edit-input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 6px;
    font-family: inherit;
    font-size: 11px;
    /* Un po' più piccolo per stare nello spazio ridotto */
    color: var(--text-primary);
    transition: var(--transition);
    min-height: 24px;
    line-height: normal;
}

.inline-edit-input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Excel-like Drag Fill Styles - Global */
.drag-fill-cell {
    position: relative !important;
}

.fill-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 10px;
    height: 10px;
    background: var(--primary);
    border: 1px solid white;
    cursor: crosshair;
    z-index: 100;
    display: none;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

.drag-fill-cell:hover .fill-handle {
    display: block;
}

.drag-fill-cell.selected-fill {
    background-color: rgba(37, 99, 235, 0.1) !important;
}

.drag-fill-cell.selected-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed var(--primary);
    pointer-events: none;
    z-index: 50;
}

/* Undo Button in Toast */
.btn-undo {
    background: white;
    color: var(--primary);
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    margin-left: 15px;
    cursor: pointer;
    text-transform: uppercase;
    transition: var(--transition);
}

.btn-undo:hover {
    background: #f1f5f9;
    transform: scale(1.05);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    padding: 32px;
    position: relative;
    animation: modalSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.inline-edit-input.number {
    text-align: right;
    letter-spacing: 0.5px;
    min-width: 60px;
    /* Previene tagli su cifre lunghe */
}

.table-compact th,
.table-compact td {
    padding: 4px 8px !important;
}

.btn-inline-save {
    padding: 8px 16px;
    background: var(--success);
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-inline-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.3);
    filter: brightness(1.1);
}

.btn-inline-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========== STATUS BADGES (PILLS) ========== */
.stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.stock-low {
    background: #fff1f2;
    color: #e11d48;
    border: 1px solid #fecdd3;
}

.stock-ok {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.stock-empty {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fee2e2;
    font-weight: 900;
}

/* Glassmorphism effects for cards */
.glass-card {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ========== MULTI-SELECT DROPDOWN ========== */
.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-trigger {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-width: 150px;
    transition: var(--transition);
}

.multi-select-trigger:hover {
    border-color: var(--primary);
}

.multi-select-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 240px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
}

.multi-select-options.active {
    display: block;
}

.multi-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.multi-option:hover {
    background: #f1f5f9;
}

.multi-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.multi-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 800;
}

/* Sticky header for .inv-table */
.inv-table {
    width: 100%;
    border-collapse: collapse;
}

/* Fix per lo Sticky Header e Filto Bar */
.inv-controls {
    position: sticky;
    top: 0;
    z-index: 1000;
    /* Stai sopra la tabella */
}

.inv-table thead th {
    background: #f8fafc;
    /* Leggermente diverso dal corpo per stacco visivo */
    color: var(--text-secondary);
    padding: 8px 12px;
    /* Ridotto per header più "basso" */
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: -1px;
    /* Fondamentale se il contenitore scorre */
    z-index: 100;
    border-bottom: 2px solid var(--border);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.inv-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* Micro-animations for table rows */
.inv-table tbody tr {
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-out;
}

.inv-table tbody tr:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Editable Inputs in Tables - Transparent Mode */
.editable-input,
.editable-select {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px;
    font-family: 'Arial', sans-serif;
    font-size: 11px;
    color: inherit;
    transition: all 0.2s;
    border-radius: 4px;
}

.editable-input:hover,
.editable-select:hover {
    border-color: #e2e8f0;
    background: #f8fafc;
}

.editable-input:focus,
.editable-select:focus {
    border-color: var(--primary);
    background: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* ========== FONT & TEXT UTILITIES ========== */

/* Font Families */
.font-arial {
    font-family: 'Arial', sans-serif;
}

.font-verdana {
    font-family: 'Verdana', sans-serif;
}

.font-calibri {
    font-family: 'Calibri', 'Segoe UI', sans-serif;
}

/* Text Sizes */
.text-xs {
    font-size: 10px;
}

.text-sm {
    font-size: 11px;
}

.text-md {
    font-size: 13px;
}

.text-lg {
    font-size: 15px;
}

.text-xl {
    font-size: 18px;
}

/* Font Weights */
.font-normal {
    font-weight: 400;
}

.font-bold {
    font-weight: 700;
}

/* ========== RESPONSIVENESS & TABLET OPTIMIZATIONS ========== */
.sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 6000;
}

@media screen and (max-width: 1100px) {
    :root {
        --font-size-base: 14px;
        --font-size-sm: 13px;
        --font-size-lg: 18px;
    }

    /* Force sidebar to be hidden even if 'static' in template */
    .sidebar.sidebar-static,
    .sidebar {
        position: fixed !important;
        left: -280px !important;
        width: 280px !important;
        z-index: 5001 !important;
        transition: left 0.3s ease !important;
        top: 0 !important;
        height: 100vh !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3) !important;
    }

    .sidebar.active {
        left: 0 !important;
    }

    .sidebar-overlay {
        display: block !important;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
        z-index: 5000 !important;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .std-page-container {
        padding: 10px;
        height: auto;
        min-height: calc(100vh - 72px);
        overflow: visible;
    }

    .std-table-wrapper {
        overflow-x: auto;
        border-radius: 8px;
    }

    .std-table th,
    .std-table td {
        padding: 12px 15px !important;
        font-size: 14px !important;
    }

    .table-compact th,
    .table-compact td {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }

    .btn-premium {
        height: 48px;
        padding: 0 24px;
        font-size: 15px;
    }

    .form-control,
    .inline-edit-input {
        height: 44px;
        font-size: 16px !important;
    }

    .pos-header {
        padding: 0 15px;
        height: 64px;
    }

    .sidebar-toggle-btn {
        display: flex !important;
    }

    .pos-header h1 {
        font-size: 18px;
    }

    /* DEBUG INDICATOR: Confirming media query is active */
    body::before {
        content: "MOBILE/TABLET MODE ACTIVE 📱";
        position: fixed;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        background: #ef4444;
        color: white;
        padding: 4px 12px;
        font-size: 10px;
        font-weight: 800;
        z-index: 10000;
        border-radius: 0 0 8px 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }
}

@media screen and (max-width: 768px) {
    :root {
        --font-size-base: 15px;
        --font-size-sm: 14px;
    }

    .std-table th,
    .std-table td {
        padding: 15px 10px !important;
        font-size: 15px !important;
    }

    .std-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .pos-header h1 {
        font-size: 16px;
    }
}
