/* Buanderie : habillage inspiré d'iOS (barre translucide, listes groupées, contrôle segmenté, SF) */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --bg: #f2f2f7; --card: #ffffff; --fg: #000000; --muted: #6c6c70; --sep: rgba(60, 60, 67, .18);
  --fill: rgba(120, 120, 128, .12); --bar: rgba(249, 249, 249, .82);
  --accent: #5b4bd6; --accent-fg: #ffffff; --accent-tint: rgba(91, 75, 214, .12);
  --green: #1e8a3c; --green-tint: rgba(52, 199, 89, .16);
  --orange: #b25e00; --orange-tint: rgba(255, 149, 0, .16); --orange-solid: #ff9500;
  --red: #d70015; --red-tint: rgba(255, 59, 48, .12);
  --ic-violet: #4b2a7b; --ic-blue: #1a82cc; --ic-muted: #6c6c70;
  --app-a: #9a7af2; --app-b: #4b2a7b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --card: #1c1c1e; --fg: #ffffff; --muted: #98989f; --sep: rgba(84, 84, 88, .55);
    --fill: rgba(120, 120, 128, .24); --bar: rgba(28, 28, 30, .78);
    --accent: #7d7aff; --accent-fg: #ffffff; --accent-tint: rgba(125, 122, 255, .2);
    --green: #30d158; --green-tint: rgba(48, 209, 88, .2);
    --orange: #ff9f0a; --orange-tint: rgba(255, 159, 10, .2); --orange-solid: #ff9f0a;
    --red: #ff453a; --red-tint: rgba(255, 69, 58, .2);
    --ic-violet: #b9a0f5; --ic-blue: #64c4ff; --ic-muted: #98989f;
    --app-a: #8e6cf0; --app-b: #3b1f78;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.35 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2 { margin: 0; line-height: 1.1; }

/* témoin « Hors ligne » (pastille flottante, visible seulement si le serveur est injoignable) */
.net { position: fixed; top: calc(env(safe-area-inset-top) + 8px); right: 12px; z-index: 10; background: var(--red-tint); color: var(--red); border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 600; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
main { max-width: 640px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom)); }
main.wide { max-width: 980px; }
.page { animation: page-in .22s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page { animation: none; } }
.loading { color: var(--muted); text-align: center; padding: 40px 0; }

/* icônes (SVG inline de config/icons/<machine>/) */
.ico { display: inline-flex; flex: none; width: 44px; height: 44px; }
.ico.lg { width: 56px; height: 56px; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico svg.violet { color: var(--ic-violet); }
.ico svg.blue { color: var(--ic-blue); }
.ico svg.muted { color: var(--ic-muted); }
.ico.prov { outline: 2px dashed var(--muted); outline-offset: 2px; border-radius: 8px; }
.ico.soft.prov { outline: none; }
.ico.soft { width: 56px; height: 56px; padding: 8px; border-radius: 14px; background: var(--fill); }
/* icône d'application : carré arrondi dégradé, pictogramme blanc */
.ico.app { width: 56px; height: 56px; padding: 11px; border-radius: 14px; background: linear-gradient(150deg, var(--app-a), var(--app-b)); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .25); }
.ico.app.big { width: 72px; height: 72px; padding: 14px; border-radius: 17px; }
.ico.app svg, .ico.app svg.violet, .ico.app svg.blue { color: #fff; stroke-width: 1.7; }

/* accueil : une carte par machine, même structure dans les trois états */
.cards { display: grid; gap: 14px; margin-top: 8px; }
.card { display: block; border-radius: 22px; background: var(--card); overflow: hidden; }
.card-main { display: block; padding: 16px; color: inherit; text-decoration: none; }
.card-main:active { background: var(--fill); }
.card-head { display: flex; align-items: center; gap: 14px; }
.ct { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card h2 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.prog-line { margin: 4px 0 0; font-size: 16px; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 4px 11px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.free { background: var(--green-tint); color: var(--green); }
.pill.running { background: var(--orange-tint); color: var(--orange); }
.pill.done { background: var(--red-tint); color: var(--red); }
.card-body { margin-top: 14px; text-align: center; }
.cta { margin-top: 14px; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; background: var(--accent-tint); color: var(--accent); font-size: 17px; font-weight: 600; }
.cta::after { content: ""; width: 8px; height: 8px; border-top: 2.5px solid currentColor; border-right: 2.5px solid currentColor; transform: rotate(45deg); }
.headline { margin: 0; font-size: 24px; font-weight: 700; color: var(--red); letter-spacing: -.01em; }
.card .bar { height: 6px; background: var(--fill); border-radius: 99px; overflow: hidden; margin: 10px 8px 8px; }
.bar span { display: block; height: 100%; width: 0; background: var(--orange-solid); border-radius: 99px; transition: width .9s linear; }
.card .card-btn { display: block; width: calc(100% - 32px); margin: 0 16px 16px; }
.count { margin: 6px 0 2px; font-family: var(--font-num); font-size: clamp(48px, 15vw, 64px); font-weight: 300; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sub { margin: 4px 0; color: var(--muted); font-size: 15px; }

/* page machine / programme */
.mhead { margin: 4px 0 12px; }
.back { display: inline-flex; align-items: center; gap: 2px; padding: 10px 0; color: var(--accent); font-size: 17px; text-decoration: none; }
.back::before { content: ""; width: 10px; height: 10px; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) scale(.9); margin-right: 8px; }
.mtitle { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.mtitle h1 { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.model { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.warn { background: var(--orange-tint); color: var(--orange); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 0 0 12px; }

/* contrôle segmenté */
.tabs { display: flex; gap: 2px; padding: 2px; margin: 12px 0 16px; background: var(--fill); border-radius: 9px; }
.tabs button { flex: 1; min-height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--fg); font: inherit; font-size: 14px; font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--card); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .04); }
@media (prefers-color-scheme: dark) { .tabs button[aria-selected="true"] { background: #636366; } }

/* boutons */
.btn { min-height: 50px; border: 0; border-radius: 14px; background: var(--accent-tint); color: var(--accent); font: inherit; font-size: 17px; font-weight: 600; padding: 0 18px; cursor: pointer; width: 100%; }
.btn:active { opacity: .7; }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.danger { background: var(--red-tint); color: var(--red); }
.btn.big { min-height: 56px; font-size: 18px; }
.btn:disabled { opacity: .45; }
.actions { display: grid; gap: 10px; margin-top: 18px; }
.notify { margin-top: 18px; }
.btn:focus-visible, .chip:focus-visible, .tabs button:focus-visible, .tile:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* minuteur : jauge circulaire */
.timer { text-align: center; }
.now { display: flex; align-items: center; gap: 14px; text-align: left; }
.now h2 { font-size: 22px; font-weight: 700; }
.now p { margin: 2px 0 0; color: var(--muted); }
.ringwrap { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 18px auto 12px; }
.ringwrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--fill); stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--orange-solid); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .9s linear; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center .count { margin: 0; font-size: clamp(40px, 13vw, 58px); }
.cap { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* listes groupées */
.group-title { margin: 20px 16px 6px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
.group { background: var(--card); border-radius: 14px; overflow: hidden; }
.group.pad { padding: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; padding: 8px 16px; }
.row + .row { border-top: .5px solid var(--sep); }
.row .val { color: var(--muted); }
.row strong.val { color: var(--fg); font-size: 22px; font-variant-numeric: tabular-nums; }
.foot { margin: 6px 16px 0; color: var(--muted); font-size: 13px; min-height: 1em; }
.foot:empty { display: none; }
.row input[type="time"] {
  flex: 0 0 auto; width: 9.5em; min-height: 36px; padding: 4px 10px; border: 0; border-radius: 8px; background: var(--fill); color: var(--fg);
  font: inherit; font-size: 17px; font-variant-numeric: tabular-nums;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; min-width: 64px; padding: 0 16px; border: 0; border-radius: 99px; background: var(--fill);
  color: var(--fg); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--accent); color: var(--accent-fg); }
.err { color: var(--red); font-weight: 600; margin: 12px 4px 0; }
.err:empty { display: none; }

/* programmes : tuiles carrées sur 3 colonnes */
.hint { margin: 4px 4px 12px; color: var(--muted); font-size: 15px; }
.grid3 { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid3 li { aspect-ratio: 1 / 1; display: flex; min-width: 0; }
.tile {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 6px 4px; text-align: center; text-decoration: none; color: var(--fg); overflow: hidden;
  background: var(--card); border-radius: 22px;
}
.tile .ico { width: 42%; height: auto; aspect-ratio: 1 / 1; }
.tile .ico.prov { outline-offset: 3px; }
.tile strong { font-size: 13px; font-weight: 600; line-height: 1.1; overflow-wrap: anywhere; }
.tile small { color: var(--muted); font-size: 11.5px; }
.tile:active { transform: scale(.95); background: var(--fill); }

/* notice : cartes empilées sur téléphone, tableau sur grand écran */
.notice { width: 100%; border-collapse: collapse; }
.notice thead { display: none; }
.notice tr { display: block; background: var(--card); border-radius: 14px; margin-bottom: 12px; padding: 4px 16px; }
.notice td { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; text-align: right; }
.notice td + td { border-top: .5px solid var(--sep); }
.notice td::before { content: attr(data-label); color: var(--muted); text-align: left; }
.notice td.pname { justify-content: flex-start; align-items: center; gap: 12px; text-align: left; font-weight: 700; font-size: 18px; padding: 12px 0; }
.notice td.pname::before { content: none; }
.fine { color: var(--muted); font-size: 13px; margin: 14px 4px; }
@media (min-width: 760px) {
  .notice { background: var(--card); border-radius: 14px; overflow: hidden; }
  .notice thead { display: table-header-group; }
  .notice tr { display: table-row; background: none; border-radius: 0; margin: 0; padding: 0; }
  .notice th { text-align: left; padding: 10px 12px; border-bottom: .5px solid var(--sep); color: var(--muted); font-size: 13px; font-weight: 600; }
  .notice td { display: table-cell; padding: 10px 12px; text-align: left; border-top: .5px solid var(--sep); vertical-align: middle; }
  .notice td::before { content: none; }
  .notice td.pname { display: table-cell; font-size: 16px; padding: 10px 12px; }
  .notice td.pname .ico { vertical-align: middle; margin-right: 10px; }
}
.ltitle { margin: 8px 4px 4px; font-size: 34px; font-weight: 700; letter-spacing: -.02em; }

/* interrupteur façon iOS */
.switch { position: relative; flex: none; width: 51px; height: 31px; border: 0; border-radius: 99px; background: rgba(120, 120, 128, .32); cursor: pointer; transition: background .2s; padding: 0; }
.switch .thumb { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch[aria-checked="true"] { background: #34c759; }
.switch[aria-checked="true"] .thumb { transform: translateX(20px); }
.switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.fu-pick { display: grid; gap: 14px; margin-top: 8px; }
.fu-next { color: var(--accent); font-weight: 600; }

/* demande « ensuite » sur un lavage terminé */
.fu { display: grid; gap: 10px; margin: 0 16px 14px; padding: 14px; border-radius: 16px; background: var(--accent-tint); text-align: center; }
.fu-ask { margin: 0; font-size: 16px; }
.fu-ask strong { display: block; margin-top: 2px; font-size: 18px; }
.fu-busy { margin: 0; color: var(--orange); font-weight: 600; font-size: 15px; }
.link-btn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; text-decoration: underline; padding: 4px; cursor: pointer; }
.timer > .fu { margin: 14px 0 0; }
