/* ============================================================
   Salle — carnet d'entraînement
   1. Jetons        5. Cartes & listes    9. Séance
   2. Base          6. Boutons           10. Graphiques
   3. Coque         7. Formulaires       11. Feuilles & toast
   4. Typographie   8. Statistiques      12. Écran de connexion
   ============================================================ */

/* 1. Jetons ------------------------------------------------- */
:root {
  --ink:        #0c0e12;
  --surface:    #14171d;
  --surface-2:  #1a1e26;
  --surface-3:  #212632;
  --line:       rgba(255, 255, 255, .075);
  --line-2:     rgba(255, 255, 255, .13);
  --text:       #e9eaee;
  --text-2:     #a2a9b6;
  --text-3:     #6f7683;
  --accent:     #d9a24a;
  --accent-ink: #1a1204;
  --accent-dim:  rgba(217, 162, 74, .13);
  --accent-line: rgba(217, 162, 74, .32);
  --accent-wash: rgba(217, 162, 74, .17);
  --ok:          #5cc08a;
  --ok-dim:      rgba(92, 192, 138, .13);
  --ok-line:     rgba(92, 192, 138, .36);
  --warn:        #e0b04f;
  --danger:      #e0705f;
  --danger-dim:  rgba(224, 112, 95, .12);
  --danger-line: rgba(224, 112, 95, .38);
  --cool:        #6fa8c9;
  --glass:       rgba(12, 14, 18, .87);

  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);

  --pad: 16px;
  --maxw: 560px;
  --tabh: 62px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --ink:        #f6f4f1;
  --surface:    #ffffff;
  --surface-2:  #fbfaf8;
  --surface-3:  #f1efeb;
  --line:       rgba(24, 20, 14, .09);
  --line-2:     rgba(24, 20, 14, .16);
  --text:       #1b1d22;
  --text-2:     #5f6570;
  --text-3:     #8d939e;
  --accent:     #a8742a;
  --accent-ink: #ffffff;
  --accent-dim:  rgba(168, 116, 42, .11);
  --accent-line: rgba(168, 116, 42, .3);
  --accent-wash: rgba(168, 116, 42, .14);
  --ok:          #2f8b5c;
  --ok-dim:      rgba(47, 139, 92, .11);
  --ok-line:     rgba(47, 139, 92, .3);
  --danger:      #c0503f;
  --danger-dim:  rgba(192, 80, 63, .09);
  --danger-line: rgba(192, 80, 63, .32);
  --cool:        #3d7d9c;
  --glass:       rgba(246, 244, 241, .9);
  --shadow: 0 1px 2px rgba(24,20,14,.06), 0 10px 28px -18px rgba(24,20,14,.35);
}

/* 2. Base --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent-dim); }

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

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); padding: 10px 14px; z-index: 100;
}
.skip:focus { left: 8px; top: 8px; }

.ic { flex: none; }

/* 3. Coque -------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.topbar-in {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 54px;
  padding: 8px var(--pad);
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
}

.tb-btn, .tb-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-2);
}
.tb-btn { background: var(--surface-2); border: 1px solid var(--line); }
.tb-btn:active { transform: scale(.94); }
.tb-mark { color: var(--accent); }

.tb-title { min-width: 0; }
.tb-title h1 {
  margin: 0;
  font-size: 17px; font-weight: 620;
  letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-title p {
  margin: 1px 0 0;
  font-size: 11.5px; color: var(--text-3);
  letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-act { display: flex; gap: 6px; align-items: center; }

.main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px var(--pad) calc(var(--tabh) + 34px + env(safe-area-inset-bottom));
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  height: var(--tabh);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-3);
  transition: color .15s;
}
.tab-ic { position: relative; display: grid; place-items: center; }
.tab-lb { font-size: 10px; letter-spacing: .02em; }
.tab.is-on { color: var(--accent); }
.tab:active { opacity: .6; }
.tab .dot {
  position: absolute; top: -2px; right: -3px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--ink);
}

.flash {
  margin-bottom: 14px; padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
}
.flash-ok    { border-color: var(--ok-line); color: var(--ok); }
.flash-err   { border-color: var(--danger-line); color: var(--danger); }

/* 4. Typographie -------------------------------------------- */
.eyebrow {
  font-size: 11px; font-weight: 620;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-3);
  margin: 26px 0 10px;
}
.eyebrow:first-child { margin-top: 0; }
.eyebrow .link { float: right; letter-spacing: .02em; text-transform: none; color: var(--accent); font-weight: 500; }

h2 { font-size: 17px; font-weight: 620; letter-spacing: -.02em; margin: 0 0 8px; }
h3 { font-size: 14.5px; font-weight: 600; margin: 0; }
p  { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

.muted   { color: var(--text-2); }
.dim     { color: var(--text-3); }
.small   { font-size: 12.5px; }
.tiny    { font-size: 11.5px; }
.center  { text-align: center; }
.num     { font-variant-numeric: tabular-nums; }
.strong  { font-weight: 620; }
.accent  { color: var(--accent); }

/* 5. Cartes & listes ---------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 12px; }
.card-pad { padding: 15px; }

.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}
.card-head .grow { flex: 1; min-width: 0; }
.card-head h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }

.list { display: block; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  color: inherit;
}
.list-item:last-child { border-bottom: 0; }
.list-item:active { background: var(--surface-2); }
.li-main { flex: 1; min-width: 0; }
.li-main strong { display: block; font-weight: 560; font-size: 14.5px; letter-spacing: -.01em; }
.li-main span { display: block; font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.li-right { text-align: right; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.li-chev { color: var(--text-3); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-dim); color: var(--accent);
  font-size: 13px; font-weight: 640; letter-spacing: .02em;
  border: 1px solid var(--accent-line);
}
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--surface-3); color: var(--text-2);
  border: 1px solid var(--line);
}
.badge.is-accent { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-line); }
.badge.is-ok     { background: var(--ok-dim); color: var(--ok); border-color: var(--ok-line); }
.badge.is-live   { background: var(--ok-dim); color: var(--ok); border-color: transparent; }

.empty {
  text-align: center;
  padding: 34px 20px;
  color: var(--text-3);
}
.empty .ic { color: var(--text-3); opacity: .5; margin-bottom: 10px; }
.empty p { font-size: 13.5px; }

.sep { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* 6. Boutons ------------------------------------------------ */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 16px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14.5px; font-weight: 560; letter-spacing: -.01em;
  cursor: pointer;
  transition: transform .08s, opacity .15s, background .15s;
  text-align: center;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  border-color: transparent; font-weight: 640;
}
.btn-quiet  { background: transparent; border-color: var(--line-2); color: var(--text-2); }
.btn-danger { background: transparent; border-color: var(--danger-line); color: var(--danger); }
.btn-block  { display: flex; width: 100%; }
.btn-sm     { height: 34px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg     { height: 52px; font-size: 16px; border-radius: 14px; }

.btn-icon {
  width: 34px; height: 34px; padding: 0;
  border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text-2);
  display: grid; place-items: center; cursor: pointer;
}
.btn-icon:active { transform: scale(.92); }
.btn-icon.is-accent { color: var(--accent); background: var(--accent-dim); border-color: transparent; }

.fab-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* segments */
.seg {
  display: flex; padding: 3px; gap: 3px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 11px;
}
.seg a, .seg button {
  flex: 1; text-align: center;
  padding: 7px 6px; border-radius: 8px;
  font-size: 12.5px; font-weight: 560; color: var(--text-2);
  background: none; border: 0; cursor: pointer;
  white-space: nowrap;
}
.seg .is-on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }

.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line);
  cursor: pointer;
}
.chip.is-on { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-line); }

/* 7. Formulaires -------------------------------------------- */
.field { display: block; margin-bottom: 13px; }
.field > .lab {
  display: block;
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 6px;
}
.field .hint { display: block; font-size: 12px; color: var(--text-3); margin-top: 5px; }

.input, select.input, textarea.input {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 46px;
  padding: 0 13px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  color: var(--text);
  font-size: 16px; /* évite le zoom iOS */
  transition: border-color .15s, background .15s;
}
textarea.input { height: auto; min-height: 88px; padding: 11px 13px; line-height: 1.5; resize: vertical; }
select.input {
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.input:focus { border-color: var(--accent); outline: none; background: var(--surface-3); }
.input::placeholder { color: var(--text-3); opacity: .8; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-2 .field { margin-bottom: 0; }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.check input {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; flex: none;
  border: 1.5px solid var(--line-2); border-radius: 6px;
  background: var(--surface-2); cursor: pointer;
  display: grid; place-items: center;
}
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after {
  content: ""; width: 10px; height: 6px;
  border: 2px solid var(--accent-ink); border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* 8. Statistiques ------------------------------------------- */
.hero {
  padding: 4px 2px 18px;
}
.hero .hello { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.hero h2 {
  font-size: 25px; font-weight: 660; letter-spacing: -.03em;
  margin: 5px 0 0; line-height: 1.15;
}

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.tile .t-lab {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3);
}
.tile .t-val {
  margin-top: 7px;
  font-size: 23px; font-weight: 660; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.tile .t-val small { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.tile .t-sub { margin-top: 3px; font-size: 11.5px; color: var(--text-3); }
.tile.is-accent .t-val { color: var(--accent); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--text-2); margin: 0; }
.kv dd { margin: 0; font-weight: 560; font-variant-numeric: tabular-nums; }

.bar-line { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.bar-line .bl-name { width: 88px; flex: none; font-size: 12.5px; color: var(--text-2); }
.bar-line .bl-track { flex: 1; height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar-line .bl-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.bar-line .bl-val { width: 52px; text-align: right; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 9. Séance ------------------------------------------------- */
.livebar {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px;
  border-radius: var(--r);
  background: linear-gradient(135deg, var(--accent-wash), var(--surface));
  border: 1px solid var(--accent-line);
  margin-bottom: 16px;
}
.livebar .lv-t { flex: 1; min-width: 0; }
.livebar strong { display: block; font-size: 15px; letter-spacing: -.015em; }
.livebar span { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.ex-card { margin-bottom: 12px; }
.ex-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px 11px;
}
.ex-head .grow { flex: 1; min-width: 0; }
.ex-head h3 { font-size: 15px; letter-spacing: -.015em; }
.ex-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.ex-prev { font-size: 11.5px; color: var(--text-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.ex-prev b { color: var(--text-2); font-weight: 560; }

.sets { padding: 0 10px 8px; }
.set-head {
  display: grid; grid-template-columns: 26px 1fr 1fr 42px;
  gap: 8px; align-items: center;
  padding: 2px 4px 6px;
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3);
}
.set-head span:nth-child(2), .set-head span:nth-child(3) { text-align: center; }

.setrow {
  display: grid; grid-template-columns: 26px 1fr 1fr 42px;
  gap: 8px; align-items: center;
  padding: 4px;
  border-radius: 11px;
  transition: background .2s;
}
.setrow + .setrow { margin-top: 2px; }
.setrow.is-done { background: var(--ok-dim); }
.setrow.is-warmup .s-no { color: var(--warn); }

.s-no {
  text-align: center;
  font-size: 12.5px; font-weight: 620; color: var(--text-3);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.s-in {
  height: 42px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.s-in input {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 100%;
  background: none; border: 0; text-align: center;
  font-size: 16px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}
.s-in input::-webkit-outer-spin-button, .s-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.s-in input[type=number] { -moz-appearance: textfield; }
.s-in input:focus { outline: none; }
.s-in input::placeholder { color: var(--text-3); font-weight: 500; opacity: .55; }
.s-in:focus-within { border-color: var(--accent); background: var(--surface-3); }
.s-in .u {
  position: absolute; right: 7px; bottom: 3px;
  font-size: 9.5px; color: var(--text-3); letter-spacing: .04em; pointer-events: none;
}

.s-ok {
  width: 42px; height: 42px; padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text-3);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .08s, background .15s, color .15s;
}
.s-ok:active { transform: scale(.9); }
.setrow.is-done .s-ok { background: var(--ok); border-color: transparent; color: #05130c; }

.set-actions {
  display: flex; gap: 8px; padding: 8px 14px 13px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.pr-flash {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); font-size: 11px; font-weight: 620;
  letter-spacing: .04em; text-transform: uppercase;
}

/* barre de repos */
.restbar {
  position: fixed; z-index: 46;
  left: 10px; right: 10px;
  bottom: calc(var(--tabh) + 10px + env(safe-area-inset-bottom));
  max-width: calc(var(--maxw) - 12px);
  margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.7);
}
.restbar[hidden] { display: none; }
.rest-body { flex: 1; min-width: 0; }
.rest-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.rest-head strong { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.rest-track { height: 4px; border-radius: 3px; background: var(--line-2); margin-top: 5px; overflow: hidden; }
.rest-fill { height: 100%; width: 100%; background: var(--accent); border-radius: 3px; transition: width 1s linear; }
.rest-x, .rest-more {
  flex: none; border: 0; background: none; color: var(--text-2);
  cursor: pointer; font-size: 12.5px; font-weight: 560;
  padding: 6px; border-radius: 8px;
}
.rest-more { background: var(--surface); border: 1px solid var(--line); padding: 7px 10px; }

/* 10. Graphiques -------------------------------------------- */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.c-bar   { fill: var(--accent); }
.c-bar.is-empty { fill: var(--line-2); }
.c-axis  { stroke: var(--line); stroke-width: 1; }
.c-line  { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.c-area  { fill: var(--accent); opacity: .1; }
.c-dot   { fill: var(--accent); }
.c-dot.is-last { stroke: var(--ink); stroke-width: 2; }
.c-lab   { fill: var(--text-3); font-size: 10px; font-family: var(--font); letter-spacing: .02em; }

.chart-wrap { padding: 14px 14px 6px; }
.chart-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); padding: 0 15px 13px; }

/* 11. Feuilles & toast -------------------------------------- */
.sheet-back {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .2s;
}
.sheet-back.is-open { opacity: 1; }
.sheet-back[hidden] { display: none; }

.sheet {
  position: fixed; z-index: 61;
  left: 0; right: 0; bottom: 0;
  max-width: var(--maxw); margin: 0 auto;
  max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -12px 40px -12px rgba(0,0,0,.6);
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.32, .72, 0, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.is-open { transform: translateY(0); }
.sheet[hidden] { display: none; }
.sheet-grip { width: 38px; height: 4px; border-radius: 3px; background: var(--line-2); margin: 9px auto 2px; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 8px 15px 12px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { flex: 1; font-size: 16px; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 15px 18px; }
.sheet-body.is-flush { padding: 0 0 12px; }

.toast {
  position: fixed; z-index: 80;
  left: 50%; transform: translate(-50%, 12px);
  bottom: calc(var(--tabh) + 20px + env(safe-area-inset-bottom));
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px -12px rgba(0,0,0,.8);
  font-size: 13px; font-weight: 560;
  opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 88vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast[hidden] { display: none; }
.toast.is-pr { color: var(--accent); border-color: var(--accent-line); }

/* 12. Écran de connexion ------------------------------------ */
body.p-login { background: var(--ink); }
body.p-login .main { padding-bottom: 40px; }

.auth {
  min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 380px; margin: 0 auto;
  padding: 32px 22px calc(32px + env(safe-area-inset-bottom));
}
.auth-mark {
  width: 52px; height: 52px; border-radius: 15px;
  display: grid; place-items: center;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid var(--accent-line);
  margin-bottom: 20px;
}
.auth h1 { font-size: 27px; font-weight: 660; letter-spacing: -.035em; margin: 0 0 6px; }
.auth .sub { color: var(--text-3); font-size: 14px; margin-bottom: 26px; }
.auth .field { margin-bottom: 12px; }
.auth .btn { margin-top: 8px; }
.auth .foot { margin-top: 22px; font-size: 12px; color: var(--text-3); text-align: center; }
.auth-err {
  padding: 11px 13px; border-radius: 11px; margin-bottom: 16px;
  background: var(--danger-dim);
  border: 1px solid var(--danger-line);
  color: var(--danger); font-size: 13.5px;
}

/* Écrans larges : on garde la colonne mais on aère */
@media (min-width: 720px) {
  :root { --pad: 22px; }
  .main { padding-top: 26px; }
  .tabbar { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
