/* Horaire d'équipe — vert feuille, accents agrumes, police arrondie du système (SF Pro Rounded sur iPhone). */
:root {
  --bg: #f3f5f0; --card: #ffffff; --sunk: #eceee8; --ink: #1d2a21; --muted: #646e60; --line: rgba(29, 42, 33, .12);
  --accent: #2f7d4a; --accent-ink: #ffffff; --accent-soft: #e2efe5;
  --dispo: #2f7d4a; --dispo-bg: #dcefe0; --non: #b5443b; --non-bg: #f7dcd8; --vide-bg: #e7e9e3;
  --warn: #b8681d; --warn-bg: #fbecd9;
  --titre: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --corps: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  --ombre: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 20px rgba(0, 0, 0, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101410; --card: #1a201b; --sunk: #232a24; --ink: #edf2ec; --muted: #9aa597; --line: rgba(255, 255, 255, .1);
    --accent: #6cc28a; --accent-ink: #0c1a10; --accent-soft: #1f3326;
    --dispo: #6cc28a; --dispo-bg: #1f3a27; --non: #f08c80; --non-bg: #3d2421; --vide-bg: #2a312b;
    --warn: #f0a75c; --warn-bg: #3a2c1a;
    --ombre: 0 0 0 .5px rgba(255, 255, 255, .07);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 var(--corps); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
body.sans-tabs { padding-bottom: 0; }
main { max-width: 640px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px 24px; }
h1 { font-family: var(--titre); font-size: 30px; font-weight: 800; margin: 4px 2px 4px; letter-spacing: -.01em; }
h2 { font-family: var(--titre); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 24px 4px 8px; }
.sous-titre { color: var(--muted); margin: 0 2px 16px; font-size: 15px; }
.chargement { color: var(--muted); text-align: center; margin-top: 30vh; }
.marque { font-family: var(--titre); font-weight: 700; font-size: 13px; color: var(--accent); letter-spacing: .02em; margin: 0 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; font-size: 17px; color: var(--ink); background: var(--sunk); border: 1px solid transparent; border-radius: 12px; padding: 12px; width: 100%; min-height: 46px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px; background: var(--accent); color: var(--accent-ink); font-family: var(--titre); font-weight: 700; font-size: 17px; text-align: center; }
.btn:active { transform: scale(.985); }
.btn.second { background: var(--card); color: var(--ink); box-shadow: var(--ombre); }
.btn.danger { background: transparent; color: var(--non); }
.btn.petit { display: inline-block; width: auto; padding: 9px 14px; font-size: 15px; border-radius: 11px; }
.carte { background: var(--card); border-radius: 18px; box-shadow: var(--ombre); padding: 14px 16px; }
.pile { display: flex; flex-direction: column; gap: 10px; }
.ligne { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--muted); }
.vide { color: var(--muted); text-align: center; padding: 22px 10px; }

/* Connexion */
.login { max-width: 360px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login .icone { width: 92px; height: 92px; border-radius: 22px; margin: 0 auto 6px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18); }
.login h1 { margin: 0; }
.login .sous-titre { margin: 0 0 14px; }
.err { color: var(--non); font-weight: 600; min-height: 1.2em; margin: 0; }
.demo { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Barre d'onglets */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 8px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; }
#tabs a svg { width: 25px; height: 25px; }
#tabs a.on { color: var(--accent); }

/* Navigation de semaine */
.semnav { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; }
.semnav button { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--card); box-shadow: var(--ombre); font-size: 22px; line-height: 1; }
.semnav .lib { flex: 1; text-align: center; font-family: var(--titre); font-weight: 700; font-size: 17px; }
.semnav .lib small { display: block; font-family: var(--corps); font-weight: 500; font-size: 13px; color: var(--muted); }
.statut { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--warn-bg); color: var(--warn); }
.statut.pub { background: var(--dispo-bg); color: var(--dispo); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 6px; }

/* Journées et quarts */
.jour { padding: 12px 14px 14px; }
.jour + .jour { margin-top: 10px; }
.jour-tete { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.jour-tete b { font-family: var(--titre); font-size: 17px; }
.jour-tete .auj { font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent); padding: 2px 8px; border-radius: 99px; }
.jour-tete .plus { margin-left: auto; border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 700; border-radius: 10px; padding: 7px 12px; }
.quart { display: grid; grid-template-columns: 5px 1fr auto; gap: 2px 12px; align-items: center; width: 100%; text-align: left; border: 0; background: var(--sunk); border-radius: 12px; padding: 10px 12px 10px 0; margin-top: 6px; overflow: hidden; }
.quart .barre { grid-row: 1 / 3; align-self: stretch; border-radius: 0 4px 4px 0; }
.quart b { font-weight: 650; }
.quart .h { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.quart .s { grid-column: 2; color: var(--muted); font-size: 14px; }
.quart .d { grid-column: 3; color: var(--muted); font-size: 13px; text-align: right; }
.quart.alerte { box-shadow: inset 0 0 0 2px var(--warn); }
.quart .alerte-txt { grid-column: 2 / 4; color: var(--warn); font-size: 13px; font-weight: 600; }
.dispo-jour { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.puce { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 4px 9px; border-radius: 99px; background: var(--vide-bg); color: var(--muted); }
.puce.ok { background: var(--dispo-bg); color: var(--dispo); }
.puce.part { background: var(--warn-bg); color: var(--warn); }
.puce.non { background: var(--non-bg); color: var(--non); text-decoration: line-through; }
.pastille { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* Heures par employé */
.heures .rang { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.heures .rang:first-child { border-top: 0; }
.heures .rang span:nth-child(2) { flex: 1; }
.heures .rang b { font-variant-numeric: tabular-nums; }

/* Disponibilités de l'employé */
.djour { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 14px; }
.djour + .djour { margin-top: 8px; }
.djour .t { display: flex; align-items: baseline; gap: 8px; }
.djour .t b { font-family: var(--titre); font-size: 16px; }
.djour .t button { margin-left: auto; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 14px; padding: 4px 0; }
.plages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.plage { border: 0; border-radius: 12px; padding: 10px 4px; background: var(--vide-bg); color: var(--muted); font-weight: 650; font-size: 14px; line-height: 1.2; min-height: 54px; }
.plage small { display: block; font-weight: 500; font-size: 12px; margin-top: 2px; }
.plage.dispo { background: var(--dispo-bg); color: var(--dispo); }
.plage.non { background: var(--non-bg); color: var(--non); }
.plage:disabled { opacity: .45; }
.legende { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 0 2px 10px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* Grille des disponibilités (gérante) */
.grille { overflow-x: auto; }
.grille table { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 13px; }
.grille th { font-weight: 650; color: var(--muted); font-size: 12px; padding: 2px; }
.grille td.nom { white-space: nowrap; font-weight: 600; padding-right: 6px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.cellule { display: flex; flex-direction: column; gap: 2px; min-width: 30px; }
.cellule i { height: 9px; border-radius: 3px; background: var(--vide-bg); }
.cellule i.dispo { background: var(--dispo); }
.cellule i.non { background: var(--non); }

/* Employés */
.emp { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 12px 0; border-top: 1px solid var(--line); }
.emp:first-child { border-top: 0; }
.emp .pastille { width: 14px; height: 14px; }
.emp div { flex: 1; min-width: 0; }
.emp small { display: block; color: var(--muted); font-size: 14px; }
.emp.inactif { opacity: .5; }
.codes { background: var(--accent-soft); border-radius: 14px; padding: 14px; font-size: 15px; }
.codes b { font-family: ui-monospace, Menlo, monospace; font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--sunk); border-radius: 99px; padding: 6px 6px 6px 12px; font-size: 14px; }
.chip button { border: 0; background: var(--card); width: 24px; height: 24px; border-radius: 50%; line-height: 1; color: var(--muted); }

/* Feuille (fenêtre du bas) */
#sheet:empty { display: none; }
.fond { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; }
.feuille { width: 100%; max-width: 640px; margin: 0 auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.feuille h3 { font-family: var(--titre); font-size: 21px; margin: 0; }
.champ { display: flex; flex-direction: column; gap: 5px; }
.champ > span { font-size: 14px; font-weight: 600; color: var(--muted); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { border: 0; background: var(--card); box-shadow: var(--ombre); border-radius: 10px; padding: 8px 11px; font-size: 14px; font-weight: 600; }
.avis { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 99px; font-weight: 600; font-size: 15px; max-width: 90vw; text-align: center; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* En-tête : nom du commerce et bouton de déconnexion */
.haut { display: flex; align-items: center; gap: 8px; }
.haut .deco { margin-left: auto; border: 0; background: var(--card); box-shadow: var(--ombre); border-radius: 99px; padding: 7px 13px; font-size: 13px; font-weight: 650; color: var(--muted); }
/* Disponibilités en heures */
.seg2 { display: flex; gap: 4px; background: var(--sunk); border-radius: 13px; padding: 4px; margin: 6px 0 12px; }
.seg2 button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 10px 6px; font-weight: 650; font-size: 14px; color: var(--muted); }
.seg2 button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.djour .chips { min-height: 32px; align-items: center; }
.chip.ok { background: var(--dispo-bg); color: var(--dispo); font-weight: 650; }
.chip.part { background: var(--warn-bg); color: var(--warn); font-weight: 650; }
.chip.non { background: var(--non-bg); color: var(--non); font-weight: 650; padding-right: 12px; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; }
.acts button { border: 0; background: var(--sunk); border-radius: 10px; padding: 8px 11px; font-size: 13.5px; font-weight: 650; color: var(--ink); }
.acts button:first-child { background: var(--accent-soft); color: var(--accent); }
.src { margin-left: auto; font-size: 12px; font-weight: 650; color: var(--muted); }
.src.mod { color: var(--warn); }
.djour.passe { opacity: .55; }
.cel { display: block; text-align: center; font-size: 11.5px; font-weight: 700; padding: 6px 2px; border-radius: 6px; background: var(--vide-bg); color: var(--muted); white-space: nowrap; min-width: 34px; }
.cel.ok { background: var(--dispo-bg); color: var(--dispo); }
.cel.part { background: var(--warn-bg); color: var(--warn); }
.cel.non { background: var(--non-bg); color: var(--non); }
