/* Variables de design - Premium Dark Mode */
:root {
    --bg-main: #090d16;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(26, 36, 57, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(59, 130, 246, 0.5);
    
    --color-primary: #3b82f6;       /* Bleu néon */
    --color-secondary: #8b5cf6;     /* Violet */
    --color-success: #10b981;       /* Émeraude (Opérationnel) */
    --color-special: #a78bfa;       /* Mauve clair (Spécial) */
    --color-danger: #ef4444;        /* Rouge */
    --color-warning: #f59e0b;       /* Orange */
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --sidebar-width: 260px;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset & Styles Généraux */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Layout SPA */
#app-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Barre Latérale (Sidebar) */
aside {
    width: var(--sidebar-width);
    background-color: rgba(11, 15, 25, 0.95);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.logo-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--color-primary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1.5px;
}

/* Menu de Navigation */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.nav-item button i {
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
}

.nav-item button:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active button {
    color: white;
    background: linear-gradient(to right, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.05));
    border-left: 3px solid var(--color-primary);
    border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
    padding-left: calc(1rem - 3px);
}

.nav-item.active button i {
    color: var(--color-primary);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-footer .app-version {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-footer .restaurant-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Zone Principale de Contenu */
main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    min-height: 100vh;
    background: radial-gradient(circle at 70% 10%, rgba(30, 41, 59, 0.2) 0%, transparent 60%);
}

.page-view {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.page-view.active {
    display: block;
}

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

/* Headers de Page */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1.5rem;
}

.page-title {
    min-width: 0;
    flex: 1;
}

.page-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Cartes Métriques (KPIs) */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.kpi-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
    background-color: var(--bg-card-hover);
    box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.5);
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: transparent;
}

.kpi-card.blue::after { background: var(--color-primary); }
.kpi-card.purple::after { background: var(--color-secondary); }
.kpi-card.success::after { background: var(--color-success); }
.kpi-card.warning::after { background: var(--color-warning); }

.kpi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.kpi-card-header span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.04);
}

.kpi-card.blue .kpi-icon { color: var(--color-primary); background-color: rgba(59, 130, 246, 0.1); }
.kpi-card.purple .kpi-icon { color: var(--color-secondary); background-color: rgba(139, 92, 246, 0.1); }
.kpi-card.success .kpi-icon { color: var(--color-success); background-color: rgba(16, 185, 129, 0.1); }
.kpi-card.warning .kpi-icon { color: var(--color-warning); background-color: rgba(245, 158, 11, 0.1); }

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.kpi-footer {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Grille de Graphiques */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Variante à deux colonnes égales (ex: doughnut + classement) */
.dashboard-grid-even {
    grid-template-columns: 1fr 1fr;
}

/* Variante KPI à 3 colonnes (ex: statistiques du mois) */
.metrics-grid-3 {
    grid-template-columns: 1fr;
}

.dashboard-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.75rem;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.dashboard-card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-container {
    position: relative;
    width: 100%;
    min-height: 320px;
}

.chart-container-sm {
    min-height: 280px;
}

/* Inputs, Sélecteurs et Filtres */
.custom-select {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-md);
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.custom-select:hover, .custom-select:focus {
    border-color: var(--border-color-focus);
    background-color: rgba(255, 255, 255, 0.08);
}

.custom-select option {
    background-color: #0b0f19;
    color: var(--text-primary);
}

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

.search-input-wrapper i {
    position: absolute;
    left: 0.85rem;
    color: var(--text-muted);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.search-input {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border-radius: var(--border-radius-md);
    outline: none;
    font-size: 0.9rem;
    width: 250px;
    transition: var(--transition-smooth);
}

.search-input:focus {
    border-color: var(--color-primary);
    width: 320px;
    background-color: rgba(255, 255, 255, 0.08);
}

/* Tableaux de Données */
/* Tableaux de Données avec En-tête Fixe (Sticky Header) */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 65vh;
    margin-top: 1rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: #0f172a;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.data-table td {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    white-space: nowrap;
}

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

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* ----------------------------------------------------
   DESIGN SOIGNÉ HAUT DE GAMME : TABLEAU DES RECETTES
   ---------------------------------------------------- */
.recettes-table-card {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.6) !important;
    border-radius: 16px !important;
    overflow: hidden;
}

#table-recette-monthly {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

#table-recette-monthly thead tr {
    background: #0f172a;
}

#table-recette-monthly th {
    position: sticky;
    top: 0;
    z-index: 25;
    padding: 0.95rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

/* Fond opaque pour éviter toute transparence au défilement */
th.th-date { color: #93c5fd; background: #162440; }
th.th-recette { color: #6ee7b7; background: #0f2c28; }
th.th-tpe { color: #93c5fd; background: #162440; }
th.th-glovo { color: #fcd34d; background: #2f2719; }
th.th-reste { color: #c4b5fd; background: #272044; font-weight: 800; }
th.th-depenses { color: #fca5a5; background: #2d1a21; }
th.th-net { color: #facc15; background: #3c3214; font-weight: 800; font-size: 0.86rem; }
th.th-notes { color: var(--text-secondary); background: #0f172a; }
th.th-actions { color: var(--text-secondary); background: #0f172a; text-align: center; }

/* Totaux du bas fixés également (Sticky Footer) */
#table-recette-monthly tfoot td,
#table-recette-monthly tfoot th {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: #0f172a;
    border-top: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.45);
}

#table-recette-monthly tbody tr {
    transition: background 0.15s ease;
}

#table-recette-monthly tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.015);
}

#table-recette-monthly tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.08) !important;
}

#table-recette-monthly td {
    padding: 0.6rem 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.editable-cell-input {
    width: 100%;
    min-width: 90px;
    padding: 0.5rem 0.7rem;
    background: rgba(15, 23, 42, 0.85);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.editable-cell-input:hover {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(30, 41, 59, 0.95);
}

.editable-cell-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #0f172a;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.cell-reste-badge {
    font-weight: 800;
    font-size: 0.95rem;
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.35);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    display: inline-block;
    width: 100%;
    text-align: right;
    box-sizing: border-box;
}

.cell-net-badge {
    font-weight: 900;
    font-size: 1.05rem;
    color: #facc15;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.28), rgba(202, 138, 4, 0.14));
    border: 1px solid rgba(234, 179, 8, 0.55);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    display: inline-block;
    width: 100%;
    text-align: right;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.2);
    box-sizing: border-box;
}

/* Tableau Comparateur Spécifique */
.comparison-container {
    margin-top: 1.5rem;
}

.comp-table {
    font-size: 0.85rem;
}

.comp-table th.category-col {
    position: sticky;
    left: 0;
    background-color: #121926;
    z-index: 10;
}

.comp-table td.category-col {
    position: sticky;
    left: 0;
    background-color: #0d121c;
    font-weight: 600;
    z-index: 10;
    border-right: 1px solid var(--border-color);
}

.trend-panel-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border-color);
}

.trend-panel-row:last-child {
    border-bottom: none;
}

.trend-panel-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.trend-panel-value {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.trend-panel-value .amount {
    font-size: 1.05rem;
    font-weight: 700;
}

.diff-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.diff-badge.up {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

.diff-badge.down {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.diff-badge.neutral {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

/* Badges de Statut */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.badge.success { background-color: rgba(16, 185, 129, 0.1); color: var(--color-success); }
.badge.primary { background-color: rgba(59, 130, 246, 0.1); color: var(--color-primary); }
.badge.special { background-color: rgba(167, 139, 250, 0.1); color: var(--color-special); }

/* Vue de Comparaison & Sélection de Mois */
.comparison-selectors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: var(--border-radius-lg);
}

.checkbox-btn {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.checkbox-btn input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-btn-content {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1.15rem;
    border-radius: var(--border-radius-md);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    user-select: none;
}

.checkbox-btn input:checked + .checkbox-btn-content {
    border-color: var(--color-primary);
    color: white;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.1));
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.checkbox-btn:hover .checkbox-btn-content {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Zone d'Import de Fichiers (Drag and Drop) */
.import-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background-color: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 3.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.import-zone:hover, .import-zone.dragover {
    border-color: var(--color-primary);
    background-color: var(--bg-card-hover);
}

.import-zone-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: rgba(59, 130, 246, 0.08);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.import-zone h4 {
    font-size: 1.15rem;
    font-weight: 600;
}

.import-zone p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.import-zone input[type="file"] {
    display: none;
}

/* Preview de l'Import */
.import-preview-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.75rem;
    margin-top: 2rem;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.import-preview-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.import-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-item label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.meta-item span {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), #2563eb);
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: var(--color-danger);
    color: white;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Listes */
.category-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1rem;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    transition: var(--transition-smooth);
}

.ranking-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    transform: translateX(3px);
}

.ranking-number {
    font-size: 0.8rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.ranking-item:nth-child(1) .ranking-number { background-color: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.ranking-item:nth-child(2) .ranking-number { background-color: rgba(209, 213, 219, 0.15); color: #d1d5db; }
.ranking-item:nth-child(3) .ranking-number { background-color: rgba(180, 83, 9, 0.15); color: #b45309; }

.ranking-details {
    flex: 1;
}

.ranking-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.ranking-share {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.ranking-value {
    font-weight: 700;
    font-size: 0.95rem;
}

/* Alertes */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-md);
    border: 1px solid transparent;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.05);
    border-color: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.05);
    border-color: rgba(245, 158, 11, 0.15);
    color: #fde047;
}

/* Responsivité générale et affichage hybride PC / Mobile */
@media (max-width: 1024px) {
    .dashboard-grid,
    .dashboard-grid-even {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #app-layout {
        flex-direction: column;
        min-height: 100vh;
    }
    
    /* Transformation de la Sidebar en Top Header sticky ultra-compact */
    aside {
        width: 100%;
        height: auto;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        padding: 0.6rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        background-color: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        z-index: 990;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .logo-container {
        margin-bottom: 0;
        gap: 0.6rem;
        flex-shrink: 0;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .logo-text h1 {
        font-size: 1.05rem;
        line-height: 1.1;
    }

    .logo-text span {
        display: none;
    }
    
    /* Affichage du User Info Badge en haut à droite sur Mobile */
    .sidebar-footer {
        display: flex !important;
        margin-top: 0 !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        align-items: center;
    }

    .sidebar-footer .restaurant-name,
    .sidebar-footer .app-version {
        display: none !important;
    }

    #user-info-badge {
        margin-bottom: 0 !important;
        padding: 0.3rem 0.6rem !important;
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 8px !important;
        gap: 0.5rem;
    }

    #user-email-display {
        max-width: 100px;
        font-size: 0.72rem !important;
    }
    
    /* Menu Navigation sous forme de Tab-Bar fixe en bas avec effet Verre (Glassmorphism) */
    nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(62px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background-color: rgba(15, 23, 42, 0.96);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
        z-index: 1000;
        display: flex;
        align-items: center;
    }
    
    .nav-menu {
        flex-direction: row;
        width: 100%;
        height: 100%;
        justify-content: space-around;
        align-items: center;
        gap: 0;
        padding: 0;
        margin: 0;
    }
    
    .nav-item {
        flex: 1;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav-item button {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        font-size: 0.68rem;
        font-weight: 600;
        padding: 0.35rem 0.15rem;
        text-align: center;
        height: 100%;
        width: 100%;
        border-radius: 0;
        color: var(--text-secondary);
        transition: all 0.2s ease;
        background: transparent;
        border: none;
    }
    
    .nav-item.active button {
        color: #38bdf8;
        border-left: none;
        border-top: 3px solid #38bdf8;
        background: rgba(56, 189, 248, 0.08);
    }
    
    .nav-item button i {
        width: 19px;
        height: 19px;
    }
    
    /* Zone de contenu ajustée */
    main {
        margin-left: 0;
        padding: 1rem 0.85rem calc(80px + env(safe-area-inset-bottom)) 0.85rem;
        width: 100%;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }
    
    .page-title h2 {
        font-size: 1.3rem;
    }

    .page-title p {
        font-size: 0.8rem;
    }
    
    .header-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .header-actions select, .header-actions button {
        flex: 1 1 auto;
        min-width: 130px;
        justify-content: center;
        font-size: 0.82rem;
        padding: 0.55rem 0.75rem;
    }
    
    .search-input-wrapper {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
    
    /* Grille de KPI Intelligente 2x2 sur Mobile Portrait */
    .metrics-grid,
    .metrics-grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem !important;
        margin-bottom: 1.25rem;
    }
    
    .kpi-card {
        padding: 0.85rem 0.75rem !important;
        border-radius: 12px;
    }
    
    .kpi-card:hover {
        transform: none;
    }

    .kpi-title {
        font-size: 0.72rem !important;
        margin-bottom: 0.35rem !important;
    }

    .kpi-value {
        font-size: 1.15rem !important;
        font-weight: 700 !important;
        letter-spacing: -0.02em;
    }

    .kpi-subtitle {
        font-size: 0.68rem !important;
        margin-top: 0.25rem !important;
    }

    .dashboard-card {
        padding: 1rem;
        border-radius: 14px;
        margin-bottom: 1rem;
    }

    .dashboard-card-header h3 {
        font-size: 0.95rem;
    }
    
    /* Graphiques réactifs adaptés aux écrans verticaux */
    .chart-container,
    .chart-container-sm {
        min-height: 220px !important;
        max-height: 250px !important;
        height: 230px !important;
    }
    
    /* Tables adaptées pour le swipe tactile avec première colonne figée */
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
        border-radius: 10px;
        position: relative;
    }

    .data-table {
        min-width: 580px;
    }
    
    .data-table th, .data-table td {
        padding: 0.55rem 0.65rem;
        font-size: 0.78rem;
    }

    .data-table th:first-child,
    .data-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 5;
        background: var(--bg-card);
        border-right: 1px solid var(--border-color);
    }
    
    .comparison-selectors {
        padding: 0.85rem;
        gap: 0.5rem;
    }
    
    .checkbox-btn-content {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .comp-table th.category-col,
    .comp-table td.category-col {
        min-width: 130px;
        max-width: 130px;
        white-space: normal;
        font-size: 0.75rem;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    .import-preview-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .import-preview-meta {
        gap: 0.75rem 1.25rem;
    }
    
    .meta-item {
        min-width: 45%;
    }

    /* Transform de la Modal en Bottom Sheet en mode portrait mobile */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-container {
        width: 100% !important;
        max-width: 100% !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-top-left-radius: 20px !important;
        border-top-right-radius: 20px !important;
        max-height: 92vh !important;
        display: flex;
        flex-direction: column;
        animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

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

    .modal-body {
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
        padding: 1rem !important;
    }

    /* Taille de police 16px pour éliminer le zoom automatique iOS sur focus */
    .form-control,
    .form-control select,
    .form-control input {
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .metrics-grid,
    .metrics-grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .import-zone {
        padding: 1.5rem 0.85rem;
    }
}

/* --- STYLES D'IMPRESSION (EXPORT PDF) --- */
@media print {
    /* Masquer les éléments interactifs et de navigation */
    aside,
    nav,
    .sidebar-footer,
    .header-actions,
    .comparison-selectors,
    #compare-month-checkboxes,
    #compare-placeholder,
    .search-input-wrapper,
    .import-zone,
    .btn,
    .btn-group,
    .detail-controls-card {
        display: none !important;
    }

    /* Réinitialiser le layout principal */
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt !important;
        display: block !important;
        overflow: visible !important;
    }

    #app-layout {
        display: block !important;
        width: 100% !important;
        min-height: auto !important;
    }

    main {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        background: none !important;
    }

    /* Afficher uniquement la section active */
    .page-view {
        display: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .page-view.active {
        display: block !important;
    }

    /* Titres de page */
    .page-header {
        margin-bottom: 2rem !important;
        border-bottom: 2px solid #333333 !important;
        padding-bottom: 0.5rem !important;
    }

    .page-title h2 {
        color: #000000 !important;
        font-size: 22pt !important;
    }

    .page-title p {
        color: #555555 !important;
        font-size: 10pt !important;
    }

    /* Cartes métriques (KPIs) */
    .metrics-grid,
    .metrics-grid-3 {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 10px !important;
        margin-bottom: 2rem !important;
    }

    .metrics-grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .kpi-card {
        background: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
        color: #000000 !important;
        box-shadow: none !important;
        border-radius: 8px !important;
        padding: 1rem !important;
        page-break-inside: avoid;
    }

    .kpi-card::after {
        display: none !important;
    }

    .kpi-value {
        color: #000000 !important;
        font-size: 15pt !important;
    }

    .kpi-card-header span {
        color: #475569 !important;
    }

    .kpi-icon {
        display: none !important;
    }

    /* Grilles et cartes de graphiques */
    .dashboard-grid {
        display: grid !important;
        grid-template-columns: 2fr 1fr !important;
        gap: 15px !important;
        margin-bottom: 1.5rem !important;
    }

    .dashboard-grid-even {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 15px !important;
    }

    .dashboard-card {
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        color: #000000 !important;
        box-shadow: none !important;
        border-radius: 8px !important;
        padding: 1.25rem !important;
        page-break-inside: avoid;
    }

    .dashboard-card-header {
        border-bottom: 1px solid #cbd5e1 !important;
        padding-bottom: 0.5rem !important;
        margin-bottom: 1rem !important;
    }

    .dashboard-card-header h3 {
        color: #000000 !important;
        font-size: 12pt !important;
    }

    /* Graphiques */
    .chart-container,
    .chart-container-sm {
        min-height: 250px !important;
        height: 250px !important;
    }

    /* Classements et Listes */
    .ranking-item {
        border-bottom: 1px solid #e2e8f0 !important;
        padding: 0.5rem 0 !important;
    }

    .ranking-number {
        background-color: #f1f5f9 !important;
        color: #090d16 !important;
        border: 1px solid #cbd5e1 !important;
    }

    .ranking-name {
        color: #000000 !important;
    }

    .ranking-share {
        color: #64748b !important;
    }

    .ranking-value {
        color: #000000 !important;
    }

    /* Tendances */
    .trend-panel-row {
        border-bottom: 1px solid #cbd5e1 !important;
    }

    .trend-panel-label {
        color: #334155 !important;
    }

    .trend-panel-value .amount {
        color: #000000 !important;
    }

    /* Tables de données */
    .table-wrapper {
        overflow: visible !important;
        background: none !important;
    }

    .data-table {
        width: 100% !important;
        border: 1px solid #cbd5e1 !important;
    }

    .data-table th {
        background-color: #f1f5f9 !important;
        color: #0f172a !important;
        border-bottom: 2px solid #cbd5e1 !important;
        font-size: 9pt !important;
        padding: 0.5rem !important;
    }

    .data-table td {
        color: #000000 !important;
        border-bottom: 1px solid #cbd5e1 !important;
        font-size: 9pt !important;
        padding: 0.5rem !important;
    }

    /* Badges comparateurs */
    .badge {
        border: 1px solid #cbd5e1 !important;
        background: #f1f5f9 !important;
        color: #0f172a !important;
    }

    .diff-badge {
        border: 1px solid #cbd5e1 !important;
        color: #000000 !important;
        background: #f8fafc !important;
    }

    .diff-badge.up {
        background: #fef2f2 !important;
        color: #b91c1c !important;
        border-color: #fca5a5 !important;
    }

    .diff-badge.down {
        background: #f0fdf4 !important;
        color: #15803d !important;
        border-color: #86efac !important;
    }
}

/* ----------------------------------------------------
   STYLES COMPLÉMENTAIRES : RECETTES & MODALES DE CAISSE
   ---------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.25s ease-out forwards;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(17, 24, 39, 0.8);
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.upload-dropzone:hover {
    border-color: var(--color-primary) !important;
    background: rgba(59, 130, 246, 0.05) !important;
}

.editable-cell-input {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.88rem;
    width: 100%;
    text-align: right;
    font-weight: 600;
    transition: all 0.2s ease;
}

.editable-cell-input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
    background: #1e293b;
}

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

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

/* État de chargement Firebase (pendant onAuthStateChanged) */
.auth-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0 1.5rem;
    gap: 1rem;
}

.auth-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: auth-spin 0.75s linear infinite;
}

.auth-loading-state p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
    margin: 0;
}

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

/* ----------------------------------------------------
   STYLES ÉCRAN D'AUTHENTIFICATION & VERROUILLAGE SÉCURISÉ
   ---------------------------------------------------- */
#auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

#auth-overlay.auth-overlay-active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.auth-card {
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 2.25rem 2rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 30px rgba(59, 130, 246, 0.15);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--color-primary), #1d4ed8);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
    color: #fff;
    font-size: 1.75rem;
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.4);
}

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

.auth-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 0.6rem 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.auth-tab.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.pin-input {
    letter-spacing: 0.4em;
    font-size: 1.25rem !important;
    text-align: center;
    font-weight: 700;
}

.auth-form-content {
    display: none;
}

.auth-form-content.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper i {
    position: absolute;
    left: 0.85rem;
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.input-icon-wrapper .form-control {
    padding-left: 2.6rem !important;
}

.auth-alert {
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    font-size: 0.82rem;
    margin-bottom: 1rem;
}

.auth-alert.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.auth-submit-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ====================================================
   PWA & STYLES D'ORIENTATION PAYSAGE (LANDSCAPE MOBILE)
   ==================================================== */

/* Overlay d'orientation désactivé : Mode Portrait désormais entièrement pris en charge */
.orientation-overlay {
    display: none !important;
}

.orientation-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem 1.75rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: orientationFadeIn 0.4s ease-out;
}

@keyframes orientationFadeIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.rotate-phone-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rotate-phone-animation .phone-icon {
    width: 42px;
    height: 42px;
    color: var(--accent-primary);
    animation: phoneRotate 3s infinite ease-in-out;
}

.rotate-phone-animation .rotate-arrow {
    position: absolute;
    width: 64px;
    height: 64px;
    color: #38bdf8;
    opacity: 0.6;
    animation: arrowSpin 3s infinite linear;
}

@keyframes phoneRotate {
    0%, 100% { transform: rotate(0deg); }
    35%, 65% { transform: rotate(90deg); }
}

@keyframes arrowSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.orientation-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.orientation-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.orientation-card button {
    width: 100%;
    justify-content: center;
}

/* Optimisations spécifiques au mode Paysage Mobile (< 650px en hauteur) */
@media screen and (orientation: landscape) and (max-height: 650px) {
    #app-layout {
        flex-direction: row;
    }

    aside {
        width: 210px;
        padding: 0.75rem;
        flex-shrink: 0;
        overflow-y: auto;
    }

    .logo-container {
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
    }

    .logo-text h1 {
        font-size: 1rem;
    }

    .nav-item button {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    main {
        padding: 1rem 1.25rem;
        overflow-y: auto;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 0.75rem;
    }

    .kpi-card {
        padding: 0.85rem 1rem;
    }

    .kpi-value {
        font-size: 1.2rem;
    }

    .chart-container {
        height: 220px !important;
    }
}

/* Masquage complet des flèches d'incrémentation (spinners) sur les inputs numériques */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}
input[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

/* ==========================================================================
   STYLES TICKET DE CAISSE GREY CORNER, PAVÉ TACTILE & SCANNER OCR
   ========================================================================== */

/* Layout de la Modale Ticket */
.ticket-modal-container {
    max-width: 820px !important;
    width: 95% !important;
}

.ticket-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

/* Grille Split : Ticket à Gauche & Pavé Tactile à Droite */
.ticket-split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

/* Design Réaliste du Ticket de Caisse Imprimé */
.receipt-paper-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.receipt-paper {
    background: #ffffff;
    color: #111827;
    border-radius: 4px;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    font-family: 'Courier New', Courier, monospace, sans-serif;
    position: relative;
    width: 100%;
    max-width: 350px;
    border-top: 7px dashed #cbd5e1;
    border-bottom: 7px dashed #cbd5e1;
}

.receipt-header-title {
    text-align: center;
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.2rem;
    font-family: system-ui, -apple-system, sans-serif;
    color: #0f172a;
    text-transform: uppercase;
}

.receipt-divider-ornament {
    text-align: center;
    font-size: 0.72rem;
    color: #64748b;
    margin-bottom: 0.85rem;
}

.receipt-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.55rem;
    border-bottom: 1px dotted #cbd5e1;
    padding-bottom: 0.3rem;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
    border-radius: 4px;
    transition: background 0.15s, border-color 0.15s;
}

.receipt-line.active-focus {
    background: #eff6ff !important;
    border-bottom: 2px solid #3b82f6 !important;
}

.receipt-line-date {
    border-bottom: 1px dashed #94a3b8;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

.receipt-dashed-line {
    border-top: 1px dashed #64748b;
    margin: 0.6rem 0;
}

.receipt-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
}

.receipt-label-with-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-mini-sync {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-size: 0.68rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: system-ui, sans-serif;
    font-weight: 700;
}

.btn-mini-sync:hover {
    background: #2563eb;
    color: white;
}

.receipt-input {
    border: none;
    border-bottom: 1.5px solid #64748b;
    text-align: right;
    font-weight: 800;
    font-size: 1rem;
    width: 90px;
    font-family: monospace;
    color: #0f172a;
    background: transparent;
    padding: 0.15rem 0.25rem;
    outline: none;
}

.receipt-input-date {
    width: 140px;
    font-size: 0.88rem;
    font-family: system-ui, sans-serif;
}

.receipt-input:focus {
    border-bottom: 2px solid #2563eb;
    background: #dbeafe;
}

.receipt-readonly {
    background: #f1f5f9;
    border-bottom: none;
    border-radius: 4px;
    padding-right: 0.4rem;
}

.receipt-currency {
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    margin-left: 0.2rem;
}

.receipt-line-highlight {
    background: #fef9c3;
    border-bottom: 2px solid #eab308;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.receipt-notes-group {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.receipt-notes-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
}

.receipt-input-notes {
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    font-family: system-ui, sans-serif;
    color: #0f172a;
}

.receipt-footer-stamp {
    margin-top: 1rem;
    text-align: center;
    border-top: 1px dashed #94a3b8;
    padding-top: 0.85rem;
}

.receipt-logo-circle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    border: 2px double #0f172a;
    border-radius: 50%;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.35rem;
    font-family: system-ui, sans-serif;
}

.logo-title {
    font-weight: 900;
    font-size: 0.9rem;
    line-height: 1;
    color: #0f172a;
    letter-spacing: 1px;
}

.logo-sub {
    font-weight: 800;
    font-size: 0.75rem;
    line-height: 1;
    color: #334155;
    letter-spacing: 0.5px;
}

.logo-cat {
    font-size: 0.58rem;
    color: #64748b;
    margin-top: 0.15rem;
}

.receipt-thanks {
    font-size: 0.75rem;
    font-style: italic;
    color: #475569;
    font-family: Georgia, serif;
}

/* Panneau du Pavé Numérique Tactile (Option 3) */
.tactile-keypad-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.keypad-header-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.keypad-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.keypad-field-badge {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.82rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

.tactile-numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.num-key {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-size: 1.35rem;
    font-weight: 800;
    padding: 0.8rem 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    user-select: none;
}

.num-key:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

.num-key:active {
    transform: scale(0.93);
    background: #3b82f6;
    color: #ffffff;
}

.key-clear {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.key-clear:hover {
    background: #ef4444;
    color: #ffffff;
}

.keypad-actions-row {
    display: flex;
    gap: 0.6rem;
}

.key-backspace {
    flex: 1;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.key-backspace:hover {
    background: #f59e0b;
    color: #ffffff;
}

.key-next-field {
    flex: 1.5;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    font-weight: 800;
    font-size: 0.95rem;
    padding: 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}

.key-next-field:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.key-next-field:active {
    transform: translateY(1px);
}

/* Responsivité Mobile pour le Ticket */
@media (max-width: 768px) {
    .ticket-split-layout {
        grid-template-columns: 1fr;
    }

    .receipt-paper {
        max-width: 100%;
    }
}
