/* ============================================
   Aquasy — Gestion Piscine & Buvette
   Interface optimisée pour tablette tactile
   ============================================ */

:root {
    --primary:        #0ea5e9;
    --primary-dark:   #0284c7;
    --secondary:      #f59e0b;
    --success:        #22c55e;
    --danger:         #ef4444;
    --warning:        #f59e0b;
    --info:           #3b82f6;

    --bg-page:        #f1f5f9;
    --bg-card:        #ffffff;
    --bg-hover:       #f8fafc;

    --border:         #e2e8f0;
    --border-strong:  #cbd5e1;

    --text:           #0f172a;
    --text-muted:     #64748b;
    --text-light:     #94a3b8;

    --shadow-sm:      0 1px 2px rgba(0,0,0,.05);
    --shadow:         0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg:      0 10px 15px -3px rgba(0,0,0,.10), 0 4px 6px -4px rgba(0,0,0,.05);

    --radius-sm:      6px;
    --radius:         10px;
    --radius-lg:      16px;

    --space-1:        4px;
    --space-2:        8px;
    --space-3:        12px;
    --space-4:        16px;
    --space-5:        20px;
    --space-6:        24px;
    --space-8:        32px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    touch-action: manipulation;
}

/* ===== Topbar ===== */
.topbar {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: var(--space-3) var(--space-5);
    box-shadow: var(--shadow);
    gap: var(--space-5);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: 1.15rem;
    white-space: nowrap;
}
.brand-icon { font-size: 1.5rem; }

.topbar-nav {
    display: flex;
    gap: var(--space-1);
    flex: 1;
    flex-wrap: wrap;
}
.nav-link {
    color: rgba(255,255,255,.92);
    text-decoration: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background .15s ease;
    font-size: .95rem;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,.18);
    color: white;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.user-name { font-weight: 500; font-size: .95rem; }
.btn-logout {
    background: rgba(255,255,255,.18);
    color: white;
    text-decoration: none;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    transition: background .15s ease;
}
.btn-logout:hover { background: rgba(255,255,255,.30); }

/* ===== Layout ===== */
.main-content {
    padding: var(--space-5);
    max-width: 1600px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
    gap: var(--space-3);
}
.page-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text);
}
.page-subtitle {
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}
.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}
.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}
.card-body { padding: var(--space-5); }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform .1s ease, box-shadow .15s ease, background .15s ease;
    min-height: 48px;
    font-family: inherit;
    white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(.97); }
.btn-secondary { background: #475569; }
.btn-secondary:hover { background: #334155; }
.btn-success  { background: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-danger   { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning  { background: var(--warning); color: #422006; }
.btn-warning:hover { background: #d97706; }
.btn-outline  { background: white; color: var(--text); border: 1px solid var(--border-strong); }
.btn-outline:hover { background: var(--bg-hover); }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.btn-lg { padding: 18px 28px; min-height: 64px; font-size: 1.15rem; }
.btn-block { width: 100%; }

/* ===== Forms ===== */
.form-group { margin-bottom: var(--space-4); }
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text);
    font-size: .95rem;
}
.form-control,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"],
input[type="datetime-local"], input[type="tel"], input[type="url"],
select, textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: white;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
    min-height: 48px;
}
.form-control:focus,
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, .15);
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}
.form-help {
    font-size: .85rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}
.table th, .table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    background: var(--bg-hover);
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.table tbody tr:hover { background: var(--bg-hover); }
.table .actions { display: flex; gap: var(--space-2); justify-content: flex-end; }

/* ===== Alerts ===== */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
    border-left: 4px solid;
    font-weight: 500;
}
.alert-success { background: #f0fdf4; border-color: var(--success); color: #14532d; }
.alert-danger,
.alert-error   { background: #fef2f2; border-color: var(--danger);  color: #7f1d1d; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #78350f; }
.alert-info    { background: #eff6ff; border-color: var(--info);    color: #1e3a8a; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-muted);
}
.badge-success { background: #dcfce7; color: #14532d; }
.badge-danger  { background: #fee2e2; color: #7f1d1d; }
.badge-warning { background: #fef3c7; color: #78350f; }
.badge-info    { background: #dbeafe; color: #1e3a8a; }

/* ===== Login ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    padding: var(--space-5);
}
.login-card {
    background: white;
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.login-header {
    text-align: center;
    margin-bottom: var(--space-6);
}
.login-icon {
    font-size: 4rem;
    margin-bottom: var(--space-3);
}
.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}
.login-subtitle {
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* ===== Caisse - grille de produits ===== */
.caisse-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--space-5);
    align-items: start;
    height: calc(100vh - 120px);
}

/* Colonne gauche : grille des produits, scrollable */
.caisse-products {
    background: white;
    border-radius: var(--radius);
    padding: var(--space-4);
    box-shadow: var(--shadow);
    overflow-y: auto;
    height: 100%;
    -webkit-overflow-scrolling: touch;
}
.caisse-products h2 {
    margin: 0 0 var(--space-3);
    font-size: 1.25rem;
}

/* Colonne droite : panier, sticky */
.caisse-cart {
    background: white;
    border-radius: var(--radius);
    padding: var(--space-4);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.caisse-cart h2 {
    margin: 0 0 var(--space-3);
    font-size: 1.25rem;
    flex-shrink: 0;
}
#cart-items {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--space-4));
    padding: 0 var(--space-4);
}

.products-grid,
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
    align-content: start;
}
.product-tile {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    cursor: pointer;
    text-align: center;
    transition: transform .1s ease, border-color .15s ease, box-shadow .15s ease;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.product-tile:active { transform: scale(.96); }
.product-tile:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.product-tile.disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}
.product-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}
.product-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}
.product-stock {
    font-size: .8rem;
    color: var(--text-muted);
    position: absolute;
    top: 6px;
    right: 8px;
}
.product-stock.low { color: var(--danger); font-weight: 700; }

/* ===== Catégories ===== */
.categories-tabs,
.cat-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}
.cat-tab {
    background: white;
    border: 2px solid var(--border-strong);
    color: var(--text);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    min-height: 52px;
    transition: all .15s ease;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.cat-tab:active { transform: scale(.96); }
.cat-tab.active,
.cat-tab:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== Panier ===== */
.cart-panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
    border: 1px solid var(--border);
}
.cart-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
    border-radius: var(--radius) var(--radius) 0 0;
}
.cart-header h3 { font-size: 1.15rem; }
.cart-items {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    padding: var(--space-3);
}
.cart-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    border-bottom: 1px solid var(--border);
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
    font-weight: 600;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cart-item-price { color: var(--text-muted); font-size: .9rem; margin-top: 2px; }
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.qty-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: 2px solid var(--border-strong);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.qty-btn:active {
    background: var(--bg-hover);
    transform: scale(.92);
}
.qty-value {
    min-width: 32px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
}

.cart-empty {
    text-align: center;
    color: var(--text-light);
    padding: var(--space-8) var(--space-4);
}

.cart-summary {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border);
    background: var(--bg-hover);
}
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-3);
}
.cart-total .total-amount { color: var(--primary); }

.payment-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

/* ===== Stats / Dashboard ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.stat-card {
    background: white;
    padding: var(--space-5);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
}
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger  { border-left-color: var(--danger); }
.stat-label {
    color: var(--text-muted);
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    font-weight: 600;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: var(--space-1);
}
.stat-trend { font-size: .85rem; margin-top: var(--space-1); }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4);
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 95vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: var(--space-2);
    line-height: 1;
}
.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}
.modal-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    flex-shrink: 0;
    background: white;
}

/* ============================================ */
/* OPTIMISATIONS TABLETTE ANDROID                */
/* ============================================ */

/* Reset tactile global */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}
body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overscroll-behavior-y: contain; /* évite le pull-to-refresh */
}
button, .btn, .nav-link, .product-card, .product-tile,
.cat-tab, .qty-btn, .keypad-btn {
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation; /* supprime délai 300ms */
}
/* Permet la sélection sur les contenus textuels (panier, prix, etc.) */
input, textarea, .data-table, .selectable, p, h1, h2, h3 {
    user-select: text;
    -webkit-user-select: text;
}

/* ===== Tablette : optimisations tactiles (pointeur grossier) ===== */
@media (pointer: coarse) {
    .btn, .nav-link, .product-tile, .product-card, .qty-btn, .cat-tab {
        min-height: 52px;
    }
    .btn { padding: 14px 20px; font-size: 16px; }
    .btn-sm { min-height: 44px; padding: 10px 16px; font-size: 15px; }
    input, select, textarea {
        font-size: 17px;       /* lisibilité + pas de zoom auto */
        min-height: 48px;
        padding: 12px 14px;
    }
    .form-label { font-size: 15px; font-weight: 600; }
    .data-table th, .data-table td { padding: 14px 12px; font-size: 15px; }
    .modal { max-height: 92vh; overflow-y: auto; }
    /* Boutons de paiement plus gros sur tablette */
    .btn-pay { min-height: 84px; font-size: 18px; }
}

/* ===== Tablettes en paysage (>= 1024px) : layout 2 colonnes ===== */
@media (min-width: 1024px) {
    .caisse-layout {
        grid-template-columns: 1fr 420px;
        height: calc(100vh - 90px);
    }
}

/* ===== Tablettes moyennes (768-1023px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    .caisse-layout {
        grid-template-columns: 1fr 340px;
        height: calc(100vh - 90px);
        gap: var(--space-3);
    }
    .topbar { padding: var(--space-3); }
    .main-content { padding: var(--space-3); }
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* ===== Petites tablettes & téléphones (<768px) ===== */
@media (max-width: 767px) {
    .caisse-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .caisse-cart {
        position: sticky;
        bottom: 0;
        background: white;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
        margin: 0 calc(-1 * var(--space-3));
        padding: var(--space-3);
        border-top: 2px solid var(--border);
    }
    .main-content { padding: var(--space-3); padding-bottom: 0; }
    .page-title, .page-header h1 { font-size: 1.3rem; }
    .form-row { grid-template-columns: 1fr; }
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    .stats-grid { grid-template-columns: 1fr; }
}

/* ===== Header responsive avec menu hamburger ===== */
.menu-toggle {
    display: none;
    background: rgba(255,255,255,.18);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    font-size: 24px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* Sur tablette portrait et petits écrans : menu hamburger */
@media (max-width: 1023px) {
    .menu-toggle { display: inline-flex; }
    .topbar { gap: var(--space-3); }
    .topbar-nav {
        order: 99;
        width: 100%;
        flex-direction: column;
        background: var(--primary-dark);
        padding: var(--space-3);
        border-radius: var(--radius);
        gap: var(--space-2);
        max-height: 0;
        overflow: hidden;
        padding-top: 0;
        padding-bottom: 0;
        transition: max-height .25s ease, padding .25s ease;
    }
    .topbar-nav.is-open {
        max-height: 600px;
        padding-top: var(--space-3);
        padding-bottom: var(--space-3);
    }
    .topbar-nav .nav-link {
        font-size: 16px;
        padding: 14px 16px;
        background: rgba(255,255,255,.08);
    }
}

/* Sur grand écran : pas de hamburger, nav en ligne */
@media (min-width: 1024px) {
    .menu-toggle { display: none; }
}

/* ===== Très petite tablette / téléphone portrait ===== */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .payment-grid { grid-template-columns: 1fr 1fr; }
    .modal { width: 96%; }
    .topbar-brand .brand-text {
        display: none;        /* gain de place sur très petit écran */
    }
    .topbar-user .user-name { display: none; }
}

/* ===== Mode plein écran sans barre adresse (PWA-like) ===== */
@media (display-mode: standalone) {
    .topbar { padding-top: max(var(--space-3), env(safe-area-inset-top)); }
    .main-content { padding-bottom: env(safe-area-inset-bottom); }
}

/* ===== Utilitaires ===== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.flex { display: flex; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.hidden { display: none; }

/* ============================================ */
/* Alias et compléments pour pages caisse        */
/* ============================================ */

/* product-card est un alias de product-tile */
.product-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    cursor: pointer;
    transition: transform .1s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
    text-align: center;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: inherit;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.product-card:active:not(:disabled) {
    transform: scale(.95);
    background: var(--bg-hover);
}
.product-card:hover:not(:disabled) { border-color: var(--primary); box-shadow: var(--shadow); }
.product-card:disabled,
.product-card.disabled {
    opacity: .5;
    cursor: not-allowed;
}
.product-card .product-name {
    font-weight: 600;
    font-size: 17px;
    color: var(--text);
    line-height: 1.3;
}
.product-card .product-meta {
    font-size: 13px;
    color: var(--text-muted);
}
.product-card .product-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.product-card .product-stock {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}
.product-card .product-stock.stock-low {
    color: var(--warning, #f59e0b);
    font-weight: 600;
}
.product-card .product-stock.stock-out {
    color: var(--danger, #ef4444);
    font-weight: 700;
}

/* Section forfaits */
.product-section {
    margin-bottom: var(--space-4);
}
.product-section .section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: var(--space-3) 0 var(--space-2) 0;
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--border);
}

/* Modes de paiement */
.payment-methods {
    margin: var(--space-3) 0;
}
.payment-methods h3 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.payment-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.btn-pay {
    min-height: 72px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    background: white;
    border: 2px solid var(--border);
    color: var(--text);
    cursor: pointer;
    border-radius: var(--radius);
    transition: all .15s ease;
}
.btn-pay:hover:not(:disabled) {
    border-color: var(--primary);
    background: #f0f9ff;
}
.btn-pay:active:not(:disabled) { transform: scale(.97); }
.btn-pay:disabled { opacity: .5; cursor: wait; }
.btn-pay-especes:hover:not(:disabled) { border-color: #10b981; background: #ecfdf5; }
.btn-pay-cb:hover:not(:disabled) { border-color: #3b82f6; background: #eff6ff; }
.btn-pay-cheque:hover:not(:disabled) { border-color: #8b5cf6; background: #f5f3ff; }
.btn-pay-virement:hover:not(:disabled) { border-color: #f59e0b; background: #fffbeb; }

/* Empty state */
.empty-state {
    background: white;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    text-align: center;
    color: var(--text-muted);
}

/* Bloc bouton */
.btn-block { width: 100%; }

/* ============================================ */
/* Cases à cocher des modes de paiement          */
/* ============================================ */
.payment-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-2);
}
.check-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: #f8fafc;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .15s ease;
    font-size: 15px;
    user-select: none;
}
.check-item:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}
.check-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}
.check-item input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: var(--primary);
}

/* ============================================ */
/* Page Statistiques                             */
/* ============================================ */
.date-nav-form {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.date-nav-form input[type="date"] {
    padding: var(--space-2) var(--space-3);
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-3);
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: var(--space-4);
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary);
    position: relative;
    overflow: hidden;
}
.stat-card.stat-piscine { border-left-color: #0ea5e9; }
.stat-card.stat-buvette { border-left-color: #f59e0b; }
.stat-card.stat-total { border-left-color: #10b981; background: linear-gradient(135deg, #ecfdf5 0%, white 60%); }

.stat-icon {
    font-size: 28px;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    font-weight: 600;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin: 4px 0;
}
.stat-sub {
    font-size: 13px;
    color: var(--text-muted);
}

/* Chips de paiement */
.paiement-summary {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.paiement-chip {
    background: #f1f5f9;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 14px;
    color: var(--text);
}
.paiement-chip strong {
    color: var(--primary);
}

/* Tableau de données */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table thead th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .5px;
    border-bottom: 2px solid var(--border);
}
.data-table tbody tr:hover {
    background: #f8fafc;
}
.data-table .num {
    text-align: right;
}
.data-table code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    font-size: 13px;
    color: #0369a1;
}
.data-table tfoot .total-row {
    background: #fef3c7;
    font-weight: 700;
}
.data-table tfoot .total-row td {
    border-bottom: none;
    padding-top: 14px;
    padding-bottom: 14px;
}

.detail-articles {
    max-width: 400px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Badges types de forfait */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 6px;
    background: #e0f2fe;
    color: #0369a1;
}
.badge-unitaire { background: #dbeafe; color: #1d4ed8; }
.badge-carnet { background: #ddd6fe; color: #6d28d9; }
.badge-abonnement { background: #fef3c7; color: #b45309; }

.page-header {
    margin-bottom: var(--space-4);
}
.page-header h1 {
    font-size: 24px;
    color: var(--text);
}

/* ============================================ */
/* Modal Paiement Espèces                        */
/* ============================================ */
.modal-especes {
    max-width: 540px;
    width: 95%;
}
.modal-especes .modal-header h2 {
    margin: 0;
    font-size: 22px;
}

/* Body en grille : permet de réorganiser en paysage */
.especes-body {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "total"
        "input"
        "keypad"
        "actions"
        "rendu";
    gap: var(--space-3);
}
.especes-total-row   { grid-area: total; }
.especes-input-group { grid-area: input; margin: 0; }
.especes-keypad      { grid-area: keypad; margin: 0 !important; }
.especes-actions-row { grid-area: actions; }
.especes-rendu-row   { grid-area: rendu; margin: 0 !important; }

.especes-input-group .form-label {
    display: block;
    margin-bottom: var(--space-2);
}
.especes-input {
    margin-top: 0;
    margin-bottom: 0;
}

/* ===== Mode paysage tablette : layout 2 colonnes ===== */
@media (orientation: landscape) and (min-width: 700px) {
    .modal-especes {
        max-width: 820px;
    }
    .especes-body {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "total   keypad"
            "input   keypad"
            "rendu   keypad"
            "actions actions";
        gap: var(--space-3);
        align-items: start;
    }
    .especes-keypad {
        height: 100%;
    }
    .especes-actions-row {
        grid-template-columns: 1fr 1fr;
    }
    /* Pavé plus compact en paysage pour économiser de la hauteur */
    .especes-keypad .keypad-btn {
        min-height: 56px;
        font-size: 22px;
    }
}

/* ===== Mode paysage très peu haut (téléphone paysage) ===== */
@media (orientation: landscape) and (max-height: 500px) {
    .modal-especes {
        max-width: 900px;
    }
    .modal-especes .modal-header h2 { font-size: 18px; }
    .especes-keypad .keypad-btn {
        min-height: 44px;
        font-size: 18px;
    }
    .amount-rendu { font-size: 24px; }
    .especes-input { font-size: 24px; padding: 10px 14px; }
}

.especes-total-row,
.especes-rendu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 18px;
}
.especes-total-row {
    background: #f1f5f9;
    border: 2px solid var(--border);
}
.especes-total-row strong {
    font-size: 24px;
    color: var(--text);
}
.especes-rendu-row {
    background: #fefce8;
    border: 2px solid #fde047;
}
.amount-rendu {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.amount-rendu.rendu-positif {
    color: #10b981;
}
.amount-rendu.rendu-negatif {
    color: #ef4444;
}

.especes-input {
    width: 100%;
    padding: 18px 20px;
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    border: 3px solid var(--border);
    border-radius: var(--radius);
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: white;
}
.especes-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
}

.especes-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
}
.keypad-btn {
    padding: 0;
    min-height: 64px;
    font-size: 26px;
    font-weight: 700;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .1s ease;
    color: var(--text);
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.keypad-btn:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}
.keypad-btn:active {
    transform: scale(.94);
    background: #e0f2fe;
}
.keypad-btn.keypad-back {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
    font-size: 22px;
}
.keypad-btn.keypad-back:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.especes-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}
.especes-quick {
    padding: 14px 8px;
    font-size: 15px;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .15s ease;
    min-height: 52px;
    font-family: inherit;
}
.especes-quick.especes-exact {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.especes-quick.especes-exact:hover {
    background: #0284c7;
}
.especes-quick.especes-clear {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}
.especes-quick.especes-clear:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.modal-especes .modal-footer .btn {
    flex: 1;
    min-height: 56px;
    font-size: 17px;
}
.btn-success {
    background: #10b981;
    color: white;
    border: 2px solid #10b981;
}
.btn-success:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
}
.btn-success:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ============================================ */
/* Modal Fond de caisse                          */
/* ============================================ */
.modal-overlay.modal-blocking {
    background: rgba(15, 23, 42, 0.85);
}
.modal-overlay.modal-blocking.active {
    pointer-events: auto;
}
.modal-fond {
    max-width: 420px;
    width: 95%;
}
.modal-fond .modal-header h2 {
    margin: 0;
    font-size: 22px;
}
/* Layout en UNE seule colonne : tout est empilé verticalement.
   Robuste en portrait ET en paysage, aucun problème d'alignement. */
.fond-body {
    display: block;
}
.fond-intro-block {
    display: block;
}
.fond-intro {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    margin: 0 0 var(--space-3);
}
.fond-caisse-label {
    background: #f1f5f9;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 0 0 var(--space-3);
    font-weight: 600;
    color: var(--primary);
    text-align: center;
}
.fond-intro-block .form-label {
    display: block;
    margin-bottom: var(--space-2);
}
.fond-intro-block .especes-input {
    margin: 0 0 var(--space-3);
}
.modal-fond .especes-keypad {
    margin: 0 0 var(--space-3);
}
.modal-fond .especes-quick.btn-block {
    width: 100%;
    margin-bottom: 0;
}

/* En paysage sur tablette peu haute : on compacte le pavé et les textes
   pour que tout tienne dans la hauteur sans scroll, mais TOUJOURS 1 colonne */
@media (orientation: landscape) and (max-height: 620px) {
    .modal-fond .keypad-btn {
        min-height: 44px;
        font-size: 20px;
    }
    .fond-intro {
        font-size: 14px;
        margin-bottom: var(--space-2);
    }
    .fond-caisse-label {
        padding: 7px 14px;
        margin-bottom: var(--space-2);
    }
    .fond-intro-block .especes-input {
        font-size: 26px;
        padding: 9px 14px;
        margin-bottom: var(--space-2);
    }
    .modal-fond .especes-keypad {
        margin-bottom: var(--space-2);
    }
}

/* Cartes Fonds de caisse dans stats */
.fonds-caisse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-3);
}
.fond-item {
    background: #fefce8;
    border: 2px solid #fde047;
    border-radius: var(--radius);
    padding: var(--space-3);
    text-align: center;
}
.fond-caisse-tag {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}
.fond-montant {
    font-size: 24px;
    font-weight: 700;
    color: #b45309;
    font-variant-numeric: tabular-nums;
}
.fond-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================ */
/* Logo de l'établissement                       */
/* ============================================ */
.brand-logo {
    height: 36px;
    width: auto;
    max-width: 64px;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    padding: 3px;
    flex-shrink: 0;
}
.login-logo {
    max-width: 140px;
    max-height: 140px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto var(--space-3);
    display: block;
}

/* Aperçu logo dans les paramètres */
.logo-preview-row {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    flex-wrap: wrap;
}
.logo-preview-box {
    width: 120px;
    height: 120px;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    flex-shrink: 0;
}
.logo-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.logo-preview-info {
    flex: 1;
    min-width: 200px;
}
.logo-preview-info p {
    margin: 0 0 var(--space-2);
}

@media (max-width: 480px) {
    .brand-logo { height: 32px; max-width: 48px; }
}

/* ============================================ */
/* Carnets : bouton, modals                      */
/* ============================================ */

/* Header de la zone produits caisse */
.caisse-products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    gap: var(--space-3);
    flex-wrap: wrap;
}
.caisse-products-header h2 {
    margin: 0;
}
.btn-carnet {
    background: #fef3c7;
    color: #92400e;
    border: 2px solid #fde047;
    font-weight: 700;
    font-size: 16px;
    padding: 12px 20px;
}
.btn-carnet:hover {
    background: #fde047;
    color: #78350f;
}

/* Modal vente carnet (saisie identité) */
.modal-carnet-vente { max-width: 480px; }
.cv-forfait-info {
    background: #f0f9ff;
    border: 2px solid #bae6fd;
    border-radius: var(--radius);
    padding: var(--space-3);
    text-align: center;
    font-size: 16px;
}

/* Modal utilisation carnet */
.modal-carnet-use {
    max-width: 600px;
}
.cu-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.cu-tab {
    background: white;
    border: 2px solid var(--border);
    color: var(--text);
    padding: 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    font-family: inherit;
}
.cu-tab:hover {
    background: #f0f9ff;
}
.cu-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.cu-tab-content {
    margin-top: var(--space-2);
}

.cu-results {
    margin-top: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 280px;
    overflow-y: auto;
}
.cu-result-item {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    transition: all .1s ease;
}
.cu-result-item:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}
.cu-result-item:active {
    transform: scale(.98);
}
.cu-result-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.cu-result-main strong {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cu-result-numero {
    font-size: 12px;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}
.cu-result-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
}
.cu-result-restant {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* Détail carnet sélectionné */
.cu-detail-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.cu-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 15px;
}
.cu-detail-row:last-child { border-bottom: none; }
.cu-detail-row span { color: var(--text-muted); }
.cu-detail-row strong { font-weight: 700; font-size: 16px; }

.cu-detail-row-big {
    background: #fef3c7;
    border-radius: var(--radius);
    padding: var(--space-3);
    border: 2px solid #fde047;
    margin: var(--space-2) 0;
}
.cu-detail-row-big strong { font-size: 28px !important; }

.cu-restant {
    color: #10b981;
}
.cu-restant.cu-restant-low {
    color: #f59e0b;
}
.cu-restant.cu-restant-empty {
    color: #ef4444;
}

.keypad-btn.keypad-letter {
    background: #f1f5f9;
    font-size: 16px;
    font-weight: 600;
}

/* Mode paysage tablette : modal carnet utilisation 2 colonnes */
@media (orientation: landscape) and (min-width: 800px) {
    .modal-carnet-use { max-width: 780px; }
}

/* ============================================ */
/* Annulation de la dernière vente               */
/* ============================================ */
.btn-annuler-vente {
    background: #fff7ed;
    color: #c2410c;
    border: 2px solid #fdba74;
    font-weight: 600;
    margin-top: var(--space-2);
}
.btn-annuler-vente:hover {
    background: #ffedd5;
    border-color: #fb923c;
}
.btn-annuler-vente:active {
    transform: scale(.98);
}

.modal-annul-vente {
    max-width: 460px;
    width: 95%;
}
.modal-annul-vente .modal-header h2 {
    margin: 0;
    font-size: 20px;
}
.annul-loading {
    text-align: center;
    padding: var(--space-5);
    color: var(--text-muted);
}
.annul-warning {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 14px;
    color: #b91c1c;
    margin: 0 0 var(--space-3);
}
.annul-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.annul-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
.annul-row:last-child { border-bottom: none; }
.annul-row span { color: var(--text-muted); }
.annul-row strong {
    font-weight: 700;
    text-align: right;
    max-width: 60%;
}
.annul-row-big {
    background: #fef9c3;
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-top: var(--space-2);
    border: 2px solid #fde047;
}
.annul-row-big strong {
    font-size: 22px;
    color: #92400e;
}

/* ============================================ */
/* Statistiques : filtres période & graphique    */
/* ============================================ */
.periode-filtres {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.periode-personnalisee {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}
.form-label-inline {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 14px;
}
.periode-personnalisee input[type="date"] {
    min-width: 150px;
    padding: 8px 12px;
}
@media (max-width: 600px) {
    .periode-filtres .btn { flex: 1; min-width: 0; font-size: 14px; padding: 10px 8px; }
    .periode-personnalisee { flex-direction: column; align-items: stretch; }
    .periode-personnalisee input[type="date"] { width: 100%; }
}

/* Graphique d'affluence */
.affluence-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 220px;
    padding: 0 var(--space-2);
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-3);
}
.affluence-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.affluence-bars {
    flex: 1;
    width: 100%;
    display: flex;
    gap: 2px;
    align-items: flex-end;
    justify-content: center;
}
.affluence-bar {
    flex: 1;
    min-width: 8px;
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: opacity .15s ease;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.affluence-bar:hover { opacity: .8; }
.affluence-bar span {
    font-size: 10px;
    font-weight: 700;
    color: white;
    padding-top: 3px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    line-height: 1;
}
.bar-piscine { background: linear-gradient(180deg, #0ea5e9, #0369a1); }
.bar-buvette { background: linear-gradient(180deg, #f59e0b, #b45309); }
.affluence-heure {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}
.affluence-legend {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    font-size: 14px;
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
}
@media (max-width: 600px) {
    .affluence-chart { height: 160px; gap: 3px; }
    .affluence-heure { font-size: 9px; }
    .affluence-bar span { font-size: 9px; }
}

/* ============================================ */
/* Module Infirmerie                             */
/* ============================================ */
.infirm-card { max-width: 800px; margin: 0 auto; }
.infirm-section-title {
    margin: 0 0 var(--space-3);
    font-size: 1.1rem;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    padding-bottom: 6px;
}

/* Champ Âge - large et lisible */
.infirm-age-input {
    width: 100%;
    max-width: 240px;
    padding: 14px 20px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    border: 3px solid var(--border);
    border-radius: var(--radius);
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: white;
    margin-bottom: var(--space-3);
    display: block;
}
.infirm-age-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Pavé numérique pour l'âge */
.infirm-age-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    max-width: 320px;
}
.infirm-age-keypad .keypad-btn {
    min-height: 56px;
    font-size: 22px;
}

/* Cases à cocher blessures - grosses pour tactile */
.infirm-blessures {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-2);
}
.infirm-blessure-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-size: 15px;
}
.infirm-blessure-item:hover { border-color: var(--primary); }
.infirm-blessure-item.is-checked {
    background: #f0fdf4;
    border-color: #22c55e;
    font-weight: 600;
}
.infirm-blessure-item input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    margin: 0;
    accent-color: #22c55e;
    cursor: pointer;
}

/* Bloc Pompiers - bien visible */
.infirm-pompiers {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: #fff7ed;
    border: 2px solid #fdba74;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
    user-select: none;
    -webkit-user-select: none;
}
.infirm-pompiers.is-checked {
    background: #fee2e2;
    border-color: #ef4444;
}
.infirm-pompiers input[type="checkbox"] {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    margin: 0;
    accent-color: #ef4444;
    cursor: pointer;
}
.infirm-pompiers > span { display: flex; flex-direction: column; }
.infirm-pompiers small {
    display: block;
    color: var(--text-muted);
    font-weight: normal;
    font-size: .85rem;
    margin-top: 2px;
}

/* Stats infirmerie : 2 colonnes blessures / âges */
.infirm-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-top: var(--space-3);
}
@media (max-width: 720px) {
    .infirm-stats-grid { grid-template-columns: 1fr; }
}

/* Stat card variantes */
.stat-card-danger {
    border-left: 4px solid #ef4444;
}
.stat-card-danger .stat-value { color: #b91c1c; }

/* Barre infirmerie dans le graphique d'affluence */
.bar-infirm { background: linear-gradient(180deg, #22c55e, #15803d); }

/* Modal type de blessure */
.modal-blessure {
    max-width: 520px;
    width: 95%;
}
.modal-blessure .modal-header h2 {
    margin: 0;
    font-size: 20px;
}

/* ============================================ */
/* Caisse plein écran — tout sur une page, sans  */
/* scroll de page (tablette paysage / desktop)   */
/* ============================================ */
@media (min-width: 768px) {
    /* La page caisse occupe exactement la hauteur de l'écran : aucun
       scroll global, le contenu se répartit dans la hauteur disponible. */
    body.caisse-page {
        height: 100vh;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    body.caisse-page .main-content {
        flex: 1 1 auto;
        min-height: 0;
        max-width: none;
        width: 100%;
        margin: 0;
        padding: var(--space-3);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    /* La grille caisse remplit toute la hauteur restante */
    body.caisse-page .caisse-layout {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        align-items: stretch;
        grid-template-rows: minmax(0, 1fr);
        gap: var(--space-3);
    }
    /* Colonnes : elles remplissent la hauteur, scroll interne uniquement
       si le contenu déborde vraiment (rare avec les cartes compactes) */
    body.caisse-page .caisse-products,
    body.caisse-page .caisse-cart {
        height: 100%;
        min-height: 0;
    }

    /* Grille de produits compacte pour tout faire tenir sans scroll */
    body.caisse-page .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: var(--space-2);
    }
    body.caisse-page .product-card {
        min-height: 88px;
        padding: var(--space-2) var(--space-3);
        gap: 2px;
    }
    body.caisse-page .product-card .product-name { font-size: 15px; }
    body.caisse-page .product-card .product-price { font-size: 19px; margin-top: 2px; }

    /* Titres et sections plus compacts dans la caisse */
    body.caisse-page .caisse-products h2,
    body.caisse-page .caisse-cart h2 { font-size: 1.1rem; margin-bottom: var(--space-2); }
    body.caisse-page .caisse-products-header { margin-bottom: var(--space-2); }
    body.caisse-page .product-section { margin-bottom: var(--space-2); }
    body.caisse-page .product-section .section-title { margin: var(--space-2) 0 var(--space-1); }

    /* Boutons de paiement un peu plus compacts pour garder le total visible */
    body.caisse-page .payment-methods { margin: var(--space-2) 0; }
    body.caisse-page .cart-total { font-size: 1.35rem; margin-bottom: var(--space-2); }
    body.caisse-page .btn-pay { min-height: 64px; }
    /* Les deux boutons d'action du panier côte à côte pour gagner de la place */
    body.caisse-page .caisse-cart .btn-block { margin-top: var(--space-2); }
}

/* Sur tablette paysage large : boutons de paiement encore confortables */
@media (min-width: 768px) and (pointer: coarse) {
    body.caisse-page .btn-pay { min-height: 68px; font-size: 17px; }
}

/* ============================================ */
/* Sélecteur de dates de travail (formulaire)    */
/* ============================================ */
.date-picker {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3);
    background: #f8fafc;
    max-width: 420px;
    margin-top: var(--space-1);
}
.dp-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}
.dp-titre { font-weight: 700; font-size: 1.05rem; }
.dp-arrow {
    background: white;
    border: 2px solid var(--border-strong);
    border-radius: var(--radius-sm);
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.dp-arrow:active { background: var(--bg-hover); transform: scale(.94); }
.dp-grille {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.dp-entetes { margin-bottom: 4px; }
.dp-entete {
    text-align: center;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}
.dp-vide { aspect-ratio: 1 / 1; }
.dp-jour {
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s ease, border-color .12s ease;
}
.dp-jour:hover { border-color: var(--primary); }
.dp-jour:active { transform: scale(.92); }
.dp-jour.dp-auj { border-color: var(--primary); color: var(--primary); }
.dp-jour.is-selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.dp-count {
    margin-top: var(--space-2);
    font-size: .85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-align: center;
}
/* Badge jour dans la liste des utilisateurs */
.badge-jour {
    background: #e0f2fe;
    color: #075985;
    margin: 1px;
}

/* ============================================ */
/* Calendrier de présence                         */
/* ============================================ */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}
.cal-titre {
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: capitalize;
    text-align: center;
    flex: 1;
    min-width: 180px;
}
.calendrier {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-3);
    overflow-x: auto;
}
.cal-grille {
    display: grid;
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    gap: var(--space-2);
}
.cal-entetes { margin-bottom: var(--space-2); }
.cal-entete {
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: .85rem;
    padding: var(--space-2) 0;
}
.cal-case {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: 96px;
    padding: var(--space-2);
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: white;
}
.cal-case-vide {
    background: transparent;
    border: none;
}
.cal-weekend { background: #f8fafc; }
.cal-aujourdhui {
    border: 2px solid var(--primary);
    box-shadow: 0 0 0 2px rgba(14,165,233,.15);
}
.cal-num {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    align-self: flex-end;
}
.cal-aujourdhui .cal-num {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cal-gens {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cal-personne {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}
/* Pastilles colorées par rôle */
.role-pill-piscine          { background: #e0f2fe; color: #075985; }
.role-pill-buvette          { background: #fef3c7; color: #92400e; }
.role-pill-piscine_buvette  { background: #ccfbf1; color: #115e59; }
.role-pill-infirmier        { background: #dcfce7; color: #166534; }
.role-pill-admin            { background: #ede9fe; color: #5b21b6; }

.cal-legende {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding: var(--space-3);
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.cal-legende-titre { font-weight: 700; color: var(--text-muted); }

/* Sur petit écran : calendrier défilable horizontalement */
@media (max-width: 767px) {
    .cal-grille { grid-template-columns: repeat(7, minmax(96px, 1fr)); }
    .cal-case { min-height: 80px; }
    .cal-personne { font-size: .72rem; padding: 2px 6px; }
}

/* ============================================ */
/* Journal de caisse                              */
/* ============================================ */
.journal-filtres {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: flex-end;
    margin-bottom: var(--space-4);
}
.journal-filtres .form-group { margin-bottom: 0; }

.journal-totaux {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.jt-item {
    background: white;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.jt-item.jt-success { border-left-color: var(--success); }
.jt-item.jt-danger  { border-left-color: var(--danger); }
.jt-label {
    font-size: .8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    font-weight: 600;
}
.jt-value { font-size: 1.5rem; font-weight: 700; }

/* Lignes du journal colorées par type */
.journal-ligne.journal-annulation { background: #fef2f2; }
.journal-ligne.journal-fond { background: #f0f9ff; }
