/* Horaires Dixie Lee : grille de semaine façon tableau de cuisine.
   Couleurs de la marque (rouge Dixie, or), une couleur par poste. */
:root {
  --rouge: #c8102e; --rouge-f: #9c0c23; --rouge-t: #b30e29; --or: #f2b134;
  --encre: #1d1416; --papier: #ffffff; --papier-2: #f7f2f1; --gris: #64575a; --ligne: #e3d9d8;
  --ok: #157a3a; --ok-bg: #e5f4ea; --att: #8a5a00; --att-bg: #fff3d6; --err: #b3261e; --err-bg: #fde8e7;
  --cuis: #c2410c; --cuis-bg: #ffedd5; --comm: #1d5fb8; --comm-bg: #e0ecfb; --livr: #1f7a3c; --livr-bg: #dff3e5;
  --focus: #1f6feb;
  --f-titre: "Alfa Slab One", Rockwell, Georgia, serif;
  --f-texte: "Karla", "Segoe UI", system-ui, sans-serif;
  --r: 8px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --rouge: #b80f2a; --rouge-f: #8f0b20; --rouge-t: #ff7a8c; --encre: #f4eceb; --papier: #161011; --papier-2: #211819; --gris: #bcadaf; --ligne: #3d3032;
  --ok: #5ad48a; --ok-bg: #12301f; --att: #f2c35b; --att-bg: #33270c; --err: #ff8a80; --err-bg: #3a1513;
  --cuis: #fb923c; --cuis-bg: #3b1d0c; --comm: #7cb2ff; --comm-bg: #10233d; --livr: #6ee49a; --livr-bg: #0f2b1a; --focus: #7cb2ff;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --rouge: #b80f2a; --rouge-f: #8f0b20; --rouge-t: #ff7a8c; --encre: #f4eceb; --papier: #161011; --papier-2: #211819; --gris: #bcadaf; --ligne: #3d3032;
  --ok: #5ad48a; --ok-bg: #12301f; --att: #f2c35b; --att-bg: #33270c; --err: #ff8a80; --err-bg: #3a1513;
  --cuis: #fb923c; --cuis-bg: #3b1d0c; --comm: #7cb2ff; --comm-bg: #10233d; --livr: #6ee49a; --livr-bg: #0f2b1a; --focus: #7cb2ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--papier-2); color: var(--encre); font: 15px/1.45 var(--f-texte); }
h1, h2 { margin: 0; text-wrap: balance; line-height: 1.2; }
h1 { font-size: 1.25rem; font-weight: 700; }
h2 { font-size: 1.05rem; }
a { color: var(--rouge-t); }
small { font-size: .8em; color: var(--gris); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input, select, button { font: inherit; color: inherit; }

/* En-tête */
.entete { background: var(--rouge); color: #fff; position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px); }
.entete-in, .nav-in, .demo-in, .main { max-width: 84rem; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.entete-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.marque { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.marque img { background: #fff; border-radius: 50%; padding: 3px; }
.marque span { display: flex; flex-direction: column; line-height: 1.1; }
.marque b { font-family: var(--f-titre); font-weight: 400; font-size: 1.3rem; letter-spacing: .01em; }
.marque small { color: #ffe0e5; font-size: .75rem; }
#qui { display: flex; align-items: center; gap: 12px; text-align: right; }
.moi { display: flex; flex-direction: column; line-height: 1.15; font-weight: 700; }
.moi small { color: #ffe0e5; font-weight: 400; }
#qui .btn-lien { color: #fff; }
.nav { background: var(--rouge-f); }
.nav-in { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: #ffe0e5; text-decoration: none; padding: 10px 14px; font-weight: 700; white-space: nowrap; border-bottom: 3px solid transparent; }
.nav a:hover { color: #fff; }
.nav a.actif { color: #fff; border-bottom-color: var(--or); }
.pastille { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 99px; background: var(--or); color: #1d1416; font-size: .75rem; text-align: center; }

#demo { background: var(--att-bg); color: var(--att); border-bottom: 1px solid var(--ligne); font-size: .875rem; }
.demo-in { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-block: 6px; }
.demo-in label { flex-direction: row; align-items: center; gap: 6px; }
.demo-in select { width: auto; min-height: 30px; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--ligne); background: var(--papier); }

.main { padding-block: 20px 60px; display: flex; flex-direction: column; gap: 16px; }
.charge { color: var(--gris); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: var(--r); border: 1px solid var(--ligne); background: var(--papier); font-weight: 700; cursor: pointer; }
.btn:hover { border-color: var(--gris); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primaire { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.btn.primaire:hover:not(:disabled) { background: var(--rouge-f); }
.btn.danger { color: var(--err); }
.btn.petit { min-height: 30px; padding: 3px 10px; font-size: .875rem; }
.btn.icone { min-width: 38px; padding: 0; font-size: 1.3rem; line-height: 1; }
.btn-lien { background: none; border: 0; padding: 4px; color: var(--rouge-t); text-decoration: underline; cursor: pointer; font-weight: 500; }

/* Barre de semaine */
.barre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.sem { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sem h1 { min-width: 0; font-size: 1.15rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Résumé */
.resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.resume .ok b { color: var(--ok); }
.grille tfoot .vente { min-height: 32px; padding: 4px 6px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.grille tfoot tr.pct td { text-align: center; }
.pctv { display: inline-block; padding: 1px 8px; border-radius: 99px; font-weight: 700; }
.pctv.bon { background: var(--ok-bg); color: var(--ok); }
.pctv.moyen { background: var(--att-bg); color: var(--att); }
.pctv.haut { background: var(--err-bg); color: var(--err); }
.resume.r2 { grid-template-columns: repeat(2, 1fr); }
.resume > div { background: var(--papier); border: 1px solid var(--ligne); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; min-width: 0; }
.resume span { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gris); }
.resume b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.resume .att { background: var(--att-bg); border-color: transparent; }
.resume .att b, .resume .att span { color: var(--att); }

/* Filtres */
.filtres { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--ligne); background: var(--papier); cursor: pointer; font-weight: 500; }
.chip.actif { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.chip small { color: inherit; opacity: .75; }
.puce { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; }
.chip .puce { margin-right: 0; }
.puce.p-cuisinier { background: var(--cuis); } .puce.p-commis { background: var(--comm); } .puce.p-livreur { background: var(--livr); }

/* Grille */
.grille-wrap { overflow-x: auto; background: var(--papier); border: 1px solid var(--ligne); border-radius: var(--r); }
.grille { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 860px; font-variant-numeric: tabular-nums; }
.grille th, .grille td { border-bottom: 1px solid var(--ligne); border-right: 1px solid var(--ligne); padding: 6px; vertical-align: top; text-align: left; }
.grille thead th { background: var(--papier); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gris); font-weight: 700; position: sticky; top: 0; }
.grille thead th b { display: block; font-size: 1.1rem; color: var(--encre); letter-spacing: 0; }
.grille thead th.auj b { color: var(--rouge-t); }
.grille .nom { position: sticky; left: 0; z-index: 1; background: var(--papier); width: 150px; min-width: 130px; font-weight: 700; font-size: .9rem; }
.grille thead .nom { z-index: 2; }
.grille tr.grp th { background: var(--papier-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; padding: 5px 8px; position: sticky; left: 0; }
.grille tr.grp small { margin-left: 4px; }
.grille .case { min-width: 96px; height: 52px; position: relative; }
.grille.admin .case { cursor: pointer; }
.grille.admin .case:hover { background: var(--papier-2); }
.grille .case.auj { background: color-mix(in srgb, var(--or) 8%, var(--papier)); }
.grille .c-indispo { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--gris) 12%, transparent) 6px 8px); }
.grille .c-conge { background: color-mix(in srgb, var(--ok) 10%, var(--papier)); }
.grille .plus { position: absolute; right: 6px; bottom: 4px; color: var(--gris); opacity: 0; font-weight: 700; }
.grille.admin .case:hover .plus { opacity: 1; }
.grille .tot { text-align: right; white-space: nowrap; font-weight: 700; width: 92px; }
.grille .tot small, .grille tfoot small { display: block; font-weight: 400; }
.grille tfoot td, .grille tfoot th { background: var(--papier-2); font-weight: 700; font-size: .85rem; position: static; }
.grille tfoot th { position: sticky; left: 0; }
.grille tr.moi-ligne .nom { color: var(--rouge-t); }
.grille .vide { text-align: center; color: var(--gris); padding: 24px; }

.q { display: block; width: 100%; text-align: left; margin-bottom: 3px; padding: 3px 6px; border-radius: 5px; border: 1px solid transparent; font-size: .8rem; font-weight: 700; white-space: nowrap; cursor: inherit; }
button.q { cursor: pointer; }
.q small { font-weight: 400; color: inherit; opacity: .8; }
.q.p-cuisinier { background: var(--cuis-bg); color: var(--cuis); }
.q.p-commis { background: var(--comm-bg); color: var(--comm); }
.q.p-livreur { background: var(--livr-bg); color: var(--livr); }
.q.brouillon { background: var(--papier); border: 1.5px dashed currentColor; }
.legende .q { display: inline-block; width: auto; margin: 0 4px 0 0; }
.legende { color: var(--gris); font-size: .85rem; margin: 0; }

.etiq { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; margin-bottom: 3px; white-space: nowrap; }
.etiq.indispo { background: var(--err-bg); color: var(--err); }
.etiq.partiel { background: var(--papier-2); color: var(--gris); }
.etiq.conge { background: var(--ok-bg); color: var(--ok); }
.etiq.conge-att, .etiq.sup { background: var(--att-bg); color: var(--att); }

/* Cartes, listes */
.carte { background: var(--papier); border: 1px solid var(--ligne); border-radius: var(--r); padding: 16px; }
.carte.vide { color: var(--gris); text-align: center; }
.sous { margin-top: 8px; }
.aide { color: var(--gris); font-size: .875rem; margin: 0; }
.centre { text-align: center; }
.bandeau-att { background: var(--att-bg); color: var(--att); padding: 8px 12px; border-radius: var(--r); margin: 0; }
.pile-l { display: flex; flex-direction: column; gap: 10px; }
.cartes3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cartes3 .carte { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.liste { width: 100%; border-collapse: collapse; min-width: 640px; }
.liste th, .liste td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--ligne); }
.liste thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gris); }
.liste .num { text-align: right; font-variant-numeric: tabular-nums; }
.liste.inactifs { opacity: .65; }

.demande { background: var(--papier); border: 1px solid var(--ligne); border-radius: var(--r); padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.demande p { margin: 0; }
.d-tete { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.d-motif { font-style: italic; }
.d-conflit { color: var(--att); font-size: .875rem; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.d-actions input { flex: 1 1 220px; min-width: 0; }
.demande .btn.petit { align-self: flex-start; }
.etat { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.e-en_attente { background: var(--att-bg); color: var(--att); }
.e-approuve { background: var(--ok-bg); color: var(--ok); }
.e-refuse { background: var(--err-bg); color: var(--err); }

/* Formulaires */
input:not([type=radio]):not([type=checkbox]), select { width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid var(--ligne); border-radius: 6px; background: var(--papier); }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 700; min-width: 0; }
.grille-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.grille-form .large { grid-column: 1 / -1; }
.pile { display: flex; flex-direction: column; gap: 10px; }
.case-a-cocher { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.msg { color: var(--gris); min-height: 1.2em; margin: 0; }
.connexion { max-width: 420px; margin: 40px auto; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.connexion p { margin: 0; }

.qt-liste { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.qt { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem 6.5rem 38px; gap: 6px; }

/* Fenêtre */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--papier); color: var(--encre); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(20, 10, 12, .5); }
.fen { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.fen p { margin: 0; }
.fen header, .fen footer { display: flex; align-items: center; gap: 8px; }
.fen header { justify-content: space-between; }
.espace { flex: 1; }
.types { display: flex; flex-wrap: wrap; gap: 6px; }
.types .chip.actif { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.duree { margin: 0; font-weight: 700; min-height: 1.2em; }
.avert { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.avert li { background: var(--att-bg); color: var(--att); padding: 6px 10px; border-radius: 6px; font-size: .875rem; }

/* Mon horaire */
.jours { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.jours li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 12px; background: var(--papier); border: 1px solid var(--ligne); border-radius: var(--r); padding: 12px 14px; align-items: center; }
.jours li.libre { background: transparent; }
.jours li.auj { border-color: var(--rouge); box-shadow: inset 0 0 0 1px var(--rouge); }
.j-date { display: flex; flex-direction: column; }
.j-date b { text-transform: capitalize; }
.j-date span { color: var(--gris); font-size: .875rem; }
.j-quarts { display: flex; flex-wrap: wrap; gap: 8px; }
.mq { display: flex; flex-direction: column; padding: 6px 12px; border-radius: 6px; }
.mq b { font-size: 1.1rem; }
.mq span { font-size: .8rem; }
.mq em { font-size: .8rem; }
.mq.p-cuisinier { background: var(--cuis-bg); color: var(--cuis); }
.mq.p-commis { background: var(--comm-bg); color: var(--comm); }
.mq.p-livreur { background: var(--livr-bg); color: var(--livr); }

/* Dispos */
.dispos { display: flex; flex-direction: column; gap: 0; padding: 0; }
.dispo { border: 0; border-bottom: 1px solid var(--ligne); margin: 0; padding: 12px 16px; display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.dispo legend { float: left; font-weight: 700; padding: 0; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg label { flex-direction: row; font-weight: 500; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { padding: 6px 12px; border: 1px solid var(--ligne); border-radius: 99px; cursor: pointer; }
.seg input:checked + span { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.heures { grid-column: 2; display: flex; gap: 10px; }
.heures label { flex-direction: row; align-items: center; font-weight: 500; }
.heures input { width: 8rem; }
.dispos footer { padding: 14px 16px; }

/* Message flottant */
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: var(--encre); color: var(--papier); padding: 10px 16px; border-radius: 8px; font-weight: 700; transition: .2s; max-width: calc(100vw - 32px); z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--err); color: #fff; }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }

@media (max-width: 720px) {
  .resume { grid-template-columns: repeat(2, 1fr); }
  .cartes3 { grid-template-columns: 1fr; }
  .jours li { grid-template-columns: 1fr; gap: 6px; }
  .dispo { grid-template-columns: 1fr; }
  .heures { grid-column: 1; }
  .marque small, .moi small { display: none; }
}
