/* Healthcoach — thème clair, vert et frais. Couleurs des graphiques validées (dataviz) sur fond blanc. */

@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito-latin-wght.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light only;
  --page: #f4f8f1;
  --surface: #ffffff;
  --surface-2: #f3f8f0;
  --surface-3: #e7f0e2;
  --ink: #183224;
  --ink-2: #4b6155;
  --muted: #64786a;
  --tick: #7d8e81;
  --grid: #e4ece0;
  --axis: #c9d6c6;
  --border: rgba(24, 50, 36, 0.08);
  --border-strong: rgba(24, 50, 36, 0.16);

  --green: #2e9e5b;          /* marques et remplissages */
  --green-strong: #1f7a44;   /* boutons, liens, onglet actif */
  --green-deep: #155c33;
  --green-soft: #ddf1e3;
  --green-softer: #eef8f1;
  --leaf: #9bd35a;
  --leaf-soft: #effadf;
  --coral: #e8645a;          /* symptômes uniquement */
  --coral-strong: #a83a31;
  --coral-soft: #fde9e6;
  --amber: #e29a2e;          /* sucré uniquement */
  --amber-strong: #8a5a0e;
  --amber-soft: #fdf1da;
  --deemph: #8c9a90;
  --good: #2e9e5b;
  --warning: #e29a2e;
  --critical: #d64f45;

  /* Échelles séquentielles (grille de la semaine) : vert = à favoriser, ambre = sucré, gris = repères neutres. */
  --g0: var(--surface-2);
  --g1: #e4f4e7; --g2: #bee5c7; --g3: #8dcfa0; --g4: #58b67a; --g5: #1f7a44;
  --a1: #fcf0d9; --a2: #f6d592; --a3: #f0bc5c; --a4: #e29a2e; --a5: #c47f12;
  --n1: #eef1ec; --n2: #d7ddd4; --n3: #b5beb1; --n4: #8f998b; --n5: #6c7668;

  --shadow-sm: 0 1px 2px rgba(24, 50, 36, 0.05);
  --shadow: 0 1px 3px rgba(24, 50, 36, 0.04), 0 10px 30px rgba(24, 50, 36, 0.07);
  --shadow-lg: 0 4px 12px rgba(24, 50, 36, 0.06), 0 24px 60px rgba(24, 50, 36, 0.14);
  --radius-lg: 26px;
  --radius: 22px;
  --radius-sm: 16px;
  --tabbar: 66px;
  font-family: ui-rounded, "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 500px at 85% -10%, #e3f3e6 0%, rgba(227, 243, 230, 0) 70%), var(--page);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-strong); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 750; }
h3 { font-size: 15.5px; font-weight: 750; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 3px solid rgba(46, 158, 91, 0.45); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Coquille ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  height: 62px; padding: 0 18px;
  background: rgba(244, 248, 241, 0.86);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 850; font-size: 18px; letter-spacing: -0.01em; }
.logo-bg { fill: var(--green); }
.logo-leaf { fill: #ffffff; }
.logo-vein { stroke: var(--green); }
.top-nav { display: none; gap: 4px; margin-left: 10px; }
.top-link { padding: 8px 13px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: 14.5px; }
.top-link:hover { background: var(--green-softer); color: var(--ink); }
.top-link[aria-current] { background: var(--green-soft); color: var(--green-deep); }
.top-logout { display: none; margin-left: auto; }

.view {
  max-width: 1240px; margin: 0 auto;
  padding: 16px 14px calc(var(--tabbar) + 30px + env(safe-area-inset-bottom));
  transition: opacity 0.15s ease;
}
.view.is-loading { opacity: 0.6; }
.view:focus { outline: none; }

.tabbar {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 25;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: var(--tabbar); padding: 6px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow-lg);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 750; border-radius: 18px;
}
.tab-icon { display: grid; place-items: center; width: 44px; height: 28px; border-radius: 999px; }
.tab[aria-current] { color: var(--green-deep); }
.tab[aria-current] .tab-icon { background: var(--green-soft); }
.tab[aria-current] .icon { stroke-width: 2.2; }

@media (min-width: 900px) {
  .top-nav { display: flex; }
  .top-logout { display: inline-flex; }
  .tabbar { display: none; }
  .view { padding: 26px 26px 56px; }
}

/* ---------- Pages ---------- */
.page { display: grid; gap: 16px; }
.page-conversation, .page-reports, .page-settings { max-width: 800px; margin: 0 auto; width: 100%; }
.page-week, .page-health, .page-trends { max-width: 1120px; margin: 0 auto; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 4px 4px 0; }
.page-head > .muted { font-size: 14.5px; }
.page-head .btn { margin-left: auto; }
.day-nav { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; }
.day-title { display: grid; gap: 2px; text-align: center; }
.day-title h1 { font-size: 21px; }
.day-title .muted { font-size: 13.5px; }
.day-tools { grid-column: 1 / -1; display: flex; justify-content: center; gap: 8px; }
@media (min-width: 700px) {
  .day-nav { grid-template-columns: 40px auto 40px 1fr; }
  .day-title { text-align: left; }
  .day-tools { grid-column: auto; justify-content: flex-end; }
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; min-width: 0; box-shadow: var(--shadow);
}
.card > h2 { margin-bottom: 12px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 14px; }
.card-head a { color: inherit; text-decoration: none; }
.card-head a:hover { text-decoration: underline; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--grid); }
.error-card { display: grid; gap: 12px; justify-items: start; }
.callout { padding: 13px 15px; border-radius: var(--radius-sm); background: var(--green-softer); color: var(--ink-2); }
.note { margin-top: 12px; }
.foot-note { text-align: center; }

/* ---------- Boutons, champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 750; font-size: 14.5px; white-space: nowrap; text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn-primary { background: var(--green-strong); color: #ffffff; box-shadow: 0 4px 12px rgba(31, 122, 68, 0.25); }
.btn-primary:hover:not(:disabled) { background: var(--green-deep); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--green-softer); }
.btn-ghost[aria-pressed="true"] { background: var(--green-soft); border-color: transparent; color: var(--green-deep); }
.btn-soft { background: var(--green-softer); color: var(--green-deep); }
.btn-soft:hover:not(:disabled) { background: var(--green-soft); }
.btn-danger { background: var(--critical); color: #ffffff; }
.btn-quiet-danger { color: var(--coral-strong); background: var(--coral-soft); }
.btn-quiet-danger:hover:not(:disabled) { background: #fbd9d4; }
.btn-small { height: 34px; padding: 0 13px; font-size: 13.5px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 40px; height: 40px; border-radius: 999px; border: 0; background: none; color: var(--ink-2);
}
.icon-btn:hover:not(:disabled) { background: var(--green-softer); color: var(--green-deep); }
.icon { flex: none; display: block; }

.input {
  width: 100%; min-width: 0; height: 44px; padding: 0 14px; border-radius: 14px;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea.input { height: auto; padding: 11px 14px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(46, 158, 91, 0.15); }
.input::placeholder { color: #8a9a8e; }
.input-short { max-width: 140px; }
.input.date-input { width: auto; height: 36px; font-size: 14px; padding: 0 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 750; color: var(--ink-2); }
.field-hint { font-size: 12.5px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.fieldset { border: 1px solid var(--grid); border-radius: var(--radius-sm); padding: 10px 14px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; background: var(--surface-2); }
.fieldset legend { font-size: 13px; font-weight: 750; color: var(--ink-2); padding: 0 6px; }
.form-error { color: var(--coral-strong); font-size: 14px; font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.form-card { display: grid; gap: 14px; }
.form-card > h2 { margin: 0; }
.items { display: grid; gap: 8px; }
.item-row { display: grid; grid-template-columns: 1.5fr 1fr 32px; gap: 6px; align-items: center; }
.item-row .icon-btn { width: 32px; height: 32px; }
.steppers { display: grid; gap: 6px; }
@media (min-width: 560px) { .steppers { grid-template-columns: 1fr 1fr; column-gap: 18px; } }
.stepper-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stepper-label { font-size: 14.5px; }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--grid); border-radius: 999px; padding: 2px; }
.stepper-btn { width: 32px; height: 32px; border: 0; border-radius: 999px; background: none; font-size: 18px; line-height: 1; color: var(--green-deep); }
.stepper-btn:hover { background: var(--green-softer); }
.stepper-value { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 800; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--green-strong); margin: 0; }
.check-block { padding: 2px 0; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Dialogues ---------- */
.dialog {
  border: 0; padding: 0; border-radius: var(--radius-lg); width: min(580px, calc(100vw - 20px)); max-height: 92vh;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); overflow: auto;
}
.dialog::backdrop { background: rgba(24, 50, 36, 0.35); backdrop-filter: blur(2px); }
.dialog-small { width: min(420px, calc(100vw - 32px)); }
.dialog-body { padding: 20px; display: grid; gap: 14px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -6px -6px 0 0; }
.dialog-title { font-size: 19px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: -20px; background: var(--surface); padding: 12px 0 2px; margin-bottom: -4px; }
.sheet { margin: auto auto 0; width: 100%; max-width: 520px; border-radius: 26px 26px 0 0; }
.sheet-body { display: grid; gap: 4px; padding: 10px 12px calc(18px + env(safe-area-inset-bottom)); }
.sheet-grip { justify-self: center; width: 40px; height: 5px; border-radius: 999px; background: var(--axis); margin: 2px 0 8px; }
.sheet-link {
  display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; border: 0; background: none;
  color: var(--ink); text-decoration: none; font-size: 16.5px; font-weight: 750; text-align: left;
}
.sheet-link:hover { background: var(--green-softer); }
.sheet-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--green-softer); color: var(--green-deep); }
.sheet-close { margin-top: 8px; }
.photo-dialog { width: auto; max-width: min(900px, 96vw); padding: 12px; display: grid; gap: 10px; justify-items: center; }
.photo-dialog[open] { display: grid; }
.photo-dialog img { max-width: 100%; max-height: 80vh; border-radius: 16px; display: block; }

/* ---------- Info-bulle, messages ---------- */
.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  min-width: 120px; max-width: 280px; padding: 9px 12px; border-radius: 14px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  font-size: 13px; display: grid; gap: 4px;
}
.tip-title { color: var(--muted); font-size: 12px; font-weight: 700; }
.tip-row { display: flex; align-items: baseline; gap: 7px; }
.tip-row strong { font-weight: 800; }
.tip-label { color: var(--ink-2); }
.tip-key { flex: none; width: 12px; height: 3px; border-radius: 2px; align-self: center; }
.key-green { background: var(--green); }
.key-coral { background: var(--coral); }
.key-amber { background: var(--amber); }
.key-neutral, .key-other { background: var(--deemph); }
.toasts {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 70;
  bottom: calc(var(--tabbar) + 24px + env(safe-area-inset-bottom));
  display: grid; gap: 8px; width: min(420px, calc(100vw - 24px));
}
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast {
  padding: 12px 16px; border-radius: 16px; background: var(--green-deep); color: #ffffff;
  box-shadow: var(--shadow-lg); font-size: 14.5px; font-weight: 700; text-align: center;
  animation: toast-in 0.2s ease; transition: opacity 0.4s ease, transform 0.4s ease;
}
.toast-error { background: var(--critical); }
.toast-out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Connexion ---------- */
.login { position: relative; overflow: hidden; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { position: relative; width: min(390px, 100%); display: grid; gap: 14px; padding: 28px; box-shadow: var(--shadow-lg); border-radius: var(--radius-lg); }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .logo { width: 44px; height: 44px; }
.login-brand h1 { font-size: 26px; }
.login-lead { color: var(--ink-2); font-size: 16px; margin-bottom: 4px; }
.login-leaf { position: absolute; border-radius: 0 100% 0 100%; background: linear-gradient(135deg, #cfeed8, #e9f7dc); opacity: 0.9; }
.login-leaf-a { width: 340px; height: 340px; top: -120px; right: -90px; transform: rotate(8deg); }
.login-leaf-b { width: 240px; height: 240px; bottom: -90px; left: -70px; transform: rotate(-12deg); background: linear-gradient(135deg, #e9f7dc, #d6f0de); }

/* ---------- Pastilles, tuiles ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  font-size: 13.5px; font-weight: 750; color: var(--ink); white-space: nowrap;
}
.pill-white { background: rgba(255, 255, 255, 0.85); }
.pill-coral { background: var(--coral-soft); border-color: transparent; color: var(--coral-strong); }
.pill-leaf { background: var(--leaf-soft); border-color: rgba(155, 211, 90, 0.5); color: var(--green-deep); }
.pill-link { background: var(--green-strong); color: #ffffff; border-color: transparent; text-decoration: none; }
.pill-link:hover { background: var(--green-deep); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; display: grid; gap: 2px; align-content: start; box-shadow: var(--shadow-sm); }
.tile-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.tile-value { font-size: 20px; font-weight: 850; letter-spacing: -0.01em; white-space: nowrap; color: var(--ink); }
.tile-note { font-size: 12px; color: var(--muted); }
.tile .meter { margin-top: 6px; }
.meter { height: 8px; border-radius: 999px; overflow: hidden; }
.track-green { background: var(--green-soft); }
.meter-fill { height: 100%; border-radius: 999px; }
.fill-green { background: var(--green); }

/* ---------- Accueil : en-tête ---------- */
.page-home { gap: 18px; }
.home-main { display: grid; gap: 16px; min-width: 0; align-content: start; }
/* En-tête compact : le calendrier doit être visible dès l'arrivée. */
.home-head { display: grid; gap: 10px; padding: 2px 2px 0; min-width: 0; }
.home-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-head-text { display: grid; gap: 0; min-width: 0; }
.home-head-text h1 { font-size: 25px; }
.hero-date { font-size: 13.5px; font-weight: 750; color: var(--green-strong); }
.write-btn { flex: none; height: 44px; padding: 0 18px; font-size: 15px; }
.pills-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px 4px; scroll-padding: 14px; }
.pills-row::-webkit-scrollbar { display: none; }
.pills-row .pill { flex: none; }
.pill-quiet { background: var(--surface-2); color: var(--ink-2); box-shadow: none; }
.month-pills { margin-top: -2px; }
@media (min-width: 900px) {
  .pills-row { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .home-head-text h1 { font-size: 28px; }
}
.side-composer .composer { box-shadow: var(--shadow); }
.compose-sheet .composer { border: 0; box-shadow: none; padding: 4px 2px 0; }
.composer { position: relative; display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 14px; box-shadow: var(--shadow-sm); }
.composer-label { font-weight: 800; font-size: 14.5px; color: var(--ink); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-input { min-height: 48px; font-size: 16px; border-radius: 16px; background: var(--surface-2); border-color: transparent; }
.composer-input:focus { background: var(--surface); }
.composer-send { height: 48px; padding: 0 16px; }
.composer-hint { font-size: 12.5px; color: var(--muted); }
@media (max-width: 420px) { .composer-send span { display: none; } .composer-send { width: 48px; padding: 0; } }
.reply { display: grid; gap: 4px; padding: 12px 14px; border-radius: 6px 18px 18px 18px; background: var(--green-softer); border: 1px solid rgba(46, 158, 91, 0.15); }
.reply-from { font-size: 12px; font-weight: 800; color: var(--green-strong); }
.typing { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* ---------- Accueil : calendrier du mois ---------- */
.month { padding: 16px 12px 14px; }
.month-head { display: flex; align-items: center; gap: 6px; margin: 0 2px 12px; }
.month-head h2 { font-size: 19px; font-weight: 850; min-width: 150px; text-align: center; }
.month-today { margin-left: auto; }
.month-weekdays, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.month-weekdays { margin-bottom: 6px; text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.month-weekdays .wd-long { display: none; }
.cal-day {
  position: relative; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; align-items: center;
  min-height: 72px; padding: 5px 3px 7px; border-radius: 16px;
  background: var(--surface-2); color: var(--ink); text-decoration: none;
  border: 1.5px solid transparent; transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
a.cal-day:hover { background: var(--green-softer); box-shadow: var(--shadow-sm); }
a.cal-day:active { transform: scale(0.97); }
.cal-day.is-logged { background: var(--surface); border-color: var(--grid); box-shadow: var(--shadow-sm); }
.cal-day.is-empty { background: transparent; border-color: var(--grid); }
.cal-day.is-outside { opacity: 0.38; }
.cal-day.is-future { background: transparent; border-color: transparent; box-shadow: none; min-height: 46px; }
.cal-day.is-future .cal-num { color: var(--axis); font-weight: 700; }
.cal-day.is-selected { border-color: var(--green); box-shadow: 0 0 0 3px rgba(46, 158, 91, 0.18); }
.cal-top { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 2px; padding: 0 2px; }
.cal-num { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; font-size: 12.5px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-day.is-today .cal-num { background: var(--green-strong); color: #ffffff; }
.cal-day.is-today { border-color: var(--green); }
.cal-symptom { display: inline-flex; align-items: center; gap: 1px; height: 20px; padding: 0 5px 0 3px; border-radius: 999px; background: var(--coral-soft); font-size: 11px; line-height: 1; }
.cal-symptom-n { font-weight: 850; color: var(--coral-strong); font-size: 11px; }
.cal-mid { display: grid; place-items: center; min-height: 26px; }
.ring { display: block; }
.ring-track { stroke: var(--green-soft); }
.ring-value { stroke: var(--green); }
.ring.is-full .ring-value { stroke: var(--green-strong); }
.ring-check { stroke: var(--green-strong); }
.cal-dots { display: flex; gap: 3px; min-height: 6px; }
.cal-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--axis); opacity: 0.55; }
.cal-dot.is-on { background: var(--green); opacity: 1; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 14px 4px 0; font-size: 12.5px; color: var(--ink-2); }
.cal-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.cal-dots-legend { min-height: 0; }
/* Téléphone : le badge du symptôme passe dans le coin de la case (l'intensité reste dans le détail du jour). */
@media (max-width: 639px) {
  .topbar { height: 54px; }
  .cal-day { min-height: 66px; }
  .month { padding: 12px 10px 12px; }
  .month-head { margin-bottom: 8px; gap: 2px; }
  .month-head h2 { min-width: 0; font-size: 17.5px; padding: 0 4px; }
  .month-today { height: 32px; padding: 0 11px; font-size: 12.5px; }
  .cal-day .cal-symptom { position: absolute; top: -5px; right: -3px; height: 19px; padding: 0 3px; font-size: 11px; box-shadow: 0 0 0 2px var(--surface); }
  .legend-intensity { display: none; }
  .cal-symptom-n { display: none; }
  .cal-day.has-symptom { border-color: #f6c9c3; }
}
@media (min-width: 640px) {
  .month { padding: 20px 18px 16px; }
  .month-weekdays .wd-long { display: inline; }
  .month-weekdays .wd-short { display: none; }
  .month-grid { gap: 7px; }
  .cal-day { min-height: 92px; padding: 7px 5px 9px; border-radius: 18px; }
  .cal-day.is-future { min-height: 56px; }
  .cal-day .ring { width: 36px; height: 36px; }
  .cal-dot { width: 7px; height: 7px; }
  .cal-symptom { height: 22px; font-size: 12px; padding: 0 7px 0 4px; }
  .cal-symptom-n { font-size: 12px; }
}

/* ---------- Accueil : panneau du jour ---------- */
.day-panel { min-width: 0; }
.day-panel-hint { display: none; }
@media (min-width: 1100px) {
  .page-home { grid-template-columns: minmax(0, 1fr) 410px; align-items: start; }
  .home-side {
    position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain;
    display: grid; gap: 14px; align-content: start; padding: 2px 4px 4px; margin: -2px -4px 0;
  }
  .day-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px; }
  .day-panel-hint { display: block; }
  .day-close { display: none !important; }
  .write-btn { display: none; }
}
@media (max-width: 1099px) {
  .home-side { display: contents; }
  .side-composer { display: none; }
  .day-panel:not(.is-explicit) { display: none; }
  .day-panel.is-explicit {
    position: fixed; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain;
    background: var(--page); padding: calc(10px + env(safe-area-inset-top)) 14px calc(30px + env(safe-area-inset-bottom));
    animation: sheet-in 0.22s ease;
  }
  body.sheet-open { overflow: hidden; }
  .day-panel.is-explicit .day-head { top: calc(-10px - env(safe-area-inset-top)); background: var(--page); padding: 6px 0; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.day { display: grid; gap: 14px; }
.day-head { display: flex; align-items: center; gap: 4px; position: sticky; top: -18px; z-index: 2; background: inherit; padding: 2px 0; }

.day-head-title { flex: 1; display: grid; text-align: center; min-width: 0; }
.day-head-title h2 { font-size: 18px; font-weight: 850; }
.day-head-sub { font-size: 13px; color: var(--green-strong); font-weight: 750; }
@media (min-width: 1100px) { .day-head { background: var(--surface); top: 0; } }
.day-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.day-stat { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--green-softer); flex-wrap: wrap; }
.day-stat-wide { grid-column: 1 / -1; }
.day-stat-wide .meter { flex-basis: 100%; }
.day-stat-sugar { background: var(--amber-soft); }
.day-stat-emoji { font-size: 20px; line-height: 1; }
.day-stat-body { display: grid; line-height: 1.2; min-width: 0; }
.day-stat-body strong { font-size: 16.5px; font-weight: 850; }
.day-stat-body span { font-size: 12.5px; color: var(--ink-2); }
.day-empty { display: grid; justify-items: center; gap: 6px; padding: 26px 16px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.day-empty-art { font-size: 34px; line-height: 1; }
.day-empty-title { font-weight: 800; font-size: 16px; }
.manual { display: grid; gap: 8px; justify-items: start; }
.manual-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Chronologie d'un jour ---------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--coral-soft); color: var(--coral-strong); font-weight: 700; }
.timeline { display: grid; gap: 10px; }
.entry { display: grid; grid-template-columns: 46px 1fr; gap: 6px; }
.entry-time { position: relative; display: flex; justify-content: center; padding-top: 14px; }
.entry-time time { font-size: 12.5px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.entry-time::after { content: ""; position: absolute; top: 38px; bottom: -12px; width: 2px; border-radius: 2px; background: var(--grid); }
.entry:last-child .entry-time::after { display: none; }
.entry-card { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; min-width: 0; box-shadow: var(--shadow-sm); }
.entry-meal .entry-card { border-left: 4px solid var(--green); }
.entry-symptom .entry-card { border-left: 4px solid var(--coral); }
.entry-factor .entry-card { border-left: 4px solid var(--axis); }
.entry-main { display: grid; gap: 7px; padding: 12px 14px; min-width: 0; }
.entry-head { display: flex; align-items: center; gap: 8px; }
.entry-emoji { font-size: 20px; line-height: 1; }
.entry-title { font-size: 15px; }
.entry-summary { font-weight: 700; }
.entry-items { color: var(--ink-2); font-size: 14px; }
.entry-meta { color: var(--muted); font-size: 13.5px; }
.entry-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.entry-actions .btn { height: 30px; padding: 0 11px; font-size: 13px; }
.thumb { display: block; width: 100%; height: 150px; padding: 0; border: 0; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-size: 11.5px; font-weight: 800; }
.badge-watch { background: var(--coral-soft); color: var(--coral-strong); margin-left: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 650; }
.chip-food { background: var(--green-softer); color: var(--green-deep); }
.chip-sugar { background: var(--amber-soft); color: var(--amber-strong); }
.chip-neutral { background: var(--surface-3); color: var(--ink-2); }
.chip-symptom { background: var(--coral-soft); color: var(--coral-strong); }
.chip-alert { background: var(--coral-soft); color: var(--coral-strong); font-weight: 800; }
.chip-alert::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }
.empty { padding: 30px 18px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: grid; gap: 6px; box-shadow: var(--shadow-sm); }
.empty-title { font-weight: 800; }

/* ---------- Semaine : grille ---------- */
.heat-card { padding-bottom: 14px; }
.heat-scroll { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
.heat { border-collapse: separate; border-spacing: 3px; width: 100%; max-width: 900px; margin: 0 auto; font-variant-numeric: tabular-nums; }
.heat th, .heat td { padding: 0; }
.heat-corner { width: 1%; }
.heat-day { font-weight: 500; padding-bottom: 4px !important; }
.heat-day a { display: grid; justify-items: center; gap: 1px; color: var(--ink-2); text-decoration: none; padding: 4px 0; border-radius: 12px; }
.heat-day a:hover { background: var(--green-softer); }
.heat-letter { font-size: 12px; font-weight: 850; }
.heat-date { font-size: 12px; color: var(--muted); }
.heat-day.is-today a { background: var(--green-strong); color: #ffffff; }
.heat-day.is-today .heat-date { color: #ffffff; font-weight: 800; }
.heat-label {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  text-align: left; font-size: 13px; font-weight: 700; white-space: nowrap; padding-right: 10px !important; color: var(--ink-2);
}
.heat-emoji { margin-right: 5px; }
.heat-cell { height: 34px; min-width: 32px; text-align: center; font-size: 12.5px; font-weight: 800; border-radius: 10px; color: var(--ink); }
.heat-none { color: var(--axis); font-weight: 500; }
.heat-green-0, .heat-amber-0, .heat-neutral-0 { background: var(--g0); color: var(--muted); }
.heat-green-1 { background: var(--g1); } .heat-green-2 { background: var(--g2); } .heat-green-3 { background: var(--g3); } .heat-green-4 { background: var(--g4); }
.heat-green-5 { background: var(--g5); color: #ffffff; }
.heat-amber-1 { background: var(--a1); } .heat-amber-2 { background: var(--a2); } .heat-amber-3 { background: var(--a3); } .heat-amber-4 { background: var(--a4); } .heat-amber-5 { background: var(--a5); }
.heat-neutral-1 { background: var(--n1); } .heat-neutral-2 { background: var(--n2); } .heat-neutral-3 { background: var(--n3); } .heat-neutral-4 { background: var(--n4); }
.heat-neutral-5 { background: var(--n5); color: #ffffff; }
.heat-cell:not(.heat-none):hover { outline: 2px solid var(--green-deep); outline-offset: -2px; }
.heat-symptom { background: var(--coral-soft); color: var(--coral-strong); }
.heat-symptom > span:last-child { margin-left: 4px; }
.symptom-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px var(--surface); vertical-align: 0; }
.scale-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.scale-swatch { width: 18px; height: 10px; border-radius: 4px; }
.legend-sep { width: 10px; }
.heat .v-short { display: none; }
@media (max-width: 600px) {
  .heat-card { padding: 16px 10px 12px; }
  .heat { border-spacing: 2px; }
  .heat-label { font-size: 12px; padding-right: 4px !important; }
  .heat-emoji { margin-right: 3px; }
  .heat-cell { font-size: 11.5px; border-radius: 8px; }
  .heat .v-short { display: inline; }
  .heat .v-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.report-text { line-height: 1.65; }
.report { border-top: 4px solid var(--leaf); }
.report-empty { display: grid; gap: 10px; justify-items: start; }
.report-empty h2 { margin: 0; }

/* ---------- Filtres ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.segment { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 750; color: var(--ink-2); }
.segment:hover { color: var(--ink); }
.segment[aria-pressed="true"] { background: var(--green-strong); color: #ffffff; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; min-height: 40px; }
.svg-chart { display: block; overflow: visible; font-variant-numeric: tabular-nums; }
.svg-chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.svg-chart .axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.svg-chart .tick { fill: var(--tick); font-size: 11px; font-weight: 600; }
.svg-chart .ref { stroke: var(--ink-2); stroke-width: 1; opacity: 0.45; shape-rendering: crispEdges; }
.svg-chart .value-label { fill: var(--ink); font-size: 12px; font-weight: 800; }
.svg-chart .bar { transition: opacity 0.1s ease; }
.svg-chart .bar-green { fill: var(--green); }
.svg-chart .bar-coral { fill: var(--coral); }
.svg-chart .bar-amber { fill: var(--amber); }
.svg-chart .bar-neutral { fill: var(--deemph); }
.svg-chart .bar.on { opacity: 0.75; }
.svg-chart .bar-partial { fill: var(--axis); }
.svg-chart .hit { fill: transparent; outline: none; }
.svg-chart .hit:focus-visible { fill: var(--green-softer); fill-opacity: 0.8; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.chart-card { margin: 0; display: grid; gap: 8px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.chart-keys { display: flex; flex-wrap: wrap; gap: 2px 12px; width: 100%; font-size: 12px; color: var(--muted); }
.chart-key { display: inline-flex; align-items: center; gap: 5px; }
.key-ref { width: 14px; height: 1px; background: var(--ink-2); opacity: 0.6; }
.key-partial { width: 8px; height: 10px; border-radius: 2px 2px 0 0; background: var(--axis); }
.calendar-scroll { overflow-x: auto; }
.chart-calendar { min-width: 240px; }
.cal { outline: none; }
rect.cal-crisis { fill: var(--coral); }
rect.cal-logged { fill: var(--g3); }
rect.cal-none { fill: var(--surface-3); }
rect.cal:focus-visible { stroke: var(--ink); stroke-width: 2; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin: 10px 0 2px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.legend-swatch.cal-crisis { background: var(--coral); }
.legend-swatch.cal-logged { background: var(--g3); }
.legend-swatch.cal-none { background: var(--surface-3); }
.legend-swatch.cmp-crisis { background: var(--coral); }
.legend-swatch.cmp-other { background: var(--deemph); }

/* Comparaison « avant tes crises » */
.cmp { display: grid; gap: 4px; margin-top: 8px; }
.cmp-row { display: grid; gap: 6px; padding: 10px 6px; border-bottom: 1px solid var(--grid); border-radius: 10px; outline: none; }
.cmp-row:last-child { border-bottom: 0; }
.cmp-row:hover, .cmp-row:focus-visible { background: var(--surface-2); }
.cmp-label { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; }
.cmp-bars { display: grid; gap: 5px; }
.cmp-line { display: flex; align-items: center; gap: 8px; }
.cmp-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.cmp-fill { display: block; height: 100%; border-radius: 999px; }
.cmp-fill.cmp-crisis { background: var(--coral); }
.cmp-fill.cmp-other { background: var(--deemph); }
.cmp-value { width: 44px; text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
@media (min-width: 700px) { .cmp-row { grid-template-columns: minmax(200px, 1fr) 1.3fr; align-items: center; column-gap: 18px; } }

/* ---------- Tableaux ---------- */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px; text-align: left; border-bottom: 1px solid var(--grid); vertical-align: top; white-space: nowrap; }
.table thead th { font-size: 12.5px; font-weight: 800; color: var(--ink-2); border-bottom-color: var(--axis); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }
.table tbody th { font-weight: 700; }
.table .wrap { white-space: normal; min-width: 80px; }
.cell-sub { display: block; font-size: 12.5px; color: var(--muted); }
@media (max-width: 600px) { .table th, .table td { padding: 9px 6px; font-size: 13.5px; } }
.th-unit { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }

/* ---------- Conversation ---------- */
.thread-card { padding: 14px; background: linear-gradient(180deg, #f6fbf3, #ffffff 30%); }
.thread-more { display: flex; justify-content: center; margin-bottom: 8px; }
.thread { display: grid; gap: 6px; }
.day-sep { display: flex; justify-content: center; margin: 12px 0 4px; }
.day-sep span { font-size: 12px; font-weight: 750; color: var(--ink-2); background: var(--surface-3); padding: 4px 12px; border-radius: 999px; }
.bubble-row { display: flex; }
.bubble-row.is-mine { justify-content: flex-end; }
.bubble { max-width: min(82%, 520px); padding: 9px 13px 7px; border-radius: 18px; display: grid; gap: 4px; box-shadow: var(--shadow-sm); }
.bubble-mine { background: #d9f3df; border-bottom-right-radius: 6px; }
.bubble-coach { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.bubble-kind { font-size: 11.5px; font-weight: 850; color: var(--green-strong); }
.bubble-text { overflow-wrap: anywhere; }
.bubble-meta { font-size: 11px; color: var(--muted); justify-self: end; }
.bubble-photo img { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; }
.bubble-audio { width: min(260px, 100%); height: 36px; }

/* ---------- Réglages ---------- */
.kvs { margin: 0; display: grid; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-weight: 750; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status > span:first-child { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; font-size: 12px; font-weight: 900; color: #ffffff; }
.status-good > span:first-child { background: var(--good); }
.status-warning > span:first-child { background: var(--warning); color: var(--ink); }

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