/* Clévia — feuille de style unique.
   Téléphone d'abord ; tablette (≥ 700 px) : barre d'icônes à gauche ; ordinateur (≥ 1100 px) : menu complet. */

:root {
  --bg: #F4F6FA; --card: #FFFFFF; --ink: #0E1A2B; --muted: #556070; --line: #E3E7EF; --line2: #CDD4E0;
  --pri: #3346D3; --pri-ink: #2433A8; --pri-soft: #E8EBFC; --on-pri: #FFFFFF; --mint: #34D3B4;
  --nav: rgba(255,255,255,.94); --scrim: rgba(5,10,20,.5); --shadow: 0 1px 2px rgba(14,26,43,.05), 0 6px 24px rgba(14,26,43,.06);
  --t-ag: #1D5BD8; --s-ag: #E6EEFD; --t-doc: #A85A06; --s-doc: #FDF1DC; --t-arg: #047857; --s-arg: #DDF3EA;
  --t-veh: #C2410C; --s-veh: #FDE8DC; --t-san: #BE185D; --s-san: #FCE4EF; --t-cof: #4338CA; --s-cof: #E7E6FB;
  --t-fam: #0E7490; --s-fam: #DDF1F6; --t-reg: #556070; --s-reg: #EDF0F5;
  --warn: #9A4A05; --warn-s: #FEF0D6; --bad: #B4232F; --bad-s: #FDE4E6; --ok: #047857; --ok-s: #DDF3EA;
  --r: 20px; --r-s: 14px; --tab-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1220; --card: #151D30; --ink: #EEF2F8; --muted: #A3AEC2; --line: #26324B; --line2: #34425F;
    --pri: #8C99FF; --pri-ink: #B4BCFF; --pri-soft: #262E5C; --on-pri: #0B1220;
    --nav: rgba(21,29,48,.95); --scrim: rgba(0,0,0,.6); --shadow: none;
    --t-ag: #8DB4FF; --s-ag: #1A2A4A; --t-doc: #F5B65B; --s-doc: #3A2A12; --t-arg: #5DD6A8; --s-arg: #12352A;
    --t-veh: #FF9C6B; --s-veh: #3E2116; --t-san: #F68DBB; --s-san: #3E1A2B; --t-cof: #A9A3FF; --s-cof: #29265A;
    --t-fam: #6FD3EA; --s-fam: #123540; --t-reg: #A3AEC2; --s-reg: #222C42;
    --warn: #F5B65B; --warn-s: #3A2A12; --bad: #FF8A93; --bad-s: #45161C; --ok: #5DD6A8; --ok-s: #12352A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1220; --card: #151D30; --ink: #EEF2F8; --muted: #A3AEC2; --line: #26324B; --line2: #34425F;
  --pri: #8C99FF; --pri-ink: #B4BCFF; --pri-soft: #262E5C; --on-pri: #0B1220;
  --nav: rgba(21,29,48,.95); --scrim: rgba(0,0,0,.6); --shadow: none;
  --t-ag: #8DB4FF; --s-ag: #1A2A4A; --t-doc: #F5B65B; --s-doc: #3A2A12; --t-arg: #5DD6A8; --s-arg: #12352A;
  --t-veh: #FF9C6B; --s-veh: #3E2116; --t-san: #F68DBB; --s-san: #3E1A2B; --t-cof: #A9A3FF; --s-cof: #29265A;
  --t-fam: #6FD3EA; --s-fam: #123540; --t-reg: #A3AEC2; --s-reg: #222C42;
  --warn: #F5B65B; --warn-s: #3A2A12; --bad: #FF8A93; --bad-s: #45161C; --ok: #5DD6A8; --ok-s: #12352A;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; margin: 0; cursor: pointer; text-align: left; }
a { color: var(--pri); text-decoration: none; }
a.row, a.card, a.qtile, a.etile, a.search, a.nb.on .nb-ic, a.pill, a.sb, a.who { color: inherit; }
a.nb { color: var(--muted); } a.nb.on { color: var(--pri); }
a.search { color: var(--muted); }
h1, h2, h3, p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--pri) 55%, transparent); outline-offset: 2px; border-radius: 10px; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Structure ---------- */
#app { min-height: 100dvh; }
#main { padding: calc(var(--safe-t) + 8px) 0 calc(var(--tab-h) + var(--safe-b) + 24px); max-width: 1320px; margin: 0 auto; outline: none; }
.side { display: none; }

/* Barre du bas (téléphone) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tab-h) + var(--safe-b));
  padding: 6px 6px var(--safe-b); background: var(--nav); border-top: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
}
.nb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 58px; font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; }
.nb .nb-ic { width: 56px; height: 32px; border-radius: 999px; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.nb.on { color: var(--pri); }
.nb.on .nb-ic { background: var(--pri-soft); }
.nb-fab { display: flex; justify-content: center; align-items: flex-start; padding-top: 2px; }
.fab { width: 58px; height: 58px; border-radius: 19px; background: var(--pri); color: var(--on-pri); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 22px color-mix(in srgb, var(--pri) 38%, transparent); }
.fab .ico { width: 28px; height: 28px; stroke-width: 2.2; }
.badge-dot { position: absolute; top: 6px; right: 14px; min-width: 9px; height: 9px; border-radius: 5px; background: #E11D48; }

/* Tablette : barre d'icônes */
@media (min-width: 700px) {
  .tabbar { display: none; }
  .side {
    display: flex; position: fixed; left: 0; top: 0; bottom: 0; width: 96px; z-index: 30;
    flex-direction: column; align-items: center; gap: 4px; padding: calc(var(--safe-t) + 18px) 0 18px;
    background: var(--card); border-right: 1px solid var(--line); overflow-y: auto;
  }
  .side .brand { margin-bottom: 14px; }
  .side .brand b { display: none; }
  .side .brand img { width: 44px; height: 44px; }
  .sb { width: 80px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; border-radius: 14px; }
  .sb .sb-ic { width: 54px; height: 34px; border-radius: 999px; display: flex; align-items: center; justify-content: center; color: var(--c); }
  .sb.on { color: var(--pri); }
  .sb.on .sb-ic { background: var(--pri-soft); color: var(--pri); }
  .sb .sb-k { display: none; }
  .side .side-add { margin: 10px 0 4px; }
  .side .side-add span { display: none; }
  .side .side-add.btn { width: 54px; height: 54px; padding: 0; border-radius: 18px; }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .side-foot .who-txt { display: none; }
  #main { padding: calc(var(--safe-t) + 20px) 24px 40px 120px; }
  .page-switch .chev { display: none; }
}
/* Ordinateur : menu complet */
@media (min-width: 1100px) {
  .side { width: 264px; align-items: stretch; padding: 24px 16px; background: #0E1A2B; border-right: 0; }
  :root[data-theme="dark"] .side { background: #0A101C; }
  .side .brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; color: #fff; }
  .side .brand b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
  .side .brand img { width: 40px; height: 40px; }
  .sb { width: 100%; flex-direction: row; gap: 12px; height: 46px; padding: 0 12px; font-size: 15px; color: #C9D2E3; text-align: left; border-radius: 12px; }
  .sb .sb-ic { width: auto; height: auto; background: none !important; color: var(--cd) !important; }
  .sb.on { background: rgba(140,153,255,.16); color: #fff; }
  .sb .sb-k { display: block; margin-left: auto; font-size: 12px; color: #7D89A0; }
  .sb:hover { background: rgba(255,255,255,.06); }
  .side .side-add.btn { width: 100%; height: 48px; border-radius: 14px; padding: 0 16px; }
  .side .side-add span { display: inline; }
  .side-foot { align-items: stretch; }
  .side-foot .who { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; background: rgba(255,255,255,.06); color: #fff; }
  .side-foot .who-txt { display: flex; flex-direction: column; min-width: 0; }
  .side-foot .who-txt small { color: #A3AEC2; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #main { padding: 32px 40px 48px 304px; max-width: none; }
  #main > * { max-width: 1240px; }
}

/* ---------- En-têtes de page ---------- */
.page { display: flex; flex-direction: column; gap: 14px; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 20px 0; min-height: 56px; }
.ph-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-switch { display: flex; align-items: center; gap: 10px; min-height: 48px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; min-width: 0; }
.page-switch span.t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-switch .chev { color: var(--muted); width: 20px; height: 20px; }
.sec-badge { width: 40px; height: 40px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--s); color: var(--c); }
.sec-badge .ico { width: 22px; height: 22px; }
.ph-actions { display: flex; gap: 8px; flex: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--card); display: inline-flex; align-items: center; justify-content: center; flex: none; position: relative; box-shadow: var(--shadow); }
.icon-btn.plain { background: transparent; box-shadow: none; }
.icon-btn .ico { width: 21px; height: 21px; }
.ph-sub { padding: 0 20px; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
@media (min-width: 700px) { .ph, .ph-sub, .sec, .hs { padding-left: 0 !important; padding-right: 0 !important; } .hs { margin: 0; } }

/* ---------- Blocs ---------- */
.sec { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
.sec-t { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; min-height: 36px; }
.sec-t h2 { font-size: 17px; font-weight: 700; }
.link { font-size: 14px; font-weight: 700; color: var(--pri); min-height: 44px; display: inline-flex; align-items: center; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 16px; }
.list > * + * { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; min-height: 56px; width: 100%; }
button.row:active, .tap:active { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.row:first-child { border-radius: var(--r) var(--r) 0 0; } .row:last-child { border-radius: 0 0 var(--r) var(--r); } .row:only-child { border-radius: var(--r); }
.mini { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--s, var(--pri-soft)); color: var(--c, var(--pri)); }
.mini .ico { width: 20px; height: 20px; }
.av { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; font-weight: 800; background: var(--s, var(--pri-soft)); color: var(--c, var(--pri)); overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.t1 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrap { white-space: normal; }
.right { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.num { font-variant-numeric: tabular-nums; }
.big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.mid { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.chip { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; flex: none; background: var(--s, var(--pri-soft)); color: var(--c, var(--pri)); display: inline-flex; align-items: center; gap: 4px; }
.chip.warn { --s: var(--warn-s); --c: var(--warn); } .chip.bad { --s: var(--bad-s); --c: var(--bad); } .chip.ok { --s: var(--ok-s); --c: var(--ok); } .chip.grey { --s: var(--s-reg); --c: var(--t-reg); }
.dot { width: 9px; height: 9px; border-radius: 5px; flex: none; background: var(--c, var(--pri)); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cols { display: grid; gap: 18px; }
@media (min-width: 900px) { .cols.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cols.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) and (max-width: 1099px) { .cols.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cols > div { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tile { padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 108px; }
.tile .t2 { white-space: normal; }
.stat { padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.hero { background: #0E1A2B; color: #fff; border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
:root[data-theme="dark"] .hero { background: #1B2540; }
.hero .t2 { color: #A3AEC2; }
.hero-cell { background: rgba(255,255,255,.08); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.hero-cell small { font-size: 12px; color: #A3AEC2; }
.hero-cell b { font-size: 17px; }

/* Défilement horizontal */
.hs { display: flex; gap: 10px; overflow-x: auto; padding: 2px 20px 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.hs::-webkit-scrollbar { display: none; }
.hs > * { scroll-snap-align: start; }
.alert-card { width: 240px; flex: none; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pill { height: 38px; padding: 0 15px; border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; flex: none; box-shadow: var(--shadow); }
.pill.on { background: var(--ink); color: var(--bg); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--card); border-radius: 15px; padding: 4px; gap: 4px; box-shadow: var(--shadow); }
.seg button { height: 40px; border-radius: 11px; font-size: 14px; font-weight: 700; text-align: center; color: var(--muted); }
.seg button.on { background: var(--pri); color: var(--on-pri); }

/* Grille des espaces */
.qgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 12px 6px; }
.qtile { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; text-align: center; padding: 4px 0; border-radius: 14px; }
.qtile .qb { width: 58px; height: 58px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--s); color: var(--c); }
.egrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.etile { background: var(--card); border-radius: 20px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 7px; min-height: 108px; justify-content: center; text-align: center; box-shadow: var(--shadow); position: relative; }
.etile.on { outline: 2px solid var(--pri); }
.etile .el { font-size: 13px; font-weight: 700; }
.etile .eh { font-size: 11px; color: var(--muted); }

/* Boutons */
.btn { min-height: 50px; border-radius: 16px; padding: 0 18px; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 9px; text-align: center; }
.btn .ico { width: 20px; height: 20px; }
.btn.primary { background: var(--pri); color: var(--on-pri); }
.btn.secondary { background: var(--card); box-shadow: var(--shadow); }
.btn.ghost { background: transparent; color: var(--pri); }
.btn.danger { background: var(--bad-s); color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; border-radius: 12px; font-size: 14px; padding: 0 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }

/* Recherche */
.search { height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-radius: 16px; background: var(--card); color: var(--muted); box-shadow: var(--shadow); width: 100%; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; height: 100%; font-size: 16px; color: var(--ink); }
.search .ico { width: 20px; height: 20px; }

/* Barres et graphiques simples */
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--c, var(--pri)); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 84px; }
.bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars i { width: 100%; border-radius: 6px; background: var(--s-arg); display: block; min-height: 3px; }
.bars div.on i { background: var(--t-arg); }
.bars small { font-size: 11px; color: var(--muted); }

/* Semaine (agenda) */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { height: 66px; border-radius: 16px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center; box-shadow: var(--shadow); position: relative; }
.day small { font-size: 11px; font-weight: 600; color: var(--muted); }
.day b { font-size: 18px; font-weight: 800; }
.day.on { background: var(--pri); color: var(--on-pri); } .day.on small { color: var(--on-pri); }
.day.today:not(.on) b { color: var(--pri); }
.day .marks { position: absolute; bottom: 7px; display: flex; gap: 3px; } .day .marks i { width: 5px; height: 5px; border-radius: 3px; background: var(--c, var(--pri)); }
.day.on .marks i { background: var(--on-pri); }
.ev { display: flex; gap: 12px; padding: 14px; width: 100%; }
.ev .rail { width: 4px; border-radius: 2px; background: var(--c, var(--pri)); flex: none; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month .mh { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.month button { aspect-ratio: 1 / 1; border-radius: 12px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 700; font-size: 14px; text-align: center; }
.month button.out { opacity: .35; } .month button.on { background: var(--pri); color: var(--on-pri); } .month button.today:not(.on) { color: var(--pri); outline: 2px solid var(--pri-soft); }
.month .marks { display: flex; gap: 2px; height: 5px; } .month .marks i { width: 5px; height: 5px; border-radius: 3px; background: var(--c, var(--pri)); }
.cb { width: 26px; height: 26px; border-radius: 9px; border: 2px solid var(--line2); flex: none; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.cb.on { background: var(--t-arg); border-color: var(--t-arg); }
.cb .ico { width: 16px; height: 16px; stroke-width: 2.6; }
.done .t1 { text-decoration: line-through; color: var(--muted); }

/* Plaque d'immatriculation */
.plate { display: inline-flex; align-items: stretch; border-radius: 8px; overflow: hidden; border: 2px solid #0E1A2B; background: #fff; color: #0E1A2B; font-weight: 800; font-size: 16px; letter-spacing: .06em; flex: none; }
.plate .eu { background: #1D4ED8; color: #fff; font-size: 10px; width: 20px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 3px; }
.plate .pn { padding: 3px 9px; }

/* États vides, verrou */
.empty { padding: 28px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ico { width: 40px; height: 40px; stroke-width: 1.5; }
.lockbox { padding: 34px 24px 10px; display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; max-width: 440px; margin: 0 auto; width: 100%; }
.lockbox .lk { width: 108px; height: 108px; border-radius: 34px; background: var(--s-cof); color: var(--t-cof); display: flex; align-items: center; justify-content: center; }
.lockbox .lk .ico { width: 52px; height: 52px; stroke-width: 1.5; }
.lockbox p { color: var(--muted); }
.note { font-size: 13px; color: var(--muted); line-height: 1.5; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; background: var(--s, var(--pri-soft)); color: var(--ink); }
.callout .ico { color: var(--c, var(--pri)); width: 22px; height: 22px; }
.callout.warn { --s: var(--warn-s); --c: var(--warn); } .callout.ok { --s: var(--ok-s); --c: var(--ok); } .callout.bad { --s: var(--bad-s); --c: var(--bad); }

/* ---------- Feuilles (fenêtres du bas) ---------- */
#sheet-root .scrim { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: flex; flex-direction: column; justify-content: flex-end; animation: fade .18s ease; }
.sheet { background: var(--bg); border-radius: 28px 28px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; max-height: 92dvh; overflow-y: auto; animation: up .22s cubic-bezier(.2,.8,.2,1); width: 100%; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line2); margin: 0 auto; flex: none; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-h h2 { font-size: 20px; font-weight: 800; }
@media (min-width: 700px) {
  #sheet-root .scrim { justify-content: center; align-items: center; padding: 24px; }
  .sheet { border-radius: 28px; max-width: 560px; max-height: 88dvh; padding-bottom: 24px; }
  .sheet.wide { max-width: 760px; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.fld input, .fld select, .fld textarea {
  width: 100%; min-height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card);
  padding: 12px 14px; font-size: 16px; outline: none; color: var(--ink);
}
.fld textarea { min-height: 96px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--pri); }
.fld small { font-size: 12px; color: var(--muted); }
.frow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); }
.toggle input { width: 46px; height: 28px; appearance: none; -webkit-appearance: none; border-radius: 999px; background: var(--line2); position: relative; flex: none; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--pri); } .toggle input:checked::after { left: 21px; }
.toggle b { font-size: 15px; font-weight: 600; } .toggle small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { cursor: pointer; } .choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); font-size: 14px; font-weight: 600; }
.choice input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--pri) 55%, transparent); }
.drop { border: 2px dashed var(--line2); border-radius: 18px; padding: 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: center; cursor: pointer; }
.drop.over { border-color: var(--pri); background: var(--pri-soft); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); transform: translate(-50%, 20px); z-index: 80; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 700px) { .toast { bottom: 24px; } }

/* Écran de connexion */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 24px calc(32px + var(--safe-b)); text-align: center; background: var(--bg); }
.login img { width: 96px; height: 96px; border-radius: 28px; }
.login h1 { font-size: 40px; font-weight: 800; letter-spacing: -.03em; }
.login .tag { color: var(--muted); font-size: 17px; margin-top: -14px; }
.login .points { display: flex; flex-direction: column; gap: 10px; text-align: left; max-width: 360px; width: 100%; }
.login .points div { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.login .points .mini { width: 36px; height: 36px; }
#gbtn { min-height: 44px; }

/* Visionneuse */
.viewer { position: fixed; inset: 0; z-index: 70; background: #0B1220; display: flex; flex-direction: column; }
.viewer header { display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-t) + 8px) 12px 8px; color: #fff; }
.viewer header b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer .icon-btn { background: rgba(255,255,255,.1); color: #fff; box-shadow: none; }
.viewer .vbody { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; }
.viewer iframe, .viewer embed { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer img { max-width: 100%; height: auto; margin: auto; }

/* Divers */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 600; }
.secret { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: .04em; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sync-pill i { width: 8px; height: 8px; border-radius: 4px; background: var(--ok); } .sync-pill.off i { background: var(--warn); } .sync-pill.err i { background: var(--bad); }
.gap { height: 12px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
