/* autonomiereelle.fr — feuille de style
   Direction : léger et net, à la manière des réglages d'un iPhone.
   Police du système, deux graisses (400 et 500), grands chiffres fins,
   cartes blanches sans bordure, une seule couleur vive : le vert de la charge. */

:root {
  --bg: #f5f5f7;          /* fond */
  --panel: #fff;          /* cartes, listes, feuilles */
  --field: #f5f5f7;       /* champs posés sur une carte */
  --ink: #1d1d1f;
  --ink-2: #424245;       /* texte secondaire sur fond gris */
  --muted: #636366;
  --hover: rgb(0 0 0 / 0.04);  /* survol d'une ligne */
  --accent-text: #146c2e; /* vert pour du texte sur fond vert pâle */
  --line: #d2d2d7;        /* bordures des champs */
  --hair: rgb(0 0 0 / 0.1);  /* séparateurs fins */
  --fill: rgb(118 118 128 / 0.12);
  --switch-off: #86868b;  /* interrupteur éteint : contraste 3:1 sur un champ gris */
  --accent: #9C5700;      /* vert de la charge, lisible sur blanc */
  --accent-ink: #fff;     /* texte posé sur l'accent */
  --accent-soft: rgb(52 199 89 / 0.13);
  --charge: var(--accent);   /* nom utilisé par les icônes du HTML */
  --warn: #c4001a;
  --warn-soft: rgb(255 59 48 / 0.1);
  --ok-soft: rgb(52 199 89 / 0.12);
  --approval: #c93400;
  --approval-soft: rgb(255 149 0 / 0.14);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 18px rgb(0 0 0 / 0.05);
  --bar: rgb(245 245 247 / 0.78);

  --radius-s: 12px;
  --radius-m: 18px;
  --radius-l: 22px;
  --gutter: 18px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI Variable Display', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(.25, .8, .25, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --panel: #1c1c1e;
    --field: #2c2c2e;
    --ink: #f5f5f7;
    --ink-2: #d1d1d6;
    --muted: #a1a1a6;
    --hover: rgb(255 255 255 / 0.06);
    --accent-text: #30d158;
    --line: #3a3a3c;
    --hair: rgb(255 255 255 / 0.12);
    --fill: rgb(118 118 128 / 0.26);
    --switch-off: #7c7c80;
    --accent: #FFB340;
    --accent-ink: #000;
    --accent-soft: rgb(48 209 88 / 0.18);
    --warn: #ff6961;
    --warn-soft: rgb(255 69 58 / 0.18);
    --ok-soft: rgb(48 209 88 / 0.16);
    --approval: #ffb340;
    --approval-soft: rgb(255 159 10 / 0.18);
    --shadow: none;
    --bar: rgb(0 0 0 / 0.72);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(env(safe-area-inset-bottom) + 24px);
}

b, strong { font-weight: 500; }
h1, h2, h3 { font-weight: 500; }

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

[hidden] { display: none !important; }

button { -webkit-tap-highlight-color: transparent; }

/* ---------- En-tête : retour, marque, progression ---------- */
.site-head {
  position: sticky; top: 0; z-index: 5;
  padding: calc(env(safe-area-inset-top) + 8px) max(var(--gutter), calc((100% - 42rem) / 2 + var(--gutter))) 8px;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--hair);
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 500; font-size: 0.95rem; letter-spacing: -0.01em; line-height: 1;
  margin: 0 0 0 auto;
}
.brand .mark { flex: none; width: 30px; height: 18px; }
/* Hors du premier écran, le logo seul */
body:not([data-step="batterie"]):not(.page-404) .brand span {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
body[data-step="batterie"] .brand { margin-left: 0; font-size: 1rem; }
body[data-step="batterie"] .brand .mark { width: 34px; height: 20px; }
.page-404 .site-head { position: static; }
.page-404 .brand { margin-left: 0; font-size: 1rem; }
.page-404 .brand .mark { width: 34px; height: 20px; }
.back {
  display: inline-flex; align-items: center; gap: 2px;
  font: inherit; font-size: 1.0625rem; color: var(--accent);
  background: none; border: 0; padding: 8px 10px 8px 0; min-height: 44px; cursor: pointer;
  margin-left: -4px;
}
.back svg { width: 20px; height: 20px; }
.back:hover { opacity: 0.7; }
.progress {
  display: block; width: 100%; height: 3px; margin: 6px 0 2px;
  appearance: none; -webkit-appearance: none; border: 0; border-radius: 2px;
  background: var(--fill); color: var(--accent); overflow: hidden;
}
.progress::-webkit-progress-bar { background: var(--fill); border-radius: 2px; }
.progress::-webkit-progress-value { background: var(--accent); border-radius: 2px; transition: width 320ms var(--ease); }
.progress::-moz-progress-bar { background: var(--accent); border-radius: 2px; }

/* ---------- Les écrans ---------- */
main { max-width: 42rem; margin: 0 auto; padding: 0 var(--gutter); }
.slide { padding: 14px 0 0; }
.step-title {
  font-family: var(--display);
  font-size: 1.9rem; line-height: 1.12; font-weight: 500; letter-spacing: -0.025em;
  margin: 14px 0 10px;
}
.step-title:focus { outline: none; }
.slide > .lede { margin: 0 0 22px; color: var(--muted); }
@media (min-width: 760px) { .step-title { font-size: 2.4rem; margin-top: 36px; } }

/* Glissement horizontal : vers la gauche quand on avance, vers la droite quand on recule */
@keyframes slide-next { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slide-back { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.slide.enter-next { animation: slide-next 340ms var(--ease); }
.slide.enter-back { animation: slide-back 340ms var(--ease); }
body { overflow-x: hidden; }

/* Bouton « Suivant », toujours à portée de pouce */
.step-nav {
  position: sticky; bottom: 0; z-index: 4;
  margin: 26px calc(-1 * var(--gutter)) 0; padding: 14px var(--gutter) calc(env(safe-area-inset-bottom) + 14px);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 35%);
}
.btn-next {
  display: block; width: 100%;
  font: inherit; font-size: 1.0625rem; font-weight: 500; color: var(--accent-ink); background: var(--accent);
  border: 0; border-radius: 999px; padding: 14px 24px; min-height: 52px; cursor: pointer;
  transition: transform 140ms var(--ease), filter 140ms ease;
}
.btn-next:hover { filter: brightness(1.08); }
.btn-next:active { transform: scale(0.98); }
.btn-next:disabled { color: var(--muted); background: var(--fill); cursor: default; filter: none; transform: none; }

/* Grandes cartes : un choix fait avancer */
.cards { display: grid; gap: 12px; }
.card {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 16px; row-gap: 2px; align-items: center;
  width: 100%; text-align: left; padding: 20px; min-height: 92px; cursor: pointer;
  font: inherit; color: var(--ink); background: var(--panel);
  border: 0; border-radius: var(--radius-l); box-shadow: var(--shadow);
  transition: transform 160ms var(--ease), box-shadow 160ms ease;
}
.card svg { grid-row: span 2; width: 44px; height: 44px; }
.card svg [stroke-width] { stroke-width: 1.6; }
.card-name { font-weight: 500; font-size: 1.15rem; line-height: 1.25; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.card-desc { color: var(--muted); font-size: 0.9rem; line-height: 1.35; }
.card:not(:has(svg)) { grid-template-columns: 1fr; }
.card:hover { box-shadow: var(--shadow), 0 0 0 1px var(--hair); }
.card:active { transform: scale(0.985); }
.card[aria-pressed="true"] { box-shadow: var(--shadow), inset 0 0 0 2px var(--accent); }

/* Options empilées : un choix parmi quelques-uns, sans avancer tout seul */
.options {
  display: grid; gap: 0;
  background: var(--panel); border-radius: var(--radius-m); box-shadow: var(--shadow); overflow: hidden;
}
.option {
  display: block; width: 100%; text-align: left; padding: 14px 16px 14px 52px; min-height: 58px; cursor: pointer; position: relative;
  font: inherit; font-size: 1.0625rem; color: var(--ink); background: transparent;
  border: 0; border-radius: 0;
}
.option + .option::after {
  content: ''; position: absolute; top: 0; left: 52px; right: 0; border-top: 0.5px solid var(--hair);
}
.option small { display: block; margin-top: 1px; font-size: 0.86rem; color: var(--muted); }
.option::before {
  content: ''; position: absolute; left: 18px; top: 18px; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--panel);
  transition: border-color 140ms ease, background 140ms ease;
}
.option:hover { background: var(--hover); }
.option[aria-pressed="true"]::before {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent-ink) 0 3.5px, var(--accent) 4px);
}
.ac-note { margin-top: 14px; }

.big-input {
  font-family: var(--display); font-size: 2.4rem !important; font-weight: 300 !important; letter-spacing: -0.03em;
  min-height: 72px; padding-top: 6px !important; padding-bottom: 6px !important;
}
.unit-input:has(.big-input) .unit { font-size: 1.05rem; }
.chips-big .chip { font-size: 1rem; padding: 10px 18px; min-height: 46px; }
.slide .field { margin-bottom: 22px; }
.slide .field > .chips { margin-top: 6px; }

/* Mois : une grille de 12 */
.months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.months .chip { border-radius: var(--radius-s); min-height: 46px; padding: 6px 4px; }
@media (max-width: 299px) { .months { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Résultat ---------- */
.recap { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 22px; }
.recap-item {
  font: inherit; font-size: 0.82rem; color: var(--ink-2);
  background: var(--fill); border: 0; border-radius: 999px;
  padding: 5px 12px; min-height: 32px; cursor: pointer;
  transition: background 140ms ease;
}
.recap-item::after {
  content: ''; display: inline-block; width: 5px; height: 5px; margin-left: 7px; vertical-align: 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); opacity: 0.6;
}
.recap-item:hover { background: color-mix(in srgb, var(--fill) 100%, var(--ink) 6%); }

/* Listes groupées, comme les réglages d'un iPhone */
.next-links {
  list-style: none; margin: 22px 0 6px; padding: 0;
  background: var(--panel); border-radius: var(--radius-m); box-shadow: var(--shadow); overflow: hidden;
}
.next-links li + li button::before {
  content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--hair);
}
.next-links button {
  display: block; width: 100%; text-align: left; position: relative;
  font: inherit; color: var(--ink); background: transparent;
  border: 0; border-radius: 0; padding: 12px 44px 12px 16px; min-height: 58px; cursor: pointer;
}
.next-links small { display: block; font-size: 0.84rem; color: var(--muted); }
.next-links button::after {
  content: ''; position: absolute; right: 20px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-right: 1.75px solid var(--muted); border-bottom: 1.75px solid var(--muted); transform: rotate(-45deg);
}
.next-links button:hover { background: var(--hover); }
.minor-actions { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 18px 0 0; }
.rc-answer { font-family: var(--display); font-size: 1.45rem; font-weight: 400; letter-spacing: -0.02em; line-height: 1.25; margin: 8px 0 12px; }
.rc-answer:empty { display: none; }
.rc-line { margin: 0 0 12px; }
.rc-solar-out { display: grid; }
.rc-solar-out .rc-line:first-child { font-family: var(--display); font-size: 1.2rem; letter-spacing: -0.015em; }
.rc-balance {
  margin: 0 0 12px; padding: 12px 14px; border-radius: var(--radius-s);
  background: var(--approval-soft);
}
.rc-balance.is-ok { background: var(--ok-soft); }

/* Pied de page : sur le premier écran et le résultat seulement */
.after { padding-top: 8px; }

/* ---------- Champs ---------- */
.field { display: grid; gap: 6px; margin: 0 0 16px; }
.field > label, .field > .label { font-size: 0.95rem; color: var(--ink-2); }
.row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.row > .grow { flex: 1 1 9rem; min-width: 0; }

input[type="text"], select {
  font: inherit; color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  min-height: 48px;
  width: 100%;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
input[type="text"] { font-size: 1.125rem; }
input[type="text"]:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
input[aria-invalid="true"] { border-color: var(--warn); }
select { width: auto; min-width: 6.5rem; }
select.w-full { width: 100%; }
.unit-fixed { display: flex; align-items: center; padding: 0 6px; color: var(--muted); }

.unit-input { position: relative; }
.unit-input input { padding-right: 3.4rem; }
.unit-input .unit {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.w-s { max-width: 11rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 0.93rem;
  color: var(--ink); background: var(--fill);
  border: 0; border-radius: 999px;
  padding: 7px 15px; min-height: 40px; cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.chip small { color: var(--ink-2); margin-left: 6px; }
.chip:hover { background: color-mix(in srgb, var(--fill) 100%, var(--ink) 6%); }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.chip[aria-pressed="true"] small { color: inherit; opacity: 0.85; }

input[type="range"] { width: 100%; accent-color: var(--accent); }

.note { margin: 0; color: var(--muted); font-size: 0.9rem; }
.optional { font-size: 0.85rem; color: var(--muted); margin-left: 4px; }
.label-small { margin: 16px 0 6px; font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.error { color: var(--warn); font-size: 0.9rem; margin: 0; }
.error:empty { display: none; }
.callout {
  margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius-s);
  background: var(--approval-soft); font-size: 0.93rem;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Ce qui ne concerne qu'une station, ou qu'une batterie externe */
body:not([data-profile="station"]) .station-only,
body:not([data-profile="powerbank"]) .powerbank-only { display: none; }
/* Une batterie externe n'alimente pas de glacière ni d'appareil 230 V */
body[data-profile="powerbank"] .tile[data-id="fridge"],
body[data-profile="powerbank"] .tile[data-id="cold"],
body[data-profile="powerbank"] .chip[data-id="screen"],
body[data-profile="powerbank"] .chip[data-id="fridge"],
body[data-profile="powerbank"] .chip[data-id="cooler-te"],
body[data-profile="powerbank"] .chip[data-id="ebike"] { display: none; }

/* ---------- Encarts repliables ---------- */
details { margin: 12px 0 0; }
details > summary {
  cursor: pointer; color: var(--accent);
  list-style: none; display: flex; align-items: center; gap: 8px;
  min-height: 44px;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: ''; width: 7px; height: 7px; flex: none; margin: 0 3px 0 1px;
  border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor;
  transform: rotate(-45deg); transition: transform 200ms var(--ease);
}
details[open] > summary::before { transform: rotate(45deg); }
details > summary:hover { opacity: 0.75; }
details .inner { padding: 6px 0 4px 20px; }
details .inner p { margin: 0 0 10px; color: var(--ink-2); }
.sources { font-size: 0.85rem; color: var(--muted); }
details .inner p.sources { color: var(--muted); }
.explain { border-top: 0.5px solid var(--hair); padding-top: 2px; }
.more-settings { margin-top: 4px; border-top: 0.5px solid var(--hair); padding-top: 2px; }
.more { margin-top: 10px; }
.more .inner { padding-left: 0; }
.howto { margin: 0 0 12px; }
.howto .inner p { font-size: 0.93rem; }

/* ---------- Tuiles d'appareils ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 4px 10px; min-height: 88px; cursor: pointer;
  font: inherit; font-size: 0.78rem; line-height: 1.2; text-align: center; color: var(--ink-2);
  background: var(--panel); border: 0; border-radius: var(--radius-m); box-shadow: var(--shadow);
  transition: transform 160ms var(--ease), box-shadow 160ms ease;
  overflow-wrap: anywhere; hyphens: auto;
}
.tile svg { width: 28px; height: 28px; flex: none; color: var(--ink); }
.tile svg [stroke-width] { stroke-width: 1.5; }
.tile:hover { box-shadow: var(--shadow), 0 0 0 1px var(--hair); }
.tile:active { transform: scale(0.96); }
@media (min-width: 640px) { .tile { font-size: 0.85rem; } .tile svg { width: 32px; height: 32px; } }

.tile { position: relative; }
.tile.has-items { box-shadow: var(--shadow), inset 0 0 0 1.5px var(--accent); color: var(--ink); }
.tile-count:not(:empty) {
  position: absolute; top: 6px; right: 6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; font-weight: 500; line-height: 20px;
}

/* Liste d'appareils : lignes compactes, on les touche pour régler */
.devices {
  list-style: none; margin: 20px 0 0; padding: 0;
  background: var(--panel); border-radius: var(--radius-m); box-shadow: var(--shadow); overflow: hidden;
}
.devices:empty { display: none; }
.device {
  display: flex; align-items: center; gap: 4px; position: relative;
  background: transparent; padding: 2px 4px 2px 0;
}
.device + .device::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: 0.5px solid var(--hair); }
.device.is-big .device-wh { color: var(--approval); }
.device.is-invalid .device-use { color: var(--warn); }
@keyframes row-new { from { background: var(--accent-soft); } to { background: transparent; } }
.device.is-new { animation: row-new 1000ms ease-out; }
.device-open {
  flex: 1; min-width: 0; display: grid; gap: 0; text-align: left; cursor: pointer;
  font: inherit; color: var(--ink); background: none; border: 0; padding: 9px 6px 9px 16px; min-height: 54px;
}
.device-name { overflow-wrap: anywhere; }
.device-use { font-size: 0.82rem; color: var(--muted); }
.device-wh { white-space: nowrap; font-size: 0.9rem; color: var(--muted); }
.remove {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.remove:hover { background: var(--fill); color: var(--ink); }
.empty { margin: 16px 0 0; color: var(--muted); }
.total {
  margin: 12px 4px 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; color: var(--ink-2); font-size: 0.93rem;
}
.undo { margin: 10px 0 0; font-size: 0.93rem; color: var(--ink-2); }
.undo:empty { display: none; }
.undo button {
  font: inherit; font-weight: 500; color: var(--accent); background: none; border: 0; padding: 4px 2px; min-height: 40px; cursor: pointer;
}

/* ---------- Feuilles par-dessus l'écran ---------- */
.sheet {
  width: 100%; max-width: 40rem; max-height: min(88dvh, 760px);
  margin: auto auto 0; padding: 0; overflow: hidden;
  color: var(--ink); background: var(--panel); border: 0;
  border-radius: var(--radius-l) var(--radius-l) 0 0; box-shadow: 0 -10px 40px rgb(0 0 0 / 0.18);
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-up 320ms var(--ease); }
@keyframes sheet-up { from { transform: translateY(48px); opacity: 0.5; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: var(--radius-l); } }
.sheet::backdrop { background: rgb(0 0 0 / 0.32); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px 10px; border-bottom: 0.5px solid var(--hair); position: relative;
}
.sheet-head::before {
  content: ''; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px;
  border-radius: 3px; background: var(--fill);
}
@media (min-width: 700px) { .sheet-head::before { display: none; } }
.sheet-head h2 { margin: 0; font-family: var(--display); font-size: 1.2rem; line-height: 1.2; letter-spacing: -0.02em; }
.sheet-body { padding: 14px 20px calc(env(safe-area-inset-bottom) + 20px); overflow-y: auto; overscroll-behavior: contain; }
.sheet input[type="text"], .sheet select, .sheet input[type="search"] { background: var(--field); border-color: transparent; }
.sheet input[type="text"]:focus, .sheet select:focus, .sheet input[type="search"]:focus { border-color: var(--accent); }
.sheet-close, .legal-close {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; cursor: pointer;
  color: var(--ink-2); background: var(--fill); border: 0; border-radius: 999px;
}
.sheet-close svg, .legal-close svg { width: 14px; height: 14px; }
.sheet-close:hover, .legal-close:hover { color: var(--ink); }
.sheet .field { margin-bottom: 16px; }
/* Interrupteur, à la manière des réglages d'un iPhone (recharge sans fil) */
.switch-row { display: flex; align-items: center; gap: 14px; margin: 14px 0 4px; padding: 12px 14px; background: var(--field); border-radius: var(--radius-s); }
.switch-text { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; cursor: pointer; color: var(--ink); }
.switch {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto; margin: 0;
  position: relative; width: 51px; height: 31px; border-radius: 999px; cursor: pointer;
  background: var(--switch-off); transition: background 180ms ease;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / 0.2), 0 0 0 0.5px rgb(0 0 0 / 0.04);
  transition: transform 220ms var(--ease);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
#catalog-wireless-box .switch-row { margin: 10px 0 6px; }
.sheet-actions { display: grid; gap: 6px; justify-items: center; margin-top: 18px; }
.device-total { font-family: var(--display); font-size: 1.15rem; letter-spacing: -0.015em; margin: 4px 0 0; }
input[type="search"] {
  font: inherit; font-size: 1.0625rem; color: var(--ink); width: 100%;
  background: var(--field); border: 1px solid transparent; border-radius: var(--radius-s);
  padding: 10px 14px; min-height: 46px; margin-top: 6px;
}
input[type="search"]:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
#catalog-count { margin: 8px 0 0; }
#catalog-count:empty { display: none; }
.picker-list { display: grid; gap: 0; margin-top: 10px; }
.picker-list:empty { display: none; }
.pick {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  width: 100%; text-align: left; padding: 12px 4px; min-height: 48px; cursor: pointer;
  font: inherit; color: var(--ink); background: transparent;
  border: 0; border-bottom: 0.5px solid var(--hair); border-radius: 0;
}
.pick:hover { background: var(--hover); }
.pick-name { min-width: 0; overflow-wrap: anywhere; }
.pick-wh { color: var(--muted); font-size: 0.86rem; white-space: nowrap; }
.pick-generic .pick-name { color: var(--accent); }
.pick-brand { margin: 16px 0 2px; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
#catalog-presets .chip::before { content: '+'; margin-right: 6px; color: var(--accent); }
#catalog-presets .chip[aria-pressed="true"]::before { color: inherit; }
#catalog-note { margin-top: 16px; }
html:has(dialog[open]) { overflow: hidden; }

/* ---------- Résultats ---------- */
.result-block { margin: 0; }
.result-block:focus { outline: none; }
.big-answer {
  margin: 0; font-family: var(--display);
  font-size: 3.4rem; line-height: 1.02; font-weight: 200; letter-spacing: -0.04em;
}
@media (min-width: 520px) { .big-answer { font-size: 4.4rem; } }
.answer-sub { margin: 12px 0 0; color: var(--ink-2); }
.extras { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.extras:empty { display: none; }
.extras li { color: var(--ink); }
.extras li.extra-note { color: var(--muted); font-size: 0.93rem; }
.extras li.extra-sim { color: var(--warn); }
.extras li.extra-air, .extras li.extra-power {
  padding: 11px 14px; border-radius: var(--radius-s); font-size: 0.95rem;
  background: var(--ok-soft);
}
.extras li.extra-air[data-status="approval"] { background: var(--approval-soft); }
.extras li.extra-air[data-status="forbidden"], .extras li.extra-power.is-bad { background: var(--warn-soft); }
.warnings { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.warnings:empty { display: none; }
.warnings li {
  padding: 11px 14px; border-radius: var(--radius-s);
  background: var(--approval-soft); font-size: 0.93rem;
}
.vital { margin-top: 16px; }

/* La batterie : jauge de la capacité utile */
.battery { margin: 14px 0 6px; }
.battery-body {
  position: relative; display: flex; align-items: stretch;
  height: 46px; padding: 4px;
  border: 1.5px solid var(--muted); border-radius: 12px;
  margin-right: 10px;
}
.battery-body::after {
  content: ''; position: absolute; right: -8px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 16px; background: var(--muted); border-radius: 0 3px 3px 0;
}
.battery-useful, .battery-loss {
  height: 100%; display: flex; align-items: center; min-width: 0;
  transition: flex-basis 320ms var(--ease); white-space: nowrap; overflow: hidden;
}
.battery-useful { background: var(--accent); color: var(--accent-ink); border-radius: 8px 0 0 8px; padding-left: 10px; font-weight: 500; font-size: 0.9rem; }
.battery-loss {
  border-radius: 0 8px 8px 0;
  background: repeating-linear-gradient(-45deg, transparent 0 5px, var(--fill) 5px 7px);
  justify-content: center; color: var(--muted); font-size: 0.82rem;
}
.battery-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-top: 8px; font-size: 0.86rem; color: var(--muted); }
.battery-legend strong { color: var(--ink); font-weight: 500; }

/* Formule affichée */
.calc { margin-top: 12px; }
.formula {
  margin: 8px 0 0; padding: 14px 16px;
  border-radius: var(--radius-s);
  background: var(--panel); box-shadow: var(--shadow);
  font-size: 0.9rem; line-height: 1.55;
}
.formula:empty { display: none; }
.formula p { margin: 0; }
.formula p + p { margin-top: 4px; }
.formula .k { color: var(--muted); }
.formula b { font-weight: 500; }
.src-link { margin: 10px 0 0; font-size: 0.88rem; }

/* ---------- Partage ---------- */
.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 24px 0 0; }
.btn-share {
  display: block; flex: 1 1 100%; text-align: center;
  font: inherit; font-weight: 500; color: var(--accent-text); background: var(--accent-soft);
  border: 0; border-radius: 999px; padding: 12px 22px; min-height: 48px; cursor: pointer;
  transition: transform 140ms var(--ease), background 140ms ease;
}
.btn-share:hover { background: color-mix(in srgb, var(--accent-soft) 100%, var(--accent) 8%); }
.btn-share:active { transform: scale(0.98); }
.btn-reset {
  font: inherit; font-size: 0.9rem; color: var(--accent); background: none; border: 0; padding: 6px 2px;
  min-height: 40px; cursor: pointer;
}
.btn-reset:hover { opacity: 0.75; }
.share-status { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 0.9rem; text-align: center; }
.share-status:empty { display: none; }
.share-status input { width: 100%; margin-top: 6px; font-size: 0.85rem; }

/* ---------- Hypothèses et sources ---------- */
.sources-panel { max-width: 42rem; margin: 28px auto 0; padding: 0 var(--gutter); }
.sources-panel > details { background: var(--panel); border-radius: var(--radius-m); box-shadow: var(--shadow); padding: 4px 18px; }
.sources-list { margin: 8px 0 0; }
.sources-list dt { font-weight: 500; margin-top: 14px; }
.sources-list dd { margin: 4px 0 0; font-size: 0.93rem; color: var(--ink-2); }
.src-toc ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 10px 0 4px; }
.src-toc a { display: inline-block; font-size: 0.86rem; color: var(--ink); background: var(--fill); border-radius: 999px; padding: 6px 12px; text-decoration: none; }
.src-toc a:hover { background: color-mix(in srgb, var(--fill) 100%, var(--ink) 6%); }
.src-group { scroll-margin-top: 90px; margin-top: 22px; }
.src-group h3 { font-family: var(--display); font-size: 1.05rem; letter-spacing: -0.015em; margin: 0; padding-top: 14px; border-top: 0.5px solid var(--hair); }
.src-group h3:focus { outline: none; }
.src-group .sources-list dt:first-child { margin-top: 8px; }
.catalog-sources { margin: 8px 0 0; padding-left: 1.1rem; font-size: 0.88rem; }
.catalog-sources li { margin: 2px 0; overflow-wrap: anywhere; }

/* ---------- Pied de page et mentions légales ---------- */
.site-foot { max-width: 42rem; margin: 32px auto 0; padding: 0 var(--gutter); color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.site-foot p { margin: 0 0 6px; }
.site-foot .foot-links { margin-top: 12px; padding-bottom: 8px; }
.site-foot .foot-links a, .link-btn { color: var(--muted); text-underline-offset: 3px; }
.site-foot .foot-links a:hover, .link-btn:hover { color: var(--ink); }
.link-btn { font: inherit; background: none; border: 0; padding: 0; text-decoration: underline; text-decoration-thickness: 1px; cursor: pointer; }
.noscript { max-width: 42rem; margin: 16px auto; padding: 12px var(--gutter); background: var(--approval-soft); border-radius: var(--radius-s); }

.legal {
  width: calc(100% - 2 * var(--gutter)); max-width: 36rem; max-height: calc(100dvh - 48px);
  margin: auto; padding: 0 22px 22px; overflow-y: auto; overscroll-behavior: contain;
  color: var(--ink); background: var(--panel); border: 0; border-radius: var(--radius-l);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.22); font-size: 0.93rem;
}
.legal::backdrop { background: rgb(0 0 0 / 0.32); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.legal-head {
  position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 -22px; padding: 16px 22px 10px; background: var(--panel); border-bottom: 0.5px solid var(--hair);
}
.legal-head h2 { margin: 0; font-family: var(--display); font-size: 1.2rem; letter-spacing: -0.02em; }
.legal h3 { margin: 20px 0 6px; font-size: 1rem; }
.legal p { margin: 0 0 8px; color: var(--ink-2); }
html:has(.legal[open]) { overflow: hidden; }

/* ---------- Page 404 (404.html) ---------- */
.page-404 { padding-bottom: 48px; }
.brand-link { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.notfound { max-width: 42rem; margin: 0 auto; padding: 48px var(--gutter) 0; }
.notfound-code { margin: 0; font-family: var(--display); font-size: 5.5rem; font-weight: 200; line-height: 1; letter-spacing: -0.05em; }
.notfound h1 { margin: 14px 0 10px; font-family: var(--display); font-size: 1.7rem; line-height: 1.15; letter-spacing: -0.025em; }
.notfound p { margin: 0 0 12px; max-width: 32rem; color: var(--muted); }
.notfound .notfound-home { display: inline-flex; align-items: center; margin-top: 12px; color: var(--accent-ink); background: var(--accent); text-decoration: none; flex: none; }

/* ---------- Mouvement ---------- */
@keyframes answer-new { from { opacity: 0.3; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.big-answer.is-new { animation: answer-new 420ms var(--ease); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .big-answer.is-new, .slide.enter-next, .slide.enter-back, .sheet[open], .device.is-new { animation: none; }
}

/* ---------- Petits écrans (écran extérieur des Galaxy Z Fold : 280 px ; gros zoom) ---------- */
@media (max-width: 380px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 299px) {
  :root { --gutter: 12px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 14px; column-gap: 12px; } .card svg { width: 34px; height: 34px; }
  .step-title { font-size: 1.55rem; }
  .big-answer { font-size: 2.5rem; }
  .big-input { font-size: 1.9rem !important; }
}

/* ---------- Impression : le calcul affiché, sur fond blanc ---------- */
.print-head { display: none; }
@media print {
  :root {
    --bg: #fff; --panel: #fff; --field: #fff; --ink: #111; --ink-2: #333; --muted: #555; --line: #bbb; --hair: #ccc;
    --fill: transparent; --hover: transparent; --accent-text: #146c2e; --accent: #1a7f37; --accent-ink: #fff; --accent-soft: #e6f4ea;
    --warn: #b00020; --warn-soft: #fbe9eb; --ok-soft: #e6f4ea; --approval: #a33a00; --approval-soft: #fdf0dc;
    --shadow: none;
    color-scheme: light;
  }
  body { padding: 0; font-size: 11pt; background: #fff; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-head { display: block; max-width: none; margin: 0 0 12px; font-size: 9pt; color: var(--muted); }
  .share-bar, .tiles, .remove, .back, .progress, .step-nav, .next-links, .minor-actions, .lede, .undo, .empty,
  .chip:not([aria-pressed="true"]), .src-link, details.explain:not(.calc), .site-foot, .noscript, .vital { display: none !important; }
  main, .site-head, .sources-panel { max-width: none; padding: 0; }
  .site-head { position: static; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .brand span { position: static !important; width: auto !important; height: auto !important; clip: auto !important; }
  .recap-item { border: 0; padding: 0 10px 0 0; min-height: 0; background: none; color: var(--ink); }
  .recap-item::after { display: none; }
  .slide.print-extra { display: block !important; break-inside: avoid; }
  .slide.print-extra .step-title { font-size: 13pt; margin: 14pt 0 6pt; }
  .devices { box-shadow: none; border-radius: 0; }
  .device + .device::before { left: 0; }
  .device-open { min-height: 0; padding: 4px 0; }
  .big-answer { font-size: 28pt !important; font-weight: 300; }
  details.calc > summary { display: none; }
  .formula { box-shadow: none; border: 1px solid var(--hair); }
  input[type="text"], select { border: 0; padding: 0; min-height: 0; background: none; }
  .unit-input input { padding-right: 2.6rem; }
  .device { break-inside: avoid; }
  .sources-panel > details { box-shadow: none; padding: 0; }
}
