/* Sauge : feuille de style unique, mobile-first. */

:root {
  --bg: #F7F5EF;
  --bg-2: #EFEEE5;
  --card: #FFFFFF;
  --sage: #879B83;
  --sage-dark: #5F765E;
  --sage-light: #E4EBE0;
  --text: #30372F;
  --text-2: #6C7268; /* #777D73 assombri légèrement pour un contraste AA sur fond clair */
  --border: #E5E4DC;
  --accent: #D9BFA7;
  --accent-dark: #9A7556;
  --error: #B4473F;
  --error-bg: #F8E7E4;
  --success-bg: #E4EBE0;
  --info-bg: #EFEEE5;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 1px 2px rgba(48, 55, 47, .04), 0 4px 16px rgba(48, 55, 47, .04);
  --ring: 0 0 0 3px rgba(95, 118, 94, .35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --sidebar: 264px;
  --bottom: 66px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--sage-dark); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-family: var(--serif); font-size: 1.75rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: .98rem; }
p { margin: 0; }
code { font-size: .88em; background: var(--bg-2); padding: .1em .35em; border-radius: 6px; overflow-wrap: anywhere; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { display: none; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs); }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--text); color: #fff; padding: .6rem 1rem; border-radius: var(--radius-xs); }
.skip-link:focus { top: 12px; }

/* ---------- Structure ---------- */
.shell { min-height: 100vh; }
.main-wrap { min-width: 0; }
.main { max-width: 1240px; margin: 0 auto; padding: 20px 16px calc(var(--bottom) + 28px); outline: none; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(86vw, 300px);
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; padding: 18px 14px;
  transform: translateX(-104%); transition: transform .25s ease; visibility: hidden;
}
.sidebar:target, .sidebar.is-open { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(48,55,47,.12); }
.backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(48, 55, 47, .28); opacity: 0; pointer-events: none; transition: opacity .2s; }
.sidebar:target ~ .backdrop, .sidebar.is-open ~ .backdrop { opacity: 1; pointer-events: auto; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--sage-light); color: var(--sage-dark); }
.brand-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.nav-group { margin: 16px 10px 6px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); font-weight: 600; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 8px 12px;
  border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font: inherit; font-size: .95rem;
  background: none; border: 0; cursor: pointer; text-align: left; transition: background .15s, color .15s;
}
.nav-link .icon { color: var(--text-2); }
.nav-link:hover { background: var(--bg); }
.nav-link.is-active { background: var(--sage-light); color: var(--sage-dark); font-weight: 600; }
.nav-link.is-active .icon { color: var(--sage-dark); }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.nav-logout { color: var(--text-2); }

.bottom-nav {
  position: fixed; inset: auto 0 0 0; z-index: 50; height: calc(var(--bottom) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--border); backdrop-filter: blur(8px);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-2); text-decoration: none; font-size: .72rem; }
.bottom-nav a.is-active { color: var(--sage-dark); font-weight: 600; }
.bottom-nav a.is-active .icon { stroke-width: 2.1; }

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--sidebar) 1fr; }
  .sidebar { position: sticky; top: 0; height: 100vh; width: auto; transform: none; visibility: visible; box-shadow: none; }
  .sidebar .sidebar-close, .backdrop, .bottom-nav { display: none; }
  .main { padding: 32px 36px 48px; }
  h1 { font-size: 2rem; }
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.eyebrow { font-size: .8rem; color: var(--text-2); margin-bottom: 4px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Grilles ---------- */
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 10px; }
.grid { display: grid; gap: 16px; }
.cols-2, .cols-3, .cols-4 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.layout-side { display: grid; gap: 16px; }
@media (min-width: 640px) {
  .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .layout-side { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); align-items: start; }
  .layout-side > .side { position: sticky; top: 24px; }
  .span-2 { grid-column: span 2; }
}

/* ---------- Cartes ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
@media (min-width: 640px) { .card { padding: 22px; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-title { display: flex; align-items: center; gap: 10px; }
.card-title .icon { color: var(--sage-dark); }
.card-sub { font-size: .85rem; color: var(--text-2); }
.card-soft { background: var(--bg-2); box-shadow: none; }
.chip-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--sage-light); color: var(--sage-dark); flex: none; }
.chip-icon.accent { background: #F4EBE2; color: var(--accent-dark); }

.stat { display: flex; align-items: center; gap: 14px; }
.stat-value { font-family: var(--serif); font-size: 1.65rem; font-weight: 600; line-height: 1.1; letter-spacing: -.01em; }
.stat-value small { font-family: var(--font); font-size: .85rem; font-weight: 500; color: var(--text-2); margin-left: 3px; }
.stat-label { font-size: .85rem; color: var(--text-2); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; min-width: 0; }
.kpi .stat-value { font-size: 1.35rem; }
.stack > .kpis .kpi, .layout-side > .stack > .kpis .kpi { background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }

.card { container-type: inline-size; }
.hero-cal { display: grid; gap: 18px; }
@container (min-width: 460px) { .hero-cal { grid-template-columns: 190px 1fr; align-items: center; } }
.dash-nut { display: grid; gap: 22px; }
@container (min-width: 820px) { .dash-nut { grid-template-columns: 1.2fr 1fr; align-items: center; } }
.ring { position: relative; width: 168px; height: 168px; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .ring-bg { stroke: var(--sage-light); }
.ring .ring-fg { stroke: var(--sage-dark); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring .ring-fg.is-over { stroke: var(--accent-dark); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center strong { font-family: var(--serif); font-size: 1.9rem; line-height: 1; }
.ring-center span { font-size: .8rem; color: var(--text-2); }

/* ---------- Barres de progression ---------- */
.meter { display: grid; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.meter-top strong { font-weight: 600; }
.progress { height: 8px; border-radius: 99px; background: var(--sage-light); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--sage-dark); transition: width .5s ease; }
.progress.is-protein > span { background: #5F765E; }
.progress.is-carbs > span { background: #A9B88F; }
.progress.is-fat > span { background: var(--accent-dark); }
.progress.is-over > span { background: var(--accent-dark); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--card); color: var(--text);
  font: 500 .95rem/1.2 var(--font); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--sage-dark); border-color: var(--sage-dark); color: #fff; }
.btn-primary:hover { background: #50654F; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--sage-dark); }
.btn-ghost:hover { background: var(--sage-light); }
.btn-danger { color: var(--error); border-color: #EBCFCB; }
.btn-danger:hover { background: var(--error-bg); }
.btn-danger-solid { background: var(--error); border-color: var(--error); color: #fff; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; text-decoration: none;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { background: var(--error-bg); color: var(--error); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form { display: inline; margin: 0; }

.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .quick { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .quick { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.quick a, .quick button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; min-height: 86px; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text);
  text-decoration: none; font: 500 .9rem/1.25 var(--font); cursor: pointer; text-align: left; transition: border-color .15s, background .15s;
}
.quick a:hover, .quick button:hover { border-color: var(--sage); background: #FBFCFA; }
.quick .icon { color: var(--sage-dark); }

/* ---------- Formulaires ---------- */
form { margin: 0; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: .9rem; font-weight: 500; }
.hint { font-weight: 400; color: var(--text-2); font-size: .82rem; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #FDFDFB; color: var(--text); font: inherit; font-size: 16px; transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sage); box-shadow: var(--ring); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }
input[disabled] { background: var(--bg-2); }
.field-error { display: flex; align-items: flex-start; gap: 6px; color: var(--error); font-size: .85rem; }
.field-error .icon { margin-top: 2px; }
.fields { display: grid; gap: 14px; grid-template-columns: 1fr; }
.fields-2 { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) {
  .fields.cols-2-sm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields.cols-3-sm { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fields.cols-4-sm { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .field.full { grid-column: 1 / -1; }
}
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-wrap .btn-icon { position: absolute; right: 3px; top: 3px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: .9rem; font-weight: 500; margin-bottom: 8px; padding: 0; }
.choice-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #FDFDFB; cursor: pointer; font-size: .92rem; transition: border-color .15s, background .15s;
}
.choice span::before { content: ""; width: 16px; height: 16px; flex: none; border: 1.5px solid var(--sage); border-radius: 5px; background: #fff; }
.choice input[type=radio] + span::before { border-radius: 50%; }
.choice input:checked + span { border-color: var(--sage-dark); background: var(--sage-light); font-weight: 500; }
.choice input:checked + span::before { background: var(--sage-dark) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M5 12.5 10 17 19 7'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--sage-dark); }
.choice input:focus-visible + span { box-shadow: var(--ring); }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg-2); border-radius: var(--radius-sm); }
.segmented a, .segmented button { padding: 7px 12px; border-radius: 9px; color: var(--text-2); text-decoration: none; font: 500 .88rem var(--font); border: 0; background: none; cursor: pointer; }
.segmented .is-active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.toggle-row { display: flex; align-items: flex-start; gap: 10px; }
.toggle-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--sage-dark); flex: none; }
.form-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.calc-preview { background: var(--bg); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .9rem; }
.calc-preview strong { font-weight: 600; }
.searchbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.searchbar input, .searchbar select { flex: 1 1 180px; width: auto; }

/* ---------- Listes d'entrées ---------- */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.entry:first-child { border-top: 0; }
.entry-main { flex: 1; min-width: 0; }
.entry-title { font-weight: 500; overflow-wrap: anywhere; }
.entry-meta { font-size: .84rem; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 2px 10px; }
.entry-value { text-align: right; font-weight: 600; white-space: nowrap; }
.entry-value small { display: block; font-weight: 400; color: var(--text-2); font-size: .8rem; }
.entry-actions { display: flex; gap: 2px; flex: none; }
.entry.is-done .entry-title { text-decoration: line-through; color: var(--text-2); }
.meal-block + .meal-block { margin-top: 18px; }
.meal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.meal-head h3 { display: flex; align-items: center; gap: 8px; }
.meal-head .icon { color: var(--sage-dark); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); font-weight: 600; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
@media (max-width: 639px) {
  .table-stack thead { display: none; }
  .table-stack tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .table-stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; }
  .table-stack td::before { content: attr(data-label); color: var(--text-2); font-size: .85rem; }
  .table-stack td.num { text-align: right; }
}

/* ---------- Badges, messages ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 500; background: var(--bg-2); color: var(--text); white-space: nowrap; }
.badge-sage { background: var(--sage-light); color: var(--sage-dark); }
.badge-accent { background: #F4EBE2; color: var(--accent-dark); }
.badge-estimate { background: transparent; border: 1.5px dashed var(--accent-dark); color: var(--accent-dark); }
.badge-warn { background: var(--error-bg); color: var(--error); }

.flash-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: .93rem; border: 1px solid transparent; }
.flash p { flex: 1; padding-top: 1px; }
.flash .icon { margin-top: 1px; }
.flash-success { background: var(--success-bg); color: #3F553F; border-color: #D3DECD; }
.flash-error { background: var(--error-bg); color: #8E342E; border-color: #EFD2CD; }
.flash-info { background: var(--info-bg); color: var(--text); border-color: var(--border); }
.flash-close { width: 28px; height: 28px; margin: -3px -4px 0 0; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); font-size: .9rem; }
.notice .icon { color: var(--sage-dark); margin-top: 1px; }
.notice.warn { background: #F7EEE6; }
.notice.warn .icon { color: var(--accent-dark); }
.notice.danger { background: var(--error-bg); }
.notice.danger .icon { color: var(--error); }

.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 26px 12px; color: var(--text-2); }
.empty .chip-icon { width: 46px; height: 46px; }
.empty strong { color: var(--text); font-weight: 600; }

/* ---------- Navigation par date ---------- */
.datenav { display: flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.datenav input[type=date] { border: 0; min-height: 38px; width: 150px; background: transparent; padding: 6px 8px; }
.datenav-caption { display: none; }

/* ---------- Calendrier ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.cal-head h2 { font-family: var(--serif); font-size: 1.3rem; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: .74rem; color: var(--text-2); padding: 4px 0; text-transform: uppercase; letter-spacing: .04em; }
.cal-day {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  aspect-ratio: 1 / 1.05; min-height: 44px; padding-top: 6px; border-radius: 12px; text-decoration: none; color: var(--text);
  border: 1.5px solid transparent; background: var(--bg); font-size: .92rem; transition: background .15s, border-color .15s;
}
.cal-day:hover { border-color: var(--sage); }
.cal-day.is-out { background: transparent; color: #B7B9B1; }
.cal-day.is-today .cal-num { background: var(--text); color: #fff; border-radius: 99px; padding: 0 7px; }
.cal-day.is-selected { border-color: var(--sage-dark); box-shadow: var(--ring); }
.cal-day.is-period { background: var(--sage-dark); color: #fff; }
.cal-day.is-period.is-out { background: #B9C6B6; }
.cal-day.is-estimate { background: repeating-linear-gradient(135deg, #FBF5EF 0 6px, #F2E6DA 6px 12px); border: 1.5px dashed var(--accent-dark); }
.cal-day.is-ovulation { border: 1.5px dotted var(--sage-dark); background: var(--sage-light); }
.cal-marks { display: flex; gap: 3px; min-height: 8px; }
.cal-mark { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-dark); }
.cal-day.is-period .cal-mark { background: #fff; }
.cal-tag { font-size: .62rem; line-height: 1; letter-spacing: .02em; }
@media (max-width: 420px) { .cal-tag { display: none; } }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: .84rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 18px; height: 18px; border-radius: 6px; display: inline-block; }
.legend .lg-period { background: var(--sage-dark); }
.legend .lg-estimate { background: repeating-linear-gradient(135deg, #FBF5EF 0 4px, #F2E6DA 4px 8px); border: 1.5px dashed var(--accent-dark); }
.legend .lg-ovulation { background: var(--sage-light); border: 1.5px dotted var(--sage-dark); }
.legend .lg-symptom { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-dark); }

/* ---------- Graphiques ---------- */
.chart { margin: 0; min-width: 0; }
.chart-box { position: relative; width: 100%; min-height: 200px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart svg:focus-visible { box-shadow: var(--ring); border-radius: var(--radius-xs); }
.chart .c-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .c-axis { fill: var(--text-2); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .c-line { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart .c-dot { transition: r .15s ease; }
.chart .c-dot.is-active { stroke-width: 2.6; }
.chart .c-last { font: 600 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .c-goal { stroke: var(--accent-dark); stroke-dasharray: 6 5; stroke-width: 1.4; opacity: .85; }
.chart .c-guide { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; transition: opacity .12s; }
.chart .c-guide.is-on { opacity: .55; }
.chart .c-bar { transition: opacity .15s; }
.chart .c-bar.is-dim { opacity: .45; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--text-2); margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.chart-legend i.is-goal { width: 16px; height: 0; border-radius: 0; border-top: 2px dashed var(--accent-dark); }
.chart-tip { position: absolute; pointer-events: none; display: grid; gap: 3px; background: var(--text); color: #fff; font-size: .8rem; line-height: 1.35; padding: 8px 11px; border-radius: 10px; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); opacity: 0; transition: opacity .12s; z-index: 2; box-shadow: 0 6px 20px rgba(48,55,47,.18); }
.chart-tip.is-on { opacity: 1; }
.chart-tip strong { font-weight: 600; font-size: .78rem; opacity: .8; }
.chart-tip span { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; }
.chart-tip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1.5px rgba(255,255,255,.7); }
.chart-empty { display: grid; place-items: center; min-height: 160px; text-align: center; color: var(--text-2); font-size: .9rem; background: var(--bg); border-radius: var(--radius-sm); padding: 16px; }
details.data-table { margin-top: 10px; font-size: .88rem; }
details.data-table summary { cursor: pointer; color: var(--sage-dark); }

/* ---------- Connexion ---------- */
.body-blank { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, var(--sage-light), transparent 60%), var(--bg); }
.blank-main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(100%, 420px); background: var(--card); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); padding: 32px 24px; display: grid; gap: 16px; text-align: left; }
@media (min-width: 640px) { .auth-card { padding: 40px 36px; } }
.auth-card h1 { font-size: 1.9rem; }
.auth-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--sage-light); color: var(--sage-dark); }
.auth-mark .icon { width: 26px; height: 26px; }
.auth-lead { margin-top: -6px; }
.auth-foot { font-size: .82rem; text-align: center; }
.error-card { text-align: center; justify-items: center; }

/* ---------- Divers ---------- */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 12px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.prose { display: grid; gap: 12px; max-width: 72ch; }
.prose h2 { margin-top: 10px; font-family: var(--serif); font-size: 1.25rem; }
.prose ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 4px; }
.recipe-card { display: grid; gap: 8px; text-decoration: none; color: inherit; transition: border-color .15s; }
.recipe-card:hover { border-color: var(--sage); }
.ing-row { display: grid; gap: 8px; grid-template-columns: 1fr; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #FDFDFB; }
@media (min-width: 800px) { .ing-row { grid-template-columns: 1.6fr .7fr .8fr repeat(4, .7fr) auto; align-items: end; } }
.ing-row .field > label { font-size: .78rem; }
.ing-row input, .ing-row select { min-height: 42px; }
.ing-food { grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 500; }
.danger-zone { border-color: #EBCFCB; }
.measure-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.measure-grid .kpi .stat-value { font-size: 1.3rem; }
.delta { font-weight: 600; color: var(--text); }
.table-measures th, .table-measures td { font-size: .85rem; padding: 8px 6px; }
.tips { display: grid; gap: 4px; padding-left: 1.1rem; margin: 0; }
.input-narrow { width: 90px !important; min-height: 38px !important; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.nowrap { white-space: nowrap; }
.wrap-anywhere { overflow-wrap: anywhere; }
@media print { .sidebar, .bottom-nav, .page-actions, .entry-actions, form { display: none !important; } .shell { display: block; } .card { box-shadow: none; } }
.chart .c-last { paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
