/* li.ster — charte commune des apps .ster (marine / orange / crème) */
:root {
  --marine: #0B2A5B; --marine-clair: #2B4C80;
  --orange: #FF8A00; --orange-doux: color-mix(in srgb, var(--orange) 25%, var(--surface));
  --sur-orange: #0B2A5B;
  --fond: #FFF8F0; --surface: #FFF8F0; --surface-2: #F3E9DC; --trait: #E3D8C7;
  --texte: #0B2A5B; --texte-2: #2B4C80; --texte-3: #6F7F99;
  --entete-fond: #0B2A5B; --entete-texte: #FFF8F0;
  --accent-texte: var(--orange);
  --ok: #1A8A4C; --attention: #A86B00; --critique: #C62F35;
  --rayon: 10px; --rayon-carte: 14px; --rayon-fenetre: 16px;
  --police: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="clair"] {
  --fond: #FFFFFF; --surface: #FFFFFF; --surface-2: #F3EDF7; --trait: #E4E1EA;
  --texte: #1B1B1F; --texte-2: #49454F; --texte-3: #79747E;
  --entete-fond: #F3EDF7; --entete-texte: #1B1B1F;
  --accent-texte: #B35F00;
}
:root[data-theme="sombre"] {
  --fond: #10141B; --surface: #10141B; --surface-2: #1A2029; --trait: #1E3866;
  --texte: #E3E2E6; --texte-2: #A9B6CC; --texte-3: #7486A3;
  --entete-fond: #1A2029; --entete-texte: #E3E2E6;
  --orange-doux: color-mix(in srgb, var(--orange) 45%, var(--surface));
  --ok: #3CCF7E; --attention: #F5B82E; --critique: #FF5A5F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 15px/1.45 var(--police); min-height: 100dvh; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
svg.ic { width: 24px; height: 24px; fill: currentColor; display: block; }

/* ---------- Bandeau du haut (identique aux autres apps .ster) ---------- */
.entete { position: sticky; top: 0; z-index: 20; background: var(--entete-fond); color: var(--entete-texte);
  padding-top: calc(6px + env(safe-area-inset-top)); overflow: hidden; isolation: isolate; }
:root[data-decor="halo"] .entete::before, :root[data-decor="halo"] .entete::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none; border-radius: 50%; }
:root[data-decor="halo"] .entete::before { width: 90vw; height: 90vw; left: 30%; top: 30%; translate: -50% -50%;
  background: radial-gradient(circle, rgba(255,138,0,.22), transparent 50%); animation: halo-a 40s ease-in-out infinite; }
:root[data-decor="halo"] .entete::after { width: 70vw; height: 70vw; left: 70%; top: 80%; translate: -50% -50%;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 50%); animation: halo-b 40s ease-in-out infinite; }
:root[data-anime="non"] .entete::before, :root[data-anime="non"] .entete::after { animation: none; }
@media (prefers-reduced-motion: reduce) { .entete::before, .entete::after { animation: none !important; } }
@keyframes halo-a { 50% { left: 70%; top: 70%; } }
@keyframes halo-b { 50% { left: 30%; top: 20%; } }
.entete .ligne { display: flex; align-items: center; height: 48px; padding: 0 4px 0 12px; max-width: 1440px; margin: 0 auto; }
.entete .ligne-2 { padding: 0 4px; }
.entete .marque { display: flex; align-items: center; gap: 10px; margin-right: auto; font-size: 22px; font-weight: 700;
  color: inherit; text-decoration: none; border-radius: 10px; padding-right: 6px; }
.entete .marque img { width: 32px; height: 32px; }
.entete .titre { flex: 1; font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.entete .recherche { flex: 1; min-width: 0; height: 36px; border-radius: var(--rayon); border: 0; padding: 0 12px;
  background: rgba(255,255,255,.14); color: inherit; font: 15px var(--police); }
:root[data-theme="clair"] .entete .recherche { background: rgba(0,0,0,.06); }
.entete .recherche::placeholder { color: inherit; opacity: .7; }
.icone { width: 48px; height: 48px; flex: none; border: 0; background: none; color: inherit; border-radius: 50%;
  cursor: pointer; display: grid; place-items: center; }
@media (hover: hover) { .icone:hover { background: rgba(127,127,127,.14); } }
.icone[aria-pressed="true"] { color: var(--orange); }
.hors-ligne { background: rgba(255,138,0,.22); font-size: 13px; padding: 6px 16px; text-align: center; }

:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ---------- Menu latéral ---------- */
.voile { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
.tiroir { position: fixed; z-index: 41; top: 0; bottom: 0; left: 0; width: 260px; background: var(--surface);
  color: var(--texte); display: flex; flex-direction: column; padding: calc(16px + env(safe-area-inset-top)) 12px 8px;
  box-shadow: 0 0 24px rgba(0,0,0,.2); }
.tiroir-profil { display: flex; align-items: center; gap: 10px; padding: 4px 4px 12px; border-bottom: 2px solid var(--trait); font-weight: 700; }
.tiroir-arbre { padding: 12px 0 8px 8px; border-left: 2px solid var(--trait); margin: 12px 0 0 14px; }
.tiroir-lien { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; border: 0; background: none;
  text-align: left; cursor: pointer; border-radius: var(--rayon); padding: 0 8px; font-size: 15px; }
.tiroir-lien:hover { background: var(--surface-2); }
.tiroir-lien .branche { color: var(--texte-3); font-family: ui-monospace, monospace; }
.tiroir-lien.actif { color: var(--accent-texte); font-weight: 700; }
.tiroir-bientot { font-size: 12.5px; color: var(--texte-3); margin: 16px 8px; }
.tiroir-bas { margin-top: auto; padding-bottom: env(safe-area-inset-bottom); }

/* ---------- Contenu ---------- */
.contenu { max-width: 760px; margin: 0 auto; padding: 8px 0 calc(96px + env(safe-area-inset-bottom)); }
.aide { color: var(--texte-2); font-size: 13px; margin: 8px 16px; }
.rayon-titre { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--texte-2);
  margin: 16px 16px 2px; }
.ligne-article { display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 0 12px 0 4px;
  transition: opacity .25s, transform .25s; }
.ligne-article.part { opacity: 0; transform: translateX(24px); }
.ligne-article.nouveau { animation: arrivee .5s; }
@keyframes arrivee { from { background: var(--orange-doux); } }
.case { width: 48px; height: 48px; flex: none; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.case::before { content: ""; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--texte-2); box-sizing: border-box; }
@media (hover: hover) { .case:hover::before { border-color: var(--orange); background: var(--orange-doux); } }
.case[aria-checked="true"]::before { background: var(--orange); border-color: var(--orange); }
.article-corps { flex: 1; min-width: 0; border: 0; background: none; text-align: left; cursor: pointer; padding: 6px 4px;
  border-radius: var(--rayon); min-height: 44px; }
.article-texte { font-weight: 600; overflow-wrap: anywhere; }
.article-quantite { color: var(--texte-2); font-size: 13px; margin-left: 6px; font-weight: 400; }
.ligne-article.coche .article-texte { text-decoration: line-through; font-weight: 400; }
.ligne-article.coche .article-corps, .ligne-article.coche .avatar { opacity: .45; }
.article-note-ic { display: inline-block; vertical-align: -3px; margin-left: 6px; color: var(--texte-3); }
.article-note-ic svg.ic { width: 16px; height: 16px; }
.etat { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.etat.maison { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.etat.manque { color: var(--attention); background: color-mix(in srgb, var(--orange) 16%, transparent); }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 11px; }
.tiroir-profil .avatar { width: 40px; height: 40px; font-size: 15px; }
.vide { text-align: center; color: var(--texte-2); padding: 48px 24px; }
.vide img { width: 96px; opacity: .9; }
.vide p { margin: 8px 0; }

.ligne-historique { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 8px 0 16px; }
.ligne-historique .article-corps { cursor: default; }
.ligne-historique .quand { color: var(--texte-3); font-size: 12px; white-space: nowrap; }

/* Mode magasin : gros éléments, faciles à toucher en marchant */
body.magasin .ligne-article { min-height: 64px; }
body.magasin .article-texte { font-size: 19px; }
body.magasin .case::before { width: 30px; height: 30px; }
body.magasin .case { width: 56px; height: 56px; }

/* ---------- Barre d'ajout ---------- */
.barre-ajout { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; align-items: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--trait); }
.barre-ajout > input { flex: 1; min-width: 0; height: 48px; border-radius: 24px; border: 1px solid var(--trait);
  background: var(--surface-2); color: var(--texte); padding: 0 18px; font: 16px var(--police); }
.barre-ajout > input:focus { outline: 2px solid var(--orange); outline-offset: 0; border-color: transparent; }
.fab { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 0; background: var(--orange); color: var(--sur-orange);
  cursor: pointer; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(11,42,91,.25); }
.fab svg.ic { width: 28px; height: 28px; }
@media (min-width: 800px) { .barre-ajout { left: 50%; translate: -50% 0; width: 760px; border: 1px solid var(--trait); border-bottom: 0; border-radius: 16px 16px 0 0; } }
.suggestions { position: absolute; left: 16px; right: 84px; bottom: calc(100% + 4px); background: var(--surface);
  border: 1px solid var(--trait); border-radius: 12px; box-shadow: 0 6px 18px rgba(11,42,91,.15); overflow: hidden; }
.suggestion { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 8px; padding: 0 16px; border: 0;
  background: none; text-align: left; cursor: pointer; font-size: 15px; }
.suggestion:hover, .suggestion[aria-selected="true"] { background: var(--surface-2); }
.suggestion small { color: var(--texte-3); margin-left: auto; font-size: 12px; }

/* ---------- Snackbar ---------- */
.snackbar { position: fixed; z-index: 50; left: 50%; translate: -50% 0; bottom: calc(84px + env(safe-area-inset-bottom));
  max-width: min(560px, calc(100vw - 32px)); width: max-content; background: #1B1B1F; color: #F4EFF4; border-radius: 8px;
  padding: 6px 8px 6px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.3); font-size: 14px; }
.snackbar .bouton.texte { color: #FFB869; }

/* ---------- Boutons, champs ---------- */
.bouton { border-radius: var(--rayon); padding: 10px 16px; font: 600 14px var(--police); border: 0; cursor: pointer; min-height: 40px; }
.bouton.plein { background: var(--marine); color: #FFF8F0; width: 100%; min-height: 48px; font-size: 15px; }
:root[data-theme="sombre"] .bouton.plein { background: var(--orange); color: #2A1600; }
.bouton.texte { background: none; color: var(--texte); }
.bouton.texte:hover { background: var(--surface-2); }
.bouton.texte.fort { color: var(--accent-texte); }
.bouton.texte.danger { color: var(--critique); }
.champ { display: block; margin: 12px 0; }
.champ-etiquette { display: block; font-size: 13px; font-weight: 600; color: var(--texte-2); margin-bottom: 4px; }
.champ textarea { width: 100%; border-radius: var(--rayon); border: 1px solid var(--texte-3); background: var(--surface);
  color: var(--texte); padding: 10px 12px; font: 16px/1.4 var(--police); resize: vertical; }
.champ textarea:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.champ input, .champ select { width: 100%; height: 48px; border-radius: var(--rayon); border: 1px solid var(--texte-3);
  background: var(--surface); color: var(--texte); padding: 0 12px; font: 16px var(--police); }
.champ input:focus, .champ select:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.erreur { color: var(--critique); font-size: 14px; margin: 4px 0 12px; }

/* ---------- Connexion ---------- */
.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon-carte);
  box-shadow: 0 1px 2px rgba(11,42,91,.06), 0 6px 18px rgba(11,42,91,.06); padding: 24px; }
.carte-connexion { width: 100%; max-width: 380px; text-align: center; }
.carte-connexion .champ { text-align: left; }
.connexion-hamster { width: 112px; height: 112px; }
.connexion-titre { margin: 4px 0 0; font-size: 28px; font-weight: 700; }
.connexion-sous-titre { margin: 0 0 12px; color: var(--texte-2); }

/* ---------- Fenêtres ---------- */
.fenetre { border: 0; border-radius: var(--rayon-fenetre); padding: 24px 24px 12px; width: min(420px, calc(100vw - 32px));
  background: var(--surface); color: var(--texte); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.fenetre::backdrop { background: rgba(0,0,0,.4); }
.fenetre h2 { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.fenetre-actions { display: flex; align-items: center; gap: 4px; margin-top: 16px; }
.fenetre-actions .espace { flex: 1; }
.groupe { border: 0; padding: 0; margin: 0 0 14px; }
.radio { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-right: 14px; cursor: pointer; }
.radio input { accent-color: var(--orange); width: 18px; height: 18px; }
.interrupteur { display: flex; align-items: center; justify-content: space-between; min-height: 44px; cursor: pointer; }
.interrupteur input { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--texte-3);
  position: relative; cursor: pointer; transition: background .2s; flex: none; }
.interrupteur input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: left .2s; }
.interrupteur input:checked { background: var(--orange); }
.interrupteur input:checked::after { left: 21px; }
.pastilles { display: flex; flex-wrap: wrap; gap: 8px; }
.pastille { width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.pastille[aria-pressed="true"] { border-color: var(--texte); box-shadow: inset 0 0 0 3px var(--surface); }
