:root {
  --fond: #f4f2ee; --carte: #fff; --texte: #1d1d1b; --doux: #6b6862; --ligne: #e3dfd8;
  --accent: #7a5a3a; --accent-fonce: #5e4429; --ok: #2f7a4f; --alerte: #b3412e;
  --rayon: 14px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--texte); font-size: 15px; line-height: 1.45; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 10px; padding: .6em 1.1em; background: var(--accent); color: #fff; font-weight: 600; }
button:hover { background: var(--accent-fonce); }
button.secondaire { background: transparent; color: var(--accent); border: 1px solid var(--ligne); }
button.secondaire:hover { background: #fff; border-color: var(--accent); }
button.danger { background: transparent; color: var(--alerte); border: 1px solid var(--ligne); }
button:disabled { opacity: .5; cursor: default; }
input, select { width: 100%; padding: .65em .8em; border: 1px solid var(--ligne); border-radius: 10px; background: #fff; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--doux); margin: 12px 0 4px; }
.erreur { color: var(--alerte); font-size: 14px; min-height: 1.2em; margin: 10px 0 0; }

header.barre { display: flex; align-items: center; gap: 12px; padding: 14px 24px; background: var(--carte); border-bottom: 1px solid var(--ligne); }
header.barre .titre { font-weight: 700; letter-spacing: .02em; }
header.barre .qui { margin-left: auto; color: var(--doux); font-size: 14px; }
header.barre a { color: var(--accent); font-size: 14px; text-decoration: none; font-weight: 600; }

main { max-width: 640px; margin: 0 auto; padding: 32px 20px 60px; }
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 28px; }

/* Connexion */
.connexion { max-width: 380px; margin: 9vh auto 0; }
.connexion h1 { font-size: 22px; margin: 0 0 4px; }
.connexion p.sous { color: var(--doux); margin: 0 0 12px; }
.connexion button[type=submit] { width: 100%; margin-top: 20px; padding: .8em; }

/* Choix du compte */
.comptes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.comptes button { background: var(--carte); color: var(--texte); border: 1px solid var(--ligne); font-weight: 500; }
.comptes button small { color: var(--doux); font-weight: 400; margin-left: 4px; }
.comptes button[aria-pressed=true] { background: var(--accent); color: #fff; border-color: var(--accent); }
.comptes button[aria-pressed=true] small { color: #eadfd2; }

/* Code */
.code-carte { text-align: center; padding: 36px 28px; }
.code-carte .compte { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--doux); font-weight: 600; }
.code { font: 700 clamp(44px, 12vw, 72px)/1.1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .12em; margin: 18px 0 6px; font-variant-numeric: tabular-nums; }
.code.ancien { color: #b5b0a7; }
.recu { font-size: 17px; }
.recu strong { font-variant-numeric: tabular-nums; }
.age { color: var(--doux); }
.age.ancien { color: var(--alerte); }
.provenance { color: var(--doux); font-size: 13px; margin-top: 10px; overflow-wrap: anywhere; }
.actions { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
#lu { min-width: 180px; padding: .8em 1.4em; font-size: 17px; }
.code-carte { padding: 48px 28px 40px; }
.vide { color: var(--doux); padding: 20px 0 6px; }
.vide strong { display: block; color: var(--texte); font-size: 17px; margin-bottom: 6px; }
.etat { text-align: center; color: var(--doux); font-size: 13px; margin-top: 14px; }
.etat .point { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.etat.pause .point { background: #c9c3b8; }
.precedents { margin-top: 18px; border-top: 1px solid var(--ligne); padding-top: 12px; font-size: 14px; color: var(--doux); }
.precedents div { display: flex; justify-content: space-between; padding: 3px 0; }
.precedents code { font-size: 15px; color: var(--texte); }
.bandeau { background: #fff4dc; border: 1px solid #ecd9a8; color: #6d5214; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 16px; }

/* Admin */
main.large { max-width: 1040px; }
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--ligne); margin-bottom: 20px; }
.onglets button { background: none; color: var(--doux); border-radius: 0; border-bottom: 2px solid transparent; font-weight: 600; }
.onglets button[aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); }
.entete-section { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.entete-section h2 { font-size: 18px; margin: 0; }
table { width: 100%; border-collapse: collapse; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); overflow: hidden; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ligne); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--doux); background: #faf8f5; }
tr:last-child td { border-bottom: 0; }
td.actions-ligne { text-align: right; white-space: nowrap; }
td.actions-ligne button { padding: .35em .8em; font-size: 13px; margin-left: 4px; }
.pastille { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #efebe4; color: var(--doux); margin: 1px 2px 1px 0; }
.pastille.admin { background: #efe3d4; color: var(--accent-fonce); }
.pastille.off { background: #f6dcd6; color: var(--alerte); }
.muet { color: var(--doux); }
dialog { border: 0; border-radius: var(--rayon); padding: 26px; width: min(520px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(29,29,27,.35); }
dialog h3 { margin: 0 0 6px; }
dialog .pied { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.cases { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; max-height: 220px; overflow: auto; border: 1px solid var(--ligne); border-radius: 10px; padding: 10px; }
.cases label { display: flex; gap: 8px; align-items: center; margin: 0; font-weight: 400; color: var(--texte); font-size: 14px; }
.cases input { width: auto; }
.aide { font-size: 12px; color: var(--doux); margin-top: 4px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--texte); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; }
