/* ============================================================
   MEDI-DIET — Design system mobile
   Méditerranée éditoriale : papier chaud, émeraude profonde,
   terracotta, typographie Fraunces / Readex Pro.
   ============================================================ */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: "Readex Pro";
  src: url("../fonts/readex.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+0020-007E;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #FBFAF6;
  --bg-2: #F1E8D8;
  --surface: #FFFDF8;
  --surface-2: #F7F0E4;
  --ink: #20322A;
  --ink-2: #52655B;
  --ink-3: #66756B; /* ≥ 4.5:1 sur --bg et --surface */
  --line: rgba(32, 50, 42, 0.10);
  --line-strong: rgba(32, 50, 42, 0.18);

  --brand: #173E31;
  --brand-deep: #0B281F;
  --brand-soft: #E7EFE7;
  --on-brand: #FFF9EA;
  --accent: #C86D3F;
  --accent-soft: #F7E2D5;
  --gold: #A9792B;
  --gold-soft: #F4E5C3;

  --c-programme: #16594A;
  --c-programme-2: #2A7A64;
  --c-eau: #1F6E8C;
  --c-eau-2: #3A93B3;
  --c-poulet: #B07E1F;
  --c-poulet-2: #D09E3F;
  --c-fer: #A94A2E;
  --c-fer-2: #C66A48;
  --c-levain: #7C6134;
  --c-levain-2: #9C7F4E;

  --ok: #2E7D5B;
  --warn: #B3701E;
  --bad: #B0442C;

  --radius-s: 14px;
  --radius: 20px;
  --radius-l: 26px;
  --radius-xl: 34px;

  --shadow-1: 0 2px 8px rgba(32, 50, 42, 0.06), 0 10px 28px rgba(32, 50, 42, 0.07);
  --shadow-2: 0 8px 24px rgba(32, 50, 42, 0.10), 0 18px 44px rgba(32, 50, 42, 0.12);
  --shadow-3: 0 16px 42px rgba(32, 50, 42, 0.16), 0 28px 68px rgba(32, 50, 42, 0.18);

  --font-display: "Fraunces", "Readex Pro", Georgia, serif;
  --font-body: "Manrope", "Readex Pro", -apple-system, "Segoe UI", Roboto, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --dur: 0.45s;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 76px;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh; /* fallback iOS < 15.4 */
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.35s ease;
}

html[lang="ar"] body { font-family: "Readex Pro", var(--font-body); letter-spacing: 0; }
html[lang="ar"] .display, html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 {
  font-family: "Readex Pro", sans-serif;
  font-weight: 600;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
ul, ol { list-style: none; }
a { color: var(--brand); text-decoration: none; }

h1, h2, h3, .display { font-family: var(--font-display); font-weight: 560; letter-spacing: 0; line-height: 1.16; }

::selection { background: var(--brand); color: var(--on-brand); }

/* ---------- Layout ---------- */
.app {
  max-width: 560px;
  margin-inline: auto;
  min-height: 100vh; /* fallback iOS < 15.4 */
  min-height: 100dvh;
  position: relative;
}

.view {
  padding: calc(var(--safe-top) + 18px) 20px calc(var(--tabbar-h) + var(--safe-bottom) + 42px);
  outline: none;
  animation: screen-in var(--dur) var(--ease-out) both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* stagger helper: children with --i */
.stagger > * {
  animation: rise 0.55s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
}
.kicker {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
html[lang="ar"] .kicker { letter-spacing: 0; }
.page-title { font-size: clamp(1.7rem, 6.5vw, 2.1rem); }
.page-sub { color: var(--ink-2); font-size: 0.95rem; margin-top: 6px; max-width: 34ch; }

.avatar-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(160deg, #183F31, #0F2B22);
  border: 1.5px solid #C59B45;
  box-shadow: 0 0 0 3px rgba(197, 155, 69, 0.12), 0 12px 24px rgba(18, 42, 32, 0.20);
  display: grid; place-items: center;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* back header for pushed screens */
.pushbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
}
.back-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  display: grid; place-items: center;
  transition: transform 0.2s var(--ease-spring);
  flex-shrink: 0;
}
.back-btn:active { transform: scale(0.88); }
.back-btn svg { width: 20px; height: 20px; stroke: var(--ink); }
html[dir="rtl"] .back-btn svg { transform: scaleX(-1); }
.pushbar h1 { font-size: 1.35rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-1);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.card + .card, .section + .section { margin-top: 16px; }
.section-title {
  font-size: 1.28rem;
  margin: 26px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-title .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.card-press { transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease; }
.card-press:active { transform: scale(0.975); }

/* Hero photo — carte principale du jour */
.hero {
  background: var(--brand-deep);
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  color: #FFF8E8;
  box-shadow: 0 18px 40px rgba(22, 44, 34, 0.18);
  border: 1px solid rgba(169, 121, 43, 0.18);
  display: block;
  padding: 28px 22px 24px;
  width: 100%;
  text-align: start;
}
.hero::before {
  content: none;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(8, 30, 23, 0.94) 0%, rgba(8, 30, 23, 0.72) 45%, rgba(8, 30, 23, 0.10) 100%),
    linear-gradient(0deg, rgba(8, 30, 23, 0.18), rgba(8, 30, 23, 0.18));
}
/* En RTL le texte se place à droite : le voile sombre doit suivre. */
html[dir="rtl"] .hero::after {
  background:
    linear-gradient(270deg, rgba(8, 30, 23, 0.94) 0%, rgba(8, 30, 23, 0.72) 45%, rgba(8, 30, 23, 0.10) 100%),
    linear-gradient(0deg, rgba(8, 30, 23, 0.18), rgba(8, 30, 23, 0.18));
}
html[dir="rtl"] .hero-photo { object-position: 33% center; }
.hero-txt {
  position: relative;
  z-index: 2;
  max-width: 86%;
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center;
}
.hero .hero-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: #E7C875;
  background: rgba(255, 249, 234, 0.06);
  padding: 9px 15px; border-radius: 999px;
  margin-bottom: 16px;
  border: 1px solid rgba(231, 200, 117, 0.52);
}
html[lang="ar"] .hero .hero-kicker { letter-spacing: 0; }
.hero h2 { font-size: clamp(1.95rem, 8vw, 2.34rem); margin-bottom: 10px; color: #FFFDF5; }
.hero p { font-size: 0.98rem; line-height: 1.38; color: rgba(255, 248, 232, 0.86); max-width: 26ch; }
.hero .hero-cta {
  margin-top: 18px;
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #FFF8E8, #F3E6C6); color: #162F26;
  font-weight: 800; font-size: 0.9rem;
  padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  transition: transform 0.25s var(--ease-spring);
}
.hero .hero-cta:active { transform: scale(0.94); }
.hero .cta-arrow { font-size: 1.1rem; line-height: 1; }
html[dir="rtl"] .hero .cta-arrow { transform: scaleX(-1); }
.hero-photo {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 67% center;
  border: 0;
}

/* progress bar */
.progress {
  height: 8px; border-radius: 99px;
  background: rgba(255, 249, 238, 0.25);
  overflow: hidden;
  margin-top: 14px;
}
.progress i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #FFD98E, #FFB35C);
  border-radius: 99px;
  transition: width 0.8s var(--ease-out);
}
.card .progress { background: var(--bg-2); }
.card .progress i { background: linear-gradient(90deg, var(--c-programme-2), var(--c-programme)); }

/* ---------- Chips, badges, segmented ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem; font-weight: 700;
  color: var(--ink-2);
  transition: all 0.25s var(--ease-spring);
  white-space: nowrap;
}
.chip.on {
  background: var(--brand); color: var(--on-brand);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(22, 89, 74, 0.35);
}
.chip:active { transform: scale(0.93); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}
html[lang="ar"] .badge { letter-spacing: 0; }

.seg {
  display: flex;
  background: var(--bg-2);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.seg button {
  flex: 1;
  padding: 9px 10px;
  border-radius: 999px;
  font-size: 0.86rem; font-weight: 700;
  color: var(--ink-2);
  transition: all 0.3s var(--ease-spring);
}
.seg button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* horizontal scroller */
.hscroll {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 4px 0 12px;
  margin-inline: 0;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 800; font-size: 0.95rem;
  background: var(--brand); color: var(--on-brand);
  box-shadow: 0 6px 20px rgba(22, 89, 74, 0.3);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s ease;
  width: 100%;
}
.btn:active { transform: scale(0.96); }
.btn.ghost {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn.danger { background: transparent; color: var(--bad); border: 1.5px solid currentColor; box-shadow: none; }
.btn.small { padding: 10px 16px; font-size: 0.85rem; width: auto; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 520px);
  height: 76px;
  display: flex;
  align-items: stretch;
  background: linear-gradient(170deg, #1D4033, #102A21);
  border: 1px solid rgba(197, 155, 69, 0.30);
  border-radius: 24px;
  box-shadow: 0 16px 36px rgba(18, 42, 32, 0.24);
  z-index: 50;
  padding: 8px;
  gap: 2px;
}
.tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  border-radius: 18px;
  color: rgba(244, 235, 215, 0.62);
  font-size: 0.7rem; font-weight: 800;
  letter-spacing: 0.02em;
  transition: color 0.3s ease, background 0.3s ease, transform 0.2s var(--ease-spring);
  position: relative;
}
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab svg { width: 23px; height: 23px; transition: transform 0.35s var(--ease-spring); }
.tab.on { color: #E7C875; background: rgba(231, 200, 117, 0.13); }
.tab.on svg { transform: translateY(-1px) scale(1.08); }
.tab:active { transform: scale(0.9); }

/* ---------- Today screen ---------- */
.greeting { font-size: clamp(2.55rem, 11vw, 3.45rem); line-height: 1.02; color: #263A31; }
.greet-sub { font-family: var(--font-display); color: var(--ink-2); font-size: 1.08rem; margin-top: 6px; }
.date-line { color: var(--ink-2); font-size: 0.92rem; font-weight: 600; margin-top: 4px; }

/* têtes de section avec icône + « voir tout » */
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 20px 0 10px;
}
.sec-head .section-title { margin: 0; }
.sec-ico { font-size: 1rem; }
.chev-i { display: inline-block; }
html[dir="rtl"] .chev-i { transform: scaleX(-1); }
.see-all {
  color: var(--ink);
  font-weight: 800; font-size: 0.9rem;
  flex-shrink: 0;
}

/* meal cards (horizontal) */
.meal-mini {
  width: 184px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(32, 50, 42, 0.08);
  text-align: start;
  position: relative;
}
.meal-mini img { height: 108px; width: 100%; object-fit: cover; }
.meal-mini .mm-body { padding: 12px 14px 14px; display: block; }
.meal-mini .mm-kind {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.68rem; font-weight: 800; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.08em;
  white-space: nowrap; overflow: hidden;
}
.meal-mini .mm-txt { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.meal-mini .mm-ico { font-size: 0.85rem; }
html[lang="ar"] .meal-mini .mm-kind { letter-spacing: 0; }
.meal-mini .mm-title {
  font-size: 0.9rem; font-weight: 700; line-height: 1.32;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.6em;
  margin-top: 4px;
}
.meal-mini .mm-bar {
  display: block;
  height: 6px; border-radius: 99px;
  background: #EEE3C8;
  margin-top: 10px;
  overflow: hidden;
}
.meal-mini .mm-bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #E4BE6A, #C9A24B);
  border-radius: 99px;
  transition: width 0.6s var(--ease-out);
}
.meal-mini .mm-check {
  position: absolute; top: 10px; inset-inline-end: 10px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 253, 248, 0.92);
  display: grid; place-items: center;
  box-shadow: 0 5px 16px rgba(32, 50, 42, 0.12);
  color: #826423;
}
.meal-mini.done img { filter: none; }
.meal-mini.done .mm-check { background: rgba(255, 253, 248, 0.94); color: #826423; }

/* hydration — carte photo émeraude */
.hydro-lux {
  min-height: 224px;
  background: linear-gradient(150deg, #1B4234 0%, #102D23 58%, #0A2119 100%);
  border: 1px solid rgba(231, 200, 117, 0.18);
  border-radius: 24px;
  box-shadow: 0 16px 34px rgba(18, 42, 32, 0.24);
  padding: 22px;
  display: block;
  color: #FFF8E8;
  position: relative; overflow: hidden;
}
.hydro-lux::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(10, 33, 25, 0.94) 0%, rgba(10, 33, 25, 0.72) 53%, rgba(10, 33, 25, 0.22) 100%),
    linear-gradient(0deg, rgba(10, 33, 25, 0.14), rgba(10, 33, 25, 0.14));
  pointer-events: none;
}
html[dir="rtl"] .hydro-lux::after {
  background:
    linear-gradient(270deg, rgba(10, 33, 25, 0.94) 0%, rgba(10, 33, 25, 0.72) 53%, rgba(10, 33, 25, 0.22) 100%),
    linear-gradient(0deg, rgba(10, 33, 25, 0.14), rgba(10, 33, 25, 0.14));
}
.hydro-title,
.hydro-grid {
  position: relative;
  z-index: 2;
}
.hydro-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hydro-title h2 {
  font-size: 1.52rem;
  color: #FFF8E8;
}
.hydro-title span {
  font-size: 1.1rem;
}
.hydro-grid {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 14px;
}
.hydro-lux .ring-bg { stroke: rgba(255, 248, 232, 0.20); }
.hydro-lux .ring-center b { color: #FBF6E9; }
.hydro-lux .ring-center span { color: rgba(255, 248, 232, 0.74); }
.hydro-mid { flex: 1; min-width: 0; }
.h-sub { font-size: 0.94rem; color: rgba(255, 248, 232, 0.88); max-width: 18ch; }
.h-goal { font-size: 0.86rem; color: #E7C875; font-weight: 700; margin-top: 10px; }
.hydro-lux .water-btn {
  width: 44px; height: 44px;
  background: rgba(255, 248, 232, 0.08);
  border: 1.5px solid rgba(255, 248, 232, 0.42);
  color: #FFF8E8;
  box-shadow: none;
}
.hydro-lux .water-btn.minus { background: rgba(255, 248, 232, 0.04); color: #FFF8E8; }
.hydro-lux .water-btn:disabled { opacity: 0.35; }
.water-glass {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 248, 232, 0.16);
  border: 1.5px solid rgba(255, 248, 232, 0.25);
  display: grid; place-items: center;
  font-size: 1.05rem;
}
.hydro-photo {
  position: absolute; top: 0; bottom: 0; inset-inline-end: 0;
  width: 54%; height: 100%;
  object-fit: cover;
  opacity: 0.96;
  z-index: 0;
  -webkit-mask-image: linear-gradient(to left, black 42%, transparent);
  mask-image: linear-gradient(to left, black 42%, transparent);
}
html[dir="rtl"] .hydro-photo {
  -webkit-mask-image: linear-gradient(to right, black 45%, transparent);
  mask-image: linear-gradient(to right, black 45%, transparent);
}

.hydro { display: flex; align-items: center; gap: 18px; }
.ring-wrap { position: relative; width: 122px; height: 122px; flex-shrink: 0; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--bg-2); stroke-width: 9; }
.ring-fg {
  fill: none; stroke: url(#waterGrad); stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.7s var(--ease-out);
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800;
}
.ring-center b { font-size: 2.25rem; font-family: var(--font-display); }
.ring-center span { font-size: 0.78rem; color: var(--ink-3); font-weight: 700; }
.hydro-actions { display: flex; gap: 12px; margin-top: 18px; }
.water-btn {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1.3rem; font-weight: 800;
  background: var(--c-eau); color: #F2FAFD;
  box-shadow: 0 6px 18px rgba(31, 110, 140, 0.35);
  transition: transform 0.25s var(--ease-spring);
}
.water-btn:active { transform: scale(0.85); }
.water-btn.minus { background: var(--bg-2); color: var(--ink-2); box-shadow: none; }
.water-btn:disabled { opacity: 0.4; }

@keyframes splash {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.ring-wrap.splash { animation: splash 0.5s var(--ease-spring); }

/* quick tools */
.qt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.qt {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 13px 14px;
  text-align: start;
  transition: transform 0.25s var(--ease-spring);
}
.qt:active { transform: scale(0.95); }
.qt .qt-ico {
  width: 40px; height: 40px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  color: #fff;
}
.qt b { font-size: 0.82rem; line-height: 1.25; font-weight: 700; display: block; }

/* ---------- Programme screen ---------- */
.daychip {
  min-width: 62px;
  padding: 10px 8px 8px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
  transition: all 0.3s var(--ease-spring);
}
.daychip .dc-n { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; display: block; line-height: 1.1; }
.daychip .dc-w { font-size: 0.64rem; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
html[lang="ar"] .daychip .dc-w { letter-spacing: 0; }
.daychip.on {
  background: var(--brand); border-color: transparent;
  color: var(--on-brand);
  box-shadow: 0 6px 18px rgba(22, 89, 74, 0.35);
  transform: translateY(-2px);
}
.daychip.on .dc-w { color: color-mix(in srgb, var(--on-brand) 70%, transparent); }
.daychip .dc-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--ok); margin: 3px auto 0;
  opacity: 0; transition: opacity 0.3s;
}
.daychip.has-done .dc-dot { opacity: 1; }

.day-head { margin: 6px 0 14px; }
.day-mood { color: var(--ink-2); font-size: 0.95rem; margin-top: 4px; }

.tipcard {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--gold-soft);
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.9rem;
}
.tipcard .t-ico { font-size: 1.2rem; flex-shrink: 0; }
.tipcard b { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); margin-bottom: 2px; }
html[lang="ar"] .tipcard b { letter-spacing: 0; }

/* meal rows */
.meal-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-1);
  padding: 12px;
  width: 100%;
  text-align: start;
  transition: transform 0.25s var(--ease-spring);
}
.meal-row:active { transform: scale(0.98); }
.meal-row + .meal-row { margin-top: 12px; }
.meal-row img {
  width: 76px; height: 76px;
  border-radius: 18px;
  object-fit: cover;
  flex-shrink: 0;
}
.meal-row .mr-body { flex: 1; min-width: 0; }
.meal-row .mr-meta { display: flex; align-items: center; gap: 8px; font-size: 0.7rem; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: 0.05em; }
html[lang="ar"] .meal-row .mr-meta { letter-spacing: 0; }
.meal-row .mr-meta .time { color: var(--ink-3); }
.meal-row h3 { font-size: 0.98rem; line-height: 1.3; margin-top: 3px; font-family: var(--font-body); font-weight: 700; }
.meal-row .mr-sub { font-size: 0.78rem; color: var(--ink-3); font-weight: 600; margin-top: 3px; }
.meal-row.done { opacity: 0.72; }
.meal-row.done img { filter: saturate(0.5); }
.meal-row.done h3 { text-decoration: line-through; text-decoration-color: var(--ink-3); }

.check {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid; place-items: center;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.3s var(--ease-spring);
  background: transparent;
}
.check.on {
  background: var(--ok); border-color: var(--ok); color: #fff;
  animation: pop 0.4s var(--ease-spring);
}
@keyframes pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.check svg { width: 16px; height: 16px; }

/* ---------- Recipe screen ---------- */
.recipe-hero {
  margin: calc(-1 * (var(--safe-top) + 18px)) -20px 0;
  position: relative;
  height: 300px;
}
.recipe-hero img { width: 100%; height: 100%; object-fit: cover; }
.recipe-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.35), transparent 30%, transparent 62%, var(--bg) 100%);
}
.recipe-hero .back-btn {
  position: absolute;
  top: calc(var(--safe-top) + 14px);
  inset-inline-start: 16px;
  z-index: 2;
  background: rgba(255, 253, 248, 0.9);
}
.recipe-hero .back-btn svg { stroke: #1B2723; }
.recipe-hero .fav-btn { color: #8B968C; }
.recipe-hero .fav-btn.on { color: #D96B45; }
.recipe-hero .fav-btn {
  position: absolute;
  top: calc(var(--safe-top) + 14px);
  inset-inline-end: 16px;
  z-index: 2;
}
.fav-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 253, 248, 0.9);
  display: grid; place-items: center;
  box-shadow: var(--shadow-1);
  font-size: 1.15rem;
  transition: transform 0.25s var(--ease-spring);
  color: #B8BDB4;
}
.fav-btn.on { color: var(--accent); animation: pop 0.4s var(--ease-spring); }
.recipe-body { position: relative; margin-top: -34px; }
.recipe-body h1 { font-size: 1.6rem; margin: 8px 0 8px; }
.recipe-desc { color: var(--ink-2); font-size: 0.95rem; }

.statrow { display: flex; gap: 10px; margin-top: 16px; }
.stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow-1);
}
.stat b { font-family: var(--font-display); font-size: 1.05rem; display: block; }
.stat span { font-size: 0.68rem; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }
html[lang="ar"] .stat span { letter-spacing: 0; }

.note {
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.88rem;
  border: 1px solid;
  margin-top: 10px;
}
.note b { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 3px; }
html[lang="ar"] .note b { letter-spacing: 0; }
.note.n-carb { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.note.n-carb b { color: var(--brand); }
.note.n-diab { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 30%, transparent); }
.note.n-diab b { color: var(--gold); }
.note.n-chol { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.note.n-chol b { color: var(--accent); }

.ing-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line-strong);
  font-size: 0.92rem;
}
.ing-list li::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.ing-list li:last-child { border-bottom: 0; }

.step-list { counter-reset: step; }
.step-list li {
  display: flex; gap: 14px;
  padding: 12px 0;
  font-size: 0.93rem;
}
.step-list li::before {
  counter-increment: step;
  content: counter(step);
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 800; font-size: 0.85rem;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-family: var(--font-display);
}

/* ---------- Shopping ---------- */
.shop-cat { margin-top: 22px; }
.shop-cat h3 {
  font-size: 0.8rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
html[lang="ar"] .shop-cat h3 { letter-spacing: 0; }
.shop-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px 14px;
  text-align: start;
  font-size: 0.92rem;
  transition: opacity 0.3s;
}
.shop-item:first-of-type { border-radius: var(--radius) var(--radius) 0 0; }
.shop-item:last-of-type { border-radius: 0 0 var(--radius) var(--radius); }
.shop-item:only-of-type { border-radius: var(--radius); }
.shop-item + .shop-item { border-top: 0; }
.shop-item .si-emoji { font-size: 1.15rem; flex-shrink: 0; }
.shop-item .si-name { flex: 1; font-weight: 600; }
.shop-item .si-qty { font-size: 0.78rem; color: var(--ink-3); font-weight: 700; }
.shop-item.on { opacity: 0.5; }
.shop-item.on .si-name { text-decoration: line-through; }
.shop-item .check { width: 26px; height: 26px; }

/* ---------- Tools ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.tool-card {
  border-radius: var(--radius-l);
  padding: 18px 16px;
  min-height: 148px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #FFF9EE;
  text-align: start;
  box-shadow: var(--shadow-2);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease-spring);
}
.tool-card:active { transform: scale(0.95); }
.tool-card .tc-emoji {
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}
.tool-card b { font-size: 1rem; line-height: 1.25; display: block; }
.tool-card span { font-size: 0.75rem; opacity: 0.85; display: block; margin-top: 3px; line-height: 1.35; }
.tool-card::after {
  content: "";
  position: absolute;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  top: -55px; inset-inline-end: -45px;
}

/* egg picker */
.egg-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.egg-digit {
  height: 72px; /* fallback iOS < 15 */
  border-radius: 22px;
  background: var(--surface);
  border: 2px solid var(--line);
  font-family: var(--font-display);
  font-size: 1.9rem; font-weight: 600;
  transition: all 0.3s var(--ease-spring);
  box-shadow: var(--shadow-1);
}
.egg-digit.on {
  border-color: var(--eggc, var(--brand));
  background: color-mix(in srgb, var(--eggc, var(--brand)) 14%, var(--surface));
  color: var(--eggc, var(--brand));
  transform: translateY(-3px) scale(1.05);
}
.egg-code-visual {
  font-family: ui-monospace, monospace;
  text-align: center;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  background: var(--bg-2);
  border-radius: var(--radius-s);
  padding: 10px;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.egg-code-visual b { color: var(--eggc, var(--brand)); font-size: 1.35rem; }

/* temp cards */
.temp-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.temp-row:last-child { border-bottom: 0; }
.temp-val {
  font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 600;
  color: var(--c-fer);
  min-width: 74px;
  flex-shrink: 0;
}
.temp-row .tr-body b { display: block; font-size: 0.93rem; }
.temp-row .tr-body span { font-size: 0.8rem; color: var(--ink-2); }

/* storage */
.store-grid { display: flex; gap: 10px; margin-top: 10px; }
.store-cell {
  flex: 1;
  background: var(--bg-2);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  font-size: 0.82rem;
}
.store-cell b { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 2px; }
html[lang="ar"] .store-cell b { letter-spacing: 0; }

/* levain tracker */
.lev-day {
  display: flex; gap: 14px;
  position: relative;
  padding-bottom: 22px;
}
.lev-day::before {
  content: "";
  position: absolute;
  inset-inline-start: 17px;
  top: 38px; bottom: 0;
  width: 2px;
  background: var(--line-strong);
}
.lev-day:last-child::before { display: none; }
.lev-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  flex-shrink: 0;
  z-index: 1;
  transition: all 0.3s var(--ease-spring);
}
.lev-day.done .lev-num { background: var(--c-levain); border-color: var(--c-levain); color: #FFF6E6; }
.lev-day.current .lev-num { border-color: var(--c-levain); color: var(--c-levain); box-shadow: 0 0 0 5px color-mix(in srgb, var(--c-levain) 18%, transparent); }
.lev-body { flex: 1; }
.lev-body .card { padding: 14px 16px; }
.lev-body h4 { font-size: 0.95rem; margin-bottom: 4px; }
.lev-body p { font-size: 0.85rem; color: var(--ink-2); }
.lev-body .lev-expect { font-size: 0.8rem; color: var(--c-levain); font-weight: 600; margin-top: 6px; }

/* ---------- Guides ---------- */
.guide-card {
  display: flex; align-items: stretch;
  border-radius: var(--radius-l);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  width: 100%;
  text-align: start;
  transition: transform 0.25s var(--ease-spring);
}
.guide-card:active { transform: scale(0.97); }
.guide-card + .guide-card { margin-top: 14px; }
.guide-card img { width: 112px; object-fit: cover; flex-shrink: 0; }
.guide-card .gc-body { padding: 16px; flex: 1; }
.guide-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.guide-card p { font-size: 0.82rem; color: var(--ink-2); line-height: 1.45; }
.guide-card .gc-tag { margin-top: 8px; }

/* accordion */
.acc {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.acc + .acc { margin-top: 10px; }
.acc-head {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px;
  text-align: start;
  font-weight: 700; font-size: 0.92rem;
}
.acc-head .acc-arrow { margin-inline-start: auto; transition: transform 0.3s var(--ease-spring); color: var(--ink-3); flex-shrink: 0; }
.acc.open .acc-arrow { transform: rotate(180deg); }
.acc-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s var(--ease-out);
}
.acc.open .acc-body { grid-template-rows: 1fr; }
.acc-body > div { overflow: hidden; }
.acc-body p { padding: 0 16px 15px; font-size: 0.88rem; color: var(--ink-2); }
.verdict {
  font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 3px 9px; border-radius: 999px;
  flex-shrink: 0;
  color: #fff;
}
html[lang="ar"] .verdict { letter-spacing: 0; }
.verdict.v-vrai { background: var(--ok); }
.verdict.v-faux { background: var(--bad); }
.verdict.v-nuance { background: var(--warn); }

/* two-col food list */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duo .card { padding: 16px; }
.duo h4 { font-size: 0.82rem; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.food-li { font-size: 0.83rem; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.food-li:last-child { border-bottom: 0; }
.food-li b { display: block; font-weight: 700; }
.food-li span { color: var(--ink-3); font-size: 0.76rem; }

/* profile grid (eau) */
.pf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pf {
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--surface);
  padding: 14px 8px;
  text-align: center;
  transition: all 0.3s var(--ease-spring);
}
.pf .pf-ico { font-size: 1.5rem; display: block; }
.pf b { font-size: 0.72rem; font-weight: 700; line-height: 1.2; display: block; margin-top: 6px; }
.pf.on {
  border-color: var(--c-eau);
  background: color-mix(in srgb, var(--c-eau) 10%, var(--surface));
  transform: translateY(-2px);
}

.advice-card {
  background: linear-gradient(135deg, var(--c-eau), var(--c-eau-2));
  color: #F2FAFD;
  border: none;
  box-shadow: 0 10px 30px rgba(31, 110, 140, 0.35);
}
.advice-card b { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; display: block; margin-bottom: 6px; }
html[lang="ar"] .advice-card b { letter-spacing: 0; }

/* ---------- Profile screen ---------- */
.row-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.row-group + .row-group { margin-top: 14px; }
.prow {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: start;
  font-size: 0.93rem;
}
.prow:last-child { border-bottom: 0; }
.prow .pr-ico { font-size: 1.15rem; flex-shrink: 0; }
.prow .pr-label { flex: 1; font-weight: 700; }
.prow .pr-value { color: var(--ink-3); font-size: 0.85rem; font-weight: 600; }

.lang-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 14px 18px; }
.lang-btn {
  padding: 10px 6px;
  border-radius: var(--radius-s);
  border: 2px solid var(--line);
  font-weight: 700; font-size: 0.85rem;
  transition: all 0.25s var(--ease-spring);
}
.lang-btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }

.tag-wrap { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 18px 16px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.88rem; font-weight: 700;
  box-shadow: var(--shadow-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-spring);
  z-index: 100;
  max-width: 86%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Empty / soon ---------- */
.soon-card {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-3);
  font-weight: 600;
}
.soon-card .s-ico { font-size: 2rem; display: block; margin-bottom: 10px; }

/* footnote */
.footnote {
  font-size: 0.78rem;
  color: var(--ink-3);
  text-align: center;
  margin-top: 28px;
  padding: 0 12px;
  line-height: 1.5;
}

/* ---------- Focus clavier ---------- */
:is(button, a, [tabindex]):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.tabbar .tab:focus-visible,
.hero .hero-cta:focus-visible,
.hydro-lux :is(button):focus-visible {
  outline-color: #FFF8E8;
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-delay: 0s !important;
    transition-duration: 0.001s !important;
  }
}

@media (max-width: 380px) {
  .view {
    padding-inline: 16px;
  }
  .top {
    gap: 12px;
  }
  .avatar-btn {
    width: 56px;
    height: 56px;
  }
  .hero {
    padding: 30px 20px 24px;
  }
  .hero-txt {
    max-width: 88%;
  }
  .hero .hero-kicker {
    margin-bottom: 20px;
    padding-inline: 12px;
  }
  .hero h2 {
    font-size: 1.88rem;
  }
  .hero p {
    font-size: 0.96rem;
  }
  .meal-mini {
    width: 184px;
  }
  .hydro-lux {
    padding: 20px 18px;
  }
  .hydro-grid {
    gap: 14px;
  }
  .ring-wrap,
  .ring-wrap svg {
    width: 108px;
    height: 108px;
  }
  .ring-center b {
    font-size: 1.9rem;
  }
  .tabbar {
    width: min(calc(100% - 20px), 520px);
  }
  .tab {
    font-size: 0.68rem;
  }
  /* le padding de .view passe à 16px : aligner le débord du hero recette */
  .recipe-hero {
    margin-inline: -16px;
  }
}

/* larger phones / small tablets */
@media (min-width: 480px) {
  .qt-grid, .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .pf-grid { grid-template-columns: repeat(3, 1fr); }
}
