/* ===================== Jetons ===================== */
:root {
  color-scheme: light;
  --bg: #fbf7f3; --surface: #ffffff; --surface-2: #f5efe9; --surface-3: #ede5dd; --line: #ebe2d9;
  --text: #2a2330; --text-2: #675d6e; --text-3: #978c9d;
  --primary: #6250d6; --primary-ink: #ffffff; --primary-soft: #ebe8fb;
  --feed: #eb6834; --feed-soft: #fdeae1; --feed-ink: #b9461a;
  --pee: #2a78d6; --pee-soft: #e2edfb; --pee-ink: #1f5fae;
  --poo: #a0643a; --poo-soft: #f3e8de; --poo-ink: #7d4b28;
  --sleep: #6250d6; --sleep-soft: #ebe8fb; --sleep-ink: #4a3ab8;
  --care: #1baf7a; --care-soft: #ddf4ea; --care-ink: #10825a;
  --health: #e34948; --health-soft: #fbe3e3; --health-ink: #b72f2e;
  --growth: #008300; --growth-soft: #dff1df; --growth-ink: #006b00;
  --note: #8a7f95; --note-soft: #efebf2; --note-ink: #625870;
  --warn: #b86e00; --warn-soft: #fff0d6; --ok: #11845a; --ok-soft: #ddf4ea; --danger: #d23c3c;
  --chart-grid: #eee7e0; --chart-axis: #978c9d;
  --radius: 22px; --radius-sm: 14px; --radius-xs: 10px;
  --shadow: 0 1px 2px rgba(42, 35, 48, .04), 0 6px 20px rgba(42, 35, 48, .06);
  --shadow-lg: 0 -8px 40px rgba(42, 35, 48, .18);
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="night"]) {
    color-scheme: dark;
    --bg: #131118; --surface: #1f1c26; --surface-2: #28242f; --surface-3: #332e3b; --line: #2f2a37;
    --text: #efebf3; --text-2: #b9b0c1; --text-3: #857c8e;
    --primary: #9085e9; --primary-ink: #14111a; --primary-soft: #2c2745;
    --feed: #d95926; --feed-soft: #3a2420; --feed-ink: #f39a73;
    --pee: #3987e5; --pee-soft: #1e2a3d; --pee-ink: #8bb9f0;
    --poo: #c08050; --poo-soft: #33271f; --poo-ink: #dcae8a;
    --sleep: #9085e9; --sleep-soft: #2c2745; --sleep-ink: #bdb5f4;
    --care: #199e70; --care-soft: #17302a; --care-ink: #6fd3ae;
    --health: #e66767; --health-soft: #3a2025; --health-ink: #f29c9c;
    --growth: #0ca30c; --growth-soft: #1a2f1c; --growth-ink: #79d679;
    --note: #a198ab; --note-soft: #2a2630; --note-ink: #c9c1d1;
    --warn: #f0a83a; --warn-soft: #3a2c16; --ok: #4fd19c; --ok-soft: #17302a; --danger: #f07070;
    --chart-grid: #2c2834; --chart-axis: #857c8e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 -8px 40px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131118; --surface: #1f1c26; --surface-2: #28242f; --surface-3: #332e3b; --line: #2f2a37;
  --text: #efebf3; --text-2: #b9b0c1; --text-3: #857c8e;
  --primary: #9085e9; --primary-ink: #14111a; --primary-soft: #2c2745;
  --feed: #d95926; --feed-soft: #3a2420; --feed-ink: #f39a73;
  --pee: #3987e5; --pee-soft: #1e2a3d; --pee-ink: #8bb9f0;
  --poo: #c08050; --poo-soft: #33271f; --poo-ink: #dcae8a;
  --sleep: #9085e9; --sleep-soft: #2c2745; --sleep-ink: #bdb5f4;
  --care: #199e70; --care-soft: #17302a; --care-ink: #6fd3ae;
  --health: #e66767; --health-soft: #3a2025; --health-ink: #f29c9c;
  --growth: #0ca30c; --growth-soft: #1a2f1c; --growth-ink: #79d679;
  --note: #a198ab; --note-soft: #2a2630; --note-ink: #c9c1d1;
  --warn: #f0a83a; --warn-soft: #3a2c16; --ok: #4fd19c; --ok-soft: #17302a; --danger: #f07070;
  --chart-grid: #2c2834; --chart-axis: #857c8e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 -8px 40px rgba(0, 0, 0, .5);
}
/* Mode nuit : tout en rouge très sombre pour ne pas éblouir pendant les tétées de 3 h */
:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #070505; --surface: #120b0a; --surface-2: #1a100e; --surface-3: #231512; --line: #2a1714;
  --text: #d9725c; --text-2: #a65443; --text-3: #7a3e33;
  --primary: #c4563f; --primary-ink: #070505; --primary-soft: #2a1512;
  --feed: #c4563f; --feed-soft: #24120f; --feed-ink: #d9725c;
  --pee: #b8503b; --pee-soft: #24120f; --pee-ink: #d9725c;
  --poo: #9a4433; --poo-soft: #24120f; --poo-ink: #d9725c;
  --sleep: #c4563f; --sleep-soft: #24120f; --sleep-ink: #d9725c;
  --care: #b8503b; --care-soft: #24120f; --care-ink: #d9725c;
  --health: #d9725c; --health-soft: #2a1512; --health-ink: #e08a73;
  --growth: #b8503b; --growth-soft: #24120f; --growth-ink: #d9725c;
  --note: #a65443; --note-soft: #24120f; --note-ink: #d9725c;
  --warn: #e08a73; --warn-soft: #2a1512; --ok: #c4563f; --ok-soft: #24120f; --danger: #e08a73;
  --chart-grid: #24120f; --chart-axis: #7a3e33;
  --shadow: none; --shadow-lg: 0 -8px 40px rgba(0, 0, 0, .8);
}
:root[data-theme="night"] .emoji { filter: grayscale(1) sepia(1) saturate(3) hue-rotate(-30deg) brightness(.6); }

/* ===================== Base ===================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
/* Pas de zoom au double-tap (taps rapides sur −/+) ni de sélection de texte sur les boutons */
button, a, label, .qa, .stepper { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.4; min-height: 100dvh; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.row-flex { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.tabular { font-variant-numeric: tabular-nums; }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot img { width: 72px; height: 72px; border-radius: 20px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .6; } }

/* ===================== Mise en page ===================== */
.shell { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 0 14px; }
.baby-switch { display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 4px; margin: -4px; border-radius: 16px; text-align: left; min-width: 0; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: var(--primary-soft); flex: none; }
.avatar.sm { width: 34px; height: 34px; font-size: 15px; font-weight: 700; color: var(--primary); }
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: -.01em; }
.topbar .sub { color: var(--text-2); font-size: 14px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; margin-left: 4px; vertical-align: middle; }
.live-dot.off { background: var(--text-3); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; font-size: 20px; flex: none; }

h2.section { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin: 26px 4px 10px; font-weight: 700; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 12px; }
.card h3 { margin: 0 0 4px; font-size: 17px; }

/* ===================== Barre d'onglets ===================== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tabbar-h); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--text-3); font-size: 11px; font-weight: 600; }
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a[aria-current="page"] { color: var(--primary); }

/* ===================== Accueil ===================== */
.hero { position: relative; overflow: hidden; }
.hero .label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--feed-ink); }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 6px 0 2px; }
.hero .detail { color: var(--text-2); }
.progress { height: 10px; border-radius: 99px; background: var(--surface-2); margin: 16px 0 8px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 99px; background: var(--feed); transition: width .6s ease; width: 0; }
.progress.late > div { background: var(--warn); }
.next-line { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-2); }
.next-line strong { color: var(--text); }
.late-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 99px; }

.timer-card { display: flex; align-items: center; gap: 14px; background: var(--sleep-soft); border-radius: var(--radius); padding: 14px 14px 14px 16px; margin-bottom: 12px; }
.timer-card.breast, .timer-card.pump { background: var(--feed-soft); }
.timer-card .clock { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.timer-card .what { font-size: 14px; color: var(--text-2); }
.timer-card .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--sleep); animation: blink 1.6s infinite; display: inline-block; margin-right: 6px; }
.timer-card.breast .pulse, .timer-card.pump .pulse { background: var(--feed); }
@keyframes blink { 50% { opacity: .25; } }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.tile { background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 14px; min-width: 0; border: 0; text-align: left; }
.tile .t-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.tile .t-value { font-size: 20px; font-weight: 800; margin-top: 6px; letter-spacing: -.01em; }
.tile .t-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.tile.warn .t-value { color: var(--warn); }
.tile.ok .t-value { color: var(--ok); }

.today { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; }
.today .v { font-size: 20px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.today .k { font-size: 12px; color: var(--text-2); }
.today .u { font-size: 12px; font-weight: 600; color: var(--text-2); }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qa {
  border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius-sm);
  padding: 14px 4px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text); transition: transform .12s ease;
}
.qa:active { transform: scale(.94); }
.qa .ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; }
.qa.lg { grid-column: span 2; flex-direction: row; justify-content: flex-start; padding: 12px 14px; gap: 12px; font-size: 16px; text-align: left; }
.qa.lg .ic { width: 52px; height: 52px; }
.qa.lg small { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); }

.c-feed .ic, .ic.c-feed { background: var(--feed-soft); }
.c-diaper .ic, .ic.c-diaper { background: var(--pee-soft); }
.c-sleep .ic, .ic.c-sleep { background: var(--sleep-soft); }
.c-care .ic, .ic.c-care { background: var(--care-soft); }
.c-health .ic, .ic.c-health { background: var(--health-soft); }
.c-growth .ic, .ic.c-growth { background: var(--growth-soft); }
.c-note .ic, .ic.c-note { background: var(--note-soft); }

/* ===================== Journal ===================== */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 8px; margin: 0 -16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 4px 8px; gap: 8px; }
.day-head h3 { margin: 0; font-size: 17px; }
.day-head .sum { font-size: 13px; color: var(--text-2); text-align: right; }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ev {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%;
  border: 0; background: none; text-align: left; border-top: 1px solid var(--line);
}
.ev:first-child { border-top: 0; }
.ev:active { background: var(--surface-2); }
.ev .ic { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 21px; flex: none; }
.ev .time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; width: 46px; flex: none; }
.ev .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .detail { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .by { font-size: 12px; color: var(--text-3); flex: none; text-align: right; }
.ev .running { color: var(--sleep-ink); font-weight: 700; }
.ev .fever { color: var(--health-ink); font-weight: 700; }
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty .e-ic { font-size: 44px; margin-bottom: 8px; }

/* ===================== Formulaires & contrôles ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px;
  padding: 0 22px; border-radius: 16px; border: 0; font-weight: 700; font-size: 16px;
  background: var(--surface-2); color: var(--text); text-decoration: none; transition: transform .1s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.feed { background: var(--feed); color: #fff; }
.btn.sleep { background: var(--sleep); color: var(--primary-ink); }
.btn.danger { background: none; color: var(--danger); }
.btn.ghost { background: none; color: var(--primary); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row > .btn { flex: 1; }

.field { display: block; margin-top: 16px; }
.field > .lbl { display: block; font-size: 13px; font-weight: 700; color: var(--text-2); margin: 0 2px 8px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; border-radius: var(--radius-xs); border: 1.5px solid var(--line);
  background: var(--surface-2); padding: 12px 14px; font-size: 16px; outline: none; appearance: none;
}
.input:focus { border-color: var(--primary); background: var(--surface); }
textarea.input { min-height: 84px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.two .field { margin-top: 0; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; flex: 1 1 auto; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 14px;
  border-radius: 12px; background: var(--surface-2); font-weight: 650; font-size: 15px; white-space: nowrap;
  border: 1.5px solid transparent; transition: background .15s, border-color .15s;
}
.seg input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }
.seg input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.seg.big span { min-height: 72px; flex-direction: column; font-size: 15px; gap: 2px; border-radius: 16px; }
.seg.big span .emoji { font-size: 28px; }
.seg.chips label { flex: 0 0 auto; }
.seg.chips span { min-height: 38px; font-size: 14px; border-radius: 99px; padding: 0 14px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, .15); }
.sw-jaune { background: #f2c94c; } .sw-moutarde { background: #c9a227; } .sw-vert { background: #6a9a3a; }
.sw-marron { background: #8a5a35; } .sw-noir { background: #222; } .sw-rouge { background: #c0392b; } .sw-blanc { background: #f4f1ea; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 60px; height: 60px; border-radius: 18px; border: 0; background: var(--surface-2); font-size: 22px; font-weight: 700; flex: none; }
.stepper .val { flex: 1; text-align: center; }
.stepper input { width: 100%; text-align: center; font-size: 44px; font-weight: 800; border: 0; background: none; outline: none; letter-spacing: -.02em; font-variant-numeric: tabular-nums; padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.stepper .unit { font-size: 14px; color: var(--text-2); font-weight: 600; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; justify-content: center; }
.presets button { border: 0; background: var(--surface-2); border-radius: 99px; padding: 8px 14px; font-weight: 650; font-size: 14px; }

.when { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.when .input { flex: 1 1 200px; }
.when .ago { border: 0; background: var(--surface-2); border-radius: 99px; padding: 8px 12px; font-size: 13px; font-weight: 650; }
.alert { border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-top: 14px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.danger { background: var(--health-soft); color: var(--health-ink); }
.alert.info { background: var(--primary-soft); color: var(--text); }
.err { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 1em; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.switch input { appearance: none; width: 52px; height: 32px; border-radius: 99px; background: var(--surface-3); position: relative; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(20px); }

/* ===================== Feuille modale ===================== */
.backdrop { position: fixed; inset: 0; background: rgba(20, 16, 26, .45); z-index: 40; animation: fade .2s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 28px 28px 0 0; box-shadow: var(--shadow-lg);
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px); max-width: 560px; margin: 0 auto;
  animation: up .28s cubic-bezier(.2, .9, .3, 1);
}
.sheet .grip { width: 40px; height: 5px; border-radius: 99px; background: var(--surface-3); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.sheet-head .ic { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; }
.sheet-head h2 { margin: 0; font-size: 21px; flex: 1; }
.sheet-head .close { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 18px; }
.sheet .meta { font-size: 12px; color: var(--text-3); margin-top: 14px; text-align: center; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 600px) { .sheet { bottom: 24px; border-radius: 28px; } }

/* ===================== Toast ===================== */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 16px; font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: up .25s ease; max-width: 100%; }
.toast button { border: 0; background: none; color: var(--primary-soft); font-weight: 800; padding: 0; }
:root[data-theme="night"] .toast { background: var(--surface-3); color: var(--text); }

/* ===================== Statistiques ===================== */
.period { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.period button { flex: 1; border: 0; background: none; border-radius: 10px; padding: 9px 0; font-weight: 700; font-size: 14px; color: var(--text-2); }
.period button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.kpi { background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 14px; }
.kpi .k { font-size: 13px; color: var(--text-2); }
.kpi .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 14px; font-weight: 600; color: var(--text-2); margin-left: 2px; }
.chart-card { margin-top: 12px; }
.chart-card .ch-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chart-card .ch-title h3 { margin: 0; font-size: 16px; }
.chart-card .ch-title .ch-sub { font-size: 13px; color: var(--text-2); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--text-2); margin-top: 6px; flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.chart { width: 100%; height: auto; display: block; margin-top: 10px; overflow: visible; touch-action: pan-y; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--chart-axis); }
.chart .val { fill: var(--text-2); font-weight: 700; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .avg { stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .hit { fill: transparent; }
.chart .hit:hover + .mark, .chart .mark.on { opacity: .75; }
.f-feed { fill: var(--feed); } .f-pee { fill: var(--pee); } .f-poo { fill: var(--poo); } .f-sleep { fill: var(--sleep); } .f-growth { fill: var(--growth); }
.s-growth { stroke: var(--growth); fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.bg-feed { background: var(--feed); } .bg-pee { background: var(--pee); } .bg-poo { background: var(--poo); } .bg-sleep { background: var(--sleep); }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600; padding: 7px 10px; border-radius: 10px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
:root[data-theme="night"] .tip { background: var(--surface-3); color: var(--text); }
details.table-view { margin-top: 10px; font-size: 13px; color: var(--text-2); }
details.table-view summary { cursor: pointer; font-weight: 600; }
details.table-view table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
details.table-view td, details.table-view th { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; }
details.table-view td:first-child, details.table-view th:first-child { text-align: left; }

/* ===================== Réglages ===================== */
.menu { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu > .item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; text-decoration: none; color: inherit; min-height: 58px; }
.menu > .item:first-child { border-top: 0; }
.menu .item .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 18px; background: var(--surface-2); flex: none; }
.menu .item .chev { color: var(--text-3); font-size: 20px; }
.menu .item .val { color: var(--text-2); font-size: 14px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.pill.admin { background: var(--primary-soft); color: var(--sleep-ink); }
.pill.viewer { background: var(--note-soft); color: var(--note-ink); }
.linkbox { display: flex; gap: 8px; margin-top: 12px; }
.linkbox input { font-size: 13px; }
.audit { font-size: 13px; }
.audit .a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.audit .a:first-child { border-top: 0; }

/* ===================== Connexion ===================== */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px calc(env(safe-area-inset-bottom) + 32px); max-width: 440px; margin: 0 auto; }
.auth .logo { width: 88px; height: 88px; border-radius: 26px; box-shadow: var(--shadow); margin: 0 auto 20px; display: block; }
.auth h1 { text-align: center; font-size: 30px; margin: 0; letter-spacing: -.02em; }
.auth .tag { text-align: center; color: var(--text-2); margin: 8px 0 32px; }
.auth .card { padding: 22px; }
.auth .why { display: flex; gap: 12px; margin-top: 18px; font-size: 14px; color: var(--text-2); align-items: flex-start; }
.auth .why .emoji { font-size: 22px; }
.fade-in { animation: fade .25s ease; }

fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.danger-text { color: var(--danger); }
button.card { border: 0; width: 100%; text-align: left; display: block; color: inherit; font: inherit; }
.timer-card .ic { font-size: 30px; }
.chart .track { fill: var(--surface-2); }
.filters.seg { flex-wrap: nowrap; }
.chart-card .ch-title { flex-wrap: wrap; }
.chart-card .ch-title h3 { white-space: nowrap; }
