/* Suivi SJSR — styles (mobile d'abord, clair/sombre) */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --gaba: #2a78d6;
  --gaba-soft: rgba(42, 120, 214, 0.16);
  --sifrol: #eb6834;
  --sifrol-soft: rgba(235, 104, 52, 0.16);
  --sym: #d03b3b;
  --sym-soft: rgba(208, 59, 59, 0.14);
  --good: #006300;
  --window: rgba(11, 11, 11, 0.055);
  --window-line: rgba(11, 11, 11, 0.28);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.05);
  --radius: 14px;
  --tabbar-h: 62px;
  --tlabel: 70px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #262624;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #9a988f;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --gaba: #3987e5;
    --gaba-soft: rgba(57, 135, 229, 0.22);
    --sifrol: #d95926;
    --sifrol-soft: rgba(217, 89, 38, 0.24);
    --sym: #e05454;
    --sym-soft: rgba(224, 84, 84, 0.2);
    --good: #0ca30c;
    --window: rgba(255, 255, 255, 0.06);
    --window-line: rgba(255, 255, 255, 0.3);
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #262624;
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #9a988f;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --gaba: #3987e5;
  --gaba-soft: rgba(57, 135, 229, 0.22);
  --sifrol: #d95926;
  --sifrol-soft: rgba(217, 89, 38, 0.24);
  --sym: #e05454;
  --sym-soft: rgba(224, 84, 84, 0.2);
  --good: #0ca30c;
  --window: rgba(255, 255, 255, 0.06);
  --window-line: rgba(255, 255, 255, 0.3);
  --shadow: none;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--page);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; margin-top: 14px; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--sym); min-height: 1.2em; margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

/* ── Mise en page ───────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 10px;
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 4px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
}

.view { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card > h2 { margin-bottom: 10px; }
.card-flush { padding: 12px 0 6px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* ── Boutons ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--text); color: var(--page); border-color: transparent; }
.btn-ghost { background: var(--surface-2); border-color: transparent; }
.btn-sym { background: var(--sym-soft); border-color: transparent; color: var(--text); }
.btn-danger { background: transparent; color: var(--sym); border-color: var(--sym-soft); }
.btn[disabled] { opacity: 0.5; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: var(--surface-2);
  font-size: 20px;
  cursor: pointer;
}

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.row-actions > * { flex: 1 1 140px; }

.chip {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}
.chip.active { background: var(--text); color: var(--page); border-color: transparent; }
.chip-small { min-height: 32px; font-size: 13px; padding: 0 10px; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: baseline;
}
.dot-gaba { background: var(--gaba); }
.dot-sifrol { background: var(--sifrol); transform: rotate(45deg); border-radius: 2px; width: 9px; height: 9px; }
.dot-sym { background: var(--sym); border-radius: 2px; }

/* ── Saisie rapide ─────────────────────────────────────────── */

.when { display: flex; gap: 6px; align-items: center; }
.when input {
  min-height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0 8px;
  max-width: 200px;
}

.lane-label { margin: 6px 0 6px; font-size: 13px; color: var(--text-2); font-weight: 600; }

.dose-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
#sifrol-buttons { grid-template-columns: repeat(2, 1fr); }

.dose-btn {
  min-height: 52px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 650;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}
.dose-btn small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.dose-btn::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.dose-btn.gaba::before { background: var(--gaba); }
.dose-btn.sifrol::before { background: var(--sifrol); }
.dose-btn:active { transform: scale(0.97); }

/* ── Bannière symptômes en cours ───────────────────────────── */

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--sym-soft);
  border: 1px solid var(--sym);
}
.banner strong { display: block; }

/* ── Statistiques ──────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.stats:empty { display: none; }
.stats-4 { grid-template-columns: repeat(2, 1fr); margin: 0; }
@media (min-width: 620px) { .stats-4 { grid-template-columns: repeat(4, 1fr); } }

.stat {
  background: var(--surface-2);
  border-radius: 11px;
  padding: 8px 10px;
  min-width: 0;
}
.card .stat { background: var(--surface-2); }
.view > .stats .stat { background: var(--surface); border: 1px solid var(--border); }
.stat-label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; }
.stat-value { font-size: 20px; font-weight: 650; line-height: 1.2; }
.stat-sub { font-size: 12px; color: var(--muted); }

/* ── Graphique jour ────────────────────────────────────────── */

.chart { position: relative; width: 100%; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .win { fill: var(--window); }
.chart .win-line { stroke: var(--window-line); stroke-dasharray: 3 3; }
.chart .now-line { stroke: var(--text); stroke-width: 1.5; }
.chart .line-gaba { stroke: var(--gaba); }
.chart .line-sifrol { stroke: var(--sifrol); }
.chart .area-gaba { fill: var(--gaba-soft); }
.chart .area-sifrol { fill: var(--sifrol-soft); }
.chart .sym-band { fill: var(--sym-soft); }
.chart .sym-bar { fill: var(--sym); }
.chart .cross { stroke: var(--text-2); stroke-width: 1; }
.chart .lbl-strong { fill: var(--text-2); font-weight: 600; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  margin: 0 0 8px;
}
#table-legend { padding: 0 12px; }
.legend-item { display: inline-flex; align-items: center; }
.legend-swatch-win {
  display: inline-block;
  width: 14px;
  height: 10px;
  margin-right: 6px;
  background: var(--window);
  border-left: 1px dashed var(--window-line);
  border-right: 1px dashed var(--window-line);
}
.legend-line { display: inline-block; width: 14px; height: 0; border-top: 2px solid; margin-right: 6px; }
.legend-line.dashed { border-top-style: dashed; }

/* ── Tableau historique ────────────────────────────────────── */

.table-axis {
  position: sticky;
  top: var(--topbar-h, 50px);
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.table-axis svg, .t-row svg { display: block; width: 100%; height: auto; }
.table-axis text { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }

.t-month {
  padding: 10px 12px 4px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
  text-transform: capitalize;
}

.t-row {
  display: grid;
  grid-template-columns: var(--tlabel) 1fr;
  align-items: center;
  gap: 0;
  padding: 3px 8px 3px 12px;
  cursor: pointer;
  border-top: 1px solid transparent;
}
.t-row:hover, .t-row:focus-visible { background: var(--surface-2); outline: none; }
.t-row.today { background: color-mix(in srgb, var(--gaba) 7%, transparent); }
.t-date { font-size: 12.5px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.t-date b { font-weight: 650; }
.t-date .t-tot, .t-axis-row .t-date span { display: block; font-size: 10.5px; color: var(--text-2); white-space: nowrap; }
.t-tot i { font-style: normal; display: inline-flex; align-items: center; }
.t-tot i + i { margin-left: 4px; }
.t-tot i::before { content: ""; width: 5px; height: 5px; margin-right: 2px; }
.tot-gaba::before { background: var(--gaba); border-radius: 50%; }
.tot-sifrol::before { background: var(--sifrol); transform: rotate(45deg); }
.t-row .lane-bg { fill: var(--surface-2); }
.t-row .win { fill: var(--window); }
.t-row .win-line { stroke: var(--window-line); stroke-dasharray: 2 2; }
.t-row .area-gaba { fill: var(--gaba); opacity: 0.55; }
.t-row .area-sifrol { fill: var(--sifrol); opacity: 0.6; }
.t-row .mk-gaba { fill: var(--gaba); stroke: var(--surface); stroke-width: 1.5; }
.t-row .mk-sifrol { fill: var(--sifrol); stroke: var(--surface); stroke-width: 1.5; }
.t-row .sym-bar { fill: var(--sym); }
.t-row .tick { stroke: var(--grid); }
.t-axis-row { cursor: default; padding-top: 2px; padding-bottom: 2px; }
.t-axis-row:hover { background: none; }
.t-axis-row .t-date span { font-size: 10px; line-height: 1.1; }
.t-empty { padding: 24px 16px; text-align: center; color: var(--muted); }

/* ── Calendrier mensuel ────────────────────────────────────── */

.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.month-nav h2 { text-transform: capitalize; }

.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.m-head { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 2px; }
.m-cell {
  position: relative;
  min-height: 64px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid transparent;
  padding: 4px 4px 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
  min-width: 0;
}
.m-cell.out { visibility: hidden; }
.m-cell.empty { background: transparent; border-color: var(--border); cursor: default; }
.m-cell.today { border-color: var(--text); }
.m-cell.win-sym { box-shadow: inset 0 0 0 2px var(--sym); }
.m-day { font-weight: 650; font-size: 12px; }
.m-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 2px; margin-bottom: 1px; }
.m-total { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-ev {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}
.m-ev b { font-weight: 500; }
.m-ev i { font-style: normal; color: var(--text-2); display: none; }
.m-ev::before { content: ""; flex: none; width: 5px; height: 5px; }
.m-gaba::before { background: var(--gaba); border-radius: 50%; }
.m-sifrol::before { background: var(--sifrol); transform: rotate(45deg); }
.m-sym::before { background: var(--sym); border-radius: 1px; }
.m-sym b { color: var(--text); font-weight: 650; }
@media (min-width: 560px) {
  .m-ev { font-size: 11.5px; gap: 4px; }
  .m-ev::before { width: 6px; height: 6px; }
  .m-ev i { display: inline; }
  .m-total { font-size: 11px; }
}
@media (max-width: 559px) {
  #history-month { padding: 12px 6px; }
  .month-grid { gap: 3px; }
  .m-cell { padding: 4px 2px 3px 3px; min-height: 56px; }
  .m-total, .wide-only { display: none; }
  .m-ev { gap: 2px; letter-spacing: -0.3px; }
  .m-ev::before { width: 4px; height: 4px; }
}

/* ── Simulateur ────────────────────────────────────────────── */

.sim-doses { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sim-dose {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) minmax(0, 96px) minmax(0, 104px) 36px;
  align-items: center;
  gap: 6px;
}
.sim-dose input, .sim-dose select, .inline-form select, .inline-form input[type="time"] {
  min-height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0 6px;
  min-width: 0;
  width: 100%;
}
.sim-dose .icon-btn { width: 36px; height: 36px; font-size: 15px; }
.sim-name { font-size: 14px; font-weight: 600; }

.inline-form { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.inline-form label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.inline-form label.check { font-size: 13px; color: var(--text-2); }
.opt-result { margin-top: 12px; font-size: 14px; }
.opt-result .big { font-size: 22px; font-weight: 650; }

/* ── Listes d'entrées ──────────────────────────────────────── */

.entry-list { list-style: none; margin: 0; padding: 0; }
.entry-list li + li { border-top: 1px solid var(--border); }
.entry {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 2px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.entry-time { font-variant-numeric: tabular-nums; font-weight: 650; }
.entry-main { min-width: 0; }
.entry-main small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-chev { color: var(--muted); }
.entry-empty { color: var(--muted); padding: 8px 0; font-size: 14px; }

/* ── Formulaires (feuille) ─────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input[type="datetime-local"], .field input[type="number"], .field input[type="password"], .field textarea {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 8px 10px;
  width: 100%;
}
.field textarea { min-height: 70px; resize: vertical; }
.field .chips-wrap { gap: 6px; }

.prose p, .prose li { color: var(--text-2); font-size: 14px; }
.prose ul { padding-left: 18px; margin: 6px 0; }

/* ── Navigation basse ──────────────────────────────────────── */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tab {
  height: var(--tabbar-h);
  border: 0;
  background: none;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}
.tab-ico { font-size: 18px; line-height: 1; }
.tab.active { color: var(--text); font-weight: 650; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border-radius: 11px;
  padding: 3px;
}
.seg { min-height: 36px; border: 0; background: none; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ── Feuille modale ────────────────────────────────────────── */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.35);
}
.sheet {
  position: fixed;
  z-index: 21;
  left: 0; right: 0; bottom: 0;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  animation: sheet-in 0.18s ease-out;
}
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 640px; transform: translate(-50%, -50%); border-radius: 18px; animation: none; }
}
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0.5; } }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 8px;
}
.sheet-head h2 { font-size: 17px; }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(env(safe-area-inset-bottom) + 18px); }

/* ── Infobulle, toast ──────────────────────────────────────── */

.tooltip {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  background: var(--text);
  color: var(--page);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 6px 9px;
  border-radius: 8px;
  max-width: 240px;
  font-variant-numeric: tabular-nums;
}
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; }
.tooltip .dot { margin-right: 0; }

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--text);
  color: var(--page);
  font-size: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.toast button {
  background: none;
  border: 0;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}

/* ── Connexion ─────────────────────────────────────────────── */

.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
.login-card img { margin: 0 auto; }
.login-card .field { text-align: left; margin: 8px 0 0; }

/* ── Colonnes : transparentes sur mobile, grilles sur bureau ─── */

.col, .history-split { display: contents; }
#ongoing-banner { order: -1; }
#today-chart-card, #sim-chart-card { order: 1; }
#today-list-card, #sim-opt-card { order: 2; }
.brand { display: none; }
.day-panel { display: none; }
.t-row.selected { background: color-mix(in srgb, var(--text) 7%, transparent); box-shadow: inset 3px 0 0 var(--text); }
.m-cell.selected { border-color: var(--gaba); box-shadow: 0 0 0 1px var(--gaba); }

/* ── Bureau ────────────────────────────────────────────────── */

@media (min-width: 1024px) {
  :root { --sidebar-w: 220px; --tlabel: 84px; }

  .tabbar {
    top: 0;
    right: auto;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 20px 12px;
    background: var(--surface);
    border-top: 0;
    border-right: 1px solid var(--border);
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px;
    font-weight: 650;
    font-size: 16px;
  }
  .tab {
    height: 42px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 14.5px;
    color: var(--text-2);
  }
  .tab:hover { background: var(--surface-2); }
  .tab.active { background: var(--surface-2); color: var(--text); }
  .tab-ico { width: 22px; text-align: center; font-size: 17px; }

  .topbar, main { margin-left: var(--sidebar-w); }
  .topbar { padding: 22px 32px 12px; }
  main { max-width: none; padding: 4px 32px 40px; }
  .view { max-width: 1480px; }

  .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .view-split {
    display: grid;
    grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }
  .view-split .col-b { position: sticky; top: calc(var(--topbar-h, 60px) + 8px); }

  .history-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
    gap: 18px;
    align-items: start;
  }
  .day-panel {
    display: block;
    position: sticky;
    top: calc(var(--topbar-h, 60px) + 8px);
    max-height: calc(100vh - var(--topbar-h, 60px) - 24px);
    overflow-y: auto;
    padding-top: 4px;
  }
  .day-panel-head { padding: 10px 0 6px; }
  .day-panel .hint { margin: 4px 0 0; }

  .view-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
  .view-settings .prose { grid-column: 1 / -1; }

  .m-cell { min-height: 82px; padding: 6px 7px; font-size: 12.5px; }
  .m-day { font-size: 13.5px; }
  .m-cell:not(.empty):hover { border-color: var(--axis); }
  .dose-btn { min-height: 48px; }
  .toast { bottom: 24px; left: calc(50% + var(--sidebar-w) / 2); }
  .entry:hover { background: var(--surface-2); }
}
