/* Atelier VESC — design system « Clair premium Lite Foil » (voir ../index.html) :
   blanc et cyan de litefoil.fr, Instrument Sans / Serif, cartes flottantes, jauges SVG. */
:root {
  --bg1: #f7f9fa; --bg2: #eef3f5; --card: #ffffff;
  --line: #e7ebef; --line-soft: #eef2f5; --tile: #f7f9fb;
  --text: #0b0d10; --muted: #66727d; --muted-2: #9aa6b0;
  --ok: #1a9c55; --warn: #c97d00; --bad: #d1343f;
  --accent: #5acdd1; --accent-ink: #148a90; --accent-soft: #dff5f6;
  --radius: 20px;
  --sh-sm: 0 1px 2px rgba(16, 24, 32, .04), 0 2px 6px rgba(16, 24, 32, .05);
  --sh: 0 2px 10px rgba(16, 24, 32, .05), 0 16px 40px rgba(16, 24, 32, .06);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--sans);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg1), var(--bg2)) fixed;
  min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--accent-ink); }
.serif { font-family: var(--serif); font-weight: 400; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.center { text-align: center; }

/* ------------------------------------------------------------- en-tête */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  max-width: 760px; margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(247, 249, 250, .86);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.back {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line-soft); box-shadow: var(--sh-sm);
}
.back svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.logo { height: 30px; width: auto; flex: none; }
.title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.1; }
.title .serif { font-size: 22px; }
.title .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-pill {
  display: inline-flex; align-items: center; gap: 0; flex: none;
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-soft);
  background: var(--card); box-shadow: var(--sh-sm);
  font: 600 13px var(--sans); color: var(--muted); cursor: pointer;
}
.conn-pill.on { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.lamp { width: 9px; height: 9px; border-radius: 50%; background: #c5ccd3; display: inline-block; margin-right: 8px; }
.lamp.on { background: var(--ok); animation: lampPulse 2.4s infinite; }
.lamp.busy { background: var(--warn); animation: busyPulse 1s infinite; }
@keyframes lampPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(26, 156, 85, .35); } 50% { box-shadow: 0 0 0 5px rgba(26, 156, 85, 0); } }
@keyframes busyPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

@media (max-width: 420px) { .logo { display: none; } }

/* ------------------------------------------------------------- onglets */
.tabs {
  position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 19;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  max-width: 728px; margin: 2px auto 14px; padding: 5px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: 100px; box-shadow: var(--sh-sm);
}
@media (max-width: 760px) { .tabs { margin-left: 16px; margin-right: 16px; } }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 0 0 auto; border: 0; background: none; border-radius: 100px;
  padding: 9px 16px; font: 600 14px var(--sans); color: var(--muted); cursor: pointer;
  transition: color .2s, background .2s;
}
.tabs button.active { background: var(--text); color: #fff; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.page { display: none; }
.page.active { display: block; animation: fadeUp .32s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
footer { color: var(--muted-2); font-size: 12px; text-align: center; margin: 28px 0 0; }

/* ------------------------------------------------------------- cartes */
.card {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--sh-sm); margin-bottom: 12px;
}
.card h2 { font-size: 26px; margin: 0 0 6px; line-height: 1.15; }
.section-label, .m-label {
  text-transform: uppercase; letter-spacing: .07em; font-size: 11.5px; color: var(--muted); font-weight: 700;
}
.section-label { margin: 22px 6px 9px; }

.banner { border-radius: 14px; padding: 11px 14px; font-size: 14px; margin: 12px 0; }
.banner.warn { background: #fff6e3; color: #7a4b00; }
.banner.bad { background: #fdecee; color: var(--bad); font-weight: 600; }

/* ------------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px var(--sans); padding: 12px 20px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  cursor: pointer; user-select: none; touch-action: manipulation;
  transition: transform .12s ease, box-shadow .15s ease, opacity .15s, background .2s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .35; cursor: default; }
.btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--text); border-color: var(--text); color: #fff; box-shadow: var(--sh-sm); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #04282a; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost-dark { background: transparent; border-color: rgba(255, 255, 255, .25); color: #fff; }
.btn.danger-text { color: var(--bad); }
.btn.small { padding: 8px 14px; font-size: 13.5px; }
.btn.wide { width: 100%; }
.btn.icon span { font-size: 13px; }
.btn.icon.rec { background: #fdecee; border-color: #f6c5ca; color: var(--bad); }
.btn.icon.rec svg { fill: var(--bad); stroke: none; animation: busyPulse 1s infinite; }
.btn.stop {
  margin-top: 12px; min-height: 58px; font-size: 18px; letter-spacing: .04em;
  background: var(--bad); border-color: var(--bad); color: #fff; box-shadow: 0 8px 22px rgba(209, 52, 63, .28);
}
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.seg-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.seg-row .btn { padding: 10px 16px; }
.seg-row .seg button { padding: 8px 11px; }
.seg { display: inline-flex; padding: 4px; background: var(--card); border: 1px solid var(--line-soft); border-radius: 100px; box-shadow: var(--sh-sm); }
.seg.wide { display: flex; margin: 12px 0; }
.seg.wide button { flex: 1; }
.seg button {
  border: 0; background: none; padding: 8px 14px; border-radius: 100px; cursor: pointer;
  font: 600 13.5px var(--sans); color: var(--muted); transition: background .2s, color .2s;
}
.seg button.on { background: var(--text); color: #fff; }

/* ------------------------------------------------------------- formulaires */
input, select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; min-width: 0; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
input[type="number"] { font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366727d' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
}
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.input-unit { position: relative; }
.input-unit input { padding-right: 52px; }
.input-unit i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12.5px; color: var(--muted-2); pointer-events: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr; } }

.switch { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; font-size: 15px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: #dfe4e8; transition: background .2s;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* ------------------------------------------------------------- accueil */
.connect-card { text-align: center; padding: 26px 20px 22px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, #ffffff 40%, #effbfb); }
.connect-card::after { content: ""; position: absolute; right: -70px; top: -70px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(90, 205, 209, .25), transparent 70%); pointer-events: none; }
.connect-art svg { width: 108px; height: 108px; }
.connect-card h1 { font-size: 34px; line-height: 1.1; margin: 10px 0 6px; }
.connect-card h1 em { color: var(--accent-ink); }
.connect-card p { margin: 0 auto; max-width: 400px; }

.dev-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.dev-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex: none; }
.dev-ic svg { width: 26px; height: 26px; fill: none; stroke: var(--accent-ink); stroke-width: 2; stroke-linecap: round; }
.dev-name { font-family: var(--serif); font-size: 24px; line-height: 1.1; }
.dev-sub { font-size: 13px; color: var(--muted); }

.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kv { background: var(--tile); border: 1px solid var(--line-soft); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.kv .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kv .v { font-family: var(--serif); font-size: 20px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.25; }
.kv .v.mono { font-family: var(--mono); font-size: 12.5px; padding-top: 4px; }
.kv.full { grid-column: 1 / -1; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 0 12px; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
  font: 600 13px var(--sans); color: var(--muted); cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }
.chip.ghost { border-style: dashed; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.ioslist { background: #fff; border: 1px solid var(--line-soft); border-radius: 16px; overflow: hidden; margin-top: 12px; }
.ioslist:empty { display: none; }
.ioslist .item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-top: 1px solid var(--line-soft); }
.ioslist .item:first-child { border-top: 0; }
.ioslist .ic { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; color: #fff; font: 700 11px var(--sans); }
.ioslist .lb { flex: 1; min-width: 0; }
.ioslist .lb b { display: block; font-size: 14.5px; }
.ioslist .lb span { font-size: 12px; color: var(--muted); }
.ioslist .acts { display: flex; gap: 4px; }
.ioslist .acts button { border: 0; background: var(--tile); border-radius: 999px; padding: 6px 11px; font: 600 12.5px var(--sans); color: var(--accent-ink); cursor: pointer; }

/* ------------------------------------------------------------- métriques */
.hero-metric { position: relative; overflow: hidden; background: linear-gradient(135deg, #ffffff, #f0fbfb); }
.hero-metric::after { content: ""; position: absolute; right: -50px; top: -50px; width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, rgba(90, 205, 209, .22), transparent 70%); pointer-events: none; }
.hm-top { display: flex; justify-content: space-between; align-items: baseline; position: relative; z-index: 1; }
.hm-label { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--muted); font-weight: 700; }
.hm-max { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hm-value { font-family: var(--serif); font-size: 64px; line-height: 1; margin: 6px 0 0; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.hm-unit { font-family: var(--sans); font-size: 19px; color: var(--muted); margin-left: 7px; }
.spark { height: 40px; margin-top: 10px; position: relative; z-index: 1; }
.spark svg { width: 100%; height: 100%; display: block; overflow: visible; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ring-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.ring { width: 118px; height: 118px; margin: 6px auto 2px; }
.ring svg { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 11; }
.ring-fg { fill: none; stroke-width: 11; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 60px 60px;
  transition: stroke-dashoffset .7s cubic-bezier(.3, .7, .3, 1), stroke .3s; }
.ring-big { text-anchor: middle; font-family: var(--serif); font-size: 27px; fill: var(--text); }
.ring-small { text-anchor: middle; font-size: 9.5px; fill: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.metric .m-value { font-family: var(--serif); font-size: 40px; line-height: 1; margin-top: 10px; font-variant-numeric: tabular-nums; }
.m-unit { font-family: var(--sans); font-size: 15px; color: var(--muted); margin-left: 5px; }
.m-sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.temp-bar { height: 8px; border-radius: 99px; background: var(--tile); border: 1px solid var(--line-soft); margin-top: 14px; overflow: hidden; }
.temp-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #5acdd1, #f5c76a 60%, #d1343f); background-size: 200% 100%; transition: width .5s ease; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line-soft); border-radius: 16px; padding: 11px 13px; box-shadow: var(--sh-sm); }
.tile .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: var(--muted); }
.tile .v { font-family: var(--serif); font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; transition: color .3s; }
.tile .u { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-left: 4px; }
.good { color: var(--ok) !important; } .warn-c { color: var(--warn) !important; } .bad-c { color: var(--bad) !important; }

.chart-card { padding: 14px 14px 10px; }
.ch-head, .chart-card .ch-head { display: flex; flex-wrap: wrap; row-gap: 4px; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 2px 6px; }
.chart-card .ch-leg { display: flex; gap: 12px; font-size: 13px; font-variant-numeric: tabular-nums; flex-wrap: wrap; justify-content: flex-end; }
.chart-card .ch-leg i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.chart-card canvas { width: 100%; height: 140px; display: block; }

/* ------------------------------------------------------------- configuration */
.cfg-top { position: sticky; top: calc(116px + env(safe-area-inset-top)); z-index: 5; margin: 0 -16px 10px; padding: 6px 16px 8px;
  background: linear-gradient(180deg, rgba(240, 245, 247, .97) 75%, rgba(240, 245, 247, 0)); }
.cfg-search { position: relative; }
.cfg-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--muted-2); stroke-width: 2.2; stroke-linecap: round; }
.cfg-search input { padding-left: 40px; border-radius: 100px; background: #fff; box-shadow: var(--sh-sm); border-color: var(--line-soft); }
.cfg-groups { margin-top: 10px; }
.cfg-subs { margin-top: 8px; }
.cfg-subs .chip { padding: 5px 12px; font-size: 12.5px; }
.chip.mod::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
.chip.on.mod::after { background: var(--accent); }
.cfg-actions { display: flex; gap: 8px; margin: 2px 0 12px; overflow-x: auto; scrollbar-width: none; }
.cfg-actions::-webkit-scrollbar { display: none; }
.cfg-actions .btn { flex: none; }
.cfg-actions .btn.ghost { border-color: var(--line); background: transparent; color: var(--text); }
.cfg-actions .btn { padding: 8px 14px; font-size: 13.5px; }
.cfg-title { font-family: var(--serif); font-size: 26px; margin: 4px 4px 8px; line-height: 1.15; }

.params { background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--sh-sm); overflow: hidden; }
.sep { padding: 16px 16px 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--accent-ink); background: var(--tile); border-top: 1px solid var(--line-soft); }
.sep:first-child { border-top: 0; }
.param { display: grid; grid-template-columns: 1fr minmax(150px, 230px) 30px; gap: 10px; align-items: center;
  padding: 11px 14px; border-top: 1px solid var(--line-soft); transition: background .3s; }
.param:first-child { border-top: 0; }
.param.mod { background: linear-gradient(90deg, rgba(90, 205, 209, .13), rgba(90, 205, 209, .04)); box-shadow: inset 3px 0 0 var(--accent); }
.param .name { font-size: 14.5px; font-weight: 500; min-width: 0; }
.param .name small { display: block; color: var(--muted-2); font: 11px var(--mono); overflow-wrap: anywhere; }
.param .edit { display: flex; align-items: center; gap: 6px; min-width: 0; }
.param .edit .input-unit { flex: 1; }
.param .edit input:not([type="checkbox"]), .param .edit select { padding: 9px 11px; font-size: 15px; }
.param .bits { display: flex; flex-wrap: wrap; gap: 6px; }
.param .bits label { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; padding: 4px 9px; border-radius: 999px; background: var(--tile); border: 1px solid var(--line-soft); cursor: pointer; }
.param .bits input { width: 15px; height: 15px; accent-color: var(--accent-ink); }
.help-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; font: 700 13px var(--sans); padding: 0; }
.cfg-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.cfg-empty svg { width: 56px; height: 56px; fill: none; stroke: var(--accent); stroke-width: 1.6; margin-bottom: 8px; }
@media (max-width: 560px) {
  .param { grid-template-columns: 1fr 30px; row-gap: 7px; }
  .param .edit { grid-column: 1 / 2; grid-row: 2; }
  .param .help-btn { grid-row: 1; grid-column: 2; }
}

.savebar {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 8px; width: min(560px, calc(100% - 24px));
  padding: 8px 8px 8px 18px; border-radius: 100px; background: rgba(11, 13, 16, .94); color: #fff;
  box-shadow: 0 14px 40px rgba(11, 13, 16, .3); animation: rise .3s cubic-bezier(.2, .8, .3, 1.2) both;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.savebar span { flex: 1; font-size: 14px; font-weight: 600; }
.savebar .btn { padding: 9px 16px; font-size: 14px; }
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ------------------------------------------------------------- détection */
.motor-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.motor-list button {
  display: flex; flex-direction: column; overflow: hidden; padding: 0 0 10px !important;
  text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 12px; cursor: pointer;
  font: 600 13.5px var(--sans); color: var(--text); transition: border-color .2s, background .2s, box-shadow .2s;
}
.motor-list button small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.motor-list button.on { border-color: var(--accent); background: linear-gradient(180deg, #fff, #f2fbfb); box-shadow: 0 2px 12px rgba(90, 205, 209, .2); }
.adv { margin-top: 14px; border: 1px solid var(--line-soft); border-radius: 14px; padding: 10px 14px; background: var(--tile); }
.adv summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.result-head h2 { margin: 0; }
.badge { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex: none; }
.badge.ok { background: var(--ok); } .badge.err { background: var(--bad); } .badge.run { background: var(--accent); animation: busyPulse 1.2s infinite; }
.loader { height: 4px; border-radius: 9px; background: var(--tile); overflow: hidden; margin-top: 12px; }
.loader i { display: block; width: 40%; height: 100%; border-radius: 9px; background: var(--accent); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ------------------------------------------------------------- pilotage */
.ctl-sub { display: flex; gap: 16px; margin-top: 8px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.ctl-card { text-align: center; }
.ctl-val { font-family: var(--serif); font-size: 54px; line-height: 1; font-variant-numeric: tabular-nums; }
.ctl-val small { font-family: var(--sans); font-size: 18px; color: var(--muted); margin-left: 6px; }
.ctl-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-2); margin-top: 2px; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; background: none; border: 0; padding: 0; margin-top: 12px; }
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--line) var(--p, 50%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(16, 24, 32, .2); }
input[type="range"]::-moz-range-track { height: 8px; border-radius: 99px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(16, 24, 32, .2); }
.hold-btn {
  position: relative; width: 150px; height: 150px; margin: 18px auto 4px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 0; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 50% 35%, #ffffff, #eef6f7); box-shadow: var(--sh), inset 0 0 0 1px var(--line);
  transition: transform .12s ease, box-shadow .2s;
}
.hold-btn .hold-ring { position: absolute; inset: 8px; border-radius: 50%; border: 3px solid var(--line); transition: border-color .2s, box-shadow .2s; }
.hold-btn .hold-txt { font: 700 15px var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.hold-btn.active { transform: scale(.96); background: radial-gradient(circle at 50% 35%, #8fe3e6, #148a90); }
.hold-btn.active .hold-ring { border-color: rgba(255, 255, 255, .7); box-shadow: 0 0 0 10px rgba(90, 205, 209, .18), 0 0 0 22px rgba(90, 205, 209, .08); animation: holdPulse 1s infinite; }
.hold-btn.active .hold-txt { color: #fff; }
@keyframes holdPulse { 50% { box-shadow: 0 0 0 14px rgba(90, 205, 209, .12), 0 0 0 28px rgba(90, 205, 209, .04); } }

/* ------------------------------------------------------------- entrées */
.bar-gauge { position: relative; height: 14px; border-radius: 99px; background: var(--tile); border: 1px solid var(--line-soft); overflow: hidden; margin: 12px 0; }
.bar-gauge i { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: linear-gradient(90deg, #5acdd1, #148a90); border-radius: 99px; transition: all .18s ease-out; }
.bar-gauge .mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: var(--muted-2); }
.horizon { position: relative; height: 130px; border-radius: 16px; overflow: hidden; margin: 12px 0; background: linear-gradient(180deg, #2fa7ad, #0d5f66); }
.horizon-sky { position: absolute; left: -50%; right: -50%; top: -100%; height: 150%; background: linear-gradient(180deg, #8fd0f2, #e3f5fb); border-bottom: 2px solid #fff; transition: transform .2s ease-out; }
.horizon-mark { position: absolute; left: 50%; top: 50%; width: 90px; height: 3px; margin-left: -45px; background: #ffd23f; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }

/* ------------------------------------------------------------- terminal */
.term {
  height: 52vh; overflow: auto; margin: 0 0 12px; padding: 14px; border-radius: 18px;
  background: #0b0d10; color: #c9f1f2; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; box-shadow: var(--sh);
}
.term .cmd { color: var(--accent); }
.term-form { display: flex; gap: 8px; }
.term-form input { font-family: var(--mono); border-radius: 100px; padding-left: 16px; }

/* ------------------------------------------------------------- firmware */
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 14px; padding: 22px;
  border: 2px dashed var(--line); border-radius: 18px; background: var(--tile); cursor: pointer; color: var(--muted); font-weight: 600; text-align: center;
}
.file-drop input { display: none; }
.file-drop svg { width: 30px; height: 30px; fill: none; stroke: var(--accent-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.file-drop.has { border-color: var(--accent); color: var(--text); }
.progress { height: 12px; background: var(--tile); border-radius: 999px; overflow: hidden; margin: 16px 0 6px; border: 1px solid var(--line-soft); }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, #5acdd1, #148a90); border-radius: 999px; transition: width .25s; }

/* ------------------------------------------------------------- feuilles et notifications */
.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 50;
  max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 100px; background: rgba(11, 13, 16, .94); color: #fff;
  font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(11, 13, 16, .25); animation: drop .3s ease both; text-align: center;
}
.toast.error { background: var(--bad); }
@keyframes drop { from { transform: translate(-50%, -16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

dialog.sheet {
  width: min(560px, 100%); max-width: 100%; max-height: 86vh; margin: auto auto 0; padding: 10px 20px max(20px, env(safe-area-inset-bottom));
  border: 0; border-radius: 26px 26px 0 0; background: #fff; color: var(--text); box-shadow: 0 -10px 40px rgba(0, 0, 0, .15);
}
dialog.sheet[open] { animation: sheetUp .32s cubic-bezier(.2, .8, .3, 1) both; display: flex; flex-direction: column; }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 26px; } }
dialog::backdrop { background: rgba(11, 13, 16, .35); backdrop-filter: blur(2px); }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 10px; flex: none; }
.sheet h3 { font-size: 28px; margin: 0 0 4px; line-height: 1.15; }
.sheet code { font: 12px var(--mono); color: var(--muted); }
#helpBody { white-space: pre-wrap; overflow: auto; margin: 12px 0 16px; font-size: 15px; color: #2b343c; }
.diff-list { overflow: auto; margin: 12px 0 16px; border: 1px solid var(--line-soft); border-radius: 16px; }
.diff-list .d { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.diff-list .d:first-child { border-top: 0; }
.diff-list .d small { grid-column: 1 / -1; font: 11px var(--mono); color: var(--muted-2); }
.diff-list .old { color: var(--muted); text-decoration: line-through; }
.diff-list .new { color: var(--accent-ink); font-weight: 700; }
.diff-list .empty { padding: 14px; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------- diagnostic et feuilles génériques */
.link-btn { margin-top: 14px; border: 0; background: none; color: var(--accent-ink); font: 600 14px var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sheet-body { overflow: auto; margin: 10px 0 16px; }
.diag-list { margin: 8px 0 0; padding: 0; list-style: none; counter-reset: d; }
.diag-list li { counter-increment: d; position: relative; padding: 10px 0 10px 42px; border-top: 1px solid var(--line-soft); }
.diag-list li:first-child { border-top: 0; }
.diag-list li::before { content: counter(d); position: absolute; left: 0; top: 10px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.diag-list b { display: block; font-size: 15px; }
.diag-list span { font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------- essentiel */
.param .name small.hint { font: 12.5px/1.35 var(--sans); color: var(--muted); margin-top: 2px; }
.checks { padding: 6px 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.check:first-child { border-top: 0; }
.check-ic { width: 26px; height: 26px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; margin-top: 1px; }
.check.ok .check-ic { background: var(--ok); }
.check.info .check-ic { background: #0a84ff; }
.check.warn .check-ic { background: var(--warn); }
.check.bad .check-ic { background: var(--bad); }
.check b { display: block; font-size: 15px; }
.check > div > span { display: block; font-size: 13.5px; color: var(--muted); }
.dual .kv-grid { margin: 10px 0 12px; }

/* ------------------------------------------------------------- télécommande */
canvas.curve { width: 100%; height: 230px; display: block; margin-top: 6px; }

/* ------------------------------------------------------------- sessions */
.ses-live { display: flex; align-items: flex-end; justify-content: space-between; position: relative; z-index: 1; }
.ses-pow { font-family: var(--serif); font-size: 30px; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.ses-intro { position: relative; z-index: 1; margin: 8px 0 14px; }
#sesMap { height: 300px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-soft); background: #dfe6ea; }
.map-card .legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.map-card .legend i { display: inline-block; width: 14px; height: 6px; border-radius: 3px; }
.leaflet-container { font: inherit; }
.btn.primary.stop { background: var(--bad); border-color: var(--bad); }

/* ------------------------------------------------------------- firmware */
.fw-step { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border-radius: 16px; background: var(--tile); border: 1px solid var(--line-soft); }
.fw-step > div { flex: 1; min-width: 0; }
.fw-step b { display: block; font-size: 15px; }
.fw-step span:not(.step-n) { font-size: 13px; color: var(--muted); }
.fw-step .step-n { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--text); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.fw-step.done { border-color: var(--ok); background: #effaf3; }
.fw-step.done .step-n { background: var(--ok); }
.map-off { height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------- images moteur et profil */
.motor-list button img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #eef3f5; margin-bottom: 8px; }
.motor-list button span, .motor-list button small { padding: 0 12px; }
.motor-list button.on img { box-shadow: inset 0 0 0 2px var(--accent); }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.profile-head img { width: 112px; height: 84px; object-fit: cover; border-radius: 14px; flex: none; box-shadow: var(--sh-sm); }
.profile .seg.wide { margin: 0 0 8px; }
.profile .field { margin: 10px 0; }
.profile-values { margin-top: 12px; }
.profile .btn.primary { margin-top: 12px; }
.wiz-usage { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; padding: 10px; border-radius: 14px; background: var(--tile); border: 1px solid var(--line-soft); }
.wiz-usage img { width: 84px; height: 63px; object-fit: cover; border-radius: 10px; flex: none; }
.wiz-usage span { font-size: 13.5px; color: var(--muted); }

/* ------------------------------------------------------------- images */
.dev-photo { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex: none; box-shadow: var(--sh-sm); }
.motor-card { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; padding: 12px; }
.motor-card img { width: 96px; height: 72px; border-radius: 14px; object-fit: cover; flex: none; background: #eef3f5; }
.motor-card > div { flex: 1; min-width: 0; }
.motor-card .dev-name { font-size: 22px; }
.motor-card .ch { width: 18px; height: 18px; fill: none; stroke: var(--muted-2); stroke-width: 2.2; stroke-linecap: round; flex: none; }
.section-img { display: block; width: 100%; max-height: 180px; object-fit: cover; border-radius: 16px; margin: 0 0 10px; box-shadow: var(--sh-sm); background: #fff; }
.dual .section-img { object-fit: contain; max-height: 140px; box-shadow: none; margin: 10px 0; }
.diag-img { display: block; width: 100%; max-width: 280px; border-radius: 12px; margin: 10px 0 4px; }
.diag-list span.diag-cap { font-size: 12.5px; }

.page-save { margin-top: 16px; }

/* ------------------------------------------------------------- code d'accès */
body.locked { overflow: hidden; }
.lock-screen { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(180deg, var(--bg1), var(--bg2)); }
.lock-screen[hidden] { display: none; }
.lock-box { width: min(360px, 100%); text-align: center; background: var(--card); border: 1px solid var(--line-soft); border-radius: 26px;
  padding: 28px 22px 20px; box-shadow: var(--sh); display: flex; flex-direction: column; gap: 10px; }
.lock-logo { height: 46px; width: auto; margin: 0 auto; }
.lock-box h1 { font-size: 32px; margin: 4px 0 0; }
.lock-box p { margin: 0; }
.lock-box input { text-align: center; font-size: 24px; letter-spacing: .4em; padding: 14px; margin-top: 6px; }
.lock-err { color: var(--bad); font-weight: 600; font-size: 14px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
