:root {
  --red: #d42b2a;
  --red-dark: #a81f1f;
  --green: #2f7d32;
  --green-soft: #e3f1e3;
  --page: #f2f5f0;
  --sheet: #fff;
  --ink: #1d1d1b;
  --soft: #5a5f58;
  --line: #e1e5de;
  --serif: Georgia, "Times New Roman", serif;
  --shadow: 0 4px 14px rgba(0, 0, 0, .08);
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #root { height: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#root { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; position: relative; background: var(--page); overflow: hidden; }
h1, h2 { font-family: var(--serif); font-style: italic; font-weight: 700; margin: 0; }
p { margin: 0; }
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; padding: 0; }
button:disabled { opacity: .6; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -4px; }
.center { flex: 1; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; }

/* Connexion */
#root:has(.hero) { overflow-y: auto; }
.hero { background: var(--red); color: #fff; text-align: center; padding: calc(var(--top) + 20px) 24px 52px; border-radius: 0 0 28px 28px; }
.hero h1 { font-size: 29px; }
.hero p { font-size: 15px; margin-top: 6px; }
.logo-plate { display: inline-block; background: #fff; border-radius: 50%; padding: 5px; margin-bottom: 10px; line-height: 0; }
.logo-plate img { width: 118px; height: 118px; }
.logo-plate.small img { width: 84px; height: 84px; }
.logo-plate.tiny { padding: 2px; margin: 0; flex: none; }
.logo-plate.tiny img { width: 34px; height: 34px; }
.sheet-wrap { margin: -36px 16px 0; padding-bottom: calc(var(--bottom) + 16px); display: grid; gap: 12px; }
.sheet { background: var(--sheet); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.field { display: block; font-size: 15px; font-weight: 600; }
.field input { display: block; width: 100%; margin-top: 4px; padding: 12px; font: inherit; font-size: 17px; font-weight: 400; border: 2px solid var(--ink); border-radius: 8px; background: #fff; color: var(--ink); }
.field input::placeholder { color: #8a8f87; }
.field input.code { font-size: 24px; letter-spacing: 8px; text-align: center; }
.button, .button-green { display: block; width: 100%; padding: 14px; border-radius: 10px; background: var(--red); color: #fff; font-weight: 700; font-size: 17px; text-align: center; }
.button-green { background: var(--green); font-size: 16px; padding: 12px; }
.button.dark { background: var(--red-dark); }
.button-outline { display: block; width: 100%; padding: 13px; margin-top: 14px; border: 1.5px solid var(--green); border-radius: 12px; background: var(--sheet); color: var(--green); font-weight: 700; }
.link { display: block; width: 100%; padding: 8px; color: var(--green); font-weight: 600; text-align: center; }
.link.soft { color: var(--soft); }
.link.danger { color: var(--red-dark); margin-top: 8px; }
.message { color: var(--red-dark); font-weight: 600; }
.message.ok { color: var(--green); }
.message.test { background: var(--green-soft); color: var(--green); font-weight: 700; padding: 10px; border-radius: 8px; }

/* Ajouter à l'écran d'accueil */
.install { background: var(--sheet); border: 1.5px solid var(--green); border-radius: 16px; padding: 12px; display: grid; gap: 10px; }
.install-row { display: flex; align-items: center; gap: 10px; }
.install-row img { border-radius: 10px; flex: none; }
.install-text { flex: 1; min-width: 0; }
.install-text strong, .install-text span { display: block; }
.install-text span { color: var(--soft); font-size: 14px; }
.install-close { padding: 6px; color: var(--soft); align-self: flex-start; }
.steps { margin: 0; padding-left: 22px; font-size: 15px; display: grid; gap: 4px; }

/* Structure */
.top { background: var(--red); color: #fff; display: flex; align-items: center; gap: 10px; padding: calc(var(--top) + 8px) 16px 8px; flex: none; position: relative; z-index: 1; }
.top h1 { font-size: 23px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button { padding: 6px; margin: -6px; display: flex; }
main { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { position: relative; padding: 16px 16px 28px; display: grid; gap: 14px; }
.tabs { flex: none; display: flex; background: var(--sheet); border-top: 1px solid var(--line); padding: 8px 0 calc(var(--bottom) + 8px); }
.tabs button { flex: 1; display: grid; justify-items: center; gap: 2px; color: var(--soft); font-size: 12px; font-weight: 600; }
.tabs button.active { color: var(--red); font-weight: 800; }

/* Carte */
.red-band { position: absolute; inset: 0 0 auto; height: 96px; background: var(--red); border-radius: 0 0 26px 26px; }
.barcode-card { position: relative; display: block; width: 100%; background: var(--sheet); border-radius: 18px; padding: 18px 14px 10px; box-shadow: var(--shadow); }
.barcode svg { display: block; }
.barcode p { text-align: center; margin-top: 8px; letter-spacing: 2px; color: #000; }
.expand { display: flex; justify-content: center; align-items: center; gap: 6px; padding-top: 10px; color: var(--green); font-size: 15px; font-weight: 700; }
.panel { position: relative; background: var(--sheet); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.panel h2 { font-size: 23px; margin: 8px 0; }
.panel.flush { padding: 0 16px; }
.points { font: italic 700 23px var(--serif); margin-bottom: 10px; }
.points strong { font-size: 50px; line-height: 1; color: var(--red); }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.5px; background: var(--ink); border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden; }
.stamp { aspect-ratio: 1; display: grid; place-items: center; background: #fff; }
.stamp img { width: 84%; height: 84%; opacity: .08; }
.stamp.on img { opacity: 1; transform: rotate(-9deg); }
.stamp.on:nth-child(even) img { transform: rotate(8deg); }
.status { color: var(--soft); margin-top: 14px; }
.status strong { color: var(--ink); }
.reward { background: var(--green); color: #fff; border-radius: 10px; padding: 12px; margin-top: 14px; }
.reward strong, .reward span { display: block; }
.reward strong { font-size: 17px; }

/* Historique */
.lines { list-style: none; margin: 0; padding: 0 16px; background: var(--sheet); border-radius: 18px; box-shadow: var(--shadow); }
.lines li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.lines li:last-child { border-bottom: 0; }
.lines strong, .lines small { display: block; }
.lines strong { font-weight: 600; }
.lines small { color: var(--soft); font-size: 14px; }
b.green { color: var(--green); }
b.red { color: var(--red); }
b.soft { color: var(--soft); }
.empty { text-align: center; padding-top: 80px; color: var(--soft); }
.empty h2 { color: var(--ink); font-size: 21px; }

/* Magasin */
.open { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.open i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.open.yes { color: var(--green); }
.open.no { color: var(--red-dark); }
.hours { margin: 0; }
.hours div { display: flex; justify-content: space-between; gap: 12px; padding: 8px; border-radius: 8px; font-size: 15px; }
.hours dt { margin: 0; }
.hours dd { margin: 0; color: var(--soft); text-align: right; }
.hours .today { background: var(--green-soft); font-weight: 700; }
.hours .today dd { color: var(--ink); }
.actions { background: var(--sheet); border-radius: 18px; padding: 0 16px; box-shadow: var(--shadow); }
.action { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.action:last-child { border-bottom: 0; }
.action strong, .action small { display: block; }
.action strong { font-weight: 600; }
.action small { color: var(--soft); font-size: 14px; }
.action-icon { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--green-soft); color: var(--green); display: grid; place-items: center; }

/* Compte */
.settings { position: absolute; inset: 0; z-index: 5; background: var(--page); display: flex; flex-direction: column; }
.settings .page { flex: 1; overflow-y: auto; align-content: start; padding-bottom: calc(var(--bottom) + 24px); gap: 10px; }
.settings .page > h2 { font-size: 20px; margin-top: 8px; }
.settings .top h1 { font-size: 24px; }
.info { padding: 11px 0; border-bottom: 1px solid var(--line); }
.info:last-child { border-bottom: 0; }
.info small, .info strong { display: block; }
.info small { color: var(--soft); font-size: 14px; }
.info strong { overflow-wrap: anywhere; font-weight: 600; }
.rules p { color: var(--soft); font-size: 15px; margin-bottom: 6px; }
.delete { display: grid; gap: 10px; }
.delete h2 { color: var(--red-dark); font: 700 18px inherit; margin: 0; font-family: inherit; font-style: normal; }
.delete p { color: var(--soft); font-size: 15px; }

/* Code-barres en grand */
.large { position: fixed; inset: 0; z-index: 10; background: #fff; overflow: hidden; cursor: pointer; }
.large-code { position: absolute; top: 50%; left: 50%; width: 78vh; width: 78dvh; transform: translate(-50%, -50%) rotate(90deg); }
.large-code .barcode p { font-size: 22px; }
.large-close { position: absolute; top: calc(var(--top) + 12px); right: 16px; display: flex; align-items: center; gap: 4px; font-weight: 600; }
.large-hint { position: absolute; bottom: calc(var(--bottom) + 12px); left: 16px; right: 16px; text-align: center; color: var(--soft); font-size: 13px; }
@media (min-width: 561px) {
  .large-code { width: min(78vh, 90vw); transform: translate(-50%, -50%); }
}
