/* === Variables === */
:root {
    --green-dark: #264027;
    --green-mid: #3A5A40;
    --gold: #FFC72C;
    --bg: #FAFAF5;
    --white: #FFFFFF;
    --border: #E0E0D8;
    --text: #333333;
    --text-light: #666666;
    --positive: #2E7D32;
    --negative: #C62828;
    --warning: #EF6C00;
    --neutral: #757575;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --font: system-ui, 'Segoe UI', Roboto, sans-serif;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* === Topbar === */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: 56px;
    background: var(--green-dark);
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--green-dark);
    border-radius: 8px;
    padding: 4px;
}

.brand-title {
    font-size: 16px;
    white-space: nowrap;
}
.brand-title strong {
    font-weight: 700;
}
.brand-title em {
    font-style: italic;
    font-weight: 400;
}

.topbar-nav {
    display: flex;
    gap: 4px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-btn:hover { color: var(--white); background: rgba(255,255,255,0.1); }
.nav-btn.active { color: var(--gold); background: rgba(255,255,255,0.15); }

.topbar-actions {
    display: flex;
    gap: 8px;
    margin-left: 16px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--green-mid);
    color: var(--white);
}
.btn-primary:hover { background: var(--green-dark); }

.btn-outline {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.4);
    color: var(--white);
}
.btn-outline:hover { border-color: var(--white); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-danger {
    background: transparent;
    border: 1.5px solid var(--negative);
    color: var(--negative);
}
.btn-danger:hover { background: rgba(198,40,40,0.06); }

/* Icônes Lucide dans les boutons */
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Boutons en contexte clair */
.view .btn-outline {
    border-color: var(--border);
    color: var(--text);
}
.view .btn-outline:hover { border-color: var(--green-mid); color: var(--green-mid); }

/* === Views === */
.view { padding: 24px; }
.hidden { display: none !important; }

/* === Vue Saisie === */
.saisie-header { margin-bottom: 20px; }

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

.period-selector label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-light);
}

.period-selector select {
    padding: 7px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--white);
    cursor: pointer;
}

.saisie-layout {
    display: flex;
    gap: 20px;
    min-height: calc(100vh - 160px);
}

.saisie-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border: 1.5px solid transparent;
    background: var(--white);
}

.sidebar-item:hover { border-color: var(--green-mid); }
.sidebar-item.active { border-color: var(--green-mid); background: #f0f7f0; }

.sidebar-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sidebar-dot.complete { background: var(--positive); }
.sidebar-dot.partial { background: var(--warning); }
.sidebar-dot.empty { background: #ccc; }

.saisie-main {
    flex: 1;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

/* === Tabs === */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    background: #f8f8f5;
}

.tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--green-mid); border-bottom-color: var(--green-mid); background: var(--white); }

.tab-content { padding: 24px; }

/* === Form === */
.form-section { margin-bottom: 24px; }
.form-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--green-mid);
}

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

.form-group input[type="number"] { max-width: 140px; }

.critere-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0eb;
}

.critere-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.critere-select {
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--white);
    cursor: pointer;
}

.no-restaurant-msg {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 15px;
}

/* === Vue Aperçu === */
.apercu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.apercu-actions { display: flex; gap: 8px; }

/* === Zoom controls === */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.zoom-level {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    min-width: 48px;
    text-align: center;
    user-select: none;
}

.apercu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* === Report page zoom wrapper === */
.report-page-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.report-page-wrapper .report-page {
    transform-origin: top center;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

/* ============================================================
   FICHE RAPPORT – PAYSAGE A4, DESIGN ÉDITORIAL
   ============================================================ */

.report-page {
    width: 297mm;
    height: 210mm;
    position: relative;
    overflow: hidden;
    page-break-after: always;
    page-break-inside: avoid;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    border-radius: 3px;

    /* Fond aquarelle affiné – plus subtil, plus élégant */
    background:
        radial-gradient(ellipse 600px 420px at 3% 6%, rgba(144, 206, 175, 0.38) 0%, transparent 70%),
        radial-gradient(ellipse 500px 360px at 94% 4%, rgba(165, 218, 190, 0.28) 0%, transparent 65%),
        radial-gradient(ellipse 420px 500px at 48% 88%, rgba(148, 208, 176, 0.26) 0%, transparent 60%),
        radial-gradient(ellipse 380px 320px at 86% 76%, rgba(130, 200, 162, 0.20) 0%, transparent 55%),
        radial-gradient(ellipse 450px 360px at 12% 82%, rgba(172, 222, 198, 0.28) 0%, transparent 60%),
        /* Lignes diagonales – à peine visibles */
        repeating-linear-gradient(-25deg, transparent 0px, transparent 120px, rgba(58, 90, 64, 0.03) 120px, rgba(58, 90, 64, 0.03) 122px),
        repeating-linear-gradient(40deg, transparent 0px, transparent 160px, rgba(58, 90, 64, 0.02) 160px, rgba(58, 90, 64, 0.02) 162px),
        /* Dégradé de base – plus clair, plus doux */
        linear-gradient(155deg, #e2f2e6 0%, #d0e8d8 28%, #daeee0 52%, #cce4d4 78%, #d6ecde 100%);
}

/* Grille principale – 3 colonnes, header pleine largeur */
.report-grid {
    display: grid;
    grid-template-columns: 4fr 2.7fr 3.3fr;
    grid-template-rows: auto 1fr 1fr;
    grid-template-areas:
        "header  header   header"
        "mcdo    google   synthese"
        "mcdo    oph      synthese";
    gap: 3mm;
    padding: 7mm 10mm;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* Logo M en haut à droite */
.report-logo {
    position: absolute;
    top: 7mm;
    right: 10mm;
    z-index: 2;
    width: 60px;
    height: 56px;
    background: var(--green-dark);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(38, 64, 39, 0.25);
}

.report-logo svg {
    width: 44px;
    height: 36px;
}

/* === EN-TÊTE ÉDITORIAL – texte sur fond aquarelle === */
.report-header {
    grid-area: header;
    padding: 0 2mm 1mm 2mm;
}

.header-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--green-dark);
    text-transform: uppercase;
    letter-spacing: 3.5px;
    opacity: 0.6;
    margin-bottom: 0.5mm;
}

.header-period {
    font-size: 21px;
    font-weight: 800;
    font-style: italic;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 4px rgba(38, 64, 39, 0.35);
}

.header-accent {
    width: 72px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold) 65%, transparent);
    border-radius: 2px;
    margin: 1.5mm 0;
}

.header-restaurant {
    font-size: 26px;
    font-weight: 900;
    color: var(--green-dark);
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.1;
}

/* === CARTES – style affiné, semi-transparent === */
.report-card {
    background: rgba(255, 255, 255, 0.93);
    border: 1.5px solid rgba(38, 64, 39, 0.14);
    border-radius: 12px;
    padding: 3.5mm 4.5mm;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(38, 64, 39, 0.07);
}

.report-card-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--green-dark);
    margin-bottom: 3.5mm;
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font);
}

/* Barre d'accent colorée devant le titre de carte */
.card-title-bar {
    display: inline-block;
    width: 3.5px;
    height: 16px;
    background: var(--green-mid);
    border-radius: 2px;
    flex-shrink: 0;
}

.card-title-bar.bar-gold {
    background: var(--gold);
}

.card-title-bar.bar-dark {
    background: var(--green-dark);
}

/* --- Carte McDo & Moi (colonne gauche, 2 rangées) --- */
.card-mcdo {
    grid-area: mcdo;
}

.mcdo-layout {
    display: flex;
    gap: 3mm;
    flex: 1;
    flex-direction: column;
}

.mcdo-criteres {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1px;
}

.mcdo-chart-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.critere-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 2.5px 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

/* Icônes SVG inline */
.ic {
    flex-shrink: 0;
    vertical-align: middle;
}

.ic-star {
    vertical-align: middle;
}

.mcdo-separator {
    font-size: 11px;
    font-weight: 700;
    color: var(--warning);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 4px 0 2px 0;
    padding-top: 4px;
    border-top: 1px solid rgba(239, 108, 0, 0.18);
}

.chart-container {
    width: 190px;
    height: 190px;
    position: relative;
}

/* Légende du pie chart (nouveau design) */
.mcdo-chart-legend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 3px;
}

.mcdo-chart-legend .legend-sat {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--green-mid);
}

.mcdo-chart-legend .legend-insat {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--gold);
}

.mcdo-questionnaires {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
    text-align: center;
}

/* --- Carte Google (centre haut) --- */
.card-google {
    grid-area: google;
}

.google-top {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    margin-bottom: 1.5mm;
}

.google-note {
    display: flex;
    align-items: baseline;
    gap: 1px;
}

.google-note-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--green-dark);
}

.google-note-suffix {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 600;
}

.card-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    color: var(--green-dark);
    background: rgba(38, 64, 39, 0.08);
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.google-stars-row {
    display: flex;
    gap: 1px;
    margin-bottom: 2.5mm;
}

.google-points {
    display: flex;
    flex-direction: column;
    gap: 1.5mm;
    flex: 1;
}

.google-points-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.google-point-item {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 12.5px;
    color: var(--text);
    line-height: 1.35;
    padding: 1.5px 0;
}

.google-point-item .ic {
    margin-top: 2px;
}

.google-points-col + .google-points-col {
    margin-top: 2mm;
    padding-top: 2mm;
    border-top: 1px solid rgba(38, 64, 39, 0.09);
}

/* --- Carte OPH (centre bas) --- */
.card-oph {
    grid-area: oph;
}

.oph-chart-area {
    flex: 1;
    position: relative;
    min-height: 0;
}

.oph-values {
    display: flex;
    gap: 0;
    align-items: center;
    justify-content: space-around;
    padding-top: 2mm;
    border-top: 1px solid rgba(38, 64, 39, 0.10);
}

.oph-item {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    position: relative;
}

.oph-item + .oph-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    height: 70%;
    width: 1px;
    background: rgba(38, 64, 39, 0.15);
}

.oph-item .oph-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.oph-item .oph-val {
    font-size: 15px;
    font-weight: 800;
    color: var(--green-dark);
    letter-spacing: -0.3px;
}

/* --- Carte Synthèse (colonne droite, 2 rangées) --- */
.card-synthese {
    grid-area: synthese;
    /* Override display:flex hérité de .report-card : on gère les 4 zones en grid */
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.synthese-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5mm;
    min-height: 0;
}

.synthese-kpi {
    display: flex;
    flex-direction: column;
    padding: 2mm 3mm;
    background: rgba(38, 64, 39, 0.04);
    border-radius: 8px;
    justify-content: flex-start;
    gap: 0;
    overflow: hidden;
}

.synthese-kpi-head {
    display: flex;
    align-items: center;
    gap: 4px;
}

.synthese-kpi-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.synthese-kpi-value {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 17px;
    font-weight: 800;
    color: var(--green-dark);
    line-height: 1.3;
}

/* Dans synthese-kpi-num-row (flex row), la valeur ne doit pas s'étirer horizontalement */
.synthese-kpi-num-row .synthese-kpi-value {
    flex: 0 0 auto;
}

.synthese-kpi-value.kpi-num {
    font-size: 22px;
    letter-spacing: -0.5px;
}

.synthese-kpi-value.positive {
    color: var(--positive);
}

.synthese-kpi-value.warning {
    color: var(--warning);
}

.synthese-notes {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3.5mm;
    margin-top: 1.5mm;
    padding-top: 1.5mm;
    border-top: 1px solid rgba(38, 64, 39, 0.10);
    flex-shrink: 0;
}

.synthese-note-item {
    display: flex;
    align-items: center;
    gap: 2mm;
}

.synthese-notes .note-value {
    font-size: 17px;
    font-weight: 800;
    color: var(--green-dark);
}

.synthese-notes .note-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-light);
}

.note-separator {
    width: 1px;
    height: 22px;
    background: var(--green-dark);
    border-radius: 1px;
    opacity: 0.2;
    flex-shrink: 0;
}

/* === Fiche Fidélité – Layout grille === */
.fidelite-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr 1fr;
    grid-template-areas:
        "header   header"
        "comptes  perf"
        "evol     trends";
    gap: 3mm;
    padding: 7mm 10mm;
    height: 100%;
    position: relative;
    z-index: 1;
}

.card-fid-comptes { grid-area: comptes; }
.card-fid-perf { grid-area: perf; }
.card-fid-evol { grid-area: evol; }
.card-fid-trends { grid-area: trends; }

.fid-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5mm;
    flex: 1;
}

.fid-kpi-grid.fid-kpi-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.fid-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3mm 2mm;
    background: rgba(38, 64, 39, 0.04);
    border-radius: 8px;
    gap: 1mm;
}

.fid-kpi-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
}

.fid-kpi-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--green-dark);
    letter-spacing: -0.3px;
}

.fid-kpi-value.fid-kpi-accent {
    color: var(--positive);
}

.fid-evol-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5mm;
    flex: 1;
    justify-content: center;
}

.fid-evol-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2.5mm 4mm;
    background: rgba(38, 64, 39, 0.04);
    border-radius: 8px;
}

.fid-evol-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.fid-evol-item .delta-badge {
    font-size: 14px;
    font-weight: 700;
    padding: 2px 10px;
}

.fid-sparklines {
    display: flex;
    flex-direction: column;
    gap: 1.5mm;
    flex: 1;
}

.fid-spark-item {
    display: flex;
    align-items: center;
    gap: 2mm;
    flex: 1;
    min-height: 0;
}

.fid-spark-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 60px;
    flex-shrink: 0;
}

.fid-spark-chart {
    flex: 1;
    position: relative;
    min-height: 0;
    height: 100%;
}

/* === Vue Restaurants === */
.restaurants-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.restaurants-header h2 {
    font-size: 20px;
    color: var(--green-dark);
}

.restaurants-list {
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.restaurant-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.restaurant-card.inactive {
    opacity: 0.5;
    background: #f5f5f0;
}

.restaurant-card-name {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
}

.restaurant-card-actions {
    display: flex;
    gap: 6px;
}

.restaurant-card-actions button {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.restaurant-card-actions button:hover {
    border-color: var(--green-mid);
    color: var(--green-mid);
}

.restaurant-card-actions svg { width: 14px; height: 14px; }

.restaurant-card-actions .btn-toggle-active {
    font-size: 12px;
}

.restaurant-card-actions .btn-toggle-active.is-active {
    color: var(--positive);
    border-color: var(--positive);
}

.restaurant-card-actions .btn-delete {
    color: var(--negative);
}
.restaurant-card-actions .btn-delete:hover {
    border-color: var(--negative);
    color: var(--negative);
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: var(--white);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 400px;
    max-width: 90vw;
}

.modal h3 {
    margin-bottom: 16px;
    color: var(--green-dark);
}

.modal input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    margin-bottom: 20px;
}

.modal input:focus { outline: none; border-color: var(--green-mid); }

.modal-message {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* === Modal large (import CSV) === */
.modal-lg {
    width: 680px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
}

.csv-import-table-wrap {
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

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

.csv-import-table thead {
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 1;
}

.csv-import-table th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 600;
    color: var(--green-dark);
    border-bottom: 2px solid var(--border);
}

.csv-import-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}

.csv-import-table tr:last-child td { border-bottom: none; }

.csv-import-table select {
    width: 100%;
    padding: 5px 8px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--white);
}

.csv-import-table select:focus {
    outline: none;
    border-color: var(--green-mid);
}

.csv-import-table .csv-match-ok { color: var(--positive); }
.csv-import-table .csv-match-partial { color: var(--warning); }
.csv-import-table .csv-match-none { color: var(--text-light); font-style: italic; }

.csv-import-legend {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 16px;
}

/* === Toast / notifications === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--green-dark);
    color: var(--white);
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    animation: toast-in 0.3s ease;
}

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

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

/* === Delta badges (M/M) === */
.delta-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
    white-space: nowrap;
    flex-shrink: 0;
}
.delta-pos { background: #E8F5E9; color: var(--positive); }
.delta-neg { background: #FFEBEE; color: var(--negative); }
.delta-neu { background: #F5F5F5; color: var(--neutral); }

/* Sparkline Google (bas de la carte, pleine largeur) */
.google-sparkline {
    height: 90px;
    position: relative;
    flex-shrink: 0;
    margin-top: 2mm;
    padding-top: 1.5mm;
    border-top: 1px solid rgba(38, 64, 39, 0.09);
}

/* KPI Synthèse – rangée valeur + badge delta */
.synthese-kpi-num-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
}

/* Sparkline Synthèse (note_actuelle sur 4 mois) */
.synthese-sparkline-area {
    height: 46px;
    position: relative;
    margin-top: 1.5mm;
    padding-top: 1.5mm;
    border-top: 1px solid rgba(38, 64, 39, 0.09);
}

/* === OPH Form – champs calculés === */
.oph-readonly {
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    background: #f8f8f5;
    color: var(--text-light);
    min-height: 38px;
    display: flex;
    align-items: center;
}

.oph-readonly.oph-computed {
    background: #f0f7f0;
    border-color: var(--green-mid);
    color: var(--positive);
}

.oph-readonly.oph-computed-negative {
    background: #fff0f0;
    border-color: var(--negative);
    color: var(--negative);
}

.oph-auto-tag {
    font-weight: 400;
    font-size: 11px;
    color: var(--text-light);
    font-style: italic;
    margin-left: 4px;
}

.oph-formula {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
    font-style: italic;
}

/* === Champ calculé (read-only) dans le formulaire === */
.input-computed {
    background: #f0f7f0 !important;
    border-color: var(--green-mid) !important;
    color: var(--positive) !important;
    cursor: default;
}

/* === Critère checklist (Google points positifs/négatifs) === */
.critere-checklist {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.critere-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.critere-check-item:hover:not(.crossed) {
    border-color: var(--green-mid);
    background: #f0f7f0;
}

.critere-check-item input[type="checkbox"] {
    accent-color: var(--green-mid);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.critere-check-item.crossed {
    opacity: 0.4;
    text-decoration: line-through;
    cursor: not-allowed;
}

.critere-check-item.crossed input[type="checkbox"] {
    cursor: not-allowed;
}

/* === OPH Dashboard === */
.oph-dash-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.oph-dash-header h2 {
    font-size: 20px;
    color: var(--green-dark);
    font-weight: 700;
}

.oph-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 28px;
}

.oph-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
}

.oph-table-wrap {
    overflow-x: auto;
    margin-bottom: 20px;
}

.oph-monthly-table,
.oph-annual-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.oph-monthly-table th,
.oph-annual-table th {
    background: var(--green-dark);
    color: var(--white);
    padding: 7px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}

.oph-monthly-table th:first-child,
.oph-annual-table th:first-child {
    text-align: left;
}

.oph-monthly-table td,
.oph-annual-table td {
    padding: 6px 12px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.oph-monthly-table .col-month,
.oph-annual-table .col-month {
    text-align: left;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
}

.oph-monthly-table .col-avg,
.oph-annual-table .col-avg {
    background: rgba(38, 64, 39, 0.06);
    font-weight: 700;
    color: var(--green-dark);
}

.oph-monthly-table .row-annual,
.oph-annual-table .row-annual {
    font-weight: 700;
    color: var(--positive);
}

.oph-monthly-table .row-footer td {
    background: rgba(38, 64, 39, 0.04);
    border-top: 2px solid var(--green-dark);
    font-weight: 700;
    color: var(--green-dark);
}

.oph-monthly-table tbody tr:hover td,
.oph-annual-table tbody tr:hover td {
    background: rgba(38, 64, 39, 0.03);
}

.oph-chart-wrap {
    height: 280px;
    position: relative;
}

.oph-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 15px;
}

/* === Fidélité Dashboard === */
.fid-metric-select {
    margin-left: 12px;
    padding: 5px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    background: var(--white);
    cursor: pointer;
    vertical-align: middle;
}

.fid-metric-select:focus {
    outline: none;
    border-color: var(--green-mid);
}

.fid-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.fid-status.fid-complete {
    background: #E8F5E9;
    color: var(--positive);
}

.fid-status.fid-partial {
    background: #FFF3E0;
    color: var(--warning);
}

.fid-status.fid-empty {
    color: var(--text-light);
}

/* === Login screen === */
.login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.login-card {
    background: var(--white);
    padding: 40px 36px 36px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 360px;
    max-width: 90vw;
    text-align: center;
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 32px;
}

.login-brand .brand-title {
    font-size: 20px;
    color: var(--green-dark);
}

.login-field {
    margin-bottom: 16px;
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font);
    transition: border-color 0.2s;
}

.login-field input:focus {
    outline: none;
    border-color: var(--green-mid);
}

.login-error {
    color: var(--negative);
    font-size: 13px;
    margin-bottom: 12px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    justify-content: center;
}

/* === Print === */
@media print {
    @page { size: A4 landscape; margin: 0; }
    .topbar, .apercu-header, .saisie-header { display: none !important; }
    body { background: white; }
    .view { padding: 0; }
    .apercu-container { gap: 0; }
    .report-page-wrapper {
        height: auto !important;
        overflow: visible;
    }
    .report-page {
        transform: none !important;
        box-shadow: none;
        border-radius: 0;
        margin: 0;
        page-break-after: always;
    }
}

/* === Responsive – tablette === */
@media (max-width: 900px) {
    .saisie-layout { flex-direction: column; }
    .saisie-sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
}

/* === Responsive – mobile === */
@media (max-width: 640px) {
    /* --- Topbar : passe en wrap multi-lignes --- */
    .topbar {
        height: auto;
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 8px;
    }

    .topbar-brand { margin-right: 0; }

    .topbar-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 2px;
    }

    .nav-btn {
        padding: 6px 10px;
        font-size: 13px;
        flex: 1;
        text-align: center;
    }

    .topbar-actions {
        margin-left: auto;
        gap: 6px;
    }

    /* Masquer le texte des boutons topbar, garder les icônes */
    .topbar-actions .btn { padding: 6px 8px; font-size: 0; gap: 0; }
    .topbar-actions .btn svg { width: 16px; height: 16px; }

    /* --- Padding général réduit --- */
    .view { padding: 12px; }

    /* --- Saisie --- */
    .saisie-header { margin-bottom: 12px; }

    .period-selector {
        gap: 6px;
    }

    .period-selector label { font-size: 12px; }

    .period-selector select {
        padding: 6px 8px;
        font-size: 13px;
    }

    /* Boutons pré-remplir / effacer : icône seule */
    .saisie-header .btn { font-size: 0; gap: 0; padding: 6px 8px; }
    .saisie-header .btn svg { width: 14px; height: 14px; }

    .saisie-sidebar {
        gap: 3px;
    }

    .sidebar-item {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    .tab {
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    .tab-content { padding: 14px; }

    .form-grid { grid-template-columns: 1fr; gap: 12px; }

    .form-group input[type="number"] { max-width: none; }

    /* --- Aperçu --- */
    .apercu-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 14px;
    }

    .apercu-header .period-selector {
        justify-content: center;
    }

    .zoom-controls {
        justify-content: center;
    }

    .apercu-actions {
        justify-content: center;
    }

    .apercu-container { gap: 16px; }

    /* --- Restaurants --- */
    .restaurants-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 14px;
    }

    .restaurants-header h2 { font-size: 17px; }

    .restaurant-card {
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 8px;
    }

    .restaurant-card-name { font-size: 14px; }

    .restaurant-card-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 4px;
    }

    .restaurant-card-actions button {
        padding: 4px 8px;
        font-size: 12px;
    }

    /* --- OPH Dashboard --- */
    .oph-dash-header { gap: 12px; margin-bottom: 16px; }
    .oph-dash-header h2 { font-size: 17px; }
    .oph-section { padding: 12px 14px; margin-bottom: 16px; }
    .oph-section h3 { font-size: 14px; margin-bottom: 10px; }

    /* --- Modal --- */
    .modal { padding: 20px; }
    .modal h3 { font-size: 16px; }

    /* --- Toast : centré en bas --- */
    .toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
        text-align: center;
    }
}
