/* Kale app styles, extraits de mockups/kale-home-v2.html v2.0
 * Brand: Whoop / Systèmes territory, sans-serif + mono, cool dark / off-white auto-switch
 */

:root {
  /* Dark mode (default), cool neutral, Whoop-aligned */
  --bg: #0A0B0E;
  --surface: #14161B;
  --surface-2: #1B1D22;
  --hairline: #25282E;
  --hairline-soft: #1B1D22;
  --text: #F2F3F5;
  --text-2: #9CA0A8;
  --text-3: #6B6E76;
  --text-4: #5A5D66;
  --accent: #7DB055;
  --accent-soft: rgba(125, 176, 85, 0.18);
  --marine: #4A6E96;
  --marine-soft: rgba(74, 110, 150, 0.18);
  --rust: #D24528;
  --rust-soft: rgba(210, 69, 40, 0.18);
  --ochre: #E0A33B;
  --ochre-soft: rgba(224, 163, 59, 0.18);
  --sage: #7DB055;
  --sage-soft: rgba(125, 176, 85, 0.18);
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: "DM Mono", "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============== LIGHT MODE (auto via system preference) ==============
   Off-white pur, Whoop-aligned. Pas de warmth, pas de papier.
   Accent vert signature unique, macros en heritage pour identification.
*/
@media (prefers-color-scheme: light) {
  :root {
    --bg: #FAFAFA;
    --surface: #F1F2F4;
    --surface-2: #E9EAEC;
    --hairline: #D6D8DC;
    --hairline-soft: #E5E6E9;
    --text: #0A0B0E;
    --text-2: #3D3F45;
    --text-3: #6B6E76;
    --text-4: #767A82;
    --accent: #5E9438;
    --accent-soft: rgba(94, 148, 56, 0.12);
    --marine: #2B3A4F;
    --marine-soft: rgba(43, 58, 79, 0.10);
    --rust: #C13B22;
    --rust-soft: rgba(193, 59, 34, 0.14);
    --ochre: #B07520;
    --ochre-soft: rgba(176, 117, 32, 0.14);
    --sage: #5E9438;
    --sage-soft: rgba(94, 148, 56, 0.14);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); }
body {
  font-family: var(--sans);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;

  /* App: mobile-first (480px), élargi sur tablette/desktop (720px puis 960px) */
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 28px 100px;
  min-height: 100vh;
  position: relative;
}
@media (min-width: 768px) {
  body { max-width: 720px; padding: 24px 40px 120px; font-size: 16px; }
}
@media (min-width: 1100px) {
  body { max-width: 960px; padding: 32px 56px 140px; }
}

.num { font-feature-settings: "tnum" 1, "lnum" 1; font-variant-numeric: tabular-nums lining-nums; }
.smcaps { letter-spacing: 0.18em; text-transform: uppercase; font-weight: 500; }
.mono { font-family: var(--mono); }

/* Wordmark in app */
.wordmark {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--sans);
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  margin-bottom: 40px;
}
.wordmark .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--marine);
  display: inline-block;
  transform: translateY(-2px);
}

/* Day masthead */
.day {
  margin-bottom: 36px;
}
.day .name {
  font-family: var(--sans);
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--text-2);
  margin-bottom: 4px;
}
.day .meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.day .meta .sep { color: var(--text-4); margin: 0 8px; }

/* Hero number */
.hero-num {
  margin-bottom: 32px;
}
.hero-num .label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.hero-num .value {
  font-family: var(--mono);
  font-weight: 300;
  font-size: 92px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.hero-num .value .unit {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 22px;
  color: var(--text-3);
  letter-spacing: 0;
}
.hero-num .delta {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}
.hero-num .delta .pos { color: var(--marine); }

/* Sparkline */
.sparkline-wrap {
  margin-bottom: 40px;
}
.sparkline {
  width: 100%;
  height: 60px;
  display: block;
  color: var(--text);
}
.sparkline .axis-label {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--text-4);
  letter-spacing: 0.12em;
}

/* Macro rows */
.macros {
  margin-bottom: 44px;
}
.macro-row {
  display: grid;
  grid-template-columns: 18px 1fr 92px;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.macro-row:last-child { border-bottom: none; }
.macro-row .key {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.04em;
}
.macro-row .bar {
  position: relative;
  height: 5px;
  background: var(--hairline);
  border-radius: 1px;
  overflow: hidden;
}
.macro-row .bar .fill {
  position: absolute;
  inset: 0;
  background: var(--marine);
  width: 0;
  transition: width 1.2s var(--ease) 0.4s;
}
.macro-row[data-macro="P"] .key { color: var(--rust); }
.macro-row[data-macro="P"] .bar .fill { background: var(--rust); }
.macro-row[data-macro="L"] .key { color: var(--ochre); }
.macro-row[data-macro="L"] .bar .fill { background: var(--ochre); }
.macro-row[data-macro="G"] .key { color: var(--sage); }
.macro-row[data-macro="G"] .bar .fill { background: var(--sage); }
.macro-row .bar .goal-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: var(--text-3);
}
.macro-row .stat {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  letter-spacing: 0.04em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.macro-row .stat .goal { color: var(--text-4); }
.macro-row .stat .delta {
  display: block;
  font-size: 9.5px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  margin-top: 2px;
  text-transform: uppercase;
}
.macro-row .stat .delta.up { color: var(--text-2); }

/* Card section: hairline-separated, operator-style */
.card {
  padding: 22px 0 26px;
  border-top: 1px solid var(--hairline-soft);
}
.card:first-of-type {
  border-top: none;
  padding-top: 6px;
}

/* Card label header, mono small caps, with optional right meta */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 14px;
}
.section-head .title {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-2);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
}
.section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--hairline);
  transform: translateY(-2px);
}
.section-head .count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.08em;
}

/* Weight tracking card */
.weight-value {
  font-family: var(--mono);
  font-weight: 300;
  font-size: 48px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}
.weight-value .unit {
  font-size: 14px;
  color: var(--text-3);
  letter-spacing: 0;
  font-weight: 400;
}
.weight-spark {
  width: 100%;
  height: 36px;
  display: block;
  color: var(--text);
}
.weight-spark .axis-label {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--text-4);
  letter-spacing: 0.12em;
}

/* Journal entries */
.entries {
  margin-bottom: 36px;
}
.entry {
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline-soft);
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  align-items: baseline;
}
.entry:last-child { border-bottom: none; }
.entry .time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-align: right;
}
.entry .dish {
  font-family: var(--sans);
  font-size: 19px;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.005em;
}
.entry .right {
  text-align: right;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--text-2);
}
.entry .right .kcal {
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.02em;
  display: block;
  margin-bottom: 1px;
}
.entry .right .macros {
  color: var(--text-3);
  letter-spacing: 0.06em;
  font-size: 9.5px;
}

/* Empty future slot */
.empty-slot {
  margin: 8px 0 36px;
  padding: 22px;
  border: 1px dashed var(--hairline);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.3s var(--ease);
}
.empty-slot:hover { border-color: var(--marine); }
.empty-slot .label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.empty-slot .ghost {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text-4);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Demain, aged */
.demain { opacity: 0.42; margin-top: 32px; }
.demain .quiet {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 10px;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

/* Floating action, voice.
   Was absolute inside .phone, now fixed bottom-right relative to viewport. */
.fab-wrap {
  position: fixed;
  bottom: 24px;
  right: max(20px, calc(50vw - 240px + 20px));
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.fab-hint {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--bg);
  padding: 6px 10px;
  border-radius: 2px;
  border: 1px solid var(--hairline-soft);
}
.fab {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--marine);
  border: 1px solid color-mix(in srgb, var(--marine) 70%, white 6%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg);
  cursor: pointer;
  box-shadow:
    0 18px 36px -10px rgba(43, 58, 79, 0.55),
    0 6px 18px -4px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.18s var(--ease), box-shadow 0.3s var(--ease);
  position: relative;
}
.fab::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--marine);
  opacity: 0.3;
  animation: pulse 3.4s var(--ease) infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.45; }
  70% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}
.fab:hover { transform: translateY(-2px); }
.fab:active { transform: scale(0.96); }
.fab svg { width: 22px; height: 22px; }

/* ============== STAGGER REVEAL ============== */

.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.8s var(--ease) forwards;
}
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.18s; }
.delay-3 { animation-delay: 0.32s; }
.delay-4 { animation-delay: 0.46s; }
.delay-5 { animation-delay: 0.6s; }
.delay-6 { animation-delay: 0.74s; }
.delay-7 { animation-delay: 0.88s; }
.delay-8 { animation-delay: 1.02s; }
.delay-9 { animation-delay: 1.16s; }

/* ============== ACCESSIBILITY: REDUCED MOTION ==============
   Respecte la préférence système. Coupe les animations,
   fige les reveals à leur état final, supprime le pulse FAB infini.
*/
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  .fab::before {
    display: none;
  }
}

/* ============== ACCESSIBILITY: FOCUS VISIBLE ============== */
*:focus-visible {
  outline: 2px solid var(--marine);
  outline-offset: 2px;
  border-radius: 2px;
}
.fab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ============== SPRINT 2 ADDITIONS ============== */

/* Wordmark settings cog */
.wordmark { position: relative; }
.wordmark-settings {
  background: transparent;
  border: 0;
  color: var(--text-3);
  margin-left: auto;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s var(--ease);
  position: relative;
}
/* Zone touch 44pt iOS HIG sans grossir le visuel */
.wordmark-settings::before {
  content: '';
  position: absolute;
  inset: -14px;
}
.wordmark-settings:hover { color: var(--text); }
.wordmark-settings svg { width: 16px; height: 16px; }

/* Link button (mini text-style action in section-head) */
.link-button {
  background: transparent;
  border: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 12px 8px;
  position: relative;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.link-button:hover { color: var(--text); }

/* Weight delta inline (next to value au lieu de count) */
.weight-value .delta-aside {
  margin-left: 12px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  align-self: end;
  margin-bottom: 6px;
}

/* Fresh entry animation (htmx-inserted) */
@keyframes entry-fresh-flash {
  0%   { background: var(--accent-soft); transform: translateY(-4px); opacity: 0; }
  20%  { transform: translateY(0); opacity: 1; }
  100% { background: transparent; }
}
.entry-fresh {
  animation: entry-fresh-flash 1400ms var(--ease) forwards;
  border-radius: 4px;
}

/* ============== DIALOG (capture + settings) ============== */
.dialog {
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 0;
  max-width: 420px;
  width: calc(100vw - 32px);
  margin: auto;
  box-shadow: 0 24px 80px -16px rgba(0, 0, 0, 0.5);
}
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.dialog-inner {
  padding: 24px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dialog-title {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}
.dialog-sub {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-3);
  margin: -8px 0 4px;
  line-height: 1.45;
}

/* Capture dialog specifics */
.dialog.capture .capture-mode {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.dialog.capture .capture-state {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.08em;
}
.dialog.capture .capture-waveform {
  display: flex;
  gap: 4px;
  height: 28px;
  align-items: center;
  margin: 4px 0;
}
.dialog.capture .capture-waveform span {
  display: inline-block;
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}
.dialog.capture .capture-waveform span:nth-child(1) { animation-delay: 0s; }
.dialog.capture .capture-waveform span:nth-child(2) { animation-delay: 0.1s; }
.dialog.capture .capture-waveform span:nth-child(3) { animation-delay: 0.2s; }
.dialog.capture .capture-waveform span:nth-child(4) { animation-delay: 0.3s; }
.dialog.capture .capture-waveform span:nth-child(5) { animation-delay: 0.4s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
  50%      { transform: scaleY(1); opacity: 1; }
}
.dialog.capture textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s var(--ease);
}
.dialog.capture textarea:focus {
  border-color: var(--accent);
}

/* Settings form labels */
.dialog.settings label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text-2);
}
.dialog.settings label span {
  flex: 1;
}
.dialog.settings label input {
  width: 120px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  text-align: right;
  outline: none;
  transition: border-color 0.15s var(--ease);
}
.dialog.settings label input:focus {
  border-color: var(--accent);
}

/* Action buttons row */
.capture-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.ghost-btn, .primary-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.ghost-btn {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--text-2);
}
.ghost-btn:hover {
  border-color: var(--text-3);
  color: var(--text);
}
.primary-btn {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--bg);
}
.primary-btn:hover {
  opacity: 0.9;
}
.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Safe area iOS (encoche / Dynamic Island) */
@supports (padding: max(0px)) {
  body {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(80px, env(safe-area-inset-bottom));
  }
  .fab-wrap {
    bottom: max(24px, env(safe-area-inset-bottom));
  }
}

/* =================================================================
   ONBOARDING PAGE — refonte operator/Whoop, sprint 6.10
   ================================================================= */

body.onboarding-page {
  background: var(--bg);
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: 0;
}

/* ===== Hero ===== */
.ob-hero {
  padding: 32px 0 40px;
  text-align: center;
}
.ob-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--sans);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 32px;
}
.ob-wordmark-text { line-height: 1; }
.ob-wordmark-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-bottom: 4px;
  display: inline-block;
}
.ob-headline {
  font-family: var(--sans);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 12px;
}
.ob-subhead {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  margin: 0;
  line-height: 1.5;
}

/* ===== Form layout ===== */
.ob-form {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-bottom: 140px; /* place pour le sticky CTA */
}
.ob-section {
  display: flex;
  flex-direction: column;
}
.ob-section-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  margin: 0 0 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline-soft);
}

/* ===== Big-number rows (mesures) ===== */
.ob-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 4px 18px;
  border-bottom: 1px solid var(--hairline-soft);
  cursor: text;
  position: relative;
  min-height: 64px;
}
.ob-row:last-of-type {
  border-bottom: none;
}
.ob-row-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.ob-row-input {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-left: auto;
}
.ob-row input[type="number"] {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 0;
  padding: 0;
  outline: none;
  width: auto;
  max-width: 140px;
  letter-spacing: -0.01em;
  text-align: right;
  -moz-appearance: textfield;
  transition: color 0.15s var(--ease);
}
.ob-row input[type="number"]::-webkit-outer-spin-button,
.ob-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.ob-row input:focus {
  color: var(--accent);
}
.ob-row-unit {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: lowercase;
  flex-shrink: 0;
}
.ob-row-hint {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-4);
  letter-spacing: 0.06em;
  margin: 14px 4px 0;
  line-height: 1.55;
}

/* Select dans une ob-row (palier de départ) */
.ob-row-select {
  cursor: pointer;
}
.ob-row-select .ob-row-input {
  flex: 1;
  justify-content: flex-end;
  position: relative;
  padding-right: 20px;
}
.ob-row-select .ob-row-input::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-30%) rotate(45deg);
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  pointer-events: none;
}
.ob-row select {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  text-align: right;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.02em;
}

/* ===== Protocoles ===== */
.ob-protocols {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
}
.ob-proto {
  display: grid;
  grid-template-columns: 40px 1fr 18px;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  cursor: pointer;
  background: var(--bg);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), transform 0.1s var(--ease);
  position: relative;
  min-height: 72px;
}
.ob-proto:hover {
  border-color: var(--text-3);
}
.ob-proto:active {
  transform: scale(0.992);
}
.ob-proto input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ob-proto:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.proto-code {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.04em;
  transition: color 0.18s var(--ease);
}
.ob-proto:has(input:checked) .proto-code {
  color: var(--accent);
}
.proto-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.proto-name {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.005em;
}
.proto-spec {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  line-height: 1.4;
}
.proto-check {
  width: 18px;
  height: 18px;
  border: 1px solid var(--text-3);
  border-radius: 50%;
  position: relative;
  transition: border-color 0.18s var(--ease);
  justify-self: end;
}
.ob-proto:has(input:checked) .proto-check {
  border-color: var(--accent);
}
.ob-proto:has(input:checked) .proto-check::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
}

/* ===== Formula recap ===== */
.ob-formula {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-4);
  letter-spacing: 0.05em;
  line-height: 1.7;
  margin: 12px 4px 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--hairline-soft);
}
.ob-formula span {
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 9.5px;
  margin-right: 4px;
}

/* ===== Sticky CTA ===== */
.ob-cta-sticky {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px max(20px, env(safe-area-inset-right))
           max(20px, env(safe-area-inset-bottom))
           max(20px, env(safe-area-inset-left));
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(to top, var(--bg) 30%, color-mix(in srgb, var(--bg) 80%, transparent) 70%, transparent 100%);
}
.ob-cta {
  pointer-events: auto;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  min-height: 56px;
  transition: transform 0.1s var(--ease), opacity 0.15s var(--ease);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}
.ob-cta:hover {
  opacity: 0.92;
}
.ob-cta:active {
  transform: scale(0.985);
}
.ob-cta svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Desktop ≥768px : centre, plus respiré */
@media (min-width: 768px) {
  body.onboarding-page {
    max-width: 560px;
    padding-top: max(40px, env(safe-area-inset-top));
  }
  .ob-hero { padding: 48px 0 56px; }
  .ob-headline { font-size: 40px; }
  .ob-row input[type="number"] { font-size: 38px; }
  .ob-cta-sticky {
    padding: 32px max(40px, env(safe-area-inset-right))
             max(32px, env(safe-area-inset-bottom))
             max(40px, env(safe-area-inset-left));
  }
}

/* ============== SPRINT 3 ADDITIONS ============== */

/* App header (wordmark + cog) */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* Layout grid : sur desktop, 2 colonnes pour day/hero/trend/macros/weight */
.layout-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
@media (min-width: 768px) {
  .layout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "day    hero"
      "trend  macros"
      "weight weight"
      "journal journal";
    gap: 0 28px;
  }
  .card-day     { grid-area: day; }
  .card-hero    { grid-area: hero; }
  .card-trend   { grid-area: trend; }
  .card-macros  { grid-area: macros; }
  .card-weight  { grid-area: weight; }
  .card-journal { grid-area: journal; }
}
@media (min-width: 1100px) {
  .layout-grid {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
      "day     hero   hero"
      "trend   macros weight"
      "journal journal journal";
    gap: 0 32px;
  }
}

/* Empty state */
.empty-state {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.04em;
  margin: 18px 0 0;
}

/* ============== MEAL SECTIONS ============== */
.meal-section {
  margin-bottom: 8px;
}
.meal-section + .meal-section {
  margin-top: 8px;
  padding-top: 8px;
}
.meal-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 6px;
}
.meal-label {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--accent);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
}
.meal-rule {
  flex: 1;
  height: 1px;
  background: var(--hairline);
  transform: translateY(-1px);
}
.meal-kcal {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.06em;
}
.meal-add-btn {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--text-3);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease), background 0.15s var(--ease);
  position: relative;
  flex-shrink: 0;
}
/* Zone touch 44pt via overlay invisible */
.meal-add-btn::before {
  content: '';
  position: absolute;
  inset: -8px;
}
.meal-add-btn:active {
  background: var(--accent-soft);
  transform: scale(0.95);
}
.meal-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.meal-add-btn svg {
  width: 12px;
  height: 12px;
}
.meal-entries {
  display: flex;
  flex-direction: column;
}
.meal-empty {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-4);
  letter-spacing: 0.04em;
  padding: 10px 0 14px 4px;
}

/* Entry actions (duplicate + delete) à droite de chaque entry, masqués jusqu'au hover/tap */
.entry {
  position: relative;
  grid-template-columns: 48px 1fr auto auto !important;
}
.entry-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
  margin-left: 8px;
}
.entry:hover .entry-actions,
.entry:focus-within .entry-actions {
  opacity: 1;
}
@media (hover: none) {
  .entry-actions { opacity: 0.65; }
}
.entry-action-btn {
  background: transparent;
  border: 0;
  padding: 8px;
  min-width: 32px;
  min-height: 32px;
  cursor: pointer;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
  position: relative;
}
/* Zone touch 44pt via overlay (visu compact mais hit-area généreuse) */
.entry-action-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
}
.entry-action-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.entry-action-btn.destructive:hover {
  color: var(--rust);
  background: var(--rust-soft);
}
.entry-action-btn svg {
  width: 14px;
  height: 14px;
}

/* ============== TWO FABs (text + voice) ============== */
.fab-wrap {
  align-items: center;
  flex-direction: row !important;
  gap: 12px;
}
.fab-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}
.fab-secondary {
  width: 48px;
  height: 48px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--text-2);
  box-shadow:
    0 8px 20px -8px rgba(0, 0, 0, 0.4),
    0 2px 6px -2px rgba(0, 0, 0, 0.3);
}
.fab-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}
.fab-secondary svg {
  width: 18px;
  height: 18px;
}
.fab-primary {
  /* hérite du .fab classique */
  touch-action: none;  /* éviter le scroll pendant le hold */
  user-select: none;
}
.fab-primary.recording {
  background: var(--rust);
  border-color: var(--rust);
  transform: scale(1.08);
  box-shadow:
    0 0 0 6px rgba(210, 69, 40, 0.18),
    0 0 0 12px rgba(210, 69, 40, 0.08),
    0 18px 36px -10px rgba(210, 69, 40, 0.55);
  transition: transform 0.15s var(--ease), box-shadow 0.3s var(--ease), background 0.2s var(--ease);
}
.fab-primary.recording::before {
  animation-duration: 1.4s;
  border-color: var(--rust);
  opacity: 0.5;
}

/* Recording sheet (Wispr-style bottom sheet pendant hold) */
.recording-sheet {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  z-index: 11;
  width: calc(100vw - 32px);
  max-width: 420px;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
}
.recording-sheet.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.recording-sheet-inner {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow:
    0 24px 60px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.recording-state {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.recording-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rust);
  box-shadow: 0 0 12px rgba(210, 69, 40, 0.7);
  animation: rec-pulse 1.2s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(0.75); opacity: 0.6; }
}
.recording-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.recording-transcript {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.4;
  color: var(--text);
  min-height: 28px;
  margin-bottom: 10px;
  font-weight: 500;
}
.recording-hint {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text-4);
  letter-spacing: 0.08em;
}

/* ===== Capture dialog refondu (sprint 5) ===== */

/* Header avec titre + close button */
.dialog.capture .capture-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.dialog.capture .capture-mode {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: color 0.2s var(--ease);
}
.dialog.capture .capture-mode.error {
  color: var(--rust, #c75432);
}
.capture-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--hairline-soft);
  border-radius: 50%;
  color: var(--text-3);
  cursor: pointer;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
  flex-shrink: 0;
}
.capture-close:hover { border-color: var(--text-3); color: var(--text); }
.capture-close svg { width: 14px; height: 14px; }

/* Row de chips pour choisir la section meal */
.capture-section-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -4px 4px;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.capture-section-row::-webkit-scrollbar { display: none; }
.capture-chip {
  flex: 1 0 auto;
  min-width: 80px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.1s var(--ease);
}
.capture-chip:hover { border-color: var(--text-3); }
.capture-chip:active { transform: scale(0.97); }
.capture-chip .chip-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.capture-chip .chip-time {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-4);
  letter-spacing: 0.05em;
  line-height: 1;
}
.capture-chip.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.capture-chip.active .chip-label { color: var(--text); }
.capture-chip.active .chip-time { color: color-mix(in srgb, var(--accent) 80%, var(--text-3)); }

/* ===== Autocomplete dropdown CIQUAL ===== */
.capture-suggestions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: -4px 0 6px;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  border-top: 1px solid var(--hairline-soft);
  padding-top: 6px;
}
.capture-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 8px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s var(--ease);
  min-height: 40px;
}
.capture-suggestion:hover,
.capture-suggestion:focus {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  outline: none;
}
.capture-suggestion .sugg-name {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.capture-suggestion .sugg-macros {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
}
.capture-suggestion .sugg-kcal { color: var(--text-2); font-weight: 500; }
.capture-suggestion .sugg-per { color: var(--text-4); font-size: 9.5px; }

/* Ligne meta (heure custom) sous le textarea */
.capture-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -2px 0 2px;
}
.capture-meta-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-4);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.capture-meta input {
  flex: 0 0 auto;
  width: 80px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  text-align: center;
  outline: none;
  transition: border-color 0.15s var(--ease);
}
.capture-meta input:focus { border-color: var(--accent); }
.capture-meta input::placeholder { color: var(--text-4); }

/* Bouton submit avec spinner inline pour loading state */
.primary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary-btn .btn-spinner {
  display: none;
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.primary-btn.loading .btn-label { opacity: 0.35; }
.primary-btn.loading .btn-spinner { display: inline-block; }
.primary-btn:disabled { cursor: wait; }
@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .capture-chip { min-width: 72px; padding: 7px 8px; }
  .capture-chip .chip-label { font-size: 11px; }
  .capture-chip .chip-time { font-size: 8.5px; }
}

@media (min-width: 768px) {
  .recording-sheet { bottom: 130px; }
}

/* ============== TOAST (success/error feedback inline) ============== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(116px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  max-width: calc(100% - 32px);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.22s var(--ease), opacity 0.22s var(--ease);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.32);
}
.toast.active {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.toast-success {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.toast.toast-error {
  border-color: color-mix(in srgb, var(--rust) 60%, transparent);
  color: color-mix(in srgb, var(--rust) 50%, var(--text));
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 0.15s linear; transform: translate(-50%, 0); }
}

/* ============== WEIGHT QUICK-LOG DIALOG ============== */
.dialog.weight-log .weight-input-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 18px 0 8px;
  border-bottom: 1px solid var(--hairline-soft);
  margin-bottom: 8px;
}
.dialog.weight-log #weight-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: 38px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  text-align: left;
  -moz-appearance: textfield;
}
.dialog.weight-log #weight-input::-webkit-outer-spin-button,
.dialog.weight-log #weight-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.dialog.weight-log #weight-input::placeholder {
  color: var(--text-4);
}
.dialog.weight-log .weight-unit {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
