/* ==========================================================================
   Buvette — feuille de style unique
   ========================================================================== */

:root {
    --primary: #BA2932;
    --primary-dark: #8E1C24;
    --primary-soft: #FBE9EA;
    --ground: #F6F3EF;
    --surface: #FFFFFF;
    --ink: #1D1B19;
    --ink-2: #4A4540;
    --muted: #6B655F;
    --line: #E7E1DA;
    --line-soft: #EFE9E2;
    --field: #DCD4CB;
    --on: #1F7A4D;
    --off: #CFC8C0;
    --danger: #A3242C;
    --warn-bg: #FFF1D6;
    --warn-line: #F1D9A6;
    --warn-ink: #5C3D00;
    --ok-bg: #E8F3EC;
    --ok-line: #CFE6D7;
    --ok-ink: #155A38;
    --radius: 16px;
    --nav-height: 4.5rem;
    --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

/* Pas de zoom au pincement ni au double-tap (choix d'appli installée).
   Les tailles sont en rem : le réglage « taille du texte » du téléphone reste respecté. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: pan-x pan-y; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.4;
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid #2F6FDB; outline-offset: 2px; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- En-tête -------------------------------------------------------------- */

.app-top {
    position: sticky;
    top: 0;
    z-index: 100;
}
/* Texte très agrandi : l'en-tête ne reste plus collé pour laisser de la place au contenu */
.app-top.is-static { position: static; }

.app-header {
    background: var(--primary);
    color: #FFFFFF;
    padding: calc(0.875rem + env(safe-area-inset-top)) 1rem 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4.25rem;
    flex-wrap: wrap;
}

.app-header-text { flex: 1 1 10rem; min-width: 0; }
.app-header h1 { font-size: 1.375rem; font-weight: 800; letter-spacing: -0.01em; }
.app-header-sub { font-size: 0.875rem; color: #FBE3E4; margin-top: 2px; }

.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.75rem;
    padding: 0 0.875rem;
    border-radius: 22px;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    background: transparent;
    color: #FFFFFF;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    flex-shrink: 0;
}
.header-btn svg { width: 1.125rem; height: 1.125rem; }

.back-btn {
    width: 2.75rem;
    height: 2.75rem;
    margin-left: -0.5rem;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    flex-shrink: 0;
}
.back-btn svg { width: 1.5rem; height: 1.5rem; }

/* --- Bandeau d'état des écrans ------------------------------------------- */

.status-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem 0.625rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid transparent;
}
.status-strip svg { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.status-strip-text { flex: 1 1 12rem; min-width: 0; }
.status-strip-title { font-size: 0.9375rem; font-weight: 700; }

.status-strip.is-ok { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); font-weight: 600; }
.status-strip.is-dirty { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.status-strip.is-sending { background: var(--surface); color: var(--ink); border-color: var(--line); }
.status-strip.is-error { background: #FDECEC; color: var(--danger); border-color: #F3C9CB; }

.status-strip .btn { min-height: 2.75rem; padding: 0 0.875rem; font-size: 0.9375rem; flex-shrink: 0; }

.tech-details { margin-top: 0.375rem; font-size: 0.8125rem; }
.tech-details summary { cursor: pointer; font-weight: 600; text-decoration: underline; min-height: 1.75rem; display: flex; align-items: center; }
.tech-details pre {
    margin: 0.375rem 0 0;
    padding: 0.5rem 0.625rem;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.75rem;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    color: var(--ink-2);
    user-select: all;
}
.problem-card { background: #FDECEC; border-color: #F3C9CB; color: var(--danger); gap: 0.5rem; }
.problem-card p { color: var(--ink); font-size: 0.9375rem; }
.screen-error { background: #FDECEC; border-radius: 12px; padding: 0.75rem; font-size: 0.875rem; color: var(--ink); }
.screen-error strong { color: var(--danger); }

.progress { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; margin-top: 6px; }
.progress-bar {
    height: 100%;
    width: 35%;
    border-radius: 3px;
    background: var(--primary);
    animation: progress-slide 1.2s ease-in-out infinite;
}
@keyframes progress-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(290%); }
}

/* --- Page ----------------------------------------------------------------- */

.page {
    max-width: 40rem;
    margin: 0 auto;
    padding: 1rem 1rem 7.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.hint { font-size: 0.8125rem; color: var(--muted); text-align: center; }

/* --- Filtres en pastilles ------------------------------------------------- */

.chips {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    margin: 0 -1rem;
    padding: 0 1rem 2px;
    scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0 1rem;
    border-radius: 20px;
    border: 1.5px solid var(--field);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }

/* --- Sections et listes --------------------------------------------------- */

.section { display: flex; flex-direction: column; gap: 0.5rem; scroll-margin-top: 8.75rem; }

.section-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.25rem 0.25rem 0;
    flex-wrap: wrap;
}
.section-head h2 { font-size: 1.125rem; font-weight: 800; }
.section-count { font-size: 0.875rem; color: var(--muted); }

.pill {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 700;
    color: #5E5750;
    background: var(--line);
    padding: 3px 0.5rem;
    border-radius: 10px;
}

.list {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.row {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 0.625rem;
    background: var(--surface);
    min-height: 4rem;
}
.row + .row { border-top: 1px solid var(--line-soft); }

.row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 0.5rem 0.75rem 1rem;
    color: inherit;
    text-decoration: none;
    background: transparent;
    border: none;
    text-align: left;
}
.drag-handle + .row-main { padding-left: 0.25rem; }

.row-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    background: var(--ground);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    color: #5E5750;
}
.row-icon svg { width: 1.375rem; height: 1.375rem; }

.row-text { flex: 1 1 7rem; min-width: 0; }
.row-name {
    display: block;
    font-size: 1.0625rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.row-sub { display: block; font-size: 0.8125rem; color: var(--muted); margin-top: 2px; }
.row-price { font-size: 1.0625rem; font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0; }

.row-sold-out { display: none; font-size: 0.8125rem; font-weight: 700; color: var(--danger); margin-top: 2px; }
.row.is-off .row-main { opacity: 0.6; }
.row.is-off .row-name { text-decoration: line-through; }
.row.is-off .row-sold-out { display: block; }

.row-empty { padding: 1.125rem 1rem; font-size: 0.9375rem; color: var(--muted); }

.status-ok { color: var(--on) !important; font-weight: 600; }
.status-old, .status-never, .status-late { color: #8A5A00 !important; font-weight: 600; }
.status-off { color: var(--muted) !important; }
.status-sending { color: #2F5FB3 !important; font-weight: 600; }
.status-error { color: var(--danger) !important; font-weight: 600; }
.screen-info { margin-top: 0; }
.screen-info.is-warning { color: #8A5A00; }

/* --- Interrupteur --------------------------------------------------------- */

.switch {
    flex-shrink: 0;
    width: 3.75rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
}
.switch-track {
    position: relative;
    display: block;
    width: 3.25rem;
    height: 2rem;
    border-radius: 16px;
    background: var(--off);
    transition: background 0.2s;
}
.switch-knob {
    position: absolute;
    top: 0.1875rem;
    left: 0.1875rem;
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}
.switch[aria-checked="true"] .switch-track { background: var(--on); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(1.25rem); }
.switch:disabled { opacity: 0.6; }
.switch-form { margin: 0; display: contents; }

/* --- Glisser-déposer ------------------------------------------------------ */

.drag-handle {
    width: 2.25rem;
    height: 3rem;
    margin-left: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #A39B93;
    cursor: grab;
    flex-shrink: 0;
    border-radius: 10px;
    touch-action: none;
}
.drag-handle svg { width: 1.25rem; height: 1.25rem; pointer-events: none; }
.drag-handle:active { cursor: grabbing; color: var(--primary); background: var(--primary-soft); }
.drag-handle.hint { animation: pulse-handle 1.5s ease-in-out 3; color: var(--primary); }
@keyframes pulse-handle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.row.sortable-ghost { background: var(--primary-soft); }
.row.sortable-ghost > * { opacity: 0.4; }
.row.sortable-chosen { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15); }
.row.sortable-drag, .row.sortable-fallback { opacity: 0 !important; }

/* --- Boutons -------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 3.25rem;
    padding: 0 1.25rem;
    border-radius: 14px;
    border: 1.5px solid transparent;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.btn svg { width: 1.25rem; height: 1.25rem; }
.btn-primary { background: var(--primary); color: #FFFFFF; }
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); border-color: var(--field); color: var(--ink); }
.btn-dashed { background: var(--surface); border: 1.5px dashed #C9BFB4; color: var(--primary); }
.btn-link-danger { background: transparent; color: var(--danger); min-height: 3rem; font-size: 0.9375rem; }
.btn-block { width: 100%; }
.btn-lg { min-height: 3.5rem; font-size: 1.0625rem; font-weight: 800; }
.btn:disabled { background: #B7AEA5; border-color: #B7AEA5; color: #FFFFFF; cursor: not-allowed; }

.fab {
    position: fixed;
    right: max(1rem, calc(50% - 19rem));
    bottom: calc(var(--nav-height) + 1rem + env(safe-area-inset-bottom));
    z-index: 80;
    min-height: 3.5rem;
    padding: 0 1.375rem 0 1.125rem;
    border-radius: 28px;
    background: var(--primary);
    color: #FFFFFF;
    font-size: 1rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(186, 41, 50, 0.35);
}
.fab svg { width: 1.375rem; height: 1.375rem; }

/* --- Cartes (blocs) ------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.card-head h2 { font-size: 1.125rem; font-weight: 800; }
.card-head span { font-size: 0.8125rem; color: var(--muted); }

/* --- Formulaires ---------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: 1.25rem; }

.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field-label, .field > label { font-size: 0.875rem; font-weight: 700; color: var(--ink-2); }
.field-help { font-size: 0.8125rem; color: var(--muted); }

.input, .field input[type="text"], .field input[type="number"], .field textarea, .field select {
    width: 100%;
    min-height: 3.25rem;
    border-radius: 12px;
    border: 1.5px solid var(--field);
    background: var(--surface);
    padding: 0 0.875rem;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--ink);
}
.field textarea { padding: 0.75rem 0.875rem; font-weight: 500; font-size: 1rem; resize: vertical; min-height: 5rem; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.input.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 500; font-size: 1rem; }

.form-error, .field ul { color: var(--danger); font-size: 0.8125rem; font-weight: 600; margin: 0; padding: 0; list-style: none; }
.field.has-error input, .field.has-error textarea { border-color: var(--danger); }

/* Choix en pastilles (radios) */
.choice-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice-chips input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chips label {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 1rem;
    border-radius: 22px;
    border: 1.5px solid var(--field);
    background: var(--surface);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
}
.choice-chips input:checked + label { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }
.choice-chips input:focus-visible + label { outline: 3px solid #2F6FDB; outline-offset: 2px; }
.placement-chips label { gap: 0.5rem; padding-left: 0.75rem; }
.placement-chips svg { width: 1rem; height: 1.4rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; }
.placement-chips svg .fill { fill: currentColor; stroke: none; }

/* Prix */
.price-stepper { display: flex; align-items: center; gap: 0.625rem; }
.stepper-btn {
    width: 3.25rem;
    min-height: 3.25rem;
    border-radius: 14px;
    border: 1.5px solid var(--field);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stepper-btn svg { width: 1.375rem; height: 1.375rem; }
.price-input {
    flex: 1;
    min-width: 0;
    min-height: 3.25rem;
    border-radius: 14px;
    border: 1.5px solid transparent;
    background: var(--ground);
    text-align: center;
    font-size: 1.625rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.price-input:focus { border-color: var(--primary); outline: none; background: var(--surface); }
.price-wrap { position: relative; flex: 1; display: flex; }
.price-wrap .price-input { padding-right: 2.125rem; padding-left: 2.125rem; }
.price-wrap::after {
    content: '€';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--muted);
    pointer-events: none;
}

.quick-prices { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.75rem, 1fr)); gap: 0.375rem; }
.quick-price {
    min-height: 2.5rem;
    border-radius: 10px;
    border: 1.5px solid var(--field);
    background: var(--surface);
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0;
    font-variant-numeric: tabular-nums;
}
.quick-price.is-active { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }

/* Ligne avec interrupteur (case à cocher stylée) */
.toggle-row { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.toggle-row-text { flex: 1; }
.toggle-row-title { font-size: 1.0625rem; font-weight: 700; }
.toggle-row-help { font-size: 0.8125rem; color: var(--muted); }
.toggle-row input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row input[type="checkbox"]:checked + .switch-track { background: var(--on); }
.toggle-row input[type="checkbox"]:checked + .switch-track .switch-knob { transform: translateX(1.25rem); }
.toggle-row input[type="checkbox"]:focus-visible + .switch-track { outline: 3px solid #2F6FDB; outline-offset: 2px; }
.toggle-row .switch-track { flex-shrink: 0; }

/* Repliable */
details.more { border-top: 1px solid var(--line-soft); }
details.more > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--ink-2);
    cursor: pointer;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary svg { width: 1.25rem; height: 1.25rem; transition: transform 0.2s; }
details.more[open] > summary svg { transform: rotate(180deg); }
details.more > .more-body { display: flex; flex-direction: column; gap: 1.125rem; padding: 0.25rem 0 0.5rem; }

.form-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.625rem; }

/* Grille d'émojis */
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr)); gap: 0.5rem; }
.emoji-btn {
    min-height: 3rem;
    border-radius: 12px;
    border: 2px solid var(--line);
    background: var(--surface);
    font-size: 1.5rem;
    padding: 0;
}
.emoji-btn.is-active { border-color: var(--primary); background: var(--primary-soft); }

/* Sélecteurs segmentés */
.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr)); gap: 0.5rem; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
    min-height: 3.5rem;
    border-radius: 12px;
    border: 2px solid var(--line);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    padding: 0.25rem;
}
.segmented input:checked + label { border-color: var(--primary); background: var(--primary-soft); }
.segmented input:focus-visible + label { outline: 3px solid #2F6FDB; outline-offset: 2px; }
.swatch { width: 22px; height: 14px; border-radius: 3px; border: 1px solid var(--ink); flex-shrink: 0; }
.orient-icon { border: 2px solid var(--ink); border-radius: 3px; flex-shrink: 0; }

/* --- Écrans e-ink --------------------------------------------------------- */

.preview-frame {
    align-self: center;
    background: #2A2826;
    padding: 0.625rem;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    width: 100%;
    max-width: 18.125rem;
}
.preview-frame.is-landscape { max-width: 100%; }
.preview-screen {
    position: relative;
    background: #FFFFFF;
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-frame.is-landscape .preview-screen { aspect-ratio: 3 / 2; }
.preview-screen img { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview-placeholder { font-size: 0.875rem; color: var(--muted); text-align: center; padding: 1rem; }
.preview-screen.is-loading img { opacity: 0.35; }
.preview-screen .spinner { position: absolute; }

.spinner {
    width: 1.75rem;
    height: 1.75rem;
    border: 3px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.inline-form { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-top: 1px solid var(--line-soft); }
.screen-edit { padding: 0 1rem 1rem 4.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.screen-edit .actions { display: flex; gap: 0.625rem; flex-wrap: wrap; }

.label-items { max-height: 15rem; overflow-y: auto; }
.label-item.is-selected { background: var(--primary-soft); }

/* --- Barre d'onglets ------------------------------------------------------ */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    min-height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: var(--muted);
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    padding: 0.375rem 0.25rem;
    text-align: center;
}
.bottom-nav a[aria-current="page"] { color: var(--primary); }
.bottom-nav .nav-icon { position: relative; width: 1.625rem; height: 1.625rem; }
.bottom-nav .nav-icon svg { width: 1.625rem; height: 1.625rem; }
.nav-dot {
    position: absolute;
    top: -2px;
    right: -0.25rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #E08A00;
    border: 2px solid var(--surface);
}

/* --- Messages ------------------------------------------------------------- */

.toasts {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: calc(var(--nav-height) + 5.25rem + env(safe-area-inset-bottom));
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    pointer-events: none;
}
.toast {
    width: 100%;
    max-width: 30rem;
    min-height: 3.25rem;
    background: var(--ink);
    color: #FFFFFF;
    border-radius: 14px;
    padding: 0.375rem 0.375rem 0.375rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    font-size: 0.9375rem;
    font-weight: 600;
    pointer-events: auto;
    animation: toast-in 0.25s ease-out;
}
.toast.is-error { background: var(--danger); }
.toast-text { flex: 1; padding: 0.5rem 0; }
.toast-action {
    min-height: 2.75rem;
    padding: 0 0.875rem;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #FFB4B8;
    font-size: 0.9375rem;
    font-weight: 800;
}
.toast.is-leaving { opacity: 0; transform: translateY(0.625rem); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(0.625rem); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- État vide / hors ligne ---------------------------------------------- */

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.empty-state svg { width: 3.5rem; height: 3.5rem; color: #B7AEA5; }
.empty-state h2 { color: var(--ink); font-size: 1.25rem; }

/* --- Tirer pour actualiser ----------------------------------------------- */

.pull-to-refresh {
    position: fixed;
    top: 5rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 95;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-1.25rem);
    transition: opacity 0.2s, transform 0.2s;
}
.pull-to-refresh.visible { opacity: 1; transform: translateY(0); }
.pull-to-refresh .pull-arrow { width: 32px; height: 32px; color: var(--primary); transition: transform 0.2s; background: var(--surface); border-radius: 50%; padding: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.pull-to-refresh.ready .pull-arrow { transform: rotate(180deg); }

/* --- Connexion ------------------------------------------------------------ */

.login-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.login-screen.hidden { display: none; }
.login-box {
    width: 100%;
    max-width: 22.5rem;
    background: var(--surface);
    border-radius: 24px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.login-logo { width: 5.5rem; height: 5.5rem; object-fit: contain; margin: 0 auto 0.75rem; display: block; }
.login-title { font-size: 1.625rem; font-weight: 800; }
.login-subtitle { color: var(--muted); font-size: 0.9375rem; margin: 0.375rem 0 1.5rem; }
.login-input {
    width: 100%;
    min-height: 3.5rem;
    border-radius: 14px;
    border: 1.5px solid var(--field);
    padding: 0 1rem;
    font-size: 1.125rem;
    text-align: center;
    margin-bottom: 0.75rem;
}
.login-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.login-input.error { border-color: var(--danger); animation: shake 0.4s; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-0.5rem); }
    75% { transform: translateX(0.5rem); }
}
.login-error { color: var(--danger); font-size: 0.875rem; font-weight: 600; margin-top: 0.75rem; display: none; }
.login-error.show { display: block; }

/* --- Bannière d'installation PWA ----------------------------------------- */

.pwa-install-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: calc(var(--nav-height) + 0.75rem + env(safe-area-inset-bottom));
    z-index: 150;
    max-width: 30rem;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    gap: 0.75rem;
}
.pwa-install-banner.show { display: flex; animation: toast-in 0.3s ease-out; }
.pwa-install-header { display: flex; align-items: center; gap: 0.75rem; }
.pwa-install-icon { width: 48px; height: 48px; border-radius: 12px; }
.pwa-install-content { flex: 1; }
.pwa-install-title { font-size: 1rem; font-weight: 800; }
.pwa-install-subtitle { font-size: 0.875rem; color: var(--muted); }
.pwa-install-close { width: 44px; height: 44px; border: none; background: var(--ground); border-radius: 22px; display: flex; align-items: center; justify-content: center; }
.pwa-ios-instructions { font-size: 14px; color: var(--ink-2); background: var(--ground); border-radius: 12px; padding: 12px; }
.pwa-ios-instructions svg { width: 1.125rem; height: 1.125rem; vertical-align: -3px; }
.pwa-install-footer label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--muted); }

/* --- Portrait uniquement --------------------------------------------------
   Téléphone tenu à l'horizontale (écran tactile peu haut) : l'interface est masquée.
   Tablettes et ordinateurs ne sont pas concernés. */

.rotate-overlay { display: none; }

@media (orientation: landscape) and (max-height: 37.5em) and (pointer: coarse) {
    .rotate-overlay {
        position: fixed;
        inset: 0;
        z-index: 10000;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 1.5rem;
        background: var(--primary);
        color: #FFFFFF;
        text-align: center;
    }
    .rotate-overlay svg { width: 4rem; height: 4rem; margin-bottom: 0.5rem; }
    .rotate-title { font-size: 1.375rem; font-weight: 800; }
    .rotate-text { font-size: 1rem; color: #FBE3E4; }
    body { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
