/* Cockpit — interface mobile façon iOS.
   Une seule audace : le cadran du jour (instrument de bord). Le reste suit les conventions natives. */

:root {
  --nuit: #3442a8;
  --nuit-soft: rgba(52, 66, 168, 0.12);
  --ambre: #e89a0c;
  --ambre-soft: rgba(232, 154, 12, 0.16);
  --alerte: #e5484d;
  --valide: #2e9e5b;
  --fond: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f7f7fa;
  --encre: #1c1c1e;
  --encre-2: rgba(60, 60, 67, 0.62);
  --encre-3: rgba(60, 60, 67, 0.34);
  --trait: rgba(60, 60, 67, 0.18);
  --voile: rgba(0, 0, 0, 0.32);
  --barre: rgba(249, 249, 251, 0.82);
  --ombre-feuille: 0 -8px 30px rgba(0, 0, 0, 0.12);
  --rayon-groupe: 12px;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --tabbar: calc(50px + var(--bottom));
  --kb: 0px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --nuit: #8c96ff;
    --nuit-soft: rgba(140, 150, 255, 0.16);
    --ambre: #ffb340;
    --ambre-soft: rgba(255, 179, 64, 0.16);
    --alerte: #ff6369;
    --valide: #3dd68c;
    --fond: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --encre: #ffffff;
    --encre-2: rgba(235, 235, 245, 0.6);
    --encre-3: rgba(235, 235, 245, 0.3);
    --trait: rgba(84, 84, 88, 0.6);
    --voile: rgba(0, 0, 0, 0.55);
    --barre: rgba(22, 22, 24, 0.82);
    --ombre-feuille: 0 -8px 30px rgba(0, 0, 0, 0.5);
  }
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--encre);
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;
  letter-spacing: -0.01em;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: var(--nuit);
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--nuit);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

svg.ic {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

svg.ic.sm {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* ---------- Écran ---------- */

#app {
  min-height: 100dvh;
}

.screen {
  padding: calc(var(--top) + 8px) 16px calc(var(--tabbar) + 88px);
  max-width: 680px;
  margin: 0 auto;
  animation: screen-in 0.22s ease-out;
}

.screen.no-tabs {
  padding-bottom: calc(var(--bottom) + 32px);
}

.screen.push {
  animation: screen-push 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes screen-in {
  from {
    opacity: 0.4;
  }
}

@keyframes screen-push {
  from {
    transform: translateX(28%);
    opacity: 0.3;
  }
}

/* Barre du haut (titre compact + boutons) */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: calc(-8px - var(--top)) -16px 0;
  padding: calc(var(--top) + 4px) 8px 4px;
  min-height: calc(var(--top) + 44px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: transparent;
  transition: background 0.2s, box-shadow 0.2s;
}

.navbar.scrolled {
  background: var(--barre);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 var(--trait);
}

.navbar .nav-title {
  font-weight: 600;
  font-size: 17px;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60vw;
}

.navbar.scrolled .nav-title {
  opacity: 1;
}

.navbar .nav-left {
  justify-self: start;
}

.navbar .nav-right {
  justify-self: end;
  display: flex;
  gap: 4px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 8px;
  color: var(--nuit);
  font-size: 17px;
  justify-content: center;
}

.nav-btn.back {
  padding-left: 0;
}

.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--nuit-soft);
  color: var(--nuit);
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 5px 8px;
}

.large-title {
  font-size: 34px;
  line-height: 41px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 2px 0 2px;
}

.subtitle {
  color: var(--encre-2);
  font-size: 15px;
  margin: 0 0 18px;
}

/* ---------- Cadran du jour ---------- */

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.hero .large-title {
  margin-bottom: 0;
}

.hero .subtitle {
  margin: 2px 0 0;
}

.gauge {
  position: relative;
  width: 78px;
  height: 78px;
  flex: none;
}

.gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(135deg);
  overflow: visible;
}

.gauge .track,
.gauge .value {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
}

.gauge .track {
  stroke: var(--trait);
}

.gauge .value {
  stroke: var(--ambre);
  transition: stroke-dashoffset 0.9s cubic-bezier(0.3, 0.9, 0.3, 1), stroke 0.3s;
}

.gauge.full .value {
  stroke: var(--valide);
}

.gauge .ticks line {
  stroke: var(--encre-3);
  stroke-width: 1.5;
}

.gauge .readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.gauge .readout b {
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gauge .readout small {
  font-size: 11px;
  color: var(--encre-2);
  margin-top: 2px;
}

/* ---------- Groupes de lignes (listes iOS) ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 4px 7px;
}

.section-head h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0;
}

.section-head h2.late {
  color: var(--alerte);
}

.section-head .count {
  color: var(--encre-2);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.section-head button {
  color: var(--nuit);
  font-size: 15px;
}

.group {
  background: var(--surface);
  border-radius: var(--rayon-groupe);
  overflow: hidden;
}

.group + .group {
  margin-top: 20px;
}

.group-note {
  color: var(--encre-2);
  font-size: 13px;
  margin: 7px 16px 0;
  line-height: 1.35;
}

.group-label {
  color: var(--encre-2);
  font-size: 13px;
  margin: 26px 16px 7px;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--surface);
  width: 100%;
  text-align: left;
}

.row::after {
  content: '';
  position: absolute;
  left: var(--sep-left, 16px);
  right: 0;
  bottom: 0;
  height: 0.5px;
  background: var(--trait);
}

.row:last-child::after {
  display: none;
}

button.row:active,
a.row:active {
  background: var(--surface-2);
}

.row .grow {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
}

.row .value {
  color: var(--encre-2);
  white-space: nowrap;
}

.row .chev {
  color: var(--encre-3);
}

.row .emoji {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex: none;
}

.row.danger {
  color: var(--alerte);
  justify-content: center;
}

.row.action {
  color: var(--nuit);
}

.row label {
  flex: 1;
  padding: 11px 0;
}

.row input[type='text'],
.row input[type='email'],
.row input[type='password'],
.row input[type='search'] {
  flex: 1;
  border: 0;
  background: none;
  padding: 11px 0;
  min-width: 0;
  outline: none;
}

.row input::placeholder,
.row textarea::placeholder {
  color: var(--encre-3);
}

/* Champs natifs date/heure/sélection présentés comme une valeur iOS */
.pill-input {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: var(--surface-2);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 17px;
  color: var(--encre);
  min-height: 34px;
  max-width: 60vw;
}

.pill-input::-webkit-date-and-time-value {
  text-align: right;
}

select.pill-input {
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

/* Interrupteur iOS */
.switch {
  position: relative;
  width: 51px;
  height: 31px;
  flex: none;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 31px;
  background: var(--trait);
  transition: background 0.25s;
}

.switch span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.25s cubic-bezier(0.3, 0.7, 0.4, 1);
}

.switch input:checked + span {
  background: var(--valide);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--nuit);
  outline-offset: 2px;
}

/* Contrôle segmenté */
.segmented {
  display: flex;
  background: var(--surface-2);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.segmented button {
  flex: 1;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--encre);
}

.segmented button[aria-pressed='true'] {
  background: var(--surface);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .segmented button[aria-pressed='true'] {
    background: #636366;
  }
}

/* ---------- Tâches ---------- */

.task {
  --sep-left: 52px;
  align-items: flex-start;
  touch-action: pan-y;
  transition: background 0.2s;
}

.task .check {
  margin-top: 11px;
}

.task .grow {
  padding: 11px 0 10px;
}

.task .title {
  display: block;
  word-break: break-word;
  transition: color 0.25s;
}

.task .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 3px;
  font-size: 13px;
  color: var(--encre-2);
}

.task .meta span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.task .meta .late {
  color: var(--alerte);
}

.task .meta .today {
  color: var(--nuit);
}

.task .flag {
  color: var(--ambre);
  font-weight: 700;
  margin-right: 4px;
}

.task.done .title {
  color: var(--encre-2);
  text-decoration: line-through;
  text-decoration-color: var(--encre-3);
}

.task.leaving {
  animation: task-leave 0.45s 0.35s ease-in forwards;
}

@keyframes task-leave {
  to {
    opacity: 0;
    transform: translateX(12px);
  }
}

.who {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--nuit);
  letter-spacing: 0;
}

.who.both {
  background: var(--ambre);
}

/* Case à cocher ronde */
.check {
  position: relative;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  border: 1.6px solid var(--encre-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.check::before {
  content: '';
  position: absolute;
  inset: -10px;
}

.check.prio {
  border-color: var(--ambre);
}

.check:active {
  transform: scale(0.86);
}

.check svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
  stroke-width: 3;
  fill: none;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  transition: stroke-dashoffset 0.25s 0.05s ease-out;
}

.check.on {
  background: var(--nuit);
  border-color: var(--nuit);
  animation: pop 0.3s ease-out;
}

.check.on svg {
  stroke-dashoffset: 0;
}

@keyframes pop {
  50% {
    transform: scale(1.15);
  }
}

/* Glisser une ligne */
.swipe-wrap {
  position: relative;
  overflow: hidden;
}

.swipe-wrap .row::after {
  display: block;
}

.swipe-wrap:last-child .row::after {
  display: none;
}

.swipe-actions {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.swipe-actions .side {
  display: flex;
  height: 100%;
  pointer-events: auto;
}

.swipe-actions .side.right {
  margin-left: auto;
}

.swipe-actions button {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  min-width: 78px;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.swipe-actions .lead {
  background: var(--valide);
  justify-content: center;
  align-items: flex-start;
  padding-left: 24px;
  min-width: 100%;
}

.swipe-content {
  position: relative;
  z-index: 1;
  will-change: transform;
}

.swipe-content.animating {
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- Barre d'ajout ---------- */

.composer-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--tabbar);
  z-index: 25;
  padding: 8px 16px;
  pointer-events: none;
  display: flex;
  justify-content: center;
}

.composer-bar button {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 648px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--encre-3);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1), 0 0 0 0.5px var(--trait);
  text-align: left;
}

.composer-bar .plus {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--nuit);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.composer-bar .plus svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.6;
}

/* ---------- Onglets ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: var(--tabbar);
  padding-bottom: var(--bottom);
  display: flex;
  background: var(--barre);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -0.5px 0 var(--trait);
}

.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--encre-2);
  font-size: 10px;
  font-weight: 500;
  position: relative;
}

.tabbar a[aria-current='page'] {
  color: var(--nuit);
}

.tabbar a .ic {
  width: 26px;
  height: 26px;
}

.tabbar .badge {
  position: absolute;
  top: 3px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--alerte);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- Feuilles (panneaux du bas) ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--voile);
  opacity: 0;
  transition: opacity 0.3s;
}

.sheet-backdrop.open {
  opacity: 1;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--kb);
  z-index: 51;
  max-width: 680px;
  margin: 0 auto;
  max-height: calc(100dvh - var(--top) - 10px - var(--kb));
  display: flex;
  flex-direction: column;
  background: var(--fond);
  border-radius: 14px 14px 0 0;
  box-shadow: var(--ombre-feuille);
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.2, 0.9, 0.25, 1), bottom 0.25s;
}

.sheet.open {
  transform: translateY(0);
}

.sheet.dragging {
  transition: none;
}

.sheet.tall {
  height: calc(100dvh - var(--top) - 10px - var(--kb));
}

.sheet-head {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 6px 8px 2px;
  touch-action: none;
}

.sheet-head::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  width: 36px;
  height: 5px;
  margin-left: -18px;
  border-radius: 3px;
  background: var(--encre-3);
}

.sheet-head h2 {
  margin: 10px 0 0;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.sheet-head .nav-btn {
  margin-top: 8px;
}

.sheet-head .nav-btn.strong {
  font-weight: 600;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 8px 16px calc(var(--bottom) + 20px);
}

/* Feuille d'actions (confirmations) */
.action-sheet .sheet-body {
  padding-top: 14px;
}

.action-sheet .message {
  text-align: center;
  color: var(--encre-2);
  font-size: 13px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 0.5px 0 var(--trait);
}

.action-sheet .choices .row {
  justify-content: center;
  color: var(--nuit);
  font-size: 19px;
  min-height: 56px;
}

.action-sheet .choices .row.danger {
  color: var(--alerte);
}

.action-sheet .cancel {
  margin-top: 8px;
}

.action-sheet .cancel .row {
  justify-content: center;
  font-weight: 600;
  color: var(--nuit);
  font-size: 19px;
  min-height: 56px;
}

/* ---------- Saisie rapide ---------- */

.composer {
  padding-top: 4px;
}

.composer textarea {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: var(--surface);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 19px;
  line-height: 1.3;
  min-height: 54px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 2px 0;
  min-height: 30px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  color: var(--encre);
  box-shadow: 0 0 0 0.5px var(--trait);
  animation: chip-in 0.2s ease-out;
}

.chip.date {
  background: var(--nuit-soft);
  color: var(--nuit);
  box-shadow: none;
}

.chip.repeat,
.chip.prio {
  background: var(--ambre-soft);
  color: var(--encre);
  box-shadow: none;
}

button.chip {
  color: var(--encre-2);
}

button.chip[aria-pressed='true'] {
  background: var(--nuit);
  color: #fff;
  box-shadow: none;
}

@keyframes chip-in {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}

.composer .hint {
  color: var(--encre-2);
  font-size: 13px;
  margin: 14px 4px 0;
  line-height: 1.5;
}

.composer .hint code {
  font-family: inherit;
  background: var(--surface);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--encre);
}

.composer .targets {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 14px -16px 0;
  padding: 0 16px 2px;
  scrollbar-width: none;
}

.composer .targets::-webkit-scrollbar {
  display: none;
}

.composer .targets .chip {
  flex: none;
}

/* ---------- Boutons ---------- */

.btn {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  background: var(--nuit);
  color: #fff;
  font-weight: 600;
  font-size: 17px;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
  opacity: 0.85;
}

.btn[disabled] {
  opacity: 0.45;
}

.btn.secondary {
  background: var(--nuit-soft);
  color: var(--nuit);
}

.btn + .btn {
  margin-top: 10px;
}

/* ---------- Cartes d'aide (installer, notifications) ---------- */

.callout {
  background: var(--surface);
  border-radius: var(--rayon-groupe);
  padding: 16px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  align-items: start;
}

.callout .callout-icon {
  grid-row: span 2;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ambre-soft);
  color: var(--ambre);
  display: flex;
  align-items: center;
  justify-content: center;
}

.callout h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.callout p {
  margin: 0;
  color: var(--encre-2);
  font-size: 14px;
  line-height: 1.4;
}

.callout .callout-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.callout .callout-actions .btn {
  min-height: 40px;
  font-size: 15px;
  margin: 0;
}

.callout ol {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--encre);
  font-size: 14px;
  line-height: 1.6;
}

.callout ol svg {
  vertical-align: -3px;
  color: var(--nuit);
}

/* ---------- États vides ---------- */

.empty {
  text-align: center;
  padding: 48px 24px 24px;
  color: var(--encre-2);
}

.empty .empty-art {
  font-size: 44px;
  margin-bottom: 10px;
}

.empty h3 {
  color: var(--encre);
  font-size: 19px;
  margin: 0 0 6px;
}

.empty p {
  margin: 0 auto;
  max-width: 300px;
  font-size: 15px;
  line-height: 1.4;
}

/* ---------- Courses ---------- */

.shop-add {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 12px;
  padding: 0 6px 0 14px;
  min-height: 50px;
}

.shop-add input {
  flex: 1;
  border: 0;
  outline: none;
  background: none;
  font-size: 17px;
  padding: 13px 0;
  min-width: 0;
}

.shop-add button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--nuit);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.shop-add button[disabled] {
  opacity: 0.3;
}

.suggest {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 10px -16px 0;
  padding: 0 16px 4px;
  scrollbar-width: none;
}

.suggest::-webkit-scrollbar {
  display: none;
}

.suggest .chip {
  flex: none;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--encre-2);
}

.live::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--valide);
  animation: live 2s infinite;
}

.live.off::before {
  background: var(--encre-3);
  animation: none;
}

@keyframes live {
  50% {
    opacity: 0.35;
  }
}

.item {
  --sep-left: 52px;
  touch-action: pan-y;
}

.item .name {
  display: block;
}

.item .qty {
  color: var(--encre-2);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.item .by {
  font-size: 12px;
  color: var(--encre-2);
}

.item.checked .name {
  color: var(--encre-2);
  text-decoration: line-through;
  text-decoration-color: var(--encre-3);
}

.item.flash {
  animation: flash 1s ease-out;
}

@keyframes flash {
  from {
    background: var(--ambre-soft);
  }
}

.cat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 4px 7px;
  font-size: 15px;
  font-weight: 600;
}

.cat-head .n {
  color: var(--encre-2);
  font-weight: 400;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cat-grid button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  font-size: 15px;
}

.cat-grid button[aria-pressed='true'] {
  box-shadow: 0 0 0 2px var(--nuit);
}

/* ---------- Notes ---------- */

.search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 0 8px;
  height: 36px;
  color: var(--encre-2);
  margin-bottom: 14px;
}

@media (prefers-color-scheme: light) {
  .search {
    background: rgba(118, 118, 128, 0.12);
  }
}

.search input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  font-size: 17px;
  min-width: 0;
  color: var(--encre);
}

.search input::placeholder {
  color: var(--encre-2);
}

.note-row {
  display: block;
  padding: 12px 16px;
  --sep-left: 16px;
}

.note-row .t {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-row .t .ic {
  color: var(--ambre);
}

.note-row .p {
  color: var(--encre-2);
  font-size: 15px;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.note-row .m {
  color: var(--encre-2);
  font-size: 13px;
  margin-top: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.editor {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--top) - 120px);
}

.editor input.note-title {
  border: 0;
  background: none;
  outline: none;
  font-size: 28px;
  font-weight: 700;
  padding: 4px 0 8px;
  width: 100%;
}

.editor textarea {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  resize: none;
  font-size: 17px;
  line-height: 1.5;
  width: 100%;
  min-height: 50vh;
  padding: 0;
}

.editor .status {
  font-size: 13px;
  color: var(--encre-2);
  min-height: 18px;
}

.editor-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--encre-2);
}

.pick-lines .row {
  --sep-left: 52px;
}

/* ---------- Connexion ---------- */

.auth {
  padding: calc(var(--top) + 48px) 20px calc(var(--bottom) + 32px);
  max-width: 440px;
  margin: 0 auto;
}

.auth .logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin: 0 0 22px;
  display: block;
  box-shadow: 0 8px 24px rgba(52, 66, 168, 0.25);
}

.auth h1 {
  font-size: 30px;
  line-height: 1.15;
  margin: 0 0 8px;
}

.auth p.lead {
  color: var(--encre-2);
  margin: 0 0 26px;
  line-height: 1.4;
}

.auth .group {
  margin-bottom: 8px;
}

.auth .row input {
  font-size: 17px;
}

.error-text {
  color: var(--alerte);
  font-size: 14px;
  margin: 8px 4px 14px;
  min-height: 1em;
}

.auth .switch-link {
  text-align: center;
  margin-top: 18px;
  font-size: 15px;
}

/* ---------- Toast ---------- */

.toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar) + 72px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}

/* Panneau ouvert : les messages restent en bas (au-dessus du clavier), loin des boutons de l'en-tête. */
.sheet-open .toasts {
  bottom: calc(var(--kb) + var(--bottom) + 16px);
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 520px;
  width: max-content;
  min-height: 46px;
  padding: 10px 10px 10px 18px;
  border-radius: 23px;
  background: rgba(30, 30, 32, 0.94);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: toast-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.toast.error {
  background: var(--alerte);
}

.toast button {
  color: #ffd17a;
  font-weight: 600;
  padding: 4px 10px;
}

.toast.out {
  animation: toast-out 0.2s ease-in forwards;
}

@keyframes toast-in {
  from {
    transform: translateY(16px) scale(0.96);
    opacity: 0;
  }
}

@keyframes toast-out {
  to {
    transform: translateY(8px);
    opacity: 0;
  }
}

.offline-banner {
  position: fixed;
  top: calc(var(--top) + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 5px 12px;
  border-radius: 14px;
  background: var(--encre);
  color: var(--fond);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- Chargement ---------- */

.skeleton {
  border-radius: var(--rayon-groupe);
  background: var(--surface);
  height: 132px;
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--surface-2), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

.more-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 20px 4px 7px;
  color: var(--encre-2);
  font-size: 15px;
}

.more-btn .ic {
  transition: transform 0.2s;
}

.more-btn[aria-expanded='true'] .ic {
  transform: rotate(90deg);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 12px;
}

.emoji-grid button {
  aspect-ratio: 1;
  border-radius: 10px;
  font-size: 24px;
}

.emoji-grid button[aria-pressed='true'] {
  background: var(--nuit-soft);
  box-shadow: inset 0 0 0 2px var(--nuit);
}

.weekdays {
  display: flex;
  gap: 6px;
  padding: 10px 16px 12px;
}

.weekdays button {
  flex: 1;
  aspect-ratio: 1;
  max-width: 42px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 600;
}

.weekdays button[aria-pressed='true'] {
  background: var(--nuit);
  color: #fff;
}

.sub-input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  padding: 11px 0;
  min-width: 0;
}

.title-input {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: none;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  padding: 12px 0 4px;
}

.notes-input {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: none;
  font-size: 16px;
  line-height: 1.4;
  padding: 0 0 12px;
  color: var(--encre);
  min-height: 24px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 700px) {
  .screen {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* ---------- Repas ---------- */

.row-sub {
  display: block;
  font-size: 13px;
  color: var(--encre-2);
  margin-top: 2px;
  line-height: 1.3;
}

.segmented a {
  flex: 1;
  text-align: center;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--encre);
}

.segmented a.on {
  background: var(--surface);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .segmented a.on {
    background: #636366;
  }
}

.recipe-tile {
  flex: none;
  border-radius: 10px;
  background: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  line-height: 1;
}

.recipe-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-tile.small,
.recipe-tile.add {
  width: 44px;
  height: 44px;
  font-size: 22px;
}

.recipe-tile.add {
  background: var(--nuit-soft);
  color: var(--nuit);
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px -8px 0;
}

.week-title {
  text-align: center;
  font-weight: 600;
}

.week-title .subtitle {
  color: var(--encre);
  font-size: 17px;
}

.day {
  margin-top: 16px;
}

.day.past {
  opacity: 0.55;
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 4px 7px;
}

.day-head h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.day-head.today h2 {
  color: var(--nuit);
}

.day-head button {
  color: var(--nuit);
  font-size: 14px;
  padding: 4px 0 4px 10px;
}

.meal-row,
.lunchbox-row {
  min-height: 64px;
}

.meal-row .slot,
.lunchbox-row .slot {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ambre);
  margin-bottom: 1px;
}

.lunchbox-row .slot {
  color: var(--valide);
}

.meal-name {
  display: block;
}

.heart {
  color: var(--alerte);
  font-size: 15px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 9px;
  flex: none;
}

.stepper button {
  width: 40px;
  height: 34px;
  font-size: 22px;
  color: var(--nuit);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper button[disabled] {
  color: var(--encre-3);
}

.stepper output {
  min-width: 26px;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.meal-head .meal-title {
  font-size: 19px;
  font-weight: 600;
}

.tonight {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 0 0 4px;
  border-radius: var(--rayon-groupe);
  background: var(--surface);
  color: inherit;
  box-shadow: inset 3px 0 0 var(--ambre);
}

.tonight .tonight-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ambre);
}

.tonight .tonight-title {
  display: block;
  font-weight: 600;
}

.recipe-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 6px 0 14px;
}

.recipe-hero .recipe-tile {
  border-radius: 20px;
}

.recipe-title {
  font-size: 26px;
  line-height: 1.15;
  margin: 0;
  font-weight: 700;
}

.recipe-actions {
  display: flex;
  gap: 10px;
  margin: 12px 0 4px;
}

.recipe-actions .btn {
  margin: 0;
}

.ingredients {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ingredients li {
  padding: 9px 0;
  border-bottom: 0.5px solid var(--trait);
  line-height: 1.35;
}

.ingredients li:last-child {
  border-bottom: 0;
}

.steps {
  margin: 0;
  padding-left: 26px;
}

.steps li {
  padding: 9px 0;
  line-height: 1.45;
}

.steps li::marker {
  color: var(--ambre);
  font-weight: 700;
}

/* Mode cuisine : plein écran, grosses lettres, lisible à un mètre. */
.cook {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--fond);
  display: flex;
  flex-direction: column;
  padding: calc(var(--top) + 8px) 20px calc(var(--bottom) + 16px);
  animation: screen-in 0.2s ease-out;
}

.cook-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cook-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cook-ingredients {
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 8px;
  max-height: 40vh;
  overflow: auto;
}

.cook-ingredients summary {
  font-weight: 600;
  color: var(--nuit);
  cursor: pointer;
}

.cook-counter {
  margin-top: auto;
  color: var(--ambre);
  font-weight: 600;
}

.cook-step {
  font-size: 26px;
  line-height: 1.35;
  font-weight: 500;
  margin: 10px 0 18px;
}

.cook-timers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 34px;
  margin-bottom: auto;
}

.cook-timers .chip {
  font-size: 17px;
  padding: 8px 14px;
  border-radius: 18px;
}

.cook-timers .chip.done {
  background: var(--valide);
  color: #fff;
}

.cook-nav {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.cook-nav .btn {
  margin: 0;
}

/* Mode sombre : texte foncé sur les boutons pleins (le bleu clair rend le blanc illisible). */
@media (prefers-color-scheme: dark) {
  .btn:not(.secondary),
  .composer-bar .plus,
  .shop-add button,
  button.chip[aria-pressed='true'],
  .weekdays button[aria-pressed='true'] {
    color: #10133a;
  }
  .check.on svg {
    stroke: #10133a;
  }
}
