/* ============================================================
   RestoDesk — feuille de styles
   Principes : plein écran (pas de coque flottante), bordures fines
   plutôt qu'ombres, rayons différents selon la hiérarchie, couleur
   réservée au sens (cobalt = agir, safran = "vous êtes ici", piment /
   cobalt / vert = état d'une commande). L'élément mémorable : le ticket
   de commande, un vrai bon de cuisine en papier.
   Les noms de variables (--primary, --ink, --line…) sont ceux utilisés
   par les styles en ligne du HTML et du JavaScript : ne pas les renommer.
   ============================================================ */
:root{
  /* Surfaces */
  --bg-outer:#EEF0F6;
  --sidebar:#0F2272;
  --surface:#FFFFFF;
  --surface-soft:#F6F7FB;
  --line:#DFE3EE;
  --field-border:#8E98BA;
  /* Texte */
  --ink:#121A3A;
  --ink-soft:#5B6485;
  /* Cobalt : tout ce sur quoi on peut agir */
  --primary:#2147C9;
  --primary-dark:#183596;
  --primary-soft:#E6ECFC;
  /* Safran : repère "vous êtes ici" et attention (jamais un fond de bouton) */
  --saffron:#FFB400;
  --saffron-soft:#FFF4D1;
  /* États */
  --ok:#15803D;      --ok-soft:#DDF4E4;
  --pepper:#C2410C;  --pepper-soft:#FFE9DD;
  --amber:#8A5300;   --amber-soft:#FFF1D6;
  --red:#C62828;     --red-soft:#FDE8E8;
  /* Typographie */
  --font-display:'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body:'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  /* Rayons : petit pour les contrôles, moyen pour les blocs, grand pour les fenêtres */
  --r-sm:8px;
  --r-md:14px;
  --r-lg:20px;
  /* Une seule ombre, pour ce qui flotte (fenêtres, menus) */
  --shadow: 0 1px 2px rgba(18,26,58,0.06);
  --shadow-lg: 0 24px 60px rgba(10,16,40,0.28);
  --scrim: rgba(10,16,40,0.55);
  --toast-bg:#121A3A;
  --toast-text:#fff;
  --focus: 0 0 0 3px rgba(33,71,201,0.28);
}
.dark-mode{
  --bg-outer:#0A0F22;
  --sidebar:#0B1544;
  --surface:#131A36;
  --surface-soft:#1A2347;
  --line:#2A3562;
  --field-border:#5A6694;
  --ink:#E8ECFA;
  --ink-soft:#A3AED6;
  --primary:#4565EC;
  --primary-dark:#A9BCFF;
  --primary-soft:#1F2C5E;
  --saffron-soft:#3A2D08;
  --ok:#5BD08A;      --ok-soft:#12331F;
  --pepper:#FF9A6B;  --pepper-soft:#3B1D10;
  --amber:#F2B84B;   --amber-soft:#3A2B0C;
  --red:#FF8C8C;     --red-soft:#3C1717;
  --shadow: none;
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.6);
  --scrim: rgba(3,6,18,0.7);
  --toast-bg:#E8ECFA;
  --toast-text:#121A3A;
  --focus: 0 0 0 3px rgba(125,150,255,0.4);
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  background:var(--bg-outer);
  color:var(--ink);
  font-family:var(--font-body);
  font-size:14px;
  line-height:1.45;
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
/* Chiffres alignés en colonnes partout où il y a des montants */
td, th, .stat-value, .kpi-value, .ticket, .receipt-card, .mode-row, .article-row,
.breakdown-row, .emp-row, .achat-row, .nav-count{ font-variant-numeric:tabular-nums; }

/* Visible au clavier, discret à la souris */
:focus-visible{ outline:2px solid var(--primary); outline-offset:2px; }
.sidebar :focus-visible{ outline-color:var(--saffron); }
.visually-hidden, .eyebrow{
  position:absolute !important; width:1px; height:1px; overflow:hidden;
  clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap; border:0; padding:0; margin:-1px;
}

.app{ display:flex; width:100%; min-height:100vh; }

/* ---------------- Rail de navigation ---------------- */
.sidebar{
  position:sticky; top:0; align-self:flex-start;
  width:244px; height:100vh; flex-shrink:0;
  background:var(--sidebar);
  color:#fff;
  padding:24px 14px 16px;
  display:flex; flex-direction:column; gap:2px;
  overflow-y:auto;
}
.brand-logo{
  display:block; margin:0 auto 16px auto;
  width:auto; height:auto; max-width:45%; max-height:100px; object-fit:contain;
}
.brand{
  font-family:var(--font-display);
  font-weight:700; font-size:24px; letter-spacing:-0.02em; line-height:1.1;
  color:#fff; margin:2px 0 4px 10px;
}
.brand-sub{
  font-size:12.5px; font-weight:500;
  color:rgba(255,255,255,0.66);
  margin:0 0 26px 10px;
}
.nav-item{
  position:relative;
  display:flex; align-items:center; gap:12px;
  padding:10px 12px;
  border-radius:var(--r-sm);
  cursor:pointer; user-select:none;
  font-size:14.5px; font-weight:500;
  color:rgba(255,255,255,0.78);
  transition:background .12s ease, color .12s ease;
}
.nav-item:hover{ background:rgba(255,255,255,0.09); color:#fff; }
.nav-item.active{ background:rgba(255,255,255,0.14); color:#fff; font-weight:600; }
.nav-item.active::before{
  content:''; position:absolute; left:-14px; top:8px; bottom:8px; width:4px;
  background:var(--saffron); border-radius:0 3px 3px 0;
}
.nav-icon{ display:inline-flex; width:20px; height:20px; flex-shrink:0; }
.nav-icon svg{ width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; }
.nav-count{
  margin-left:auto; font-size:12.5px; font-weight:600;
  color:rgba(255,255,255,0.58);
}
.nav-item.active .nav-count{ color:var(--saffron); }
.nav-alert-dot{
  display:none; position:absolute; top:-3px; right:-4px;
  width:9px; height:9px; border-radius:50%;
  background:var(--saffron); border:2px solid var(--sidebar);
}
.nav-alert-dot.show{ display:block; }
.sidebar-foot{
  margin-top:auto; padding:14px 6px 0;
  font-size:12px; color:rgba(255,255,255,0.6); line-height:1.5;
  border-top:1px solid rgba(255,255,255,0.14);
}
.sidebar-foot #session-user-label{ color:#fff; }
.sidebar .btn-ghost{
  background:transparent; border-color:rgba(255,255,255,0.3); color:#fff;
}
.sidebar .btn-ghost:hover{ background:rgba(255,255,255,0.1); }

/* ---------------- Zone principale ---------------- */
.main{ flex:1; min-width:0; }
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:26px 40px 6px;
}
.topbar h1{
  font-family:var(--font-display);
  font-size:32px; font-weight:700; letter-spacing:-0.025em; line-height:1.1;
  margin:0;
}
.topbar .date{ font-size:13.5px; font-weight:500; color:var(--ink-soft); }
.topbar .date::first-letter{ text-transform:uppercase; }
.topbar-actions{ display:flex; align-items:center; gap:10px; }
.topbar .icon-btn{
  position:relative; width:40px; height:40px; padding:0;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-sm);
  color:var(--ink);
}
.topbar .icon-btn:hover{ background:var(--surface-soft); color:var(--ink); }
.topbar .icon-btn svg, .ico{ width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; }
.btn-logout-mobile{ display:none; }
.content{ padding:14px 40px 64px; max-width:1360px; }

.panel{ display:none; }
.panel.active{ display:block; }

.section-head{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; flex-wrap:wrap; margin-bottom:18px;
}
.section-head h2{
  font-family:var(--font-display); font-size:22px; font-weight:600; letter-spacing:-0.015em; margin:0;
}
/* Le titre de page (haut) suffit : le sous-titre ne reste que pour les lecteurs d'écran,
   sauf à l'accueil où il porte le message de bienvenue. */
.panel:not(#panel-dashboard) .section-head h2{
  position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap;
}
.panel:not(#panel-dashboard) .section-head{ justify-content:flex-end; }

/* ---------------- Boutons ---------------- */
button{ font-family:var(--font-body); cursor:pointer; }
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  min-height:40px; padding:9px 16px;
  background:var(--primary); color:#fff;
  border:1px solid transparent; border-radius:var(--r-sm);
  font-size:14px; font-weight:600; line-height:1.2;
  transition:background .12s ease, transform .08s ease;
}
.btn:hover{ background:var(--primary-dark); }
.dark-mode .btn:hover{ background:#5877F2; }
.btn:active{ transform:translateY(1px); }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn-ghost{
  background:var(--surface); color:var(--ink); border-color:var(--line);
}
.btn-ghost:hover{ background:var(--surface-soft); border-color:var(--field-border); }
.dark-mode .btn-ghost:hover{ background:var(--surface-soft); }
.btn-danger{ background:var(--red); color:#fff; }
.btn-danger:hover{ background:#a31f1f; }
.dark-mode .btn-danger{ color:#2a0a0a; }
.btn-soft{ background:var(--primary-soft); color:var(--primary-dark); }
.btn-soft:hover{ background:var(--primary-soft); filter:brightness(0.95); }
.dark-mode .btn-soft:hover{ background:var(--primary-soft); filter:brightness(1.15); }
.btn-sm{ min-height:32px; padding:5px 11px; font-size:13px; }
.icon-btn{
  background:transparent; border:none; color:var(--ink-soft); font-size:14px;
  padding:6px 8px; border-radius:var(--r-sm); min-width:30px; min-height:30px;
}
.icon-btn:hover{ background:var(--red-soft); color:var(--red); }
.icon-btn.neutral:hover{ background:var(--surface-soft); color:var(--ink); }

/* ---------------- Cartes et formulaires ---------------- */
.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--r-md);
  padding:20px;
}
.card:has(> table){ padding:6px 14px; }
.form-grid{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(150px,1fr));
  gap:14px; margin-bottom:14px;
}
label{
  display:block; margin-bottom:6px;
  font-size:13px; font-weight:600; color:var(--ink);
}
input, select, textarea{
  width:100%; min-height:40px; padding:9px 12px;
  border:1px solid var(--field-border); border-radius:var(--r-sm);
  background:var(--surface); color:var(--ink);
  font-family:var(--font-body); font-size:14px;
}
input::placeholder{ color:var(--ink-soft); opacity:.75; }
input:focus, select:focus, textarea:focus{
  outline:none; border-color:var(--primary); box-shadow:var(--focus);
}
input[type=checkbox], input[type=radio]{ width:auto; min-height:0; accent-color:var(--primary); }
input:disabled, select:disabled{ background:var(--surface-soft); color:var(--ink-soft); }

/* ---------------- Tableaux ---------------- */
table{ width:100%; border-collapse:collapse; }
th{
  text-align:left; font-size:13px; font-weight:600; color:var(--ink-soft);
  padding:12px 12px 10px; border-bottom:1px solid var(--line);
}
td{ padding:12px; border-bottom:1px solid var(--line); font-size:14px; font-weight:500; }
tbody tr:hover td{ background:var(--surface-soft); }
tr:last-child td{ border-bottom:none; }
.qty-low{ color:var(--red); font-weight:700; }

/* Badges d'état (une information qui change) : coins francs, pas de pastille */
.pill{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12.5px; font-weight:600; line-height:1.2;
  padding:3px 9px; border-radius:6px;
}
.pill-low{ background:var(--red-soft); color:var(--red); }
.pill-ok{ background:var(--ok-soft); color:var(--ok); }
/* Donnée descriptive (catégorie, rôle…) : du texte, pas un badge */
.pill-neutral{ padding:0; background:none; color:var(--ink-soft); font-weight:500; font-size:13.5px; }

.empty{
  text-align:center; padding:48px 20px;
  color:var(--ink-soft); font-size:14px; font-weight:500;
  border:1px dashed var(--field-border); border-radius:var(--r-md);
  background:transparent;
}

/* ---------------- Tickets de commande ---------------- */
.ticket-rail{
  display:grid; grid-template-columns:repeat(auto-fill, minmax(290px,1fr));
  gap:26px 22px; padding-bottom:12px;
}
.ticket{
  --st:var(--pepper);
  --paper:var(--surface);
  position:relative;
  background:var(--paper);
  padding:22px 18px 18px;
  margin-bottom:8px;
  /* Le contour suit la silhouette, bord dentelé compris */
  filter:drop-shadow(0 0 .6px rgba(18,26,58,.5)) drop-shadow(0 2px 3px rgba(18,26,58,.07));
}
.dark-mode .ticket{ filter:drop-shadow(0 0 .6px rgba(160,175,235,.45)); }
.ticket.st-attente{ --st:var(--pepper); }
.ticket.st-preparation{ --st:var(--primary); }
.ticket.st-servi{ --st:var(--ok); }
.ticket::before{               /* bandeau de couleur = état de la commande */
  content:''; position:absolute; left:0; right:0; top:0; height:6px; background:var(--st);
}
.ticket::after{                /* bord perforé */
  content:''; position:absolute; left:0; right:0; bottom:-8px; height:8px;
  background:
    linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 12px 8px,
    linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 12px 8px;
  background-repeat:repeat-x;
}
.ticket-head{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
.ticket-num{ font-size:12.5px; font-weight:600; color:var(--ink-soft); }
.ticket-table{
  font-family:var(--font-display);
  font-size:23px; font-weight:700; letter-spacing:-0.02em; line-height:1.15;
  margin:8px 0 2px;
  overflow-wrap:anywhere;
}
.ticket-employe{ font-size:12.5px; font-weight:500; color:var(--ink-soft); margin:0 0 12px; }
.ticket-items{ list-style:none; padding:0; margin:12px 0 10px; }
.ticket-items li{
  display:flex; justify-content:space-between; align-items:flex-start; gap:12px;
  font-size:14px; font-weight:500; padding:7px 0;
  border-bottom:1px dotted var(--field-border);
}
.ticket-items li:last-child{ border-bottom:none; }
.ticket-items li > span:last-child{ font-weight:600; white-space:nowrap; }
.ticket-item-note{ font-size:12.5px; font-weight:500; color:var(--ink-soft); font-style:italic; margin-top:2px; }
.ticket-total{
  display:flex; justify-content:space-between; align-items:baseline;
  font-family:var(--font-display); font-size:19px; font-weight:700;
  margin-top:8px; padding-top:12px;
  border-top:2px dashed var(--field-border);
}
.breakdown-row{
  display:flex; justify-content:space-between;
  font-size:13px; font-weight:500; color:var(--ink-soft); padding:2px 0;
}
.status-row{
  display:flex; align-items:center; justify-content:flex-end; gap:6px; flex-wrap:wrap;
  margin-top:16px;
}
.status-badge{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12.5px; font-weight:700; padding:3px 9px; border-radius:6px;
}
.status-badge::before{ content:''; width:7px; height:7px; border-radius:50%; background:currentColor; }
.status-attente{ background:var(--pepper-soft); color:var(--pepper); }
.status-preparation{ background:var(--primary-soft); color:var(--primary-dark); }
.status-servi{ background:var(--ok-soft); color:var(--ok); }
.ticket-actions{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; justify-content:flex-end; width:100%; }
.ticket-actions .icon-btn{ order:-1; margin-right:auto; }
.ticket-actions .btn-sm{ padding:4px 9px; }
.item-row{ display:grid; grid-template-columns:2fr 1fr 1fr auto; gap:8px; margin-bottom:8px; align-items:end; }
.order-item-block{ margin-bottom:12px; }
.order-item-block .oi-note{ font-size:13px; padding:7px 10px; margin-top:4px; }

/* ---------------- Employés ---------------- */
.employee-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(310px,1fr)); gap:16px; }
.emp-card{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--r-md); padding:20px;
}
.emp-name{ font-family:var(--font-display); font-size:19px; font-weight:700; letter-spacing:-0.01em; margin:0; }
.emp-role{ font-size:13.5px; color:var(--ink-soft); font-weight:500; margin:2px 0 14px; }
.emp-row{ display:flex; justify-content:space-between; gap:12px; font-size:13.5px; font-weight:500; padding:7px 0; border-bottom:1px solid var(--line); }
.emp-row:last-of-type{ border-bottom:none; }
.days-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:5px; margin-top:10px; }
.day-cell{ text-align:center; }
.day-label{ font-size:12px; font-weight:600; color:var(--ink-soft); display:block; margin-bottom:4px; }
.day-cell input{ padding:7px 2px; min-height:34px; font-size:12px; text-align:center; border-radius:6px; }
.salaire-du-box{ background:var(--surface-soft); border-radius:var(--r-sm); padding:10px 12px; margin-top:10px; }
.salaire-du-box .emp-row{ border-bottom:none; padding:3px 0; }
.emp-actions{ display:flex; gap:8px; margin-top:14px; }
.paiements-list{ margin-top:10px; max-height:110px; overflow-y:auto; }
.paiement-line{ display:flex; justify-content:space-between; font-size:13px; font-weight:500; padding:5px 0; color:var(--ink-soft); }
.add-pay-row{ display:flex; gap:6px; margin-top:10px; }
.add-pay-row input{ font-size:13px; padding:8px 10px; }
.achats-list{ margin-top:6px; max-height:230px; overflow-y:auto; display:flex; flex-direction:column; }
.achat-row{ display:flex; justify-content:space-between; align-items:center; gap:12px; padding:9px 0; border-bottom:1px solid var(--line); font-size:14px; font-weight:500; }
.achat-row:last-child{ border-bottom:none; }
.achat-numero{ font-size:14px; font-weight:600; color:var(--ink); }
.achat-date{ font-size:12.5px; color:var(--ink-soft); margin-top:1px; }
.achat-montant{ font-size:13.5px; font-weight:700; color:var(--primary-dark); }
.achat-empty{ font-size:13px; color:var(--ink-soft); padding:8px 0; }

/* ---------------- Accueil ---------------- */
.dash-actions{ display:flex; flex-wrap:wrap; gap:8px; margin:0 0 18px; }
.dash-alert{
  display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px;
  padding:12px 16px; margin-bottom:18px;
  background:var(--saffron-soft); border:1px solid var(--saffron); border-left-width:5px;
  border-radius:var(--r-sm); font-size:14px;
}
.dash-alert b{ font-weight:700; }
.dash-alert span{ color:var(--ink-soft); margin-left:6px; }
/* Les chiffres du jour : une seule bande, séparée par des filets, sans boîtes */
.kpi-band{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(190px,1fr));
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md);
  margin-bottom:22px;
}
.kpi{ padding:18px 20px; border-left:1px solid var(--line); min-width:0; }
.kpi:first-child{ border-left:none; }
.kpi-label{ display:block; font-size:13px; font-weight:600; color:var(--ink-soft); margin-bottom:6px; }
.kpi-value{
  display:block; font-family:var(--font-display);
  font-size:30px; font-weight:700; letter-spacing:-0.025em; line-height:1.1;
  overflow-wrap:anywhere;
}
.kpi-value small{ font-size:14px; font-weight:600; color:var(--ink-soft); margin-left:4px; letter-spacing:0; }
.kpi-sub{ display:block; font-size:13px; color:var(--ink-soft); margin-top:6px; }
.kpi-split{ display:flex; gap:18px; }
.kpi-split div{ min-width:0; }
.kpi-split .kpi-value{ font-size:30px; }
.kpi-split .kpi-sub{ margin-top:4px; }
.is-pepper{ color:var(--pepper); } .is-primary{ color:var(--primary-dark); } .is-ok{ color:var(--ok); } .is-red{ color:var(--red); }
.dash-cols{ display:grid; grid-template-columns:minmax(0,1.6fr) minmax(0,1fr); gap:22px; align-items:start; }
.dash-col{ display:flex; flex-direction:column; gap:22px; min-width:0; }
.dash-block{ background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); padding:18px 20px; }
.dash-block h3{
  display:flex; align-items:baseline; justify-content:space-between; gap:12px;
  font-family:var(--font-display); font-size:18px; font-weight:600; letter-spacing:-0.01em;
  margin:0 0 6px;
}
.link-btn{
  background:none; border:none; padding:2px 0; font-family:var(--font-body);
  font-size:13.5px; font-weight:600; color:var(--primary-dark); text-decoration:underline; text-underline-offset:3px;
}
.link-btn:hover{ color:var(--primary); }
.dash-muted{ color:var(--ink-soft); font-size:14px; margin:8px 0 2px; }
.activity-row{ display:flex; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); }
.activity-row:last-child{ border-bottom:none; }
.activity-ico{ flex:0 0 28px; height:28px; border-radius:var(--r-sm); background:var(--surface-soft); color:var(--ink-soft); display:flex; align-items:center; justify-content:center; }
.activity-ico svg{ width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
.activity-text{ font-size:14px; font-weight:500; }
.activity-meta{ font-size:12.5px; color:var(--ink-soft); margin-top:1px; }

.dash-cols.single{ grid-template-columns:1fr; max-width:760px; }
/* Graphique des 7 derniers jours : aujourd'hui en plein, les jours passés en atténué */
.mini-chart{ display:flex; align-items:stretch; gap:10px; height:170px; padding-top:6px; }
.mc-col{ flex:1; min-width:0; display:flex; flex-direction:column; align-items:stretch; gap:5px; }
.mc-val{ height:16px; font-size:12px; font-weight:600; color:var(--ink-soft); text-align:center; white-space:nowrap; }
.mc-col.today .mc-val{ color:var(--ink); }
.mc-bar-wrap{ flex:1; display:flex; align-items:flex-end; }
.mc-bar{ width:100%; background:var(--primary); opacity:.5; border-radius:4px 4px 0 0; min-height:2px; }
.mc-col.today .mc-bar{ opacity:1; }
.mc-label{ font-size:12.5px; font-weight:500; color:var(--ink-soft); text-align:center; text-transform:capitalize; }
.mc-col.today .mc-label{ color:var(--ink); font-weight:700; }

/* ---------------- Reçus ---------------- */
.receipt-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(280px,1fr)); gap:18px; }
.receipt-card{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-md); padding:20px;
}
.receipt-head{ display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:10px; gap:8px; }
.receipt-num{ font-size:12.5px; font-weight:600; color:var(--ink-soft); }
.receipt-client{ font-family:var(--font-display); font-size:19px; font-weight:700; letter-spacing:-0.01em; margin:2px 0 0; }
.receipt-items{ list-style:none; padding:0; margin:12px 0; }
.receipt-items li{ display:flex; justify-content:space-between; gap:12px; font-size:13.5px; font-weight:500; padding:6px 0; border-bottom:1px dotted var(--field-border); }
.receipt-items li:last-child{ border-bottom:none; }
.receipt-total{
  display:flex; justify-content:space-between; align-items:baseline;
  font-family:var(--font-display); font-size:18px; font-weight:700;
  padding-top:12px; border-top:2px dashed var(--field-border); margin-bottom:12px;
}
.pay-select{
  width:auto; min-height:32px; font-weight:700; font-size:13px; padding:4px 10px;
  border-radius:6px; border:1px solid transparent;
}
.pay-non_paye{ background:var(--red-soft); color:var(--red); }
.pay-partiel{ background:var(--amber-soft); color:var(--amber); }
.pay-paye{ background:var(--ok-soft); color:var(--ok); }
.receipt-foot{ display:flex; align-items:center; justify-content:space-between; margin-top:12px; gap:8px; flex-wrap:wrap; }
.receipt-actions{ display:flex; gap:6px; }
.receipt-mode{ font-size:12.5px; color:var(--ink-soft); font-weight:500; margin-top:3px; }

/* ---------------- Rapports ---------------- */
.report-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(340px,1fr)); gap:20px; }
.report-card{ padding:22px; }
.report-card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:10px; }
.report-card-head h3{ font-family:var(--font-display); font-size:19px; font-weight:600; letter-spacing:-0.01em; margin:0; }
.stat-grid{ display:grid; grid-template-columns:1fr 1fr; gap:0 28px; margin-bottom:12px; }
.stat-box{ background:none; border:none; border-top:1px solid var(--line); padding:12px 0; }
/* Bande de chiffres : un seul cadre, séparée par des filets (même langage que l'Accueil) */
.stats-bar{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(170px,1fr));
  gap:1px; background:var(--line);
  border:1px solid var(--line); border-radius:var(--r-md); overflow:hidden;
}
.stats-bar .stat-box{ background:var(--surface); border:none; padding:16px 18px; }
.stat-box .stat-label{ font-size:13px; font-weight:600; color:var(--ink-soft); display:block; margin-bottom:4px; }
.stat-box .stat-value{ font-family:var(--font-display); font-size:22px; font-weight:700; letter-spacing:-0.02em; color:var(--ink); }
.stats-bar .stat-box .stat-value{ font-size:24px; }
.report-sub{ font-size:14px; font-weight:700; color:var(--ink); margin:18px 0 8px; }
.mode-row, .article-row{ display:flex; justify-content:space-between; gap:12px; font-size:14px; padding:7px 0; border-bottom:1px solid var(--line); }
.mode-row:last-child, .article-row:last-child{ border-bottom:none; }
.article-row .art-qty{ color:var(--ink-soft); font-size:13px; }
.pagination{ display:flex; align-items:center; justify-content:center; gap:6px; margin-top:26px; flex-wrap:wrap; }
.page-btn{
  min-width:38px; height:38px; padding:0 10px;
  border-radius:var(--r-sm); border:1px solid var(--line); background:var(--surface);
  color:var(--ink); font-size:14px; font-weight:600;
}
.page-btn:hover{ background:var(--surface-soft); border-color:var(--field-border); }
.page-btn.active{ background:var(--primary); border-color:var(--primary); color:#fff; }
.page-btn:disabled{ opacity:.4; cursor:not-allowed; }
.hide-cout .col-cout{ display:none; }
.search-row{ display:flex; gap:8px; margin-bottom:16px; align-items:center; flex-wrap:wrap; }
.search-row input{ max-width:380px; }
.search-row label{ margin:0; font-weight:600; }

/* ---------------- Fenêtres ---------------- */
.modal-overlay{
  display:none; position:fixed; inset:0; background:var(--scrim);
  align-items:center; justify-content:center; z-index:50; padding:20px;
}
.modal-overlay.active{ display:flex; }
.modal{
  background:var(--surface); color:var(--ink);
  border:1px solid var(--line); border-radius:var(--r-lg);
  padding:28px; width:100%; max-width:500px; max-height:88vh; overflow-y:auto;
  box-shadow:var(--shadow-lg); position:relative;
}
.modal h3{ font-family:var(--font-display); margin:0 0 18px; font-size:23px; font-weight:700; letter-spacing:-0.02em; }
.modal-foot{ display:flex; justify-content:flex-end; gap:8px; margin-top:20px; }
.modal-close-btn{
  position:absolute; top:12px; right:12px; width:40px; height:40px;
  background:transparent; border:none; border-radius:var(--r-sm);
  font-size:24px; line-height:1; color:var(--ink-soft);
}
.modal-close-btn:hover{ background:var(--surface-soft); color:var(--ink); }

/* ---------------- Connexion ---------------- */
#login-overlay{ background:var(--sidebar) !important; }
#login-overlay .modal{ max-width:400px; }
#login-overlay .modal h3{ font-size:26px; }

/* ---------------- Notifications ---------------- */
#notif-panel{ box-shadow:var(--shadow-lg); }
#notif-panel .notif-item{ display:flex; gap:10px; align-items:flex-start; padding:10px; border-radius:var(--r-sm); cursor:pointer; }
#notif-panel .notif-item:hover{ background:var(--surface-soft); }
#notif-panel .notif-icon{ width:18px; flex-shrink:0; color:var(--ink-soft); }
#notif-panel .notif-title{ font-size:14px; font-weight:600; color:var(--ink); }
#notif-panel .notif-sub{ font-size:12.5px; color:var(--ink-soft); margin-top:1px; }
#notif-panel .notif-empty{ text-align:center; padding:24px 10px; color:var(--ink-soft); font-size:14px; }

/* ---------------- Messages ---------------- */
.toast-container{
  position:fixed; top:20px; right:20px; z-index:9999;
  display:flex; flex-direction:column; gap:10px; max-width:380px;
}
.toast{
  background:var(--toast-bg); color:var(--toast-text);
  padding:12px 14px; border-radius:var(--r-sm);
  box-shadow:var(--shadow-lg);
  font-size:14px; font-weight:500; line-height:1.4;
  display:flex; align-items:flex-start; gap:10px;
  border-left:5px solid var(--primary);
  animation:slideIn .22s ease;
}
.toast svg{ width:18px; height:18px; flex-shrink:0; margin-top:1px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.toast.error{ border-left-color:var(--red); }
.toast.success{ border-left-color:var(--ok); }
.toast.warning{ border-left-color:var(--saffron); }
.toast-close{ background:transparent; border:none; color:inherit; opacity:.65; font-size:18px; line-height:1; margin-left:auto; padding:0 2px; }
.toast-close:hover{ opacity:1; }
@keyframes slideIn{ from{ transform:translateX(24px); opacity:0; } to{ transform:none; opacity:1; } }

::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:var(--line); border-radius:5px; border:2px solid transparent; background-clip:content-box; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}
@media (pointer: coarse){
  .btn{ min-height:44px; }
  .btn-sm{ min-height:38px; }
  input, select{ min-height:44px; }
}

/* ---------------- Tablette ---------------- */
@media (max-width: 1080px){
  .dash-cols{ grid-template-columns:1fr; }
  .topbar, .content{ padding-left:28px; padding-right:28px; }
  .sidebar{ width:212px; }
}

/* ---------------- Téléphone : navigation en barre d'onglets en bas ---------------- */
@media (max-width: 760px){
  .app{ flex-direction:column; }
  .sidebar{
    position:fixed; left:0; right:0; bottom:0; top:auto; z-index:40;
    width:100%; height:auto; flex-direction:row; align-items:stretch; gap:0;
    padding:6px 6px calc(6px + env(safe-area-inset-bottom));
    overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch;
    border-top:1px solid rgba(255,255,255,0.14);
  }
  .brand, .brand-sub, .sidebar-foot, .nav-count{ display:none; }
  .nav-item{
    flex:0 0 auto; flex-direction:column; justify-content:center; gap:3px;
    min-width:70px; padding:7px 8px; font-size:12px; text-align:center;
  }
  .nav-item.active::before{ left:12px; right:12px; top:-6px; bottom:auto; width:auto; height:4px; border-radius:0 0 3px 3px; }
  .main{ padding-bottom:84px; }
  #env-banner{ bottom:84px !important; }
  .topbar{ padding:16px 18px 4px; flex-wrap:wrap; row-gap:8px; }
  .topbar h1{ font-size:26px; }
  .topbar .date{ display:none; }
  .btn-logout-mobile{ display:inline-flex; }
  .content{ padding:12px 18px 24px; }
  .kpi{ border-left:none; border-top:1px solid var(--line); }
  .kpi:first-child{ border-top:none; }
  .kpi-band{ grid-template-columns:1fr; }
  .item-row{ grid-template-columns:1fr 1fr; }
  .card{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .card table{ min-width:600px; }
  .toast-container{ left:12px; right:12px; top:12px; max-width:none; }
  .modal{ padding:22px 18px; }
  .ticket-rail{ grid-template-columns:1fr; }
}
