:root {
  --bg: #FFF4E3;
  --paper: #FFFBF4;
  --sand: #F7E6C8;
  --ink: #3B2A1E;
  --ink-soft: #7A6555;
  --line: #3B2A1E;
  --river: #4FA3C7;
  --river-light: #9FD6EA;
  --river-deep: #2E6F8E;
  --otter: #8B5E3C;
  --sun: #FFD25E;
  --coral: #F28C6B;
  --danger: #E05A47;
  --ok: #3FB68B;
  --shadow: 0 4px 0 var(--line);
  --shadow-sm: 0 3px 0 var(--line);
  --radius: 20px;
  --font: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  color-scheme: light;
}

/* Sombre : suit le système (Automatique), sauf si l'utilisateur a forcé Clair ou Sombre dans les Réglages. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14222B;
    --paper: #1F323D;
    --sand: #2A4250;
    --ink: #F6EBDD;
    --ink-soft: #B5A595;
    --line: #070D11;
    --river: #2E6F8E;
    --river-light: #3E8AAD;
    --river-deep: #9FD6EA;
    --sun: #F2C14E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14222B;
  --paper: #1F323D;
  --sand: #2A4250;
  --ink: #F6EBDD;
  --ink-soft: #B5A595;
  --line: #070D11;
  --river: #2E6F8E;
  --river-light: #3E8AAD;
  --river-deep: #9FD6EA;
  --sun: #F2C14E;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.35;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: .2px; }

/* ---------- En-tête rivière ---------- */
.top {
  position: relative;
  background: var(--river);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 34px;
}
.top-inner { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 12px; }
.top .otter { flex: none; filter: drop-shadow(0 3px 0 rgba(0,0,0,.15)); }
.bubble {
  position: relative;
  flex: 1;
  background: var(--paper);
  color: var(--ink);
  border: 2.5px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  padding: 10px 14px;
  margin-bottom: 18px;
}
.bubble::before {
  content: '';
  position: absolute; left: -11px; bottom: 14px;
  width: 16px; height: 16px;
  background: var(--paper);
  border-left: 2.5px solid var(--line);
  border-bottom: 2.5px solid var(--line);
  transform: rotate(45deg) skew(10deg, 10deg);
  border-radius: 0 0 0 4px;
}
.bubble h1 { font-size: 20px; }
.bubble p { margin: 2px 0 0; color: var(--ink-soft); font-size: 15px; }
.wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 26px; display: block; }
.wave path { fill: var(--bg); }
.sync-dot {
  position: absolute; right: 16px; top: calc(env(safe-area-inset-top) + 12px);
  font-size: 12px; background: rgba(0,0,0,.18); padding: 3px 9px; border-radius: 999px; color: #fff;
}

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

/* ---------- Contrôles ---------- */
.row { display: flex; gap: 8px; align-items: center; }
.spread { justify-content: space-between; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 4px 0; }
.chip {
  flex: none;
  border: 2.5px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 500;
  font-size: 15px;
  box-shadow: 0 2px 0 var(--line);
  white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--c, var(--sun)); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.chip.plain[aria-pressed="true"] { background: var(--sun); color: #3B2A1E; text-shadow: none; }

.seg { display: flex; background: var(--sand); border: 2.5px solid var(--line); border-radius: 999px; padding: 3px; margin: 10px 0 6px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 999px; padding: 7px 8px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--paper); box-shadow: 0 2px 0 var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 2.5px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--sun);
  color: #3B2A1E;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s;
}
.btn:active, .chip:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.btn.blue { background: var(--river-light); }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--river-deep); font-weight: 600; padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }

.toggle-line { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 15px; margin: 4px 0; }

/* ---------- Groupes & cartes devoir ---------- */
.group { margin-top: 18px; }
.group-title { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0 0 8px 4px; }
.group-title .count { font-size: 13px; background: var(--sand); border: 2px solid var(--line); border-radius: 999px; padding: 0 8px; }
.group.late .group-title { color: var(--danger); }
.list { display: grid; gap: 10px; }
@media (min-width: 900px) {
  main { max-width: 1040px; }
  .top-inner { max-width: 1040px; }
  .list { grid-template-columns: 1fr 1fr; }
}

.hw {
  display: flex; align-items: stretch;
  background: var(--paper);
  border: 2.5px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hw-stripe { width: 9px; background: var(--c); border-right: 2.5px solid var(--line); flex: none; }
.hw-check {
  flex: none; align-self: center;
  width: 36px; height: 36px; margin: 0 4px 0 10px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  background: var(--bg);
  display: grid; place-items: center;
  font-size: 18px; font-weight: 700; color: #fff;
}
.hw.done .hw-check { background: var(--ok); }
.hw-body { flex: 1; min-width: 0; padding: 10px 12px 10px 8px; background: none; border: 0; text-align: left; }
.hw-title { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.hw.done .hw-title { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-soft); }
.hw.done { opacity: .75; box-shadow: 0 2px 0 var(--line); }
.hw-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; font-size: 13.5px; color: var(--ink-soft); align-items: center; }
.tag { border: 2px solid var(--line); border-radius: 999px; padding: 0 8px; background: var(--sand); color: var(--ink); font-weight: 500; }
.tag.hot { background: var(--danger); color: #fff; }
.tag.subj { background: var(--c); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.due.late { color: var(--danger); font-weight: 600; }
.due.soon { color: var(--river-deep); font-weight: 600; }

.empty { text-align: center; padding: 36px 16px 10px; color: var(--ink-soft); }
.empty h2 { color: var(--ink); font-size: 20px; margin-top: 8px; }

/* ---------- Matières ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.tile {
  position: relative;
  border: 2.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--c);
  color: #fff;
  text-align: left;
  padding: 14px;
  min-height: 118px;
  display: flex; flex-direction: column; justify-content: space-between;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
}
.tile .emo { font-size: 32px; text-shadow: none; }
.tile b { font-size: 17px; display: block; }
.tile small { opacity: .95; font-size: 13.5px; }
.tile.add { background: var(--paper); color: var(--ink-soft); border-style: dashed; align-items: center; justify-content: center; text-shadow: none; font-weight: 600; }
.subject-head { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px; }
.subject-head .emo { font-size: 30px; width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; background: var(--c); border: 2.5px solid var(--line); box-shadow: var(--shadow-sm); }
.subject-head h2 { font-size: 22px; flex: 1; }

/* ---------- Calendrier ---------- */
.cal { background: var(--paper); border: 2.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-top: 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h2 { font-size: 19px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--ink-soft); font-weight: 600; padding-bottom: 2px; }
.cal-day {
  aspect-ratio: 1 / 1; min-height: 40px;
  border: 2px solid transparent; border-radius: 12px; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-weight: 500; padding: 0;
}
.cal-day.out { opacity: .35; }
.cal-day.today { color: var(--coral); font-weight: 700; }
.cal-day[aria-pressed="true"] { border-color: var(--line); background: var(--sun); color: #3B2A1E; }
.dots { display: flex; gap: 2px; height: 7px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); border: 1px solid var(--line); }

/* ---------- Réglages ---------- */
.card { background: var(--paper); border: 2.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-top: 16px; }
.card h2 { font-size: 18px; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.card p { margin: 6px 0; color: var(--ink-soft); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 2px dashed var(--sand); }
.setting:first-of-type { border-top: 0; }
.field { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 14px; color: var(--ink-soft); }
input[type=text], input[type=date], select, textarea {
  width: 100%;
  border: 2.5px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  padding: 10px 12px;
  font-size: 17px;
  outline: none;
  min-height: 46px;
}
select { width: auto; min-width: 100px; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px var(--river-light); }
textarea { min-height: 80px; resize: vertical; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 20px; font-weight: 700; letter-spacing: 1px; background: var(--sand); border: 2.5px dashed var(--line); border-radius: 14px; padding: 10px; text-align: center; margin: 8px 0; user-select: all; }
.switch { position: relative; width: 54px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--sand); border: 2.5px solid var(--line); transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 2.5px solid var(--line); transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(22px); }
.days { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 6px; }
.days .chip { width: 40px; padding: 6px 0; text-align: center; }
.steps { margin: 6px 0; padding-left: 22px; color: var(--ink-soft); }
.steps li { margin: 4px 0; }
.notice { background: var(--river-light); color: #12303D; border: 2.5px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-top: 14px; box-shadow: var(--shadow-sm); }
.notice b { display: block; margin-bottom: 2px; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--paper);
  border-top: 2.5px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  display: flex; justify-content: center;
}
.nav-inner { display: flex; width: 100%; max-width: 560px; }
.nav button {
  flex: 1; border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  padding: 4px 0; border-radius: 14px;
}
.nav button svg { width: 26px; height: 26px; }
.nav button[aria-current="page"] { color: var(--ink); background: var(--sand); }
.fab {
  position: fixed; z-index: 11;
  right: max(18px, calc(50% - 360px));
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--line);
  background: var(--coral);
  color: #fff;
  font-size: 38px; font-weight: 600; line-height: 1;
  box-shadow: var(--shadow);
  display: grid; place-items: center;
  padding-bottom: 4px;
}
.fab:active { transform: translateY(4px); box-shadow: none; }

/* ---------- Feuille modale ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(20, 34, 43, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; overscroll-behavior: none; touch-action: none; }
/* Fiche ouverte : la page derrière ne bouge plus. */
html.sheet-open, html.sheet-open body { overflow: hidden; overscroll-behavior: none; }
.sheet {
  width: 100%; max-width: 620px; max-height: 92dvh; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border: 3px solid var(--line); border-bottom: 0;
  border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  animation: up .22s ease-out;
}
@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 26px; border-bottom: 3px solid var(--line); box-shadow: 0 6px 0 var(--line); }
}
.grabber { width: 44px; height: 5px; border-radius: 9px; background: var(--sand); margin: 0 auto 10px; }
.sheet h2 { font-size: 21px; display: flex; align-items: center; gap: 8px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; background: var(--bg); font-size: 22px; padding: 0; }
.emoji-grid button[aria-pressed="true"] { border-color: var(--line); background: var(--sun); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 36px; height: 36px; border-radius: 50%; border: 2.5px solid var(--line); background: var(--c); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--line); }

/* ---------- Accueil ---------- */
.welcome { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: calc(env(safe-area-inset-top) + 24px) 22px 32px; background: linear-gradient(var(--river) 0 42%, var(--bg) 42%); }
.welcome h1 { font-size: 30px; color: #fff; margin: 6px 0 22px; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.welcome .card { width: 100%; max-width: 420px; text-align: left; }

.toast {
  position: fixed; left: 50%; bottom: calc(160px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  border-radius: 999px; padding: 10px 18px; font-weight: 600;
  box-shadow: 0 4px 0 rgba(0,0,0,.25);
  animation: up .2s ease-out;
  max-width: calc(100% - 32px); text-align: center;
}

.splash { position: fixed; pointer-events: none; z-index: 70; font-size: 22px; animation: splash .8s ease-out forwards; }

.otter-wave { transform-origin: 90px 92px; animation: wave 1.2s ease-in-out infinite; }
.otter-sleepy { animation: bob 3s ease-in-out infinite; }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translate(var(--tx, 0), 30px); opacity: 0; } }
.toast { --tx: -50%; }
@keyframes wave { 50% { transform: rotate(-18deg); } }
@keyframes bob { 50% { transform: translateY(3px); } }
@keyframes splash { to { transform: translate(var(--dx), -70px) scale(.6); opacity: 0; } }

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

/* ---------- Ajouts : accueil en étapes, gestion matières, rappels ---------- */
.step { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--river-deep); text-transform: uppercase; letter-spacing: .5px; }
.hint { font-size: 14px; color: var(--ink-soft); margin: 10px 2px; }
.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  border: 2.5px solid var(--line); background: var(--paper); box-shadow: 0 2px 0 var(--line);
  font-size: 18px; font-weight: 700; display: grid; place-items: center; padding: 0;
}
.icon-btn:disabled { opacity: .3; }
.icon-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.manage-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper); border: 2.5px solid var(--line); border-left: 12px solid var(--c);
  border-radius: 16px; box-shadow: var(--shadow-sm); padding: 8px 10px;
}
.manage-row .emo { font-size: 24px; }
.manage-row b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tile.preview { min-height: 92px; margin: 12px 0 4px; box-shadow: var(--shadow-sm); }
.swatch-custom {
  position: relative; width: 36px; height: 36px; border-radius: 50%; border: 2.5px dashed var(--line);
  background: var(--c); display: grid; place-items: center; font-size: 16px; overflow: hidden; cursor: pointer;
}
.swatch-custom[aria-pressed="true"] { border-style: solid; box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--line); }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.reminders { display: grid; gap: 10px; margin-top: 10px; }
.reminder { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 2.5px solid var(--line); border-radius: 16px; padding: 8px 12px 8px 8px; }
.reminder.off { opacity: .55; }
.reminder-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; text-align: left; padding: 0; }
.reminder-main small { display: block; color: var(--ink-soft); font-size: 13.5px; }
.reminder-time { flex: none; font-size: 22px; font-weight: 700; background: var(--sun); color: #3B2A1E; border: 2.5px solid var(--line); border-radius: 12px; padding: 4px 8px; min-width: 76px; text-align: center; }
.time-pick select { flex: 1; font-size: 22px; font-weight: 600; text-align: center; }
.options { display: grid; gap: 8px; }
.option { display: flex; align-items: center; gap: 12px; text-align: left; border: 2.5px solid var(--line); border-radius: 16px; background: var(--bg); padding: 10px 12px; }
.option .emo { font-size: 26px; }
.option small { display: block; color: var(--ink-soft); font-size: 13.5px; }
.option[aria-pressed="true"] { background: var(--sun); color: #3B2A1E; box-shadow: 0 3px 0 var(--line); }
.option[aria-pressed="true"] small { color: #5A4636; }
.stepper { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; }
.stepper span { flex: 1; text-align: center; font-size: 15px; }

/* ---------- Alertes avancées ---------- */
.chip small { display: block; font-size: 11.5px; font-weight: 500; opacity: .8; margin-top: -1px; }
.chip.past { opacity: .5; }
.custom-r { margin-top: 8px; flex-wrap: wrap; }
.custom-r select { flex: 1; min-width: 90px; }
.notif-preview {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--bg); border: 2.5px solid var(--line); border-radius: 18px; padding: 10px 12px;
  box-shadow: var(--shadow-sm); font-size: 14.5px;
}
.notif-preview img { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.notif-preview b { display: block; }
.notif-preview span { color: var(--ink-soft); }
.notif-preview.muted { color: var(--ink-soft); box-shadow: none; border-style: dashed; justify-content: center; text-align: center; }
details.more { margin-top: 14px; border: 2.5px dashed var(--line); border-radius: 16px; padding: 4px 12px 10px; }
details.more[open] { border-style: solid; }
details summary { cursor: pointer; font-weight: 600; padding: 8px 0; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details.more summary::before { content: '▸ '; }
details.more[open] summary::before { content: '▾ '; }
details.more summary small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 13px; margin-left: 14px; }
.history summary h2 { margin: 0; }
.history summary h2::after { content: '▾'; margin-left: auto; font-size: 14px; color: var(--ink-soft); }
.history:not([open]) summary h2::after { content: '▸'; }
.reminder-main small.filters { color: var(--river-deep); }
.upcoming { display: grid; gap: 8px; }
.up-row { display: flex; align-items: center; gap: 12px; }
.up-when { flex: none; min-width: 92px; background: var(--sand); border: 2px solid var(--line); border-radius: 12px; padding: 3px 8px; text-align: center; line-height: 1.15; }
.up-when small { display: block; font-size: 12px; color: var(--ink-soft); }
.devices { display: grid; gap: 8px; }
.device { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 2.5px solid var(--line); border-radius: 16px; padding: 6px 8px; }
.device-ico { font-size: 24px; }
.device-name { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 0; }
.device-name small { display: block; color: var(--ink-soft); font-size: 12.5px; }
.hist { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; }
.hist-row { background: var(--bg); border-radius: 14px; padding: 8px 12px; font-size: 14.5px; }
.hist-row small { display: block; color: var(--ink-soft); font-size: 12.5px; }
.hist-row b { display: block; }
.hist-row span { color: var(--ink-soft); }
.nav button { font-size: 11.5px; }

/* ---------- Emploi du temps ---------- */
.cal-day.has-class { box-shadow: inset 0 -3px 0 var(--river); }
.cal-day.has-class[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--line); }
.classes { display: grid; gap: 8px; }
.class-row {
  display: flex; align-items: stretch; gap: 10px;
  background: var(--paper); border: 2.5px solid var(--line); border-left: 10px solid var(--c);
  border-radius: 14px; padding: 8px 12px 8px 8px; box-shadow: 0 2px 0 var(--line);
}
.class-time { flex: none; width: 54px; font-weight: 700; text-align: center; line-height: 1.2; }
.class-time small { display: block; font-weight: 500; color: var(--ink-soft); font-size: 13px; }
.class-body { min-width: 0; }
.class-body b { display: block; overflow-wrap: anywhere; }
.class-body small { color: var(--ink-soft); font-size: 13.5px; }
.cal-links { display: grid; gap: 8px; margin-top: 8px; }
.cal-links .off { opacity: .55; }
.cal-swatch { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 2.5px solid var(--line); margin-left: 4px; }
.chip.next-class { display: block; width: 100%; text-align: left; margin-top: 6px; --c: var(--river); }
.chip.next-class[aria-pressed="true"] { background: var(--river); }
.ok-notice { background: #CFF1E2; }
.err-notice { background: #FBD5CD; }
.daily-card { background: linear-gradient(160deg, var(--paper) 55%, var(--river-light)); }
.daily-card .setting small, .onb-daily small { color: var(--ink-soft); font-size: 13.5px; }
.onb-daily { margin-top: 14px; border-top: 2px dashed var(--sand); }
.tt-age { font-size: 13px; text-decoration: none; padding: 0; }

/* ---------- Ma loutre : suivi & motivation ---------- */
.otter-btn { position: relative; flex: none; background: none; border: 0; padding: 0; }
.lvl-chip {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%);
  background: var(--sun); color: #3B2A1E; border: 2.5px solid var(--line); border-radius: 999px;
  font-size: 12.5px; font-weight: 700; padding: 0 8px; white-space: nowrap; box-shadow: 0 2px 0 var(--line);
}
.otter-hero { text-align: center; }
.otter-hero h2 { justify-content: center; margin-top: 4px; }
.xpbar { height: 18px; border: 2.5px solid var(--line); border-radius: 999px; background: var(--sand); overflow: hidden; margin: 10px 0 6px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sun), var(--coral)); border-right: 2.5px solid var(--line); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--paper); border: 2.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); padding: 12px; text-align: center; }
.stat span { font-size: 24px; display: block; }
.stat b { font-size: 24px; display: block; }
.stat small { color: var(--ink-soft); font-size: 13px; line-height: 1.25; display: block; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 18px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar i { width: 100%; min-height: 3px; background: var(--river-light); border: 2px solid var(--line); border-radius: 8px 8px 3px 3px; }
.bar.now i { background: var(--sun); }
.bar-n { font-size: 12px; font-weight: 700; }
.bar small { font-size: 10.5px; color: var(--ink-soft); margin-top: 4px; white-space: nowrap; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; align-items: center; gap: 8px; font-size: 14px; }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar i { height: 14px; border-radius: 999px; background: var(--c); border: 2px solid var(--line); min-width: 8px; }
.acc-grid, .badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.acc { border: 2.5px solid var(--line); border-radius: 16px; background: var(--bg); padding: 10px 4px; box-shadow: 0 2px 0 var(--line); }
.acc span { font-size: 28px; display: block; }
.acc small { font-size: 12.5px; font-weight: 600; }
.acc[aria-pressed="true"] { background: var(--sun); color: #3B2A1E; }
.acc.locked, .badge.locked { opacity: .45; filter: grayscale(.8); }
.badge-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.badge { border: 2.5px solid var(--line); border-radius: 16px; background: var(--bg); padding: 10px; text-align: center; }
.badge span { font-size: 30px; display: block; }
.badge b { display: block; font-size: 14px; }
.badge small { color: var(--ink-soft); font-size: 12px; line-height: 1.2; display: block; }
a.btn { text-decoration: none; text-align: center; }
.tt-status { margin: -2px 2px 8px; font-size: 13px; color: var(--ink-soft); }
.tt-status small { font-size: 12px; }
.update-banner { margin-top: 14px; background: #FFE9A8; color: #3B2A1E; }
.about { text-align: center; margin-top: 24px; color: var(--ink-soft); } .about p { margin: 4px 0; } .about b { color: var(--ink); }

/* ---------- À propos : nouveautés et licences ---------- */
.page-title { font-size: 24px; margin: 8px 2px 0; }
.whats-new { margin-top: 14px; background: #D9F2E6; color: #12303D; }
.release-head { display: flex; align-items: center; gap: 12px; }
.release-version { flex: none; font-weight: 700; font-size: 17px; background: var(--sun); color: #3B2A1E; border: 2.5px solid var(--line); border-radius: 12px; padding: 4px 10px; }
.release-head small { display: block; color: var(--ink-soft); font-size: 13px; }
.release-items { margin: 10px 0 0; padding-left: 20px; color: var(--ink-soft); }
.release-items li { margin: 5px 0; }
.licenses { display: grid; gap: 10px; }
.license { background: var(--bg); border-radius: 14px; padding: 10px 12px; display: grid; gap: 4px; }
.license small { color: var(--ink-soft); font-size: 13px; }
.license a { color: var(--river-deep); }
.license .tag { justify-self: start; text-decoration: none; }

/* Aucun champ ne doit dépasser la largeur de la fiche (le champ date peut être plus large sur mobile). */
.sheet input, .sheet select, .sheet textarea { max-width: 100%; min-width: 0; }
.sheet input[type=date] { display: block; }

/* ---------- Déménagement (1.2.0) ---------- */
.move-banner { margin-top: 14px; background: #FFE9A8; color: #3B2A1E; }
.inline-code { font-family: ui-monospace, Menlo, monospace; font-weight: 700; background: rgba(255,255,255,.6); border-radius: 6px; padding: 0 4px; white-space: nowrap; }
