:root {
  --rose: #E8B9C5;
  --rose-light: #F8E8ED;
  --cream: #FFF9F3;
  --lavender: #DCD5F2;
  --text: #403640;
  --white: #FFFFFF;
  --text-soft: #6E5F6C;
  --accent: #9E4F68;      /* rose profond : contraste suffisant sur blanc et crème */
  --accent-2: #6B5BA6;    /* lavande profonde */
  --line: #EEDDE3;
  --ok: #3E7A5A;
  --ok-bg: #E3F1E8;
  --warn: #8A5A14;
  --warn-bg: #FBEFD9;
  --danger: #A33A4E;
  --danger-bg: #FADDE3;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 6px 20px rgba(64, 54, 64, 0.07);
  --tabbar-h: 70px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--cream);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
small, .muted { color: var(--text-soft); }
.muted { font-size: .92rem; }
.ic { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--white); padding: 8px 12px; border-radius: 10px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; border-radius: 8px; }

/* ---------- Structure ---------- */
#app { min-height: 100vh; min-height: 100dvh; }
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--cream) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
#topbar .title { flex: 1; font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 6px; min-width: 0; }
#topbar .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-status { font-size: .8rem; color: var(--text-soft); white-space: nowrap; min-width: 18px; text-align: center; }
.save-status.error { color: var(--danger); font-weight: 600; }
main {
  max-width: 760px; margin: 0 auto;
  padding: 8px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  outline: none;
}
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--white);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 18px rgba(64, 54, 64, 0.05);
}
#tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--tabbar-h); text-decoration: none; color: var(--text-soft);
  font-size: .76rem; font-weight: 600;
}
#tabbar a .pill { display: grid; place-items: center; width: 52px; height: 32px; border-radius: 16px; transition: background .2s; }
#tabbar a[aria-current="page"] { color: var(--accent); }
#tabbar a[aria-current="page"] .pill { background: var(--rose-light); }

/* ---------- Cartes ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 185, 197, .25);
}
main.entering .card { animation: rise .35s ease both; }
.card.soft { background: var(--rose-light); box-shadow: none; }
.card.lav { background: #F1EEFB; box-shadow: none; border-color: var(--lavender); }
.card.warn { background: var(--warn-bg); border-color: #F1D9AE; box-shadow: none; }
.card.danger { background: var(--danger-bg); border-color: #F2B9C4; box-shadow: none; }
.card.ok { background: var(--ok-bg); border-color: #C7E3D1; box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hello { padding: 10px 2px 6px; }
.hello h1 { margin-bottom: 2px; }
.hello .date { color: var(--text-soft); text-transform: none; }
.quote { font-style: italic; color: var(--text-soft); margin-top: 6px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* ---------- Boutons ---------- */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px;
  border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--rose); color: var(--text); }
.btn-primary:hover { background: #E2A9B8; }
.btn-lav { background: var(--lavender); color: var(--text); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-white { background: var(--white); border-color: var(--line); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 6px 14px; font-size: .92rem; }
.danger-text { color: var(--danger); }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-weight: 600; min-height: 32px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 0; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--rose-light); }
.icon-btn.filled { background: var(--white); box-shadow: var(--shadow); }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.row-btns > .btn { flex: 1 1 auto; }
.sticky-btns { position: sticky; bottom: -1px; background: var(--white); padding: 12px 0 calc(env(safe-area-inset-bottom) + 4px); margin-bottom: -4px; }

.overwhelm-btn {
  width: 100%; min-height: 56px; border-radius: var(--radius);
  background: var(--lavender); border: 0; font-weight: 700; font-size: 1.05rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px;
}

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick a, .quick button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 86px; padding: 10px 6px; border-radius: var(--radius-sm);
  background: var(--cream); border: 1px solid var(--line); color: var(--text);
  text-decoration: none; font-weight: 600; font-size: .88rem; text-align: center; cursor: pointer;
}
.quick a:hover, .quick button:hover { background: var(--rose-light); }
.quick .ic { color: var(--accent); }

/* ---------- Énergie ---------- */
.energy { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.energy button {
  min-height: 64px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--cream);
  cursor: pointer; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.energy button .em { font-size: 1.4rem; line-height: 1; }
.energy button[aria-pressed="true"] { background: var(--rose-light); border-color: var(--rose); }

/* ---------- Onglets / puces ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 6px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-height: 42px; padding: 8px 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--white); cursor: pointer; font-weight: 600; font-size: .93rem;
}
.tab.active { background: var(--rose); border-color: var(--rose); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span, .chip-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--white); font-weight: 600; font-size: .92rem; cursor: pointer;
}
.chip input:checked + span, .chip-btn.active { background: var(--rose-light); border-color: var(--rose); }
.chip input:focus-visible + span { outline: 3px solid var(--accent-2); outline-offset: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; background: var(--cream); border: 1px solid var(--line); white-space: nowrap;
}
.badge-urgente { background: #F9D9E0; color: #82293F; border-color: #F2C0CB; }
.badge-importante { background: #E8E2F8; color: #4F3F87; border-color: #D5CBF1; }
.badge-facultative { background: #EEF2EA; color: #44573C; border-color: #DCE5D5; }
.badge-demo { background: #FFF1C9; color: #6D5100; border-color: #F3DD98; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: #C7E3D1; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: #F1D9AE; }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; word-break: break-word; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; font-size: .85rem; color: var(--text-soft); align-items: center; }
.item.done .item-title { text-decoration: line-through; color: var(--text-soft); }
.item-actions { display: flex; gap: 2px; flex: none; }
.section-title { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); margin: 14px 0 4px; }

.checkbox {
  flex: none; width: 32px; height: 32px; margin-top: 2px; border-radius: 50%;
  border: 2px solid var(--rose); background: var(--white); display: grid; place-items: center; cursor: pointer; color: transparent;
}
.checkbox[aria-checked="true"] { background: var(--rose); color: var(--text); }
.checkbox:active { transform: scale(.92); }

/* ---------- Formulaires ---------- */
.form .fields { display: flex; flex-wrap: wrap; gap: 0 12px; }
.field { width: 100%; margin-bottom: 14px; }
.field.half { width: calc(50% - 6px); }
.field label, .chips-field legend { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.chips-field { border: 0; padding: 0; margin: 0; }
.req { color: var(--accent); }
input[type=text], input[type=date], input[type=time], input[type=number], input[type=password], input[type=search], input[type=email], input[type=tel], select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--cream); font: inherit; color: var(--text);
  -webkit-appearance: none; appearance: none;
}
input[type=date], input[type=time] { min-width: 0; display: block; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%), linear-gradient(135deg, var(--text-soft) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); outline: none; box-shadow: 0 0 0 3px rgba(107, 91, 166, .18); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
.field-error { color: var(--danger); font-weight: 600; display: block; }
.field-error:empty { display: none; }
.hint { display: block; margin-top: 4px; font-size: .84rem; }
.check { display: flex !important; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 500 !important; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.money-input { position: relative; }
.money-input span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-soft); }
.form-error { background: var(--danger-bg); color: var(--danger); padding: 10px 12px; border-radius: 12px; font-weight: 600; }
.form-intro { margin-bottom: 12px; color: var(--text-soft); }
.field-info { width: 100%; margin-bottom: 12px; }
.draft-note { background: var(--ok-bg); color: var(--ok); padding: 8px 12px; border-radius: 12px; margin-bottom: 12px; font-size: .9rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form input { flex: 1; }
.searchbar { position: relative; margin-bottom: 10px; }
.searchbar .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-soft); }
.searchbar input { padding-left: 44px; background: var(--white); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select { width: auto; min-height: 42px; padding: 8px 36px 8px 12px; font-size: .92rem; background-color: var(--white); background-position: calc(100% - 20px) 18px, calc(100% - 15px) 18px; }

/* ---------- Feuille modale ---------- */
dialog#sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px;
  max-height: 92dvh; border-radius: 26px 26px 0 0; background: var(--white); color: var(--text);
  box-shadow: 0 -10px 40px rgba(64, 54, 64, .2);
}
dialog#sheet[open] { animation: sheetIn .28s ease both; }
dialog#sheet::backdrop { background: rgba(64, 54, 64, .35); }
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) { dialog#sheet { margin: auto; border-radius: 26px; } }
#sheet-body { max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--white); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 12px 8px 20px; }
.sheet-head h2 { margin: 0; }
.sheet-content { padding: 4px 20px 20px; }
.lead { font-size: 1.05rem; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 84px); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 560px; width: 100%; display: flex; align-items: center; gap: 10px;
  background: var(--text); color: var(--white); padding: 6px 4px 6px 14px; border-radius: 14px; box-shadow: var(--shadow); font-size: .93rem;
  animation: rise .25s ease both; transition: opacity .25s;
}
.toast span { flex: 1; }
.toast.out { opacity: 0; }
.toast-error { background: var(--danger); }
.toast-reminder { background: var(--accent-2); }
.toast-btn { background: var(--rose); color: var(--text); border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 700; cursor: pointer; min-height: 40px; }
.toast-close { background: none; border: 0; color: inherit; cursor: pointer; width: 40px; height: 40px; display: grid; place-items: center; }

/* ---------- Divers ---------- */
.progress { height: 12px; background: var(--rose-light); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--rose), #D79AB0); border-radius: 999px; transition: width .4s ease; }
.progress.lav { background: #EFEBFA; }
.progress.lav span { background: linear-gradient(90deg, var(--lavender), #B9ADE6); }
.progress.over span { background: #E59AAA; }
.ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; flex: none; display: grid; place-items: center; background: conic-gradient(var(--rose) calc(var(--p) * 1%), var(--rose-light) 0); }
.ring b { width: 58px; height: 58px; border-radius: 50%; background: var(--white); display: grid; place-items: center; font-size: 1rem; }
.flex { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stat { background: var(--cream); border-radius: var(--radius-sm); padding: 12px; }
.stat .label { font-size: .82rem; color: var(--text-soft); font-weight: 600; }
.stat .value { font-size: clamp(1rem, 4.6vw, 1.2rem); font-weight: 800; overflow-wrap: anywhere; }
.grid3 .stat { padding: 10px 8px; min-width: 0; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.empty { text-align: center; padding: 18px 10px; color: var(--text-soft); }
.empty-emoji { font-size: 2rem; margin-bottom: 6px; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); z-index: 25;
  min-height: 56px; padding: 0 22px; border-radius: 999px; border: 0; background: var(--rose); color: var(--text);
  font-weight: 800; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 8px 22px rgba(158, 79, 104, .28); cursor: pointer; font-size: 1rem;
}
.notice { font-size: .9rem; padding: 10px 12px; border-radius: 12px; background: #F1EEFB; }
.notice.warn { background: var(--warn-bg); }
.kbd-num { font-variant-numeric: tabular-nums; }

/* Calendrier */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.cal-nav strong { text-align: center; flex: 1; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-grid .dow { text-align: center; font-size: .75rem; font-weight: 700; color: var(--text-soft); padding: 4px 0; }
.month-grid button {
  aspect-ratio: 1 / 1.05; min-height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--white);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px; gap: 3px; cursor: pointer; font-weight: 600; font-size: .9rem;
}
.month-grid button.other { opacity: .4; }
.month-grid button.today { border: 2px solid var(--accent); }
.month-grid button.sel { background: var(--rose-light); }
.dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rose); }
.dot.ev { background: var(--accent-2); }
.dot.bill { background: #D9A441; }
.week-day { padding: 10px 0; border-bottom: 1px solid var(--line); }
.week-day h4 { margin: 0 0 4px; text-transform: capitalize; font-size: .95rem; }
.week-day.today h4 { color: var(--accent); }
.cal-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: .95rem; }
.cal-item .tag { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--rose); }
.cal-item .tag.ev { background: var(--accent-2); }
.cal-item .tag.bill { background: #D9A441; }
.cal-item .tag.child { background: #7FB89A; }
.cal-item .tag.proj { background: #9E4F68; }

/* Minuteur */
.timer { text-align: center; padding: 10px 0; }
.timer-ring { width: 220px; height: 220px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--rose) calc(var(--p, 0) * 1%), var(--rose-light) 0); }
.timer-ring div { width: 184px; height: 184px; border-radius: 50%; background: var(--white); display: grid; place-items: center; }
.timer-time { font-size: 2.8rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Graphiques */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(84px, 32%) 1fr auto; align-items: center; gap: 10px; font-size: .92rem; }
.bar-row .track { height: 14px; background: var(--rose-light); border-radius: 999px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--rose); border-radius: 999px; }
.bar-row .fill.over { background: #D9788F; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark { width: 100%; height: 120px; }
.spark text { font-size: 10px; fill: var(--text-soft); }

/* Humeur */
.moods { display: flex; justify-content: space-between; gap: 6px; }
.moods button { flex: 1; min-height: 58px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--cream); font-size: 1.6rem; cursor: pointer; }
.moods button[aria-pressed="true"] { background: var(--rose-light); border-color: var(--rose); }
.mood-strip { display: flex; gap: 4px; overflow-x: auto; padding: 4px 0; }
.mood-strip div { flex: none; width: 40px; text-align: center; font-size: .72rem; color: var(--text-soft); }
.mood-strip div span { display: block; font-size: 1.3rem; }
.habit-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.habit-grid button { min-height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--white); cursor: pointer; font-size: .72rem; font-weight: 700; color: var(--text-soft); padding: 2px; }
.habit-grid button[aria-pressed="true"] { background: var(--lavender); border-color: #B9ADE6; color: var(--text); }

/* Mode débordée */
.calm { text-align: center; padding: 18px 4px 4px; }
.calm .breath { width: 120px; height: 120px; margin: 10px auto 16px; border-radius: 50%; background: radial-gradient(circle, var(--lavender), var(--rose-light)); animation: breathe 8s ease-in-out infinite; display: grid; place-items: center; font-weight: 700; color: var(--text-soft); font-size: .85rem; }
@keyframes breathe { 0%, 100% { transform: scale(.82); } 50% { transform: scale(1.05); } }

.lockscreen { text-align: center; }
.lockscreen .big-ic { width: 72px; height: 72px; margin: 6px auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--rose-light); color: var(--accent); }
.urgent-list { margin: 6px 0 10px; padding-left: 20px; }
.urgent-list li { margin-bottom: 4px; }
.call-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.call-btns a { flex: 1 1 120px; }
.doc-preview { white-space: pre-wrap; background: var(--cream); padding: 12px; border-radius: 12px; font-size: .92rem; }
details summary { cursor: pointer; font-weight: 700; min-height: 40px; display: flex; align-items: center; }
.policy h3 { margin-top: 14px; }
.steps-list .item { padding: 8px 0; }
.child-switch { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 4px; }
table.simple { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.simple th, table.simple td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--text-soft); font-size: .8rem; text-transform: uppercase; }


/* ---------- Mon rendez-vous avec Dieu ---------- */
:root { --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif; --hl-rose: #F6D3DC; --hl-lavande: #E3DDF6; --hl-miel: #FBEBC2; }
.eyebrow { font-size: .76rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.scripture { font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; margin: 10px 0 6px; padding: 0 0 0 14px; border-left: 3px solid var(--rose); color: var(--text); }
.verse-card.big .scripture { font-size: 1.28rem; }
.ref-line { margin: 0 0 6px; }
.spirit-home { background: linear-gradient(160deg, var(--white) 0%, #FBF3F6 100%); }
.verse-mini { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; padding: 12px 14px; margin: 6px 0; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--cream); cursor: pointer; font: inherit; color: inherit; }
.verse-mini span { font-family: var(--serif); font-size: 1.05rem; line-height: 1.5; }
.verse-mini b { font-size: .85rem; color: var(--accent); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 8px; }
.book-btn { display: flex; align-items: center; min-height: 48px; padding: 8px 12px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; }
.book-btn:hover { background: var(--rose-light); }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.chapter-btn { display: grid; place-items: center; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--cream); color: var(--text); text-decoration: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.chapter-btn.read { background: var(--lavender); border-color: #C9BFEA; }
.reader-bar { position: sticky; top: calc(env(safe-area-inset-top) + 64px); z-index: 5; display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; background: var(--cream); }
.reader { font-family: var(--serif); font-size: var(--reader-size, 19px); line-height: var(--reader-lh, 1.75); max-width: 38em; margin: 0 auto; color: var(--text); }
.reader .verse { cursor: pointer; border-radius: 6px; padding: 1px 0; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.reader .verse:hover { background: rgba(232, 185, 197, .18); }
.reader sup { font-family: var(--font); font-size: .62em; font-weight: 700; color: var(--accent); margin-right: 3px; vertical-align: super; }
.reader .mark { font-family: var(--font); font-size: .7em; color: var(--accent); }
.hl-rose { background: var(--hl-rose) !important; }
.hl-lavande { background: var(--hl-lavande) !important; }
.hl-miel { background: var(--hl-miel) !important; }
.verse-flash { animation: flash 2s ease 1; }
@keyframes flash { 0%, 40% { background: var(--hl-miel); } 100% { background: transparent; } }
.link-row { background: none; border: 0; text-align: left; padding: 0; cursor: pointer; font: inherit; color: inherit; }
.prayer-topics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.prayer-steps { padding-left: 20px; margin: 8px 0 12px; }
.prayer-steps li { margin-bottom: 6px; }
.prayer { font-family: var(--serif); font-style: italic; font-size: 1.05rem; }
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { padding: 5px 0; }
#sheet h4 { margin: 14px 0 4px; font-size: 1rem; color: var(--accent); }

/* Lecture de nuit : appliquée à toute la page pendant la lecture de la Bible. */
body.reader-dark {
  --cream: #1E1A20; --white: #2A242C; --text: #EDE3EA; --text-soft: #B9AAB6; --line: #3C343F;
  --rose-light: #3A2B33; --lavender: #3A3352; --accent: #F0A9BE; --accent-2: #B9ADE6;
  --hl-rose: #5A3442; --hl-lavande: #3F3762; --hl-miel: #5A4A22;
  color-scheme: dark;
}
body.reader-dark #topbar { background: color-mix(in srgb, var(--cream) 92%, transparent); }
body.reader-dark .btn-primary { background: var(--accent); color: #1E1A20; }
body.reader-dark .btn-lav { color: var(--text); }
body.reader-dark .notice { background: var(--white); }


/* ---------- L'aimer dans son langage ---------- */
.love-sub { margin: 0 0 10px; }
.love-card { border-color: #F0C9D3; background: linear-gradient(170deg, var(--white) 0%, #FDF1F4 100%); }
.love-card.is-done { background: linear-gradient(170deg, var(--white) 0%, #F3EEFB 100%); }
.love-title { font-size: 1.35rem; margin: 10px 0 8px; text-wrap: balance; }
.love-h { font-size: .92rem; color: var(--accent); margin: 14px 0 4px; }
.love-check {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 60px; margin-top: 8px;
  border-radius: 999px; border: 2px solid var(--rose); background: var(--white); color: var(--text);
  font: inherit; font-weight: 800; font-size: 1.08rem; cursor: pointer; transition: background .2s, transform .12s;
}
.love-check:active { transform: scale(.98); }
.love-check .box { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--rose); display: grid; place-items: center; font-size: 1rem; background: var(--white); }
.love-check.done { background: var(--rose); border-color: var(--rose); }
.love-check.done .box { border-color: var(--white); }
.love-check.compact { min-height: 52px; font-size: 1rem; }
.love-thanks { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--rose-light); font-weight: 600; }
.love-home { background: linear-gradient(160deg, var(--white) 0%, #FDF0F3 100%); }
.love-day { aspect-ratio: 1 / 1.05; min-height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 5px; gap: 1px; font-weight: 600; font-size: .9rem; }
.love-day i { font-style: normal; font-size: .85rem; line-height: 1; color: var(--text-soft); }
.love-day.other { opacity: .4; }
.love-day.today { border: 2px solid var(--accent); }
.love-day.done { background: var(--rose-light); border-color: var(--rose); }
.lesson summary { font-size: 1.05rem; }
.lesson p { margin-top: 10px; }


/* ---------- Mon suivi Ritaline ---------- */
.meds-add {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 64px; margin: 0 0 14px;
  border: 0; border-radius: var(--radius); background: var(--rose); color: var(--text);
  font: inherit; font-weight: 800; font-size: 1.15rem; cursor: pointer; box-shadow: 0 8px 22px rgba(158, 79, 104, .22);
}
.meds-add:active { transform: scale(.98); }
.meds-add.compact { min-height: 54px; font-size: 1.05rem; margin: 12px 0 0; box-shadow: none; }
.meds-status { margin: 0; }
.meds-status.none { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--cream); color: var(--text-soft); }
.meds-status.ok { display: grid; gap: 2px; }
.meds-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.meds-line:last-child { border-bottom: 0; }
.meds-line span { color: var(--text-soft); }
.meds-ok { color: var(--ok); }
.meds-pill { font-size: 1.2rem; margin-top: 2px; }
.month-grid button.meds-has { background: var(--rose-light); border-color: var(--rose); }
.meds-dot { font-size: .72rem; font-weight: 800; line-height: 1; }
.meds-pick { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; }
.meds-pick input { width: auto; min-height: 40px; padding: 6px 10px; }

/* ---------- Tablette (iPad) ---------- */
@media (min-width: 740px) {
  body { font-size: 18px; }
  main { max-width: 860px; padding-left: 28px; padding-right: 28px; }
  #topbar { padding-left: 28px; padding-right: 28px; }
  #tabbar { grid-template-columns: repeat(5, minmax(0, 150px)); justify-content: center; }
  #tabbar a { font-size: .85rem; }
  .quick { grid-template-columns: repeat(5, 1fr); }
  .tabs { flex-wrap: wrap; overflow: visible; }
  .fab { right: max(28px, calc(50% - 402px)); }
}
@media (min-width: 1000px) {
  main { max-width: 1120px; }
  .home-cols { columns: 2; column-gap: 16px; }
  .home-cols > .card { break-inside: avoid; display: inline-block; width: 100%; }
  .fab { right: max(28px, calc(50% - 532px)); }
}
@media (hover: hover) {
  .btn-ghost:hover, .btn-white:hover, .tab:hover, .chip-btn:hover { background: var(--rose-light); }
}

@media (max-width: 380px) {
  body { font-size: 16px; }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .field.half { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  #topbar, #tabbar, .fab, #toasts { display: none !important; }
}
body.reader-dark .tab.active, body.reader-dark .chip-btn.active { color: #1E1A20; background: var(--accent); border-color: var(--accent); }

/* ---------- Étude biblique ---------- */
.claude-card { background: #F1EEFB; border-color: var(--lavender); box-shadow: none; }
.claude-card h2 { display: flex; align-items: center; gap: 8px; }
.context-verses p { margin: 0 0 6px; padding: 4px 8px; border-radius: 8px; line-height: 1.6; }
.context-verses p.current { background: var(--rose-light); font-weight: 600; }
.context-verses sup { color: var(--accent); font-weight: 700; margin-right: 4px; }
.compare { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .compare { grid-template-columns: 1fr 1fr; } }
.compare .scripture { margin: 4px 0 0; }
.relevance { height: 4px; background: var(--line); border-radius: 4px; margin-top: 6px; max-width: 160px; overflow: hidden; }
.relevance span { display: block; height: 100%; background: var(--accent-2); }
.study-intro p { line-height: 1.5; }

/* ---------- Étudier avec Claude depuis la lecture (sans quitter le chapitre) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.reader .verse.selected { background: color-mix(in srgb, var(--accent-2) 22%, transparent); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--accent-2) 70%, transparent); }
.reader .verse.selected sup { color: var(--accent-2); }
:root { --sp-peek: 132px; --sp-half: 56dvh; --sp-full: calc(100dvh - env(safe-area-inset-top) - 56px); }
body.study-open main { padding-bottom: calc(var(--sp-half) + 24px); }
body.study-open[data-panel-size="peek"] main { padding-bottom: calc(var(--sp-peek) + 24px); }
body.study-open[data-panel-size="full"] main { padding-bottom: calc(var(--sp-full) + 24px); }

#study-fab {
  position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); z-index: 35;
  display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 16px 0 13px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 40%, transparent); background: var(--white); color: var(--accent-2);
  font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; box-shadow: 0 6px 22px rgba(30, 20, 40, .22); opacity: .96;
}
#study-fab:hover { opacity: 1; }
#study-fab[hidden], #study-bar[hidden], #study-panel[hidden] { display: none; }

#study-bar {
  position: fixed; left: 50%; transform: translateX(-50%); width: min(720px, calc(100% - 20px));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); z-index: 35;
  background: var(--white); color: var(--text); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 8px 30px rgba(30, 20, 40, .25); padding: 6px 6px 8px 14px; animation: barIn .2s ease both;
}
@keyframes barIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.sb-head { display: flex; align-items: center; gap: 8px; }
.sb-head b { white-space: nowrap; }
.sb-head .muted { flex: 1; font-size: .8rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-actions { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; margin-right: 8px; }
.sb-actions::-webkit-scrollbar { display: none; }
.sb-actions button { flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--cream); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.sb-actions .sb-main { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
body.reader-dark .sb-actions .sb-main { color: #1E1A20; }

#study-panel {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 40;
  width: min(760px, 100%); height: var(--sp-half); display: flex; flex-direction: column;
  background: var(--white); color: var(--text); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 40px rgba(20, 10, 30, .28); padding-bottom: env(safe-area-inset-bottom);
  transition: height .25s ease; animation: panelIn .25s ease both;
}
#study-panel.size-peek { height: var(--sp-peek); }
#study-panel.size-full { height: var(--sp-full); }
#study-panel.dragging { transition: none; }
@keyframes panelIn { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.sp-grip { display: grid; place-items: center; height: 22px; cursor: grab; touch-action: none; flex: none; }
.sp-grip span { width: 42px; height: 5px; border-radius: 5px; background: var(--line); }
.sp-head { display: flex; align-items: center; gap: 4px; padding: 0 8px 4px 16px; flex: none; }
.sp-title { flex: 1; min-width: 0; }
.sp-title h2 { margin: 0; font-size: 1.08rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-2); }
.sp-tabs { display: flex; gap: 4px; padding: 2px 12px 8px; overflow-x: auto; scrollbar-width: none; flex: none; border-bottom: 1px solid var(--line); }
.sp-tabs button { flex: none; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; color: var(--text-soft); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.sp-tabs button.active { background: var(--rose-light); color: var(--text); }
#study-panel.size-peek .sp-tabs, #study-panel.size-peek .sp-body, #study-panel.size-peek .sp-compose { display: none; }
.sp-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 16px; -webkit-overflow-scrolling: touch; }
.sp-quote { margin-bottom: 10px; }
.sp-quote summary { cursor: pointer; font-size: .82rem; color: var(--text-soft); font-weight: 600; }
.sp-quote .scripture { font-size: 1.02rem; margin: 6px 0 0; max-height: 9.5em; overflow-y: auto; }
.sp-quote sup { color: var(--accent); font-weight: 700; font-size: .7em; margin-right: 2px; }
.sp-intro p { margin: 0 0 8px; line-height: 1.5; }
.sp-modes { margin: 6px 0 4px; }
.sp-thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msg .bubble { white-space: pre-wrap; line-height: 1.55; padding: 10px 13px; border-radius: 16px; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; max-width: 85%; }
.msg.me .bubble { background: var(--rose-light); border-bottom-right-radius: 5px; }
.msg.claude .bubble { background: var(--cream); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg-label { display: flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 700; color: var(--accent-2); margin: 0 0 4px 4px; }
.msg-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ref-chip { font: inherit; font-size: .8rem; font-weight: 600; border-radius: 999px; padding: 4px 10px; border: 1px solid var(--line); background: var(--white); color: var(--text); }
.ref-chip.ok { cursor: pointer; }
.ref-chip.bad { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
body.reader-dark .ref-chip.bad { color: #F2C77A; background: #3B3020; }
.ref-preview { flex-basis: 100%; }
.ref-preview .scripture { font-size: .98rem; margin: 2px 0 4px; }
.msg-tools { display: flex; gap: 14px; margin: 4px 0 0 4px; }
.msg-tools .link { font-size: .82rem; min-height: 28px; }
.sp-wait { margin-top: 12px; padding: 12px; border-radius: 16px; background: color-mix(in srgb, var(--accent-2) 12%, var(--white)); }
.sp-wait p { margin: 0 0 8px; line-height: 1.45; }
.sp-wait textarea, .sp-fallback { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--white); color: var(--text); font: inherit; padding: 10px; margin-bottom: 8px; }
.sp-after { margin-top: 8px; }
.sp-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }
.sp-quick .chip-btn { font-size: .84rem; }
.sp-link { margin-top: 12px; font-size: .9rem; }
.sp-link summary { cursor: pointer; color: var(--text-soft); font-weight: 600; }
.sp-link input { flex: 1; min-width: 0; }
.sp-small { font-size: .82rem; }
.sp-compare { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px; }
.sp-compose { flex: none; display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px 10px; border-top: 1px solid var(--line); background: var(--white); }
.sp-compose textarea { flex: 1; resize: none; min-height: 44px; max-height: 140px; border-radius: 22px; border: 1px solid var(--line); background: var(--cream); color: var(--text); font: inherit; font-size: 16px; padding: 11px 16px; line-height: 1.35; }
.sp-send { width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 50%; flex: none; display: grid; place-items: center; }
.pulse { animation: pulse 1.2s ease 3; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 50%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
@media (min-width: 700px) { :root { --sp-half: 50dvh; } #study-panel { bottom: 12px; border-radius: 24px; border-bottom: 1px solid var(--line); } }
@media (prefers-reduced-motion: reduce) { #study-panel, #study-bar, .pulse { animation: none; transition: none; } }
.sp-grip, .sp-head { user-select: none; -webkit-user-select: none; }
body.study-open #toasts { bottom: auto; top: calc(env(safe-area-inset-top) + 70px); }
body.study-reading:not(.study-open) main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 140px); }

/* Bulle « Expliquer » au-dessus du passage sélectionné */
#study-pop { position: absolute; z-index: 15; animation: popIn .18s ease both; }
#study-pop[hidden] { display: none; }
#study-pop button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 46px; padding: 0 18px 0 14px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--white); color: var(--text); font: inherit; font-weight: 800; font-size: 1.02rem; cursor: pointer; box-shadow: 0 10px 28px rgba(20, 10, 30, .28);
}
#study-pop button svg { color: var(--accent); }
#study-pop::after { content: ""; position: absolute; left: 26px; bottom: -7px; width: 14px; height: 14px; background: var(--white); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
#study-pop.below::after { bottom: auto; top: -7px; transform: rotate(225deg); }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }

/* Panneau : citation, onglets en pastilles, suggestions, réponses mises en forme */
.sp-badge { text-transform: none; letter-spacing: 0; font-size: .78rem; }
figure.sp-quote { position: relative; margin: 2px 0 14px; padding: 12px 14px 10px 34px; border-radius: 16px; background: var(--cream); border: 1px solid var(--line); }
.sp-quote .q-mark { position: absolute; left: 10px; top: 0; font-family: var(--serif); font-size: 2.3rem; color: var(--accent); line-height: 1.2; }
.sp-quote .scripture { margin: 0; max-height: none; border: 0; padding: 0; font-size: 1.04rem; line-height: 1.55; }
.sp-quote.clamp .scripture { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sp-quote figcaption { margin-top: 6px; font-size: .8rem; color: var(--text-soft); }
.sp-quote figcaption .link { font-size: .8rem; min-height: 0; }
.sp-tabs.seg { margin: 0 12px 8px; padding: 4px; gap: 2px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, var(--white)); }
.sp-tabs.seg button { flex: 1 0 auto; min-height: 36px; color: var(--text); }
.sp-tabs.seg button.active { background: var(--white); box-shadow: 0 2px 8px rgba(30, 20, 40, .14); }
.sp-intro h3 { margin: 4px 0 10px; font-size: 1.05rem; }
.sp-starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .sp-starters { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.starter { min-height: 48px; padding: 8px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--cream); color: var(--text); font: inherit; font-weight: 700; font-size: .92rem; text-align: left; cursor: pointer; }
.starter:hover { border-color: var(--accent); }
.sp-modes { align-items: center; margin-top: 12px; }
.sp-modes .muted { font-size: .85rem; margin-right: 2px; }
.sp-how { margin-top: 10px; font-size: .88rem; }
.sp-how summary { cursor: pointer; color: var(--text-soft); font-weight: 600; }
.sp-how p { line-height: 1.5; }
.msg-label .avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--white); }
body.reader-dark .msg-label .avatar { color: #1E1A20; }
.msg.claude { max-width: 100%; }
.bubble.md { white-space: normal; }
.bubble.md > :first-child { margin-top: 0; }
.bubble.md > :last-child { margin-bottom: 0; }
.bubble.md h4 { margin: 12px 0 4px; font-size: 1rem; color: var(--accent); }
.bubble.md p { margin: 0 0 8px; }
.bubble.md ul, .bubble.md ol { margin: 0 0 8px; padding-left: 20px; }
.bubble.md li { margin-bottom: 4px; }
.bubble.md blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--rose); font-family: var(--serif); }
.bubble.md hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.ref-inline { font: inherit; padding: 0 3px; border: 0; border-radius: 6px; background: color-mix(in srgb, var(--accent-2) 16%, transparent); color: var(--accent-2); font-weight: 700; cursor: pointer; text-decoration: underline dotted; }
.ref-inline.bad { background: var(--warn-bg); color: var(--warn); cursor: help; text-decoration: none; }
body.reader-dark .ref-inline.bad { color: #F2C77A; background: #3B3020; }
.msg .ref-preview { margin: 8px 0 0; padding: 10px 12px; border-radius: 14px; border: 1px dashed var(--line); }
.sp-tabs.seg button { flex: 1 1 0; padding: 0 6px; min-width: 0; white-space: nowrap; }

/* ---------- Suivi Ritaline : tableau de bord ---------- */
.mb-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.mb-actions .btn { width: 100%; }
.mb-metrics { margin: 4px 0 12px; }
.mb-metrics .chip-btn, .mb-score { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.mb-chart-card { padding-left: 10px; padding-right: 10px; }
.mb-chart-card h2 { padding-left: 6px; }
.mc-chart { position: relative; }
.mc-chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; border-radius: 12px; }
.mc-chart svg:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.mc-title { font-size: 10.5px; font-weight: 700; fill: var(--text-soft); }
.mc-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.mc-grid.v { stroke-dasharray: 1 4; }
.mc-base { stroke: var(--line); stroke-width: 1; }
.mc-ytick, .mc-xtick { font-size: 9.5px; fill: var(--text-soft); }
.mc-ytick { text-anchor: end; }
.mc-xtick { text-anchor: middle; }
.mc-action { fill: #3FAF6C; opacity: .10; }
.mc-rebound { fill: url(#mc-hatch); opacity: .55; }
.mc-hatch { fill: #E39A3B; opacity: .5; }
.mc-area { fill: var(--accent-2); opacity: .16; }
.mc-line { fill: none; stroke: var(--accent-2); stroke-width: 2.2; stroke-linejoin: round; }
.mc-part { fill: none; stroke-width: 1.3; stroke-dasharray: 4 3; opacity: .9; }
.mc-peak { fill: var(--white); stroke: var(--accent-2); stroke-width: 1.6; }
.mc-feel { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.mc-dot { stroke: var(--white); stroke-width: 1.4; }
.mc-dose { stroke-width: 1.4; stroke-dasharray: 3 3; opacity: .85; }
.mc-dose-l { font-size: 9.5px; font-weight: 700; text-anchor: middle; fill: var(--text); }
.mc-dip { stroke: #D46B5A; stroke-width: 1.3; stroke-dasharray: 2 2; }
.mc-dip-l { font-size: 10px; fill: #D46B5A; text-anchor: middle; }
.mc-empty { font-size: 11px; fill: var(--text-soft); text-anchor: middle; }
.mc-cross { stroke: var(--text); stroke-width: 1; opacity: .55; pointer-events: none; }
.mc-tip { position: absolute; top: 4px; z-index: 2; max-width: 240px; padding: 8px 10px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .82rem; line-height: 1.35; pointer-events: none; }
.mc-tip .muted { font-size: .78rem; }
.mc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 6px 4px; font-size: .8rem; color: var(--text-soft); }
.mc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 16px; height: 10px; border-radius: 3px; font-style: normal; }
.lg.area { background: color-mix(in srgb, var(--accent-2) 30%, transparent); border-top: 2px solid var(--accent-2); }
.lg.action { background: rgba(63, 175, 108, .22); }
.lg.rebound { background: repeating-linear-gradient(45deg, rgba(227, 154, 59, .55) 0 3px, transparent 3px 6px); }
.lg.dip { width: auto; height: auto; color: #D46B5A; font-size: .8rem; }
.mc-trend { display: block; width: 100%; height: auto; }
.mb-doses { display: grid; gap: 10px; margin: 12px 6px 0; }
.mb-dose { display: flex; gap: 10px; align-items: flex-start; }
.mb-dose .sw { width: 6px; align-self: stretch; border-radius: 4px; flex: none; }
.mb-dose .muted { font-size: .86rem; line-height: 1.45; }
.mb-ev { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--rose-light); font-size: .95rem; flex: none; }
.mb-ev.dip { background: #FBE3DE; }
.mb-scores { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: .85rem; }
.mb-means { display: grid; gap: 7px; margin-top: 12px; }
.mb-mean { display: grid; grid-template-columns: minmax(0, 9.5em) 1fr 2.4em; align-items: center; gap: 8px; font-size: .9rem; }
.mb-mean .lbl { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-mean .track { height: 8px; border-radius: 6px; background: var(--cream); overflow: hidden; }
.mb-mean .track span { display: block; height: 100%; border-radius: 6px; }
.mb-mean b { text-align: right; }
.mb-table th { font-size: .78rem; text-align: center; font-weight: 700; color: var(--text-soft); }
.mb-table td.kbd-num { text-align: center; }
.mb-safety { margin-top: 14px; }
[data-field^="sc_"] .chips { flex-wrap: nowrap; gap: 4px; }
[data-field^="sc_"] .chip { flex: 1 1 0; min-width: 0; }
[data-field^="sc_"] .chip span { justify-content: center; padding-left: 0; padding-right: 0; min-width: 0; width: 100%; }
[data-field^="ef_"] { margin-bottom: 0; }
.mb-metrics { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.mb-metrics::-webkit-scrollbar { display: none; }
.mb-metrics .chip-btn { flex: none; min-height: 34px; padding: 0 12px; font-size: .85rem; }
.mb-pick-l { margin: 0 0 4px; font-size: .82rem; }
.mc-tip { position: static; max-width: none; margin: 6px 6px 0; box-shadow: none; background: var(--cream); }
.mc-chart svg:focus:not(:focus-visible) { outline: none; }
