/* ============ Mon Suivi Endo : styles ============ */

/* ---------- Thèmes ---------- */
:root, [data-theme="rose"] {
  --bg: #fbf4f6; --surface: #ffffff; --surface-2: #f6e9ee; --border: #ecd9e0;
  --text: #3a2530; --text-2: #6b5560; --muted: #8e7782;
  --accent: #b54a73; --accent-strong: #963a5e; --accent-soft: #f9e1ea; --on-accent: #ffffff;
  --period: #d1495b; --period-soft: #f8d3d9; --ovulation: #6d5fc7; --fertile-soft: #ebe7fb;
  --chart: #b54a73; --chart-band: rgba(209, 73, 91, .12);
  --shadow: 0 1px 2px rgba(80, 30, 50, .05), 0 4px 16px rgba(80, 30, 50, .05);
  --danger: #b3261e; --warn-bg: #fff4e0; --warn-ink: #6b4500;
  color-scheme: light;
}
[data-theme="lavande"] {
  --bg: #f6f4fb; --surface: #ffffff; --surface-2: #eeeaf8; --border: #e0daf0;
  --text: #2c2640; --text-2: #5a5370; --muted: #7d7694;
  --accent: #6d55c4; --accent-strong: #5640a8; --accent-soft: #e9e3fa; --on-accent: #ffffff;
  --period: #c8487a; --period-soft: #f6d6e3; --ovulation: #2f8f9d; --fertile-soft: #dcf1f3;
  --chart: #6d55c4; --chart-band: rgba(200, 72, 122, .12);
}
[data-theme="jaune"] {
  --bg: #fdf9ee; --surface: #fffdf7; --surface-2: #f8f0d8; --border: #efe3bf;
  --text: #3a3020; --text-2: #66583d; --muted: #857756;
  --accent: #9a6a00; --accent-strong: #7d5600; --accent-soft: #fbedc4; --on-accent: #ffffff;
  --period: #c84a4a; --period-soft: #f7d9d2; --ovulation: #4a7fc1; --fertile-soft: #e0ebf7;
  --chart: #9a6a00; --chart-band: rgba(200, 74, 74, .12);
}
[data-theme="sauge"] {
  --bg: #f3f6f2; --surface: #ffffff; --surface-2: #e8efe6; --border: #d8e3d5;
  --text: #23302a; --text-2: #4e5e55; --muted: #718177;
  --accent: #3f7a5c; --accent-strong: #2f6248; --accent-soft: #dcebe1; --on-accent: #ffffff;
  --period: #c4515e; --period-soft: #f5d8dc; --ovulation: #7a63c4; --fertile-soft: #e9e4f7;
  --chart: #3f7a5c; --chart-band: rgba(196, 81, 94, .12);
}
[data-theme="ocean"] {
  --bg: #f2f6fa; --surface: #ffffff; --surface-2: #e6eef6; --border: #d4e1ee;
  --text: #1e2a38; --text-2: #4b5a6b; --muted: #6f7e90;
  --accent: #2f6db3; --accent-strong: #245892; --accent-soft: #dde9f7; --on-accent: #ffffff;
  --period: #cf4f6a; --period-soft: #f7d7de; --ovulation: #2c9a8a; --fertile-soft: #d9f1ed;
  --chart: #2f6db3; --chart-band: rgba(207, 79, 106, .12);
}
[data-theme="peche"] {
  --bg: #fdf5f0; --surface: #ffffff; --surface-2: #fae9df; --border: #f1d8ca;
  --text: #3b2820; --text-2: #6b5247; --muted: #8d7266;
  --accent: #c0533a; --accent-strong: #9e412b; --accent-soft: #fde2d8; --on-accent: #ffffff;
  --period: #c43d5a; --period-soft: #f8d5dc; --ovulation: #5b74c9; --fertile-soft: #e3e8f8;
  --chart: #c0533a; --chart-band: rgba(196, 61, 90, .12);
}
[data-theme="nuit"] {
  --bg: #1a1420; --surface: #241c2b; --surface-2: #2f2537; --border: #3d3146;
  --text: #f3e9f1; --text-2: #cbbcc8; --muted: #a091a0;
  --accent: #e58fb0; --accent-strong: #f2a9c4; --accent-soft: #3d2534; --on-accent: #2a1020;
  --period: #ef6f86; --period-soft: #4a2632; --ovulation: #a99bf0; --fertile-soft: #2c2846;
  --chart: #e58fb0; --chart-band: rgba(239, 111, 134, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --danger: #ff8a80; --warn-bg: #3a2c14; --warn-ink: #f6d58e;
  color-scheme: dark;
}
[data-theme="minuit"] {
  --bg: #0f1724; --surface: #172234; --surface-2: #1f2d42; --border: #2b3b54;
  --text: #e8eef7; --text-2: #b8c4d6; --muted: #8b9bb2;
  --accent: #7fb2f0; --accent-strong: #a3c8f5; --accent-soft: #1d3250; --on-accent: #0c1a2e;
  --period: #f07a8f; --period-soft: #44263a; --ovulation: #6fd3c1; --fertile-soft: #173a3c;
  --chart: #7fb2f0; --chart-band: rgba(240, 122, 143, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35); --danger: #ff8a80; --warn-bg: #33290f; --warn-ink: #f6d58e;
  color-scheme: dark;
}
[data-theme="contraste"] {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #f0f0f0; --border: #000000;
  --text: #000000; --text-2: #1a1a1a; --muted: #333333;
  --accent: #8a0040; --accent-strong: #5c002b; --accent-soft: #fde6ef; --on-accent: #ffffff;
  --period: #b00020; --period-soft: #ffd6dc; --ovulation: #003fb3; --fertile-soft: #dce6ff;
  --chart: #8a0040; --chart-band: rgba(176, 0, 32, .14); --shadow: none;
}
[data-theme="contraste"] .card, [data-theme="contraste"] .chip, [data-theme="contraste"] .seg-btn { border-width: 2px; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.modal-open, body.is-locked { overflow: hidden; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
p { margin: .35em 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.ico { flex: none; display: block; }
.small { font-size: .86rem; }
.muted { color: var(--muted); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 2000; }
.skip-link:focus { left: 8px; }

/* ---------- Mise en page ---------- */
.app { min-height: 100vh; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; }
.brand-small { font-size: 1.02rem; }
.view { max-width: 780px; margin: 0 auto; padding: 4px 16px 110px; outline: none; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav-link { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600; min-width: 0; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nav-link.is-active { color: var(--accent); }
.nav-ico { display: grid; place-items: center; height: 28px; width: 44px; border-radius: 14px; }
.nav-link.is-active .nav-ico { background: var(--accent-soft); }
.nav-primary .nav-ico { background: var(--accent); color: var(--on-accent); width: 46px; height: 32px; border-radius: 16px; }
.nav-primary.is-active .nav-ico { background: var(--accent-strong); }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 250px 1fr; }
  .sidebar { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--border); background: var(--surface); }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--text-2); font-weight: 600; }
  .side-link:hover { background: var(--surface-2); }
  .side-link.is-active { background: var(--accent-soft); color: var(--accent-strong); }
  .bottom-nav, .topbar { display: none; }
  .view { padding: 28px 28px 60px; }
}

/* ---------- Cartes & titres ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; margin: 0 0 14px; box-shadow: var(--shadow); }
.card-title { font-size: 1.08rem; margin-bottom: 10px; }
.card-sub { color: var(--muted); font-size: .88rem; margin: -4px 0 10px; }
.page-title { font-size: 1.5rem; margin: 8px 0 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 8px 0 14px; }
.page-head .page-title { margin: 0; }
.sub-title { font-size: .95rem; font-weight: 700; margin: 16px 0 8px; color: var(--text-2); }
.sub-head .sub-title { margin-bottom: 2px; }
.sub-head .field-hint { margin-bottom: 8px; }
.hello { margin: 6px 0 14px; }
.hello-date { color: var(--muted); margin: 0; }
.hello-title { font-size: 1.6rem; }
.disclaimer { color: var(--muted); font-size: .82rem; text-align: center; margin: 18px 8px; }
.grid-2 { display: grid; gap: 14px; }
.grid-2 > .card { margin: 0; }
.grid-2 { margin-bottom: 14px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px;
  border-radius: 14px; border: 1px solid transparent; background: var(--surface-2); color: var(--text);
  font-weight: 650; text-decoration: none; line-height: 1.2; text-align: center;
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); align-self: flex-start; }
.btn-link { background: none; border: 0; padding: 6px 0; min-height: 0; color: var(--accent); font-weight: 650; }
.btn-small { min-height: 36px; padding: 7px 12px; font-size: .9rem; border-radius: 12px; }
.btn-block { width: 100%; margin-top: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent; color: var(--text-2); text-decoration: none; flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.is-disabled { opacity: .3; pointer-events: none; }
.icon-btn-soft { background: var(--accent-soft); color: var(--accent-strong); width: 36px; height: 36px; }
.icon-btn-small { width: 32px; height: 32px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--period-soft); color: var(--text); font-weight: 600; font-size: .9rem; }

/* ---------- Champs ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-weight: 650; font-size: .92rem; color: var(--text-2); }
.field-hint { font-size: .82rem; color: var(--muted); margin: 0; }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input-big { font-size: 1.4rem; font-weight: 700; }
.input-pin { font-size: 1.4rem; letter-spacing: .4em; text-align: center; }
.textarea { resize: vertical; min-height: 110px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: .92rem; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--accent); }
.inline-fields { display: flex; flex-wrap: wrap; gap: 8px 28px; }

/* ---------- Segmenté ---------- */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-btn {
  flex: 1 1 0; min-width: 64px; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 8px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: .88rem;
}
.seg-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg-sub { font-size: .72rem; font-weight: 500; opacity: .8; }
.seg-emoji { font-size: 1.5rem; line-height: 1; }
.seg-emoji-row .seg-btn { min-width: 54px; font-size: .76rem; }
.seg-emoji-row .seg-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.seg-small .seg-btn { min-height: 36px; min-width: 52px; font-size: .8rem; padding: 6px 4px; }
.seg-flow .seg-btn { min-width: 70px; }
.seg-flow .seg-btn[aria-pressed="true"] { background: var(--period); border-color: var(--period); color: #fff; }
.drops { display: flex; gap: 1px; height: 18px; align-items: flex-end; color: var(--period); }
.seg-btn[aria-pressed="true"] .drops { color: #fff; }
.drop { width: 8px; height: 12px; background: currentColor; border-radius: 50% 50% 50% 50% / 35% 35% 65% 65%; }
.drop-small { width: 5px; height: 8px; }
.drop-none { font-size: 1rem; line-height: 18px; opacity: .6; }
.battery { display: flex; gap: 2px; height: 16px; align-items: flex-end; }
.battery i { width: 5px; border-radius: 2px; background: var(--border); }
.battery i:nth-child(1) { height: 6px; } .battery i:nth-child(2) { height: 8px; } .battery i:nth-child(3) { height: 11px; } .battery i:nth-child(4) { height: 13px; } .battery i:nth-child(5) { height: 16px; }
.battery i.on { background: var(--accent); }

/* ---------- Échelle de douleur ---------- */
.pain-row { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.pain-btn {
  min-height: 46px; padding: 0; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  box-shadow: inset 0 -5px 0 var(--pc); font-weight: 700; color: var(--text-2); transition: transform .12s;
}
.pain-btn[aria-pressed="true"] { background: var(--pc); color: var(--pi); border-color: var(--pc); transform: scale(1.08); box-shadow: 0 2px 8px color-mix(in srgb, var(--pc) 50%, transparent); }
.is-compact .pain-btn { min-height: 34px; font-size: .82rem; border-radius: 8px; box-shadow: inset 0 -3px 0 var(--pc); }
.is-compact .pain-btn[aria-pressed="true"] { box-shadow: none; }
.pain-ends { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin-top: 4px; }
.pain-info { display: flex; gap: 12px; align-items: center; margin-top: 10px; min-height: 48px; font-size: .93rem; }
.pain-face { font-size: 2.2rem; line-height: 1; }
.fived { display: flex; flex-direction: column; gap: 12px; }
.fived-label { margin: 0 0 6px; font-weight: 600; font-size: .92rem; }

/* ---------- Pastilles ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-add { margin-top: 10px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chips-scroll .chip { flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: .9rem; text-align: left;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip-emoji { font-size: 1.05rem; }
.chip-add { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }
.chip-static { cursor: default; background: var(--surface-2); border-color: transparent; }
.chip-dots { display: inline-flex; gap: 3px; }
.chip-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.chip-level[data-level="1"] { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }
.chip-level[data-level="2"] { background: color-mix(in srgb, var(--accent) 32%, var(--surface)); border-color: var(--accent); color: var(--text); }
.chip-level[data-level="3"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip-level[data-level="1"] .chip-dots i:nth-child(-n+1), .chip-level[data-level="2"] .chip-dots i:nth-child(-n+2) { background: var(--accent-strong); }
.chip-level[data-level="3"] .chip-dots i { background: var(--on-accent); }
.chip-zone { background: var(--surface-2); border-color: transparent; color: var(--text); font-size: .84rem; min-height: 34px; }
.zone-swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }

/* ---------- Pas-à-pas ---------- */
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.stepper-btn { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--surface); font-size: 1.3rem; font-weight: 700; color: var(--accent-strong); }
.stepper-val { min-width: 92px; text-align: center; font-weight: 700; padding: 0 6px; }

/* ---------- Silhouette ---------- */
.bodymap-figs { display: flex; justify-content: center; gap: 8px; }
.bodymap-fig { margin: 0; flex: 1 1 0; max-width: 200px; text-align: center; }
.bodymap-fig figcaption { font-size: .85rem; color: var(--muted); font-weight: 600; }
.bodymap-svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.bm-decor { fill: var(--surface-2); }
.bm-zone { fill: color-mix(in srgb, var(--surface-2) 70%, var(--border)); cursor: pointer; stroke: var(--surface); stroke-width: 2; transition: fill .15s; outline: none; }
.bm-zone:hover { fill: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
.bm-zone:focus-visible { stroke: var(--accent); stroke-width: 3; }
.bm-zone[data-level="1"] { fill: #e3c84c; }
.bm-zone[data-level="2"] { fill: #ea7b3b; }
.bm-zone[data-level="3"] { fill: #cc3d3c; }
.bm-side { fill: var(--muted); font-size: 12px; font-weight: 700; }
.bodymap-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bodymap-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 0 0 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Sections du journal ---------- */
.entry-head { display: flex; align-items: center; justify-content: space-between; }
.saved-pill { font-size: .85rem; font-weight: 650; color: var(--accent-strong); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; opacity: 0; transition: opacity .2s; }
.saved-pill.show { opacity: 1; }
.sect { padding: 0; overflow: hidden; }
.sect > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; min-height: 56px; }
.sect > summary::-webkit-details-marker { display: none; }
.sect > summary .ico { transition: transform .2s; color: var(--muted); }
.sect[open] > summary .ico { transform: rotate(90deg); }
.sect-emoji { font-size: 1.3rem; }
.sect-title { font-weight: 700; font-size: 1.04rem; flex: 1; }
.sect-sum { font-size: .82rem; color: var(--accent-strong); font-weight: 650; text-align: right; }
.sect-body { padding: 0 16px 16px; }
.sect-body > div > .sub-head:first-child .sub-title, .sect-body > div > .field-hint:first-child { margin-top: 0; }
.support { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); font-size: .92rem; }

/* ---------- Navigation par date ---------- */
.date-nav { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 8px; margin-bottom: 14px; }
.date-center { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.date-main { font-weight: 700; font-size: 1.05rem; }
.date-sub { font-size: .82rem; color: var(--muted); }
.date-input { border: 1px solid var(--border); border-radius: 10px; padding: 3px 8px; background: var(--surface-2); font-size: .82rem; color: var(--text-2); margin-top: 2px; }

/* ---------- Tuiles & jauges ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.card .tiles { margin-bottom: 4px; }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 700px) { .view-bilan > .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card .tile { background: var(--surface-2); border-color: transparent; }
.tile-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 1.3rem; font-weight: 700; overflow-wrap: anywhere; }
.tile-sub { font-size: .76rem; color: var(--muted); }
@media (max-width: 400px) { .tiles-3 .tile-value { font-size: 1.05rem; } .tiles-3 .tile { padding: 10px 8px; } }
.meter { height: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; margin: 10px 0 4px; }
.meter-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter-fill.is-over { background: var(--period); }
.insight { background: var(--surface-2); padding: 10px 12px; border-radius: 12px; font-size: .9rem; margin-top: 12px; }

/* ---------- Cycle (accueil) ---------- */
.cycle-main { display: flex; align-items: center; gap: 16px; }
.cycle-text { flex: 1; min-width: 0; }
.cycle-phase { font-weight: 700; font-size: 1.1rem; color: var(--accent-strong); margin-top: 0; }
.ring-track { stroke: var(--accent-soft); }
.ring-fill { stroke: var(--accent); }
.ring.is-period .ring-fill { stroke: var(--period); }
.ring.is-period .ring-track { stroke: var(--period-soft); }
.ring-num { fill: var(--text); font-size: 24px; font-weight: 800; }
.ring-sub { fill: var(--muted); font-size: 11px; font-weight: 600; }
.steps-ring .ring-num { font-size: 18px; }

/* ---------- Bannières ---------- */
.banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--accent-soft); color: var(--text); padding: 12px 14px; border-radius: 14px; margin-bottom: 12px; font-size: .92rem; }
.banner-warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner-inline { margin: 8px 0; }
.card-welcome { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.warn-box { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 12px; border-radius: 12px; font-size: .9rem; }
.empty { text-align: center; padding: 20px 8px; }
.empty-emoji { font-size: 2.4rem; }
.empty-title { font-weight: 700; }

/* ---------- Traitements ---------- */
.checklist, .intake-list, .item-list, .food-list, .day-lines { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.check-row {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; min-height: 50px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
}
.check-box { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--border); display: grid; place-items: center; color: transparent; flex: none; }
.check-row[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; }
.check-row[aria-pressed="true"] .check-box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check-text { flex: 1; min-width: 0; }
.med-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.intake-row { border: 1px solid var(--border); border-radius: 14px; padding: 8px 10px; }
.intake-main { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 2px; text-align: left; }
.intake-list > li > .intake-main { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; }
.intake-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-2); min-width: 46px; }
.intake-name { flex: 1; min-width: 0; }
.intake-relief { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.med-list { display: flex; flex-direction: column; gap: 10px; }
.med-card { border: 1px solid var(--border); border-radius: 16px; padding: 12px; }
.med-card.is-stopped { opacity: .75; }
.med-card .btn-row { margin-top: 8px; }
.med-card-main { display: flex; gap: 12px; align-items: flex-start; }
.med-pill { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.med-name { font-size: 1.02rem; }
.times { display: flex; flex-direction: column; gap: 6px; }
.time-row { display: flex; gap: 6px; align-items: center; }
.time-row .input { max-width: 160px; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-height: 44px; }
.color-btn { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.color-btn[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--text); }
.history { display: flex; flex-direction: column; gap: 12px; }
.history-date { font-weight: 700; font-size: .9rem; color: var(--text-2); margin: 0 0 6px; }

/* ---------- Forme ---------- */
.steps-editor { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.steps-fields { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 10px; }
.item-row, .food-pick {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
}
.item-row { margin-bottom: 0; }
.acts > .btn { margin-top: 10px; }
.item-emoji { font-size: 1.5rem; }
.item-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.item-kcal { font-weight: 700; font-size: .9rem; color: var(--text-2); white-space: nowrap; }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.act-btn { display: flex; align-items: center; gap: 6px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: .82rem; font-weight: 600; text-align: left; min-height: 44px; }
.act-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.act-emoji { font-size: 1.2rem; }
.kcal-preview { font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); padding: 10px 12px; border-radius: 12px; margin: 0; }
.meals { display: flex; flex-direction: column; gap: 10px; }
.meal { border: 1px solid var(--border); border-radius: 16px; padding: 10px 12px; }
.meal-head { display: flex; align-items: center; gap: 8px; }
.meal-emoji { font-size: 1.2rem; }
.meal-title { flex: 1; font-size: 1rem; }
.meal-kcal { font-weight: 700; font-size: .9rem; color: var(--text-2); }
.food-list { margin-top: 8px; gap: 2px; }
.food-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--surface-2); }
.food-name { flex: 1; min-width: 0; font-size: .92rem; }
.food-kcal { font-size: .88rem; font-weight: 650; white-space: nowrap; }
.food-results { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.food-pick { flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; }
.food-pick-name { font-weight: 650; }
.food-detail { border: 2px solid var(--accent); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.food-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.off-box { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.off-box .food-results { width: 100%; }
.water-row { display: flex; flex-wrap: wrap; gap: 4px; }
.water-glass { width: 40px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 1.2rem; filter: grayscale(1); opacity: .45; }
.water-glass[aria-pressed="true"] { filter: none; opacity: 1; background: var(--accent-soft); border-color: transparent; }

/* ---------- Calendrier ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-size: 1.2rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1.08; min-height: 42px; border-radius: 12px; border: 1px solid transparent; background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; color: var(--text);
}
.cal-num { font-weight: 650; font-size: .95rem; font-variant-numeric: tabular-nums; }
.cal-marks { display: flex; gap: 3px; height: 8px; align-items: center; }
.pain-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1.5px var(--surface); }
.entry-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); display: inline-block; }
.med-mark { width: 9px; height: 5px; border-radius: 3px; background: var(--accent); display: inline-block; box-shadow: 0 0 0 1.5px var(--surface); }
.cal-day.is-period { background: var(--period); color: #fff; }
.cal-day.is-period.flow-2 { background: color-mix(in srgb, var(--period) 62%, var(--surface)); color: var(--text); }
.cal-day.is-period.flow-5 { background: color-mix(in srgb, var(--period) 80%, #000); }
.cal-day.is-spotting { background: var(--period-soft); }
.cal-day.is-predicted { background: var(--surface); border: 2px dashed var(--period); }
.cal-day.is-fertile { background: var(--fertile-soft); }
.cal-day.is-ovulation { background: var(--fertile-soft); border: 2px solid var(--ovulation); }
.cal-day.is-future .cal-num { opacity: .65; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--text); }
.cal-day.is-today .cal-num { font-weight: 800; }
.cal-day.is-selected { outline: 3px solid var(--accent); outline-offset: 1px; }
.cal-day:disabled { opacity: .4; cursor: default; }
.is-marking .cal-day:not(:disabled):hover { filter: brightness(.95); }
.cal-actions { margin-top: 12px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; color: var(--text-2); }
.lg { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.lg-period { background: var(--period); }
.lg-spotting { background: var(--period-soft); }
.lg-predicted { border: 2px dashed var(--period); }
.lg-fertile { background: var(--fertile-soft); border: 1px solid var(--border); }
.lg-ovulation { background: var(--fertile-soft); border: 2px solid var(--ovulation); }
.day-lines li { display: flex; gap: 10px; align-items: flex-start; font-size: .93rem; }

/* ---------- Tableaux ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; margin-top: 10px; }
.table th, .table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 650; font-size: .8rem; }
.table td { font-variant-numeric: tabular-nums; }
.table-kv th { width: 45%; color: var(--text-2); }
.table-details { margin-top: 10px; }
.table-details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; }
.table-details .table { display: block; max-height: 260px; overflow-y: auto; }

/* ---------- Graphiques ---------- */
.chart { position: relative; width: 100%; min-height: 40px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-tick.is-muted { opacity: .55; }
.chart-value { fill: var(--text-2); font-size: 11px; font-weight: 700; }
.chart-line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--chart); opacity: .1; }
.chart-dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.chart-band { fill: var(--chart-band); }
.chart-bar { fill: var(--chart); }
.chart-marker { fill: var(--period); }
.chart-cross { stroke: var(--muted); stroke-width: 1; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: .8rem; line-height: 1.35;
  padding: 6px 9px; border-radius: 8px; white-space: nowrap; opacity: 0; transition: opacity .12s; z-index: 5; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.chart-tip.show { opacity: 1; }
.legend-line { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-period { background: var(--period); }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(60px, 1fr) auto; align-items: center; gap: 10px; font-size: .88rem; }
.hbar-label { overflow-wrap: anywhere; }
.hbar-track { height: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 999px; background: var(--chart); }
.hbar-value { color: var(--text-2); font-weight: 650; font-size: .82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.range-bar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

/* ---------- Réglages ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.theme-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); text-align: left; }
.theme-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.theme-swatch { display: flex; width: 100%; height: 34px; border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.theme-swatch i { flex: 1; }
.theme-name { font-weight: 700; font-size: .92rem; }
.theme-hint { font-size: .74rem; color: var(--muted); line-height: 1.25; }

/* ---------- Fenêtres ---------- */
.overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(20, 10, 18, .45); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .18s; }
.overlay.show { opacity: 1; }
.modal {
  background: var(--surface); color: var(--text); width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column;
  border-radius: 22px 22px 0 0; box-shadow: 0 -8px 40px rgba(0,0,0,.2); transform: translateY(20px); transition: transform .2s; outline: none;
}
.overlay.show .modal { transform: none; }
.modal-wide { max-width: 680px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 8px; }
.modal-title { font-size: 1.15rem; }
.modal-body { padding: 4px 16px 16px; overflow-y: auto; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.modal-actions .btn { flex: 1; max-width: 220px; }
.confirm-text { font-size: 1rem; }
@media (min-width: 700px) {
  .overlay { align-items: center; }
  .modal { border-radius: 22px; }
}
.toast-root, #toast-root { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 1100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .92rem; font-weight: 600; opacity: 0; transform: translateY(8px); transition: all .2s; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: none; }
@media (min-width: 960px) { #toast-root { bottom: 24px; } }

/* ---------- Verrouillage ---------- */
.lock { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.lock-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; width: 100%; max-width: 320px; }
.lock-icon { width: 60px; height: 60px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-strong); display: grid; place-items: center; }
.lock-title { font-size: 1.3rem; }
.lock-dots { display: flex; gap: 14px; margin: 10px 0 2px; }
.lock-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); }
.lock-dots i.on { background: var(--accent); }
.lock-msg { color: var(--danger); min-height: 1.4em; font-weight: 600; }
.lock-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; }
.lock-key { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 1.5rem; font-weight: 600; }
.lock-pad.is-blocked { opacity: .35; pointer-events: none; }
.lock.shake .lock-inner { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- Rapport ---------- */
.report-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 16px; }
.report { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 22px; }
.report-head { border-bottom: 2px solid var(--accent); padding-bottom: 10px; margin-bottom: 8px; }
.report-head h1 { font-size: 1.35rem; margin-bottom: 4px; }
.report section { margin-top: 18px; break-inside: avoid; }
.report h2 { font-size: 1.05rem; color: var(--accent-strong); margin-bottom: 6px; }
.report-chart { margin: 10px 0 4px; }
.report-notes { padding-left: 18px; font-size: .9rem; }
.report-foot { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 8px; }

/* ---------- Mobile étroit ---------- */
@media (max-width: 420px) {
  .pain-row { gap: 3px; }
  .pain-btn { min-height: 42px; font-size: .9rem; border-radius: 8px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
  .seg-flow .seg-btn { min-width: calc(33% - 6px); }
  .cal-grid { gap: 3px; }
  .cal-day { border-radius: 10px; }
}

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

/* ---------- Impression ---------- */
@media print {
  :root[data-theme] {
    --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --border: #cfcfcf; --text: #000; --text-2: #222; --muted: #555;
    --accent: #8a2c55; --accent-strong: #6a1f40; --accent-soft: #f4e0e8; --chart: #8a2c55; --chart-band: rgba(209, 73, 91, .14); --period: #c33; --shadow: none;
  }
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .sidebar, .topbar, .bottom-nav, .no-print, #toast-root, .skip-link { display: none !important; }
  .app { display: block; }
  .view { padding: 0; max-width: none; }
  .report { border: 0; padding: 0; }
  .chart-tip { display: none; }
}
