/* Carnet d'Uma, feuille de style. Polices auto-hébergées (fichiers variables, sous-ensembles latin et latin étendu). */
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("/fonts/fraunces-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 66px;
  --ease: cubic-bezier(.2,.7,.2,1);
}
:root[data-theme="nuit"] {
  --bg: #16141c; --bg-2: #1c1923; --surface: #201d27; --surface-2: #27232f; --border: #302b3a; --border-2: #3c3648;
  --text: #f3ede4; --text-2: #a89f93; --text-3: #8f877b;
  --repas: #f0a07a; --repas-soft: rgba(240,160,122,.16);
  --sommeil: #9b93d9; --sommeil-soft: rgba(155,147,217,.18);
  --couche: #d9b44a; --couche-soft: rgba(217,180,74,.16);
  --croissance: #7fb39a; --croissance-soft: rgba(127,179,154,.16);
  --sante: #e07a73; --sante-soft: rgba(224,122,115,.16);
  --autre: #8f8a99;
  --halo: rgba(240,160,122,.10);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --on-accent: #1b1410;
}
:root[data-theme="jour"] {
  --bg: #faf6ef; --bg-2: #f4eee3; --surface: #ffffff; --surface-2: #f7f2ea; --border: #ebe4d8; --border-2: #ddd4c5;
  --text: #2a2530; --text-2: #6e6779; --text-3: #6f6879;
  --repas: #d97b52; --repas-soft: rgba(217,123,82,.13);
  --sommeil: #6c63c4; --sommeil-soft: rgba(108,99,196,.13);
  --couche: #b48f1e; --couche-soft: rgba(180,143,30,.13);
  --croissance: #4f8f6f; --croissance-soft: rgba(79,143,111,.13);
  --sante: #c9524a; --sante-soft: rgba(201,82,74,.13);
  --autre: #8a8394;
  --halo: rgba(217,123,82,.10);
  --shadow: 0 10px 30px rgba(60,40,20,.10);
  --on-accent: #2a2530;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
  font-variant-numeric: tabular-nums;
}
:root[data-theme="nuit"] body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--repas); outline-offset: 2px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 12px 14px; width: 100%; }
textarea { min-height: 88px; resize: vertical; }
label.field { display: block; font-size: 13px; color: var(--text-2); margin: 10px 0 6px; font-weight: 600; }
a { color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 24px; margin: 6px 0 12px; }
h3 { font-size: 18px; margin: 18px 0 8px; }
p { margin: 8px 0; }
small, .muted { color: var(--text-2); }
.tiny { font-size: 12px; color: var(--text-3); }
.svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------ gate ------------ */
#gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.gate-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: 30px 26px; box-shadow: var(--shadow); animation: rise .6s var(--ease) both; }
.gate-card h1 { font-size: 34px; }
.gate-card .sub { color: var(--text-2); margin: 6px 0 22px; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 18px; }
.who button { border: 1.5px solid var(--border-2); border-radius: var(--radius-sm); padding: 14px; font-weight: 600; background: var(--surface-2); transition: .2s; }
.who button[aria-pressed="true"] { border-color: var(--repas); background: var(--repas-soft); color: var(--text); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 18px; border-radius: 14px; font-weight: 700; background: var(--repas); color: var(--on-accent); transition: transform .15s var(--ease), filter .2s; }
.btn:hover { filter: brightness(1.06); } .btn:active { transform: scale(.98); }
.btn.w { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-2); }
.btn.sm { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 12px; }
.btn.danger { background: var(--sante); color: var(--on-accent); }

/* ------------ app shell ------------ */
#app { position: relative; z-index: 1; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.brand { font-family: var(--font-display); font-size: 20px; font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
.brand .age { font-family: var(--font-body); font-size: 12px; color: var(--text-2); font-weight: 600; }
.topbar .spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); font-size: 13px; font-weight: 600; min-height: 40px; transition: .2s; white-space: nowrap; }
.chip[aria-pressed="true"], .chip.on { background: var(--repas-soft); border-color: var(--repas); }
.chip.dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--repas); }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--border-2); background: var(--surface); }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
.tab { animation: fade .35s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card.soft { background: var(--surface-2); }
.card h3:first-child { margin-top: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.scrollx { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.scrollx::-webkit-scrollbar { display: none; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.tag.repas { background: var(--repas-soft); color: var(--repas); }
.tag.sommeil { background: var(--sommeil-soft); color: var(--sommeil); }
.tag.couche { background: var(--couche-soft); color: var(--couche); }
.tag.croissance { background: var(--croissance-soft); color: var(--croissance); }
.tag.sante { background: var(--sante-soft); color: var(--sante); }
.tag.ok { background: var(--croissance-soft); color: var(--croissance); }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.item .body { flex: 1; min-width: 0; }
.item .t { font-weight: 700; }
.item .d { font-size: 13px; color: var(--text-2); }
.item.done { opacity: .6; }
.check { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--border-2); display: grid; place-items: center; flex: none; background: var(--surface-2); }
.check.on { background: var(--croissance); border-color: var(--croissance); color: #fff; }
.check .svg { width: 22px; height: 22px; stroke-width: 3; }
.notice { font-size: 13px; color: var(--text-2); padding: 10px 12px; border-left: 3px solid var(--border-2); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.notice.sante { border-color: var(--sante); }
.notice.sommeil { border-color: var(--sommeil); }
details { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); margin: 8px 0; }
details summary { cursor: pointer; padding: 12px 14px; font-weight: 700; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details summary::-webkit-details-marker { display: none; }
details summary::after { content: "+"; color: var(--text-2); font-size: 18px; }
details[open] summary::after { content: "\2212"; }
details .in { padding: 0 14px 14px; color: var(--text-2); font-size: 14px; }
details .in ul { padding-left: 18px; margin: 6px 0; }

/* ------------ accueil ------------ */
.hero { position: relative; display: grid; place-items: center; padding: 6px 0 4px; }
.hero::before { content: ""; position: absolute; inset: -20px 0; background: radial-gradient(circle at 50% 45%, var(--halo), transparent 60%); pointer-events: none; }
.ringwrap { position: relative; width: min(340px, 88vw); }
.ring { width: 100%; height: auto; display: block; }
.ring .track { stroke: var(--border-2); }
.ring .sleep { stroke: var(--sommeil); stroke-width: 14; fill: none; stroke-linecap: round; }
.ring .feed { fill: var(--repas); }
.ring .feed.g { fill: var(--bg); stroke: var(--repas); stroke-width: 2.4; }
.ring .bib { fill: var(--repas); opacity: .75; }
.ring .diaper { fill: var(--couche); }
.ring .hour { fill: var(--text-3); font-size: 11px; font-weight: 700; font-family: var(--font-body); }
.ring .now { fill: var(--text); }
.ring .feedarc { fill: none; stroke: var(--repas); stroke-width: 16; }
.ring .feedTxt { fill: #1b1410; font-size: 10px; font-weight: 800; font-family: var(--font-body); }
.ring .today { fill: var(--halo); }
.ring .tick { stroke: var(--border-2); stroke-width: 1; }
.ring .selles { fill: none; stroke: var(--couche); stroke-width: 2; }
.ring .dayTxt { fill: var(--text-3); font-size: 9px; font-weight: 700; font-family: var(--font-body); letter-spacing: .04em; text-transform: uppercase; }
.ring .nowline { stroke: var(--text); stroke-width: 1.5; }
.ring.draw .feedarc { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw 1.2s var(--ease) forwards; }
.ring.draw .sleep { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw 1.2s var(--ease) forwards; }
.ring.draw .pt { opacity: 0; animation: pop .5s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { to { opacity: 1; } }
.center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.center > button { pointer-events: auto; display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; width: 58%; aspect-ratio: 1; border-radius: 50%; padding: 0 8px; transition: transform .2s var(--ease); }
.center > button:active { transform: scale(.97); }
.center .big { font-family: var(--font-display); font-size: 36px; font-weight: 500; line-height: 1; letter-spacing: -.02em; }
.center .lbl { font-size: 12px; color: var(--text-2); font-weight: 600; line-height: 1.25; }
.center .next { margin-top: 6px; }
.center.live .big { animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.legend { display: flex; justify-content: center; gap: 14px; font-size: 12px; color: var(--text-2); margin: 2px 0 10px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0; }
.action { min-height: 72px; border-radius: 20px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); text-align: left; transition: transform .15s var(--ease), background .2s, border-color .2s; }
.action:active { transform: scale(.97); }
.action .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.action .tt { font-weight: 700; font-size: 15px; white-space: nowrap; }
.action .ss { font-size: 11px; color: var(--text-2); line-height: 1.25; }
.action.repas .ic { background: var(--repas-soft); color: var(--repas); }
.action.couche .ic { background: var(--couche-soft); color: var(--couche); }
.action.sommeil .ic { background: var(--sommeil-soft); color: var(--sommeil); }
.action.autre .ic { background: var(--surface-2); color: var(--text-2); }
.action.flash { animation: flash .7s var(--ease); }
@keyframes flash { 0% { background: var(--repas-soft); border-color: var(--repas); } 100% { background: var(--surface); } }
.action.on { border-color: var(--sommeil); background: var(--sommeil-soft); }
.strip { margin: -2px 0 10px; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); animation: fade .25s var(--ease); }
.strip .title { font-weight: 700; font-size: 14px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { min-height: 44px; padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-2); font-weight: 700; transition: .15s; }
.pill.on { background: var(--repas-soft); border-color: var(--repas); }
.pill.big { min-height: 56px; flex: 1; font-size: 17px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-2); font-weight: 800; font-size: 18px; }
.stepper .v { min-width: 70px; text-align: center; font-family: var(--font-display); font-size: 24px; }
.counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.counter { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 8px; text-align: center; }
.counter .n { font-family: var(--font-display); font-size: 22px; line-height: 1.1; white-space: nowrap; }
.counter .l { font-size: 11px; color: var(--text-2); font-weight: 600; }
.lastline { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--border-2); font-size: 14px; flex-wrap: wrap; }
.lastline .edit { margin-left: auto; color: var(--repas); font-weight: 700; padding: 10px 6px; }
.vitd { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.vitd.on { border-color: var(--croissance); background: var(--croissance-soft); }
.smallgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; color: var(--text-2); margin: 10px 0; }
.smallgrid div { padding: 8px 10px; background: var(--surface-2); border-radius: 10px; }
.smallgrid b { color: var(--text); }
.remind { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--repas-soft); border: 1px solid var(--repas); font-size: 14px; }

/* ------------ journee ------------ */
.dayhead { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.dayhead .dn { font-family: var(--font-display); font-size: 22px; }
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl .ev { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; margin: 6px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; flex-wrap: wrap; }
.tl .ev::before { content: ""; position: absolute; left: -22px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px var(--bg); }
.tl .ev .h { font-weight: 800; min-width: 52px; }
.tl .ev .w { flex: 1; min-width: 120px; }
.tl .ev .w .n { font-weight: 700; }
.tl .ev .w .s { font-size: 13px; color: var(--text-2); }
.tl .ev.sommeil { background: var(--sommeil-soft); border-color: transparent; }
.tl .ev .by { font-size: 11px; color: var(--text-3); }
.tl .ev .tools { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; padding-top: 8px; }
.dup { font-size: 12px; color: var(--sante); font-weight: 700; }

/* ------------ sante ------------ */
.subnav { position: sticky; top: calc(56px + max(12px, env(safe-area-inset-top))); z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); padding: 8px 0; margin: -8px -16px 8px; padding-left: 16px; }
.emerg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.emerg a { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; }
.emerg a b { font-family: var(--font-display); font-size: 18px; letter-spacing: -.01em; }
.emerg a span { font-size: 12px; color: var(--text-2); }
.emerg a.big { grid-column: 1 / -1; background: var(--sante); color: var(--on-accent); border-color: transparent; flex-direction: row; align-items: center; justify-content: center; gap: 10px; min-height: 60px; font-weight: 800; font-size: 18px; }
.contact { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.contact .role { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; }
.contact .name { font-weight: 700; }
.contact .name.todo { color: var(--text-3); font-weight: 500; font-style: italic; }
.contact a.call { margin-left: auto; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--croissance-soft); color: var(--croissance); }
.chart { width: 100%; height: auto; display: block; }
.chart .band97 { fill: var(--croissance); opacity: .10; }
.chart .band85 { fill: var(--croissance); opacity: .14; }
.chart .p50 { stroke: var(--croissance); stroke-width: 1.6; fill: none; opacity: .8; }
.chart .pl { stroke: var(--croissance); stroke-width: .8; fill: none; opacity: .5; stroke-dasharray: 3 3; }
.chart .uma { stroke: var(--repas); stroke-width: 2.4; fill: none; }
.chart .pt { fill: var(--repas); stroke: var(--surface); stroke-width: 2; }
.chart .pt.home { fill: var(--surface); stroke: var(--repas); }
.chart .ax { stroke: var(--border-2); stroke-width: 1; fill: none; }
.chart text { font-family: var(--font-body); font-size: 10px; fill: var(--text-3); font-weight: 600; }
.chart .plabel { fill: var(--croissance); font-size: 9px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { padding: 10px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.kpi .n { font-family: var(--font-display); font-size: 19px; overflow-wrap: anywhere; }
.kpi .l { font-size: 11px; color: var(--text-2); font-weight: 600; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
table.tbl th { color: var(--text-2); font-weight: 700; font-size: 12px; }
.temp { font-family: var(--font-display); font-size: 22px; }
.temp.hi { color: var(--sante); }
.alertgrp h3 { display: flex; align-items: center; gap: 8px; }
.alertgrp ul { padding-left: 18px; margin: 4px 0 12px; color: var(--text-2); font-size: 14px; }
.alertgrp li { margin: 4px 0; }
.foot { font-size: 12px; color: var(--text-3); text-align: center; padding: 18px 0 4px; }

/* ------------ plus ------------ */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle:last-child { border-bottom: 0; }
.sw { width: 46px; height: 28px; border-radius: 999px; background: var(--border-2); position: relative; transition: .2s; flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s var(--ease); }
.sw.on { background: var(--croissance); } .sw.on::after { left: 21px; }
.device { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; flex-wrap: wrap; }
.device:last-child { border-bottom: 0; }

/* ------------ tabbar ------------ */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--text-3); transition: color .2s; }
.tabbar button[aria-current="page"] { color: var(--text); }
.tabbar button[aria-current="page"] .svg { color: var(--repas); }
.rail { display: none; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 40; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; display: flex; gap: 14px; align-items: center; opacity: 0; pointer-events: none; transition: .25s var(--ease); box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: var(--repas); font-weight: 800; }
:root[data-theme="jour"] .toast button { color: #ffd0b8; }
:root[data-theme="nuit"] .toast button { color: #9a4a22; }
:root[data-theme="jour"] .tag.repas { color: #a6532f; } :root[data-theme="jour"] .tag.couche { color: #7d6210; } :root[data-theme="jour"] .tag.croissance, :root[data-theme="jour"] .tag.ok { color: #3f7a5c; } :root[data-theme="jour"] .tag.sante { color: #a83f38; } :root[data-theme="jour"] .tag.sommeil { color: #574fa8; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .rail { display: flex; flex-direction: column; gap: 6px; position: fixed; left: 24px; top: 92px; width: 180px; }
  .rail button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-weight: 700; color: var(--text-2); }
  .rail button[aria-current="page"] { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
  .rail button[aria-current="page"] .svg { color: var(--repas); }
  main { padding-bottom: 40px; margin-left: 240px; max-width: 760px; }
  .subnav { top: 65px; }
  .actions { grid-template-columns: repeat(3, 1fr); }
  .ringwrap { width: 360px; }
  .toast { bottom: 24px; }
}
@media (max-width: 430px) { .counters { grid-template-columns: repeat(2, 1fr); } }

/* ------------ ajouts de l'application réelle ------------ */
.gate-card .err { color: var(--sante); font-size: 14px; font-weight: 600; margin: 8px 0 0; min-height: 20px; }
.gate-card .who { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.gate-card .spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border-2); border-top-color: var(--repas); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand { white-space: nowrap; }
.topbar .chip { padding: 6px 10px; }
.chip.warn { border-color: var(--couche); background: var(--couche-soft); color: var(--text); }
.chip.warn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--couche); }
.chip.off { border-color: var(--sante); background: var(--sante-soft); }
.chip.off::before { background: var(--sante); }
.bandeau { position: sticky; top: calc(56px + max(12px, env(safe-area-inset-top))); z-index: 19; margin: 0 auto; max-width: 720px; padding: 10px 16px; background: var(--couche-soft); border-bottom: 1px solid var(--couche); font-size: 14px; font-weight: 600; display: flex; gap: 10px; align-items: center; animation: fade .25s var(--ease); }
.bandeau button { margin-left: auto; color: var(--text-2); font-weight: 700; padding: 6px 8px; }
.guide { border-color: var(--repas); }
.guide ol { padding-left: 18px; margin: 6px 0; color: var(--text-2); font-size: 14px; }
.guide li { margin: 4px 0; }
.item .del { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-3); flex: none; }
.item .del:hover { color: var(--sante); }
table.tbl td .del { width: 32px; height: 32px; }
.confirm { border-color: var(--sante); }
.confirm input { letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.device .when { color: var(--text-2); font-size: 13px; }
.device .chip { margin-left: auto; }
.statut { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.statut.fait { background: var(--croissance-soft); color: var(--croissance); }
.statut.refaire { background: var(--sante-soft); color: var(--sante); }
.toggle .pills { justify-content: flex-end; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .ring.draw .pt { opacity: 1 !important; } .ring.draw .sleep, .ring.draw .feedarc { stroke-dashoffset: 0 !important; } }
