/* ================================================================
   Fitness Tracker - Mobile-first Hebrew RTL stylesheet
   ================================================================ */

:root {
  /* --- Light defaults --- */
  --bg:           #f5f7fb;
  --card-bg:      #ffffff;
  --text:         #15202b;
  --text-soft:    #6b7280;
  --border:       #e5e7eb;
  --accent:       #2563eb;
  --font-num:     "Barlow Semi Condensed", "Heebo", sans-serif;   /* hero numbers */
  --accent-text:  #2563eb;   /* accent as foreground text/icon — lightened in dark mode for contrast */
  /* Raised-key elevation (quick buttons, weigh strip). Light mode leans on
     shadow; dark mode must lean on surface lightness — shadows vanish there. */
  --key-bg:   color-mix(in srgb, #ffffff 5%, var(--card-bg));
  --key-line: var(--border);
  --key-hl:   rgba(255, 255, 255, .06);
  --accent-soft:  #dbeafe;
  --c-cal:        #16a34a;
  --c-prot:       #f97316;
  --c-water:      #0ea5e9;
  --c-workout:    #dc2626;
  --danger:       #dc2626;
  --warning:      #f59e0b;
  --success:      #16a34a;
  --shadow:       0 2px 8px rgba(15,23,42,.06);
  --shadow-lg:    0 8px 24px rgba(15,23,42,.12);
  --radius:       16px;
  --radius-sm:    10px;
  --quick-meal-hover-bg:  #f0fdf4;
  --quick-water-hover-bg: #e0f2fe;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:                  #0f172a;
    --card-bg:             #1e293b;
    --text:                #f1f5f9;
    --text-soft:           #94a3b8;
    --border:              #334155;
    --accent-soft:         #1e3a8a;
    --accent-text:         #60a5fa;
    --key-bg:              #2a3850;
    --key-line:            #46566e;
    --key-hl:              rgba(255, 255, 255, .10);
    --quick-meal-hover-bg: #052e16;
    --quick-water-hover-bg: #075985;
  }
}
:root[data-theme="dark"] {
  --bg:                  #0f172a;
  --card-bg:             #1e293b;
  --text:                #f1f5f9;
  --text-soft:           #94a3b8;
  --border:              #334155;
  --accent-soft:         #1e3a8a;
  --accent-text:         #60a5fa;
  --key-bg:              #2a3850;
  --key-line:            #46566e;
  --key-hl:              rgba(255, 255, 255, .10);
  --quick-meal-hover-bg: #3a2616;
  --quick-water-hover-bg: #075985;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Heebo', -apple-system, system-ui, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  /* Clear the fixed bottom nav INCLUDING the device safe-area inset — a flat
     84px clipped the last content under the nav on gesture-nav phones / iPhones. */
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;   /* no long-press selection toolbar / Google search overlay */
}
/* keep text selection where it's genuinely useful: typing fields */
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}
button {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, select {
  font-family: inherit;
  font-size: 15px;
}
a { color: var(--accent-text); }

/* ---- Top bar -------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: white;
  box-shadow: var(--shadow);
  overflow: hidden;
  /* iPhone with notch / Dynamic Island: extend gradient into the status-bar
     zone and push the inner content below it. Status-bar-style is
     black-translucent so env(safe-area-inset-top) is non-zero in the PWA. */
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.18);
  overflow: hidden;
  opacity: 0;
  transition: opacity .08s ease-out;
  pointer-events: none;
}
.topbar-progress.is-loading {
  opacity: 1;
  transition: opacity .08s ease-in;
}
.topbar-progress::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, #fff 50%, transparent);
  transform: translateX(-100%);
  animation: progressSlide 1.1s ease-in-out infinite;
}
@keyframes progressSlide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.topbar.is-loading .date-block { opacity: 0.65; transition: opacity .2s; }
.topbar-inner {
  display: flex; align-items: center; justify-content: center; gap: 28px;
  padding: 14px 16px;
  max-width: 720px; margin: 0 auto;
  position: relative;
}
.topbar-avatar {
  position: absolute; left: 16px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.65);
  object-fit: cover; cursor: pointer;
  transition: opacity .15s;
}
.topbar-avatar:hover { opacity: .85; }
/* Pro accounts get a gold ring — ambient status, set by renderProStatus(). */
.topbar-avatar.is-pro {
  border-color: #f59e0b;
  box-shadow: 0 0 7px rgba(245, 158, 11, .65);
}

/* Profile card in settings */
.profile-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; margin-bottom: 4px;
}
.profile-photo {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  border: 2px solid var(--border);
}
.profile-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.profile-name  { font-size: 16px; font-weight: 700; color: var(--text); }
.profile-email { font-size: 14px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-signout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  color: var(--text-soft); font-size: 15px;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
.profile-signout-btn:hover { color: var(--danger); border-color: var(--danger); }
.date-block { text-align: center; }
.date-label { font-size: 18px; font-weight: 700; }
.date-sub   { font-size: 13px; opacity: 0.85; }
.icon-btn {
  background: rgba(255,255,255,.18);
  border: none; color: white;
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.3); }

/* ---- Main app container -------------------------------------- */
#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px;
}
.tab { display: none; }
.tab.active { display: block; }

.section-title {
  font-size: 16px; font-weight: 700;
  margin: 22px 4px 8px;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

/* ---- Rings row ----------------------------------------------- */
.rings-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.ring-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 10px 8px;
  box-shadow: var(--shadow);
  position: relative;
  text-align: center;
}
.ring-svg { width: 100%; max-width: 110px; transform: rotate(-90deg); }
.ring-bg, .ring-fg {
  fill: none; stroke-width: 10;
}
.ring-bg { stroke: var(--border); }
.ring-fg {
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  /* Signature fill sweep — a deliberate ~0.9s ease so the ring visibly
     draws to its value instead of snapping. */
  transition: stroke-dashoffset .9s cubic-bezier(.22, 1, .36, 1);
}
.ring-tick { fill: var(--text); stroke: var(--card-bg); stroke-width: 2; opacity: 0.85; }
/* Each arc glows softly in its own metric color — the rings read as a lit
   instrument panel, the app's signature element. */
.ring-fg.c-cal   { stroke: var(--c-cal);   filter: drop-shadow(0 0 3px color-mix(in srgb, var(--c-cal) 60%, transparent)); }
.ring-fg.c-prot  { stroke: var(--c-prot);  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--c-prot) 60%, transparent)); }
.ring-fg.c-water { stroke: var(--c-water); filter: drop-shadow(0 0 3px color-mix(in srgb, var(--c-water) 60%, transparent)); }
@media (prefers-reduced-motion: reduce) {
  .ring-fg { transition: none; }
}

.ring-text {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.ring-value  { font-family: var(--font-num); font-size: 27px; font-weight: 700; line-height: 1; letter-spacing: .5px; }
.ring-label  { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.ring-target { font-size: 12.5px; color: var(--text-soft); }

/* Goal-reached animation — fired once per session per ring when the
   user crosses their target (prev < target → current ≥ target), only
   when viewing today. Same neutral pulse for all three metrics; the
   glow is tinted with each ring's own accent color so the moment reads
   as "this widget lit up," not as positive/negative judgment. Calories
   work in any mode (cutting, maintaining, bulking) — crossing the
   target is just the milestone, direction is signalled elsewhere. */
@keyframes goal-pulse {
  0%   { transform: scale(1);     box-shadow: 0 0 0 0 var(--ring-glow-color, rgba(100,116,139,.5)); }
  20%  { transform: scale(1.04);  box-shadow: 0 0 0 14px transparent; }
  40%  { transform: scale(1);     box-shadow: 0 0 0 0  transparent; }
  60%  { transform: scale(1.04);  box-shadow: 0 0 0 14px var(--ring-glow-color, rgba(100,116,139,.5)); }
  80%  { transform: scale(1);     box-shadow: 0 0 0 0  transparent; }
  100% { transform: scale(1);     box-shadow: 0 0 0 0  transparent; }
}
.ring-card[data-metric="calories"] { --ring-glow-color: rgba(22,163,74,.5); }
.ring-card[data-metric="protein"]  { --ring-glow-color: rgba(249,115,22,.5); }
.ring-card[data-metric="water"]    { --ring-glow-color: rgba(14,165,233,.5); }
.ring-card.goal-reached {
  animation: goal-pulse 2.2s ease-out;
}

/* ---- Summary card -------------------------------------------- */
/* Budget-remaining is the hero — it's the actionable answer to "can I
   still eat?". Supporting stats (burn + raw deficit) sit small below
   a divider. נכנס was dropped because the calorie ring shows it. */
.summary-card { padding: 16px 14px; }
/* Hero number centred across the FULL card width; the supporting stats are
   positioned out of flow in the corner so they can't shift it off centre. */
.summary-hero { position: relative; text-align: center; }
.summary-hero-label {
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.summary-hero-value {
  font-family: var(--font-num);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--success);
  line-height: 1.05;
}
.summary-stats {
  position: absolute;
  inset-inline-end: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: end;
  white-space: nowrap;
}
.summary-stat { font-size: 12px; color: var(--text-soft); line-height: 1.2; }
.summary-stat strong {
  display: block;
  font-family: var(--font-num);
  font-size: 16px;
  color: var(--text);
  font-weight: 700;
  line-height: 1.15;
}

/* ---- Health / wearable connect card ------------------------- */
.health-head { display: flex; align-items: center; gap: 12px; }
.health-head-icon {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: var(--accent-soft); color: var(--accent-text);
}
.health-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.health-head-title { font-weight: 700; font-size: 15px; }
.health-head-text .hint { margin: 0; }
.health-pill {
  flex: 0 0 auto; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--c-cal) 18%, transparent); color: var(--c-cal);
}
.health-source-row { margin-top: 16px; display: flex; flex-direction: column; gap: 5px; }
.health-source-row label { font-size: 13px; color: var(--text-soft); }
.health-source-row select {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card-bg); color: var(--text);
  font-size: 15px; font-family: inherit;
}
.health-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.health-stat {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 6px; border-radius: 14px;
  background: var(--bg); border: 1px solid var(--border);
}
.health-stat-icon { font-size: 18px; line-height: 1; }
.health-stat-value { font-size: 20px; font-weight: 800; line-height: 1; }
.health-stat-label { font-size: 12.5px; color: var(--text-soft); text-align: center; line-height: 1.2; }
.health-workouts { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.health-workouts-title { font-size: 13px; color: var(--text-soft); margin-bottom: 2px; }
.health-workout-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border); font-size: 14px;
}
.health-workout-time { color: var(--text-soft); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.health-workout-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.health-workout-type { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-workout-cals { font-size: 13px; color: var(--text-soft); }
/* Manual "add to today" fallback on a detected watch workout */
.health-workout-add {
  flex: 0 0 auto;
  background: transparent;
  border: 1.5px solid var(--accent-text);
  color: var(--accent-text);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer;
  white-space: nowrap;
}
.health-workout-add:disabled { opacity: .5; }
.health-workout-added {
  flex: 0 0 auto;
  color: var(--success);
  font-size: 13px; font-weight: 700;
  white-space: nowrap;
}
.health-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.health-foot .hint { margin: 0; }
.btn-link {
  flex: 0 0 auto; background: none; border: none; color: var(--accent-text);
  font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px 6px; font-family: inherit;
}

/* ---- Today intake distribution (smooth area) --------------- */
/* Intake distribution as an AMBIENT layer behind the summary numbers — the
   "when did I eat" shape without spending a dedicated chart row. The card
   content floats above it (z-index); label + hour axis are dropped (it's
   atmosphere here, not a readable chart). */
.summary-card { position: relative; overflow: hidden; }
/* Only the hero is lifted above the sparkline now — the stats live INSIDE it and
   inherit the stacking context. Listing .summary-stats here too would set
   position:relative on it with higher specificity than its own rule above,
   silently cancelling the absolute positioning that centres the hero number. */
.summary-card .summary-hero { position: relative; z-index: 1; }
.today-intake {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 52%;              /* keep the peak below the hero number */
  opacity: .42;             /* present but still behind the digits */
  pointer-events: none;
}
.ti-label { display: none; }
.ti-svg { width: 100%; height: 100%; display: block; }
/* The curve LINE carries the vividness (a soft glow), while the area fill
   stays a gentle wash — so the shape pops without fighting the green digits. */
.ti-svg path[stroke] {
  stroke-width: 2.5;
  filter: drop-shadow(0 0 4px rgba(34, 197, 94, .9));
}
.ti-axis { display: none; }
.ti-tick { display: none; }

/* ---- Dashboard wearable (Garmin) summary ------------------- */
.dash-health-card { padding: 10px 14px; }
/* Compact wearable sync chip (replaced the Garmin burn/estimate block). */
.dash-sync { display: flex; align-items: center; gap: 8px; }
.dash-health-card { cursor: pointer; }
.dash-health-card:active { transform: scale(.99); }
.dash-sync-more { flex: 0 0 auto; color: var(--accent-text); font-weight: 700; }
.dash-sync-icon { font-size: 16px; flex: 0 0 auto; display: inline-flex; color: var(--accent-text); }
.dash-sync-text { flex: 1; min-width: 0; font-size: 14px; color: var(--text-soft); }
.dash-health-refresh {
  flex: 0 0 auto; background: none; border: none; color: var(--accent-text);
  font-size: 18px; cursor: pointer; padding: 4px 6px; line-height: 1; font-family: inherit;
}
.dash-health-refresh:disabled { opacity: 0.4; }

/* ---- Workout burn contribution card ------------------------- */
.workout-burn-card { padding: 14px 16px; }
.wb-header {
  font-size: 15px;
  color: var(--text-soft);
  text-align: center;
  margin-bottom: 12px;
}
.wb-header strong { color: var(--c-workout); font-weight: 800; }
.wb-rows { display: flex; flex-direction: column; gap: 9px; }
.wb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.wb-type {
  flex: 0 0 auto;
  min-width: 94px;
  color: var(--text);
  white-space: nowrap;
}
.wb-bar {
  flex: 1 1 auto;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.wb-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--c-workout), #f87171);
  transition: width .4s ease;
}
.wb-cal {
  flex: 0 0 auto;
  min-width: 46px;
  text-align: left;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}


/* ---- Quick add row ------------------------------------------- */
.quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 16px 0 8px;
}
.quick-btn {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px;
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  font-weight: 600; color: var(--text);
  transition: transform .08s, border-color .15s, background .15s, box-shadow .08s;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  cursor: pointer;
}
/* Button affordance via ELEVATION, not color (colored borders read as a
   traffic light, and red-outline suggests danger): a slightly lighter
   raised surface than the surrounding cards, like keys. The metric color
   stays in exactly one carrier — the icon. */
.quick-btn {
  background: var(--key-bg);
  border-color: var(--key-line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25), inset 0 1px 0 var(--key-hl);
}
.wa-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.wa-chips .wa-chip { flex: 1 1 60px; }
.quick-btn:active { transform: scale(0.94); filter: brightness(1.15); }
.quick-icon { display: flex; align-items: center; justify-content: center; height: 26px; }
.quick-meal .quick-icon    { color: var(--c-cal); }
.quick-workout .quick-icon { color: var(--c-workout); }
.quick-water .quick-icon   { color: var(--c-water); }
.quick-meal:hover    { border-color: var(--c-cal);   background: var(--quick-meal-hover-bg); }
.quick-workout:hover { border-color: var(--accent);  background: var(--accent-soft); }
.quick-water:hover   { border-color: var(--c-water); background: var(--quick-water-hover-bg); }

/* ---- Timeline ------------------------------------------------- */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 8px; align-items: center;
  box-shadow: var(--shadow);
}
/* Plan-tab rows live INSIDE a card, so card-on-card needs its own contrast:
   page-background chips with a hairline border instead of shadow. */
#plannedWorkoutsList .timeline-item {
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: none;
}

/* Type color lives in a larger icon under the time (matches the quick-add
   buttons' language) — the old colored side-stripe read as template-y. */
.timeline-time { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tl-kind-ico { display: inline-flex; line-height: 1; }
.timeline-item.kind-meal    .tl-kind-ico { color: var(--c-cal); }
.timeline-item.kind-workout .tl-kind-ico { color: var(--c-workout); }
.timeline-item.kind-water   .tl-kind-ico { color: var(--c-water); }
.timeline-item.is-done      .tl-kind-ico { color: var(--success); }
.timeline-item.kind-plan     { border-right-color: var(--warning); border-style: dashed; opacity: .85; }
.timeline-item.is-grouped-child {
  margin-right: 14px;
  background: var(--bg);
}
.timeline-item .stack-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 22px;
  padding: 6px 10px;
  background: transparent; border: none; border-radius: 6px;
  color: var(--text-soft); cursor: pointer;
  flex: 0 0 auto;
}
.timeline-item .stack-toggle:hover {
  background: var(--border); color: var(--text);
}
.stack-toggle .stack-count {
  font-size: 15px; font-weight: 700; color: var(--text);
}
.timeline-item.is-group.is-expanded {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.timeline-item.is-done {
  opacity: 0.55;
  background: var(--bg);
}
.timeline-item.is-done .timeline-title {
  text-decoration: line-through;
}

.timeline-time { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.timeline-main { min-width: 0; }
.timeline-title { font-weight: 600; }
.timeline-desc  { font-size: 14px; color: var(--text-soft); margin-top: 2px;
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-stats { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.timeline-actions { display: flex; gap: 4px; align-items: center; }
/* Touch screens: actions hidden until the row is swiped toward them (left in
   RTL) — rows read cleaner and content gets the width. Desktop keeps them. */
@media (hover: none) and (pointer: coarse) {
  /* Hide individual action buttons, NOT the container — the water group's
     stack-toggle (a disclosure control) must stay visible in the same row. */
  .timeline-actions button:not(.stack-toggle) {
    max-width: 0; padding-left: 0; padding-right: 0; opacity: 0;
    overflow: hidden; pointer-events: none;
    transition: max-width .22s ease, opacity .18s ease, padding .22s ease;
  }
  .timeline-item.swiped .timeline-actions button:not(.stack-toggle) {
    max-width: 60px; padding-left: 6px; padding-right: 6px;
    opacity: 1; pointer-events: auto;
  }
}
/* Ring centers: colored type icon over the number + a small unit suffix */
.ring-value small { display: block; font-size: 11px; font-weight: 600; color: var(--text-soft); margin-top: 1px; line-height: 1; }
.ring-ico { display: block; margin: 0 auto 2px; line-height: 1; }
.ring-card[data-metric="calories"] .ring-ico { color: var(--c-cal); }
.ring-card[data-metric="protein"]  .ring-ico { color: var(--c-prot); }
.ring-card[data-metric="water"]    .ring-ico { color: var(--c-water); }

/* Rings are tappable (metric insight sheet) */
.ring-card { cursor: pointer; }
.rings-hint {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 8px;
  font-size: 13px; color: var(--text-soft);
}
.rings-hint .ico { color: var(--accent-text); }
.rings-hint.hidden { display: none; }
.ring-card:active { transform: scale(.98); }
/* Value / goal / remaining, above the distribution curve. Equal thirds so the
   three numbers line up as a comparison rather than a sentence; tabular figures
   so they don't jitter as the day fills in. */
.ri-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 8px;
  text-align: center;
}
/* 17px, not 20: the bar below repeats this reading graphically, and one sheet
   also holds the curve and the AI text. */
.ri-stats b {
  display: block; font-size: 17px; font-weight: 800; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.ri-stats b small { font-size: 11px; font-weight: 600; color: var(--text-soft); margin-inline-start: 3px; }
.ri-stats span { display: block; font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.ri-stats .ri-over b { color: var(--warning); }
/* The same three numbers, unrolled: fill = what's logged, light marker = the pace
   expected by this hour (identical fractions to the ring's bead). Tighter stat
   row above it, since bar + numbers + curve + AI text share one sheet. */
.ri-bar-wrap { margin-bottom: 12px; }
/* No overflow:hidden — the pace marker deliberately overhangs the track, and
   clipping it would flatten the one element that has to read as a marker rather
   than as part of the fill. The fill carries its own radius instead. */
.ri-bar {
  position: relative; height: 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--border) 55%, transparent);
}
/* Anchored to inline-START (the RIGHT edge in RTL) so the bar fills right-to-left,
   in the same direction as the distribution curve above it and the day itself —
   inline-end pinned it to the left and ran the day backwards. */
.ri-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; display: block; }
.ri-bar-pace {
  position: absolute; inset-block: -3px; width: 2px;
  background: var(--text); opacity: .7; border-radius: 2px;
}
/* Achievement sits ABOVE the bar, on its own line — the one thing the user is
   looking for shouldn't share a row with a 11px axis caption. */
/* Aligned to inline-END (the LEFT edge in RTL): the bar fills right-to-left, so
   the left is the finished end — the achievement belongs where the fill arrives,
   not where it started. */
.ri-bar-status { margin-bottom: 6px; text-align: end; }
.ri-bar-status .ri-hit,
.ri-bar-status .ri-miss {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 14px; font-weight: 800;
}
.ri-bar-status .ri-hit  { color: var(--success); }
.ri-bar-status .ri-miss { color: var(--warning); }
.ri-bar-status svg { width: 16px; height: 16px; }
/* Caption anchored under the marker itself. inset-inline-start puts its right
   edge (RTL) at the marker, so by default it reads leftwards from there; .flip
   shifts it a full width right for markers past halfway, where the left side has
   run out of bar. */
.ri-bar-caps { position: relative; height: 18px; margin-top: 5px; }
.ri-pace-cap {
  position: absolute; top: 0; white-space: nowrap;
  font-size: 13px; color: var(--text-soft);
  padding-inline: 4px;
}
.ri-pace-cap.flip { transform: translateX(100%); }
/* A reached goal also rings the track, so the state is legible from the bar alone
   without a second colour competing with the metric's own. */
.ri-bar-hit { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--success) 65%, transparent); }
.ri-chart { margin-bottom: 12px; }
.ri-chart svg { width: 100%; height: 72px; display: block; }
/* RTL like the whole app: first label (earliest hour) lands on the RIGHT,
   matching the curve (drawn morning-on-right: x = W - i/nB*W). row-reverse
   here used to flip the labels LTR against the RTL curve. */
.ri-axis { display: flex; margin-top: 2px; }
.ri-axis div { flex: 1; text-align: center; font-size: 10px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.ring-insight-text { font-size: 15px; line-height: 1.65; min-height: 52px; white-space: pre-line; }
.ring-insight-text.generating {
  color: var(--text-soft);
  filter: blur(2.5px);
  animation: coachStalePulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .ring-insight-text.generating { animation: none; }
}
.timeline-actions button {
  background: transparent; border: none; color: var(--text-soft);
  font-size: 18px; padding: 4px 6px; border-radius: 6px;
}
.timeline-actions button:hover { background: var(--border); color: var(--danger); }

.timeline-empty {
  text-align: center; padding: 32px 16px;
  color: var(--text-soft); font-size: 15px;
  background: var(--card-bg); border-radius: var(--radius);
  border: 2px dashed var(--border);
}

/* ---- Forms ---------------------------------------------------- */
.form-card .form-row { margin-bottom: 12px; }
.form-row label {
  display: block; font-size: 14px; color: var(--text-soft);
  margin-bottom: 4px; font-weight: 600;
}
.form-row input, .form-row textarea, .form-row select {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text);
  border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  border-color: var(--accent);
  background: var(--card-bg);
}
.hint { font-size: 12.5px; color: var(--text-soft); display: block; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600; border: none;
  transition: transform .1s, opacity .15s;
  width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: white; }
.btn.primary:hover { opacity: 0.92; }
.btn.ghost   { background: transparent; color: var(--accent-text); border: 1.5px solid var(--accent-text); }
.btn.danger  { background: var(--danger); color: white; }
.btn.small   { padding: 8px 14px; font-size: 14px; width: auto; }
.btn[disabled] { opacity: 0.6; pointer-events: none; }

.status-line {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-soft);
  min-height: 18px;
}
.status-line.ok    { color: var(--success); }
.status-line.error { color: var(--danger); }

/* ---- Notifications section (Settings) ------------------------- */
.notif-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
/* Separate stacked toggles with the same divider the test row uses. */
.notif-item + .notif-item {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
/* Category group sits under the master toggle, divided the same way. When the
   master is off the whole group is dimmed + non-interactive (the JS also sets
   each checkbox disabled, this is the visual cue). */
#notifCategories {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
#notifCategories.disabled {
  opacity: 0.45;
  pointer-events: none;
}
.notif-text { min-width: 0; }
.notif-title { font-size: 15px; font-weight: 700; color: var(--text); }
.notif-text .hint { margin-top: 5px; }
.notif-test {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.notif-test .hint { margin-top: 0; }

/* iOS-style toggle switch. RTL: thumb rests on the right when off and slides
   left when on, so "on" travels in the natural reading direction. */
.switch { position: relative; display: inline-block; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; display: block;
  width: 48px; height: 28px;
  background: var(--border); border-radius: 999px;
  transition: background .2s ease;
}
.switch-thumb {
  position: absolute; top: 3px; right: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .2s ease;
}
.switch input:checked + .switch-track { background: var(--c-water); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(-20px); }
.switch input:disabled + .switch-track { opacity: .5; cursor: not-allowed; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Bottom nav ---------------------------------------------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 25;
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.nav-btn {
  background: transparent; border: none;
  color: var(--text-soft);
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  font-size: 12.5px; font-weight: 600;
  padding: 6px 4px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.nav-ico { display: flex; align-items: center; justify-content: center; height: 24px; }
.nav-btn.active { color: var(--accent-text); }
.nav-btn.active .nav-ico { transform: scale(1.05); }

/* ---- Modal --------------------------------------------------- */
.modal-root {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-root.hidden { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(2px);
  animation: fadeIn .15s;
}
.modal {
  position: relative;
  background: var(--card-bg);
  width: 100%; max-width: 640px;
  border-radius: 20px 20px 0 0;
  /* Bottom-sheet: pad the bottom by the system nav-bar inset so the last control
     (e.g. "שמור ארוחה") isn't hidden behind Android's edge-to-edge nav bar. */
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height: 88vh; overflow-y: auto;
  animation: slideUp .25s ease-out;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 720px) {
  .modal-root { align-items: center; }
  .modal { border-radius: 20px; max-height: 80vh; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.modal-header h3 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-header .icon-btn {
  background: var(--border); color: var(--text);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---- Toast --------------------------------------------------- */
.toast {
  position: fixed; top: calc(20px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--card-bg);
  padding: 10px 18px; border-radius: 999px;
  font-size: 15px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1300;
  max-width: 90%;
  text-align: center;
}
.toast.hidden { display: none; }
.toast.error  { background: var(--danger); color: white; }
.toast.ok     { background: var(--success); color: white; }

/* ---- Image preview ------------------------------------------- */
.img-preview {
  width: 100%; max-height: 260px;
  object-fit: contain;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-top: 10px;
}

/* ---- AI estimate result -------------------------------------- */
.ai-result {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 12px;
}
.ai-result-title {
  font-weight: 700; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.ai-items { font-size: 14px; color: var(--text-soft); }
.ai-items li { margin: 2px 0; }
.ai-totals {
  display: flex; gap: 16px; margin-top: 10px;
  font-weight: 700;
}

/* Collapsible "how to connect your wearable" guide in the health card */
.health-guide { margin-top: 10px; font-size: 14px; }
.health-guide > summary {
  cursor: pointer; color: var(--accent-text); font-weight: 600;
  list-style: none; padding: 6px 0; direction: rtl;
}
.health-guide > summary::-webkit-details-marker { display: none; }
.health-guide-list {
  margin: 6px 0 2px; padding-inline-start: 20px;
  color: var(--text-soft); line-height: 1.7;
}
.health-guide-list li { margin: 5px 0; }

/* "New scope needs approval" notice inside the connected health card (sleep /
   resting HR were added after users first granted). Informational, not an
   error — accent-tinted rather than red. */
.health-scope-upgrade {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 12px; padding: 10px 12px;
  background: var(--accent-soft); border: 1px solid var(--accent-text);
  border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1.5;
}
.health-scope-upgrade > span { flex: 1 1 190px; display: flex; align-items: center; gap: 7px; }
.health-scope-upgrade .ico { color: var(--accent-text); flex: 0 0 auto; }
.health-scope-upgrade .btn { flex: 0 0 auto; padding: 7px 14px; font-size: 14px; }

/* AI call-to-action: a CLEAR button with a colorful neon-gradient frame, so it
   reads as a distinct action and isn't confused with the solid-blue "Save".
   Transparent interior (theme-aware) + gradient border via a masked ::before
   (keeps the rounded corners a plain gradient border can't) + a soft glow. */
.meal-ai-cta {
  position: relative;
  background: transparent;
  color: var(--accent-text);
  font-size: 16px;
  font-weight: 800;
  margin-top: 14px;
  box-shadow: 0 0 15px rgba(124, 58, 237, .22);
  transition: box-shadow .15s, transform .1s;
}
.meal-ai-cta::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 2.5px;               /* frame thickness */
  background: linear-gradient(105deg, #2563eb, #7c3aed 42%, #f97316 76%, #ef4444);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.meal-ai-cta:hover { box-shadow: 0 0 22px rgba(124, 58, 237, .38); }
.meal-ai-cta:active { transform: scale(.99); }

/* While the AI is calculating: the neon frame's colors flow around the border
   and the glow gently pulses. */
.meal-ai-cta.calculating::before {
  background: linear-gradient(105deg, #2563eb, #7c3aed, #f97316, #ef4444, #2563eb, #7c3aed);
  background-size: 300% 100%;
  animation: aiFrameFlow 1.1s linear infinite;
}
.meal-ai-cta.calculating {
  animation: aiGlowPulse 1.4s ease-in-out infinite;
}
@keyframes aiFrameFlow  { to { background-position: 300% 50%; } }
@keyframes aiGlowPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(124, 58, 237, .25); }
  50%      { box-shadow: 0 0 26px rgba(124, 58, 237, .55); }
}
/* One-shot nudge after a photo is added: "this is your next step". */
.meal-ai-cta.nudge {
  animation: aiGlowPulse .85s ease-in-out 2;
}
@media (prefers-reduced-motion: reduce) {
  .meal-ai-cta.calculating::before { animation: none; }
  .meal-ai-cta.calculating { animation: none; }
  .meal-ai-cta.nudge { animation: none; }
}

/* Editable AI breakdown */
.ai-edit-btn {
  margin-inline-start: auto;
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .3);
}
.ai-edit-btn:active { transform: scale(0.97); }
.ai-edit-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 8px; }
.ai-edit-head {
  display: grid;
  grid-template-columns: 1fr 0.72fr 0.62fr 0.62fr 30px;
  gap: 6px;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
}
.ai-edit-head span { text-align: center; }
.ai-edit-head span:first-child { text-align: start; padding-inline-start: 8px; }
.ai-edit-row {
  display: grid;
  grid-template-columns: 1fr 0.72fr 0.62fr 0.62fr 30px;
  gap: 6px;
  align-items: center;
}
.ai-edit-row .ai-it-cal,
.ai-edit-row .ai-it-prot { text-align: center; }
.ai-edit-row input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}
.ai-it-del {
  background: transparent; border: none; cursor: pointer;
  font-size: 15px; padding: 0; line-height: 1; justify-self: center;
}
.ai-add-btn {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--accent);
  color: var(--accent-text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}

/* ---- Plan suggestions ---------------------------------------- */
.plan-summary {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-weight: 500;
}
.plan-summary.hidden { display: none; }
.suggestions { display: flex; flex-direction: column; gap: 8px; }
.suggestion-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px;
  align-items: center;
}
.suggestion-time {
  background: var(--accent-soft); color: var(--accent-text);
  padding: 4px 10px; border-radius: 999px;
  font-weight: 700; font-size: 14px;
}
.suggestion-title { font-weight: 600; }
.suggestion-desc  { font-size: 14px; color: var(--text-soft); margin-top: 2px; }
.suggestion-stats { font-size: 13px; color: var(--text-soft); margin-top: 2px; }

/* ---- History ------------------------------------------------- */
.chart-card { padding: 14px; }
.chart-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}
.chart-wrap canvas { position: absolute; inset: 0; }
/* Category row above the metric chips — underlined tabs, deliberately lighter
   than the chips below. An earlier version was a raised segmented control, which
   inverted the hierarchy: the category (navigation) outweighed the metric (the
   actual selection) and competed with the chart for attention. Text plus a rule
   reads as "where am I", the filled chip reads as "what I picked". */
.chart-cats {
  display: flex; gap: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.chart-cat {
  position: relative;
  background: none; border: none; padding: 0 2px 9px;
  color: var(--text-soft); font-family: inherit; font-size: 14.5px; font-weight: 600;
  cursor: pointer;
}
.chart-cat.active { color: var(--text); font-weight: 700; }
/* Sits ON the container's border so the active tab visually joins the content
   below it rather than floating above the line. */
.chart-cat.active::after {
  content: ""; position: absolute; inset-inline: 0; bottom: -1px;
  height: 2.5px; background: var(--accent-text); border-radius: 2px;
}
.chart-cat:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Horizontal drags belong to the chart, vertical ones to the page. Without this
   the browser claims the gesture and the chart never sees a clean horizontal drag
   — and the touch listeners are passive, so they can't take it back with
   preventDefault. */
.chart-wrap { touch-action: pan-y; }

/* Time paging above the chart. Deliberately quiet: it sits between the metric
   chips and the data, so it must not compete with either — until you're actually
   in the past, at which point the range label lights up because "you are not
   looking at now" is the one thing that must not be missed. */
.chart-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 0 0 8px;
}
.chart-nav-btn {
  background: transparent; border: 1.5px solid var(--border); color: var(--text-soft);
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 17px; line-height: 1; padding: 0;
  display: grid; place-items: center; flex: 0 0 auto;
}
.chart-nav-btn:disabled { opacity: .3; }
.chart-nav-btn:not(:disabled):hover { border-color: var(--accent); color: var(--accent-text); }
.chart-nav-range {
  flex: 1 1 auto; text-align: center;
  font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums;
}
.chart-nav-range.past { color: var(--accent-text); font-weight: 700; }

.chart-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-tab {
  background: transparent; border: 1.5px solid var(--border);
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: 999px; font-size: 14px; font-weight: 600;
}
.chart-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
/* Pro-only tab for non-entitled users: crowned, and never shown active because
   tapping it opens the paywall instead of switching the chart. */
.chart-tab-pro { display: inline-flex; align-items: center; gap: 5px; }

/* Shared period picker at the top of the History tab. All three views
   below it (chart, cumulative balance, raw list) filter to this window. */
.history-window-picker { padding: 12px 14px; margin-bottom: 12px; }
.history-window-picker .cum-balance-pills { margin-bottom: 0; }
.history-window-picker .cum-balance-custom { margin-top: 10px; margin-bottom: 0; }

/* Cumulative-balance summary card (History tab) */
.cum-balance-card { padding: 14px; margin-bottom: 12px; }
.cum-balance-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.cum-balance-emoji { font-size: 20px; }
.cum-balance-title { font-size: 15px; font-weight: 600; margin: 0; color: var(--text); }
.cum-balance-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.cum-pill {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-soft);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.cum-pill.active { background: var(--accent); color: white; border-color: var(--accent); }
.cum-balance-custom {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.cum-balance-custom.hidden { display: none; }
.cum-balance-date {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
}
.cum-balance-dash { color: var(--text-soft); }
.cum-balance-total {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}
.cum-balance-fat,
.cum-balance-avg {
  font-size: 14px;
  color: var(--text-soft);
  margin-top: 4px;
}

/* Streaks card (History tab) — consistency counterpart to the
   cumulative-balance magnitude card above it. */
.streaks-card { padding: 14px; margin-bottom: 12px; }
.streaks-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
}
.streaks-emoji { display: inline-flex; color: #f97316; }
.streaks-title { font-size: 15px; font-weight: 600; margin: 0; color: var(--text); }
/* Streaks — 2×2 stat tiles (current streak leads; progress bar toward record) */
.streaks-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.streaks-rows .streaks-empty { grid-column: 1 / -1; }
.streak-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.streak-tile-head {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 700;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.streak-tile-cur {
  font-size: 20px; font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.streak-tile-cur small {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-soft);
  margin-inline-start: 4px;
}
.streak-tile-cur.zero { color: var(--text-soft); opacity: .75; }
.streak-tile-bar {
  height: 4px; border-radius: 4px;
  background: var(--border);
  margin: 7px 0 6px;
  overflow: hidden;
}
.streak-tile-bar i {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 4px;
}
.streak-tile-best { font-size: 12.5px; color: var(--text-soft); }

/* Collapsible day-by-day list. Default collapsed so the History tab's
   summary surfaces (chart, balance, streaks) lead. */
.history-details {
  background: var(--card-bg);
  border-radius: var(--radius);
  margin-top: 12px;
  overflow: hidden;
}
.history-details-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.history-details-summary::-webkit-details-marker { display: none; }
.history-details-caret {
  display: inline-block;
  transition: transform .15s ease;
  color: var(--text-soft);
  font-size: 13px;
}
.history-details[open] .history-details-caret { transform: rotate(180deg); }
.history-details-count { color: var(--text-soft); font-weight: 500; font-size: 14px; }
.history-details[open] .history-list { padding: 0 14px 12px; }

.history-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.history-row {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 10px;
  align-items: center;
}
.history-date { font-weight: 700; font-size: 14px; }
.history-day  { font-size: 12.5px; color: var(--text-soft); }
.history-stats { display: flex; gap: 14px; font-size: 13px; color: var(--text-soft); flex-wrap: wrap; }
.history-stats span b { color: var(--text); font-weight: 700; }
.history-metric-val { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }

.hidden { display: none !important; }

/* ---- Presets ------------------------------------------------ */
.presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 2px 6px;
  margin-bottom: 8px;
}
.presets-grouped {
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  margin-bottom: 4px;
}
/* Meal pickers — favorites + recents as two side-by-side toggle buttons, each
   opening its own panel (collapsed by default so the form isn't pushed down). */
.picker-btns { display: flex; gap: 8px; margin-bottom: 10px; }
.picker-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 10px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 700; font-size: 15px; color: var(--text);
  font-family: inherit; cursor: pointer;
  transition: background .15s, color .15s;
}
.picker-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.picker-btn:active { transform: scale(.98); }
.picker-panel .presets-grouped {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px; margin: 0 0 10px;
}
.preset-cat-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-soft);
  margin: 6px 2px 4px;
  letter-spacing: 0.04em;
}
.preset-cat-label:first-child { margin-top: 0; }
.preset-chip {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 8px 14px;
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, color 0.15s, border-color 0.15s;
}
.preset-chip:active { transform: scale(0.96); }
/* Recents chips: meal descriptions can be long — cap and ellipsize. */
.preset-chip.recent-chip {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preset-chip.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.preset-chip[data-count]::before {
  content: '×' attr(data-count) ' ';
  font-weight: 800;
  margin-left: 2px;
}
.preset-clear {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 6px 12px;
  background: transparent;
  color: var(--text-soft);
  border: 1px dashed var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.preset-clear:hover { color: var(--danger); border-color: var(--danger); }
.preset-chip-empty {
  color: var(--text-soft);
  font-size: 14px;
  padding: 4px 0;
}

.preset-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.preset-row:last-child { border-bottom: none; }
.preset-emoji { font-size: 24px; text-align: center; }
.preset-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
}
.preset-placeholder {
  border: 1px solid var(--border);
}
.preset-placeholder.cat-drinks { background: color-mix(in srgb, var(--c-water) 25%, var(--card-bg)); }
.preset-placeholder.cat-food   { background: color-mix(in srgb, var(--c-cal) 25%, var(--card-bg)); }
.preset-placeholder.cat-snacks { background: color-mix(in srgb, var(--c-prot) 25%, var(--card-bg)); }
.preset-placeholder.cat-other  { background: color-mix(in srgb, var(--text-soft) 20%, var(--card-bg)); }
@supports not (background: color-mix(in srgb, red 25%, blue)) {
  .preset-placeholder.cat-drinks { background: #cfeafd; }
  .preset-placeholder.cat-food   { background: #dcfce7; }
  .preset-placeholder.cat-snacks { background: #ffedd5; }
  .preset-placeholder.cat-other  { background: #e7eaef; }
}
.preset-chip-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-left: 4px;
}
.preset-image-preview {
  width: 96px; height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
  margin-top: 6px;
}
.preset-info { min-width: 0; }
.preset-name { font-weight: 600; }
.preset-stats { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
.preset-actions { display: flex; gap: 4px; }
.preset-actions button {
  background: transparent; border: none; color: var(--text-soft);
  font-size: 18px; padding: 4px 6px; border-radius: 6px;
}
.preset-actions button:hover { background: var(--border); color: var(--danger); }

.presets-empty {
  text-align: center; padding: 16px 8px;
  color: var(--text-soft); font-size: 14px;
}
.preset-io-row {
  display: flex; gap: 8px; margin-top: 12px;
}
.preset-io-row .btn { flex: 1; padding: 10px 12px; font-size: 15px; }

/* ---- Insights tab ------------------------------------------- */
.insights-card {
  padding: 18px 18px 14px;
}
.insights-card h3 {
  margin: 18px 0 8px;
  font-size: 15px;
  display: flex; align-items: center; gap: 6px;
  color: var(--text);
}
.insights-card h3:first-child { margin-top: 0; }
.insights-card p {
  margin: 0;
  line-height: 1.6;
  color: var(--text);
  font-size: 15px;
}
.insights-card ul {
  margin: 0; padding: 0; list-style: none;
}
.insights-card li {
  padding: 8px 12px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.5;
}
.insights-card .coaching-list li {
  background: var(--card-bg);
  border-right: 3px solid var(--accent);
  padding: 10px 12px 10px 14px;
  box-shadow: var(--shadow);
  font-size: 15px;
  line-height: 1.55;
}
.insights-meta {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.insights-actions {
  margin-top: 14px;
  display: flex; align-items: center; gap: 8px;
}

/* ---- Confirm sheet ------------------------------------------ */
.confirm-sheet-root {
  position: fixed; inset: 0; z-index: 1150;
  display: flex; align-items: flex-end;
}
.confirm-sheet-root.hidden { display: none; }
.confirm-sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
}
.confirm-sheet {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px; margin: 0 auto;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  padding: 28px 20px 36px;
  box-shadow: 0 -4px 24px rgba(0,0,0,.15);
}
.confirm-sheet-msg {
  font-size: 17px; font-weight: 600;
  text-align: center; margin: 0 0 24px;
  color: var(--text); line-height: 1.4;
}
.confirm-sheet-btns { display: flex; gap: 10px; }
.confirm-sheet-btns .btn { flex: 1; }

/* ---- Offline banner ----------------------------------------- */
.offline-banner {
  /* Normal flow as <body>'s first child: when shown it pushes the sticky topbar
     down instead of overlaying it; when hidden (display:none) it takes no space.
     Pad the top by the status-bar inset so the text clears the clock/icons and
     the gray fills the status-bar zone cleanly on edge-to-edge devices. */
  background: #374151;
  color: #fff;
  text-align: center;
  font-size: 14px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  font-weight: 500;
}
/* While offline the banner already covers the status-bar zone, so drop the
   topbar's own status-bar padding — otherwise the two stack into a big empty
   band above "היום". (Restored to the safe-area padding when back online.) */
body.is-offline .topbar { padding-top: 0; }

/* ---- Settings gap banner ------------------------------------ */
.settings-gap-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 12px;
  border: 1.5px solid var(--warning) !important;
  background: rgba(245,158,11,.08);
}
.sgb-body { flex: 1; min-width: 0; }
.sgb-title { font-size: 15px; font-weight: 700; color: var(--warning); }
.sgb-list  { font-size: 13px; color: var(--text-soft); margin-top: 3px; }
.sgb-cta   { flex-shrink: 0; }
.sgb-dismiss {
  background: none; border: none; padding: 2px 4px;
  color: var(--text-soft); font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.sgb-dismiss:hover { color: var(--text); }

/* ---- Speak button ------------------------------------------- */
/* Audio "listen" buttons (insights speak slot, chat assistant
   replies, AI meal-estimation header). Outlined ghost style — matches
   the .btn.ghost design language. Border carries the accent color so
   it's clearly an interactive control without needing a filled
   background that would clash with the accent-soft chat bubbles +
   meal-AI header. :hover gated to mouse devices so the color doesn't
   "stick" on touch after a tap. */
.speak-btn {
  background: transparent;
  border: 2.5px solid var(--accent-text);
  color: var(--accent-text);
  width: 36px; height: 36px;
  font-size: 16px; line-height: 1;
  padding: 0;
  border-radius: var(--radius-sm);
  cursor: pointer; opacity: 1;
  transition: transform .15s, box-shadow .15s;
  display: inline-flex; align-items: center; justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}
@media (hover: hover) {
  .speak-btn:hover { transform: scale(1.05); box-shadow: 0 2px 6px rgba(0,0,0,.1); }
}
.speak-btn:active { transform: scale(0.95); }
.speak-btn.is-loading {
  pointer-events: none;
  color: transparent;
  position: relative;
}
.speak-btn.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px; height: 14px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: speak-btn-spin .8s linear infinite;
}
@keyframes speak-btn-spin { to { transform: rotate(360deg); } }
.speak-btn.is-playing {
  background: var(--accent);
  color: #fff;
}

/* ---- History tab disclaimer (above the chart window picker) -- */
.history-disclaimer {
  margin: -4px 0 12px;
  font-size: 14px;
  color: var(--text-soft);
}
.insights-loading,
.insights-error {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-soft);
}

/* ---- Insights Q&A chat ------------------------------------- */
.insights-chat-card { padding: 14px; }
.insights-chat {
  display: flex; flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
  line-height: 1.55;
  font-size: 15px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-bubble.user {
  background: var(--accent);
  color: #fff;
  align-self: flex-start;
  border-bottom-right-radius: 4px;
}
.chat-bubble.ai {
  background: var(--accent-soft);
  color: var(--text);
  align-self: flex-end;
  border-bottom-left-radius: 4px;
}
.chat-bubble.thinking {
  color: var(--text-soft);
  font-style: italic;
}
.chat-empty {
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
  padding: 18px 8px;
}
/* ---- Coach (chat-first insights) ------------------------------ */
.coach-greeting { margin-bottom: 10px; }
.coach-greeting-bubble {
  max-width: 100%;
  white-space: normal;       /* greeting holds structured HTML, not chat text */
}
.coach-greeting-bubble .coaching-list { margin: 8px 0 0; padding-inline-start: 18px; }
.coach-greeting-bubble .coaching-list li { margin: 4px 0; }
.coach-greeting-tools {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
}
.coach-refresh {
  background: transparent; border: none; cursor: pointer;
  font-size: 15px; padding: 2px; line-height: 1;
}
.coach-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 4px 0 12px;
}
.coach-chip {
  background: transparent;
  border: 1.5px solid var(--accent-text);
  color: var(--accent-text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: transform .1s;
}
.coach-chip:active { transform: scale(.96); }

/* Dynamic follow-up chips under the last coach answer (soft/filled variant
   so they read as suggestions, distinct from the outlined starter chips). */
.chat-followups { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.chat-followup {
  background: var(--accent-soft);
  border: none; color: var(--accent-text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13.5px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: transform .1s;
  text-align: start;
}
.chat-followup::before { content: '↩ '; opacity: .6; }
.chat-followup:active { transform: scale(.96); }

/* Home coach line — compact single row: icon + 3-line-clamped text + a small
   "go to coach" affordance. The whole card is tappable. */
.coach-home-card {
  padding: 11px 13px;
  display: flex; gap: 9px; align-items: center;
  cursor: pointer;
}
.coach-home-card:active { transform: scale(.99); }
.coach-home-ico { flex: 0 0 auto; }
.coach-home-line {
  flex: 1; min-width: 0;
  color: var(--text);
  font-size: 14.5px; line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.coach-home-more {
  flex: 0 0 auto; align-self: center;
  color: var(--accent-text);
  font-size: 13.5px; font-weight: 700;
  white-space: nowrap;
}

/* Weigh-in strip — slim full-width entry to the weight/waist/notes sheet,
   sitting under the three quick buttons (deliberately secondary to them). */
.weigh-strip {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  margin-top: 10px;
  padding: 11px 14px;
  /* Raised-key surface like the quick buttons (chevron + action title carry
     the rest of the affordance) — colored borders were a traffic light. */
  background: var(--key-bg);
  border: 1px solid var(--key-line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .22), inset 0 1px 0 var(--key-hl);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: inherit; font-size: 14.5px;
  color: var(--text);
  cursor: pointer;
  text-align: start;
}
.weigh-strip:active { transform: scale(.99); }
.weigh-strip-ico { flex: 0 0 auto; }
.weigh-strip-title {
  flex: 0 0 auto;
  font-weight: 600;
  white-space: nowrap;
  margin-inline-start: 16px;   /* nudge inward from the icon edge */
}
/* Mini-stats stacked on the inline-end (left in RTL) side: labeled one-liners
   like משקל: 70.2 ק״ג. Today's values highlighted; carried-over ones get
   a muted (קודם) tag. The strip grows a little taller for the two rows. */
.weigh-strip-stats {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: flex-end; justify-content: center;
  gap: 3px;
  padding-inline-end: 10px;    /* nudge inward from the chevron edge */
}
.ws-stat {
  display: inline-flex; align-items: baseline; gap: 5px;
  line-height: 1.25;
  color: var(--text-soft);
  white-space: nowrap;
}
.ws-lbl  { font-size: 14px; font-weight: 500; }
.ws-stat b { font-family: var(--font-num); letter-spacing: .3px;
  font-size: 17px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}
.ws-unit { font-size: 13.5px; }
.ws-prev { font-size: 12px; opacity: .75; }
.ws-stat.ws-today b { color: var(--accent-text); }
.ws-note { font-size: 14px; }
.weigh-strip-more { flex: 0 0 auto; color: var(--accent-text); font-weight: 700; font-size: 13.5px; }

/* Tappable value field in the weigh-in sheet — opens the wheel picker.
   Muted while showing a carried-over value; accent once the user set it. */
.wheel-field {
  width: 100%;
  padding: 11px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 16px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
  cursor: pointer;
  text-align: center;
}
.wheel-field.set { color: var(--accent-text); border-color: var(--accent); }

/* Garmin-style wheel picker */
.wheel-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0, 0, 0, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.wheel-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px;
  width: min(300px, 100%);
}
.wheel-title { font-weight: 800; font-size: 15px; margin-bottom: 12px; }
.wheel-cols {
  position: relative;
  direction: ltr;                    /* numbers compose left-to-right */
  display: flex; justify-content: center; align-items: stretch; gap: 10px;
  height: 120px;                     /* 3 rows of 40px */
}
.wheel-col {
  width: 64px; height: 120px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  text-align: center;
  z-index: 1;
}
.wheel-col::-webkit-scrollbar { display: none; }
.wheel-item {
  height: 40px; line-height: 40px;
  scroll-snap-align: center;
  font-size: 19px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.wheel-spacer { height: 40px; }
.wheel-unit {
  align-self: center;
  color: var(--text-soft); font-weight: 700; font-size: 15px;
  z-index: 1;
}
.wheel-highlight {
  position: absolute; left: 0; right: 0; top: 40px; height: 40px;
  border-top: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  opacity: .55;
  pointer-events: none;
}
.wheel-btns { display: flex; gap: 8px; margin-top: 16px; }
.wheel-btns .btn { flex: 1; }

/* ---- Inline SVG icon chrome ----------------------------------- */
.ico { display: inline-block; vertical-align: -0.18em; flex-shrink: 0; }
.weigh-strip-ico, .coach-home-ico { display: inline-flex; color: var(--accent-text); }
.history-verdict .ico { margin-inline-end: 3px; }

/* Colour key under the graded charts. Small and quiet — it explains the bars
   without competing with them. Wraps on narrow screens. */
.chart-legend {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px 14px; margin-top: 10px;
  font-size: 12px; color: var(--text-soft);
}
.chart-legend .cl-item { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend .cl-item i { flex: 0 0 auto; }
/* Swatch mirrors the mark it labels: block for bars, a stroke for lines, a
   dot-on-stroke for the measured-burn point line. */
.chart-legend .cl-bar  { width: 9px;  height: 9px; border-radius: 2px; }
.chart-legend .cl-line { width: 14px; height: 3px; border-radius: 2px; }
.chart-legend .cl-dot  {
  width: 9px; height: 9px; border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--card-bg);
}
/* Dashed swatch for the stepped goal line, so it isn't mistaken for a solid
   measured series. */
.chart-legend .cl-dash {
  height: 0; width: 14px; border-radius: 0;
  background: none !important;
  border-top: 2px dashed var(--text-soft);
}
.notif-title { display: inline-flex; align-items: center; gap: 6px; }
/* Input + action button on one line (e.g. deficit field + "חשב לפי יעד") */
.input-inline-row { display: flex; gap: 8px; align-items: stretch; }
.input-inline-row input { flex: 1; min-width: 0; }
.input-inline-row .btn { flex: 0 0 auto; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.wb-type { display: inline-flex; align-items: center; gap: 5px; }
.speak-btn { display: inline-flex; align-items: center; justify-content: center; }

/* While the first advice loads, the card holds its final footprint with a
   blurred placeholder — no layout shift under the user's finger. */
.coach-home-line { min-height: 3em; }
.coach-home-card.coach-loading .coach-home-line {
  color: var(--text-soft);
  filter: blur(2.5px);
  animation: coachStalePulse 1.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .coach-home-card.coach-loading .coach-home-line { animation: none; }
}

/* Home coach card stale state — data changed, recompute pending (burst guard
   can hold it up to ~60s): dim the old advice and show a pulsing tag so it
   doesn't read as current. */
.coach-home-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.coach-home-body .coach-home-line { flex: none; }
.coach-home-stale {
  display: none;
  color: var(--accent-text);
  font-size: 13px; font-weight: 600;
}
/* Stale: whole text grays out and blinks, clamped to 2 lines so מתעדכן…
   takes the third line beneath it. */
#coachHomeCard.coach-stale .coach-home-body { animation: coachStalePulse 1.4s ease-in-out infinite; }
#coachHomeCard.coach-stale #coachHomeLine { color: var(--text-soft); -webkit-line-clamp: 2; filter: blur(2.5px); }
#coachHomeCard.coach-stale .coach-home-stale { display: block; }
@keyframes coachStalePulse {
  0%, 100% { opacity: .45; }
  50%      { opacity: 1; }
}

/* Home coach card "just updated" glow — fired when a meal/workout add/remove
   triggers a recompute, so the new line doesn't land silently. */
#coachHomeCard.coach-updated { animation: coachUpdated 1.6s ease; }
@keyframes coachUpdated {
  0%   { box-shadow: 0 0 0 0 transparent; }
  30%  { box-shadow: 0 0 16px 1px color-mix(in srgb, var(--accent-text) 55%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  #coachHomeCard.coach-updated { animation: none; }
  #coachHomeCard.coach-stale .coach-home-body { animation: none; }
}

/* ---- History AI insight card ---------------------------------- */
/* Plan-tab "mark done" action — success-tinted so it reads as the positive
   action among the neutral edit/delete. */
.timeline-actions .plan-done-btn { color: var(--success); }

/* Week-over-week comparison (replaced the AI trends card). A compact table:
   label · last week → this week · delta, coloured by whether the direction is
   progress for the user's GOAL (a deeper deficit is good when cutting, bad when
   bulking). Wide no-change bands keep noise from reading as improvement. */
.week-compare-card { padding: 14px 16px; }
.week-compare-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.week-compare-ico { display: inline-flex; color: var(--accent-text); }
.week-compare-title { margin: 0; font-size: 15px; font-weight: 700; }
.week-compare-body { display: flex; flex-direction: column; }
.wc-row {
  display: grid; grid-template-columns: 1fr auto auto;
  align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.wc-row:last-child { border-bottom: none; }
.wc-label { color: var(--text-soft); }
.wc-vals  { color: var(--text-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wc-vals i { font-style: normal; font-size: 11px; opacity: .7; margin-inline-end: 2px; }
.wc-vals b { color: var(--text); font-weight: 700; }
.wc-delta {
  font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
  min-width: 82px; text-align: end;
}
.wc-delta.good { color: var(--success); }
.wc-delta.bad  { color: var(--danger); }
.wc-delta.flat { color: var(--text-soft); font-weight: 600; }
.week-compare-note { margin-top: 9px; font-size: 11.5px; color: var(--text-soft); }

/* Eating window (זמני אכילה) — two time inputs on one row */
/* Times read LTR even in Hebrew UI — without this the RTL row renders the
   pair as "22:00 — 08:00" and looks like a backwards window. */
.eating-window-row { display: flex; align-items: center; gap: 8px; direction: ltr; }
.eating-window-row input[type="time"] { flex: 1; min-width: 0; }
.eating-window-dash { color: var(--text-soft); flex: 0 0 auto; }

/* ---- Pro status card (settings) -------------------------------- */
.pro-card {
  padding: 14px 16px;
  border: 1.5px solid color-mix(in srgb, #f59e0b 55%, var(--border));
  background: linear-gradient(135deg, color-mix(in srgb, #f59e0b 10%, var(--card-bg)), var(--card-bg) 60%);
}
.pro-card-head { display: flex; align-items: center; gap: 8px; }
.pro-card-head .ico { color: #f59e0b; }
.pro-card-title { font-weight: 800; font-size: 16px; letter-spacing: .2px; }
.pro-card-plan {
  margin-inline-start: auto;
  font-size: 12.5px; font-weight: 700;
  background: rgba(245, 158, 11, .15); color: #f59e0b;
  padding: 2px 10px; border-radius: 999px;
}
.pro-card-sub { margin-top: 6px; font-size: 13.5px; color: var(--text-soft); }
.pro-card-manage { display: inline-block; margin-top: 8px; padding: 0; color: var(--accent-text); }

/* ---- Free-tier upsell chrome (crown = Pro) --------------------- */
.crown-gold { color: #f59e0b; display: inline-flex; vertical-align: -0.15em; }
.ai-quota-hint { display: block; margin-top: 6px; text-align: center; }
.ai-quota-hint.quota-out { color: #f59e0b; font-weight: 600; }
.quota-upsell { text-align: center; padding: 12px 10px; }
.quota-upsell-txt { margin-top: 6px; font-size: 14.5px; line-height: 1.6; }
.coach-home-card.coach-upsell .coach-home-ico { color: #f59e0b; }
.coach-home-card.coach-upsell .coach-home-more { color: #f59e0b; }

/* ---- Paywall (Reshape Pro) ------------------------------------ */
.pw-head { text-align: center; margin-bottom: 4px; }
.pw-sub  { color: var(--text-soft); font-size: 14.5px; }
.pw-feats { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 4px; }
.pw-feat {
  display: flex; align-items: center; gap: 10px;
  font-size: 14.5px; line-height: 1.4;
}
.pw-feat .ico { color: var(--accent-text); flex: 0 0 auto; }
.pw-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.pw-plan {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 16px 10px 13px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-family: inherit; color: var(--text);
  cursor: pointer;
}
.pw-plan.active { border-color: var(--accent-text); background: var(--accent-soft); }
.pw-plan-name  { font-size: 14px; font-weight: 600; color: var(--text-soft); }
.pw-plan.active .pw-plan-name { color: var(--text); }
.pw-plan-price { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pw-plan-per   { font-size: 12.5px; color: var(--text-soft); }
.pw-badge {
  position: absolute; top: -9px; inset-inline-start: 50%;
  transform: translateX(50%);
  background: var(--success); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  white-space: nowrap;
}
[dir="ltr"] .pw-badge { transform: translateX(-50%); }
.pw-fine {
  margin: 12px 0 0;
  font-size: 12px; color: var(--text-soft); line-height: 1.6;
  text-align: center;
}
.pw-fine a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* History chart verdict — one-line interpretation of the visible window */
.history-verdict {
  text-align: center;
  font-size: 14px; font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 2px 0 10px;
}
.history-verdict.hidden { display: none; }

.insights-chat-input {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.insights-chat-input input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
  font-size: 15px;
}
.insights-chat-input input:focus { border-color: var(--accent); background: var(--card-bg); }
.insights-chat-input button {
  width: auto;
  padding: 10px 18px;
  flex-shrink: 0;
}
.insights-error { color: var(--danger); }
.insights-offline {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.6;
}
.spinner-large-inline {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}
.spinner-small-inline {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}

/* Per-section insights skeleton — body fades in when content arrives. */
.insight-section { margin-bottom: 8px; }
.insight-section.hidden { display: none; }
.insight-section .section-body { transition: opacity .2s; }
.insight-section .section-body.insight-loading { opacity: 0.5; color: var(--text-soft); font-size: 14px; }

/* Insights "today" card — verdict chip + a single "eating pace" bar */
.today-verdict { display: inline-block; font-size: 14px; font-weight: 700; padding: 3px 12px; border-radius: 999px; margin-bottom: 14px; }
.today-verdict.tone-good    { background: color-mix(in srgb, var(--c-cal) 18%, transparent); color: var(--c-cal); }
.today-verdict.tone-warn    { background: color-mix(in srgb, #f59e0b 20%, transparent);      color: #f59e0b; }
.today-verdict.tone-neutral { background: var(--border); color: var(--text-soft); }
.today-pace { position: relative; }
.today-pace-label { font-size: 13px; color: var(--text-soft); margin-bottom: 10px; }
.today-pace-row { display: flex; align-items: center; gap: 8px; padding-bottom: 22px; }
.today-pace-end { font-size: 12.5px; color: var(--text-soft); white-space: nowrap; }
.today-pace-track { position: relative; flex: 1; height: 10px; border-radius: 999px; background: var(--border); }
.today-pace-fill { position: absolute; inset-inline-start: 0; top: 0; height: 100%; min-width: 4px; border-radius: 999px; background: var(--c-cal); transition: width .5s ease; }
.today-pace-marker { position: absolute; top: -4px; height: 18px; width: 2px; background: var(--text); border-radius: 2px; }
.today-pace-cap { position: absolute; top: 16px; font-size: 12.5px; color: var(--text-soft); white-space: nowrap; }
.insights-card .today-note { margin: 8px 0 0; font-size: 15px; }

/* ---- Today: hourly calorie distribution -------------------- */
.today-hours { margin-top: 16px; }
.thi-chart { position: relative; direction: rtl; display: flex; align-items: flex-end; gap: 3px; height: 56px; }
.thi-col { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 4px; }
.thi-col.thi-now { background: var(--border); }
.thi-bar { width: 100%; background: var(--c-cal); border-radius: 3px 3px 0 0; transition: height .4s ease; }
.thi-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.thi-axis { direction: rtl; display: flex; gap: 3px; margin-top: 4px; }
.thi-tick { flex: 1; text-align: center; font-size: 12px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.thi-legend { color: var(--text-soft); font-weight: 500; }

/* ---- Plan tip card ------------------------------------------ */
.plan-tip {
  margin: 12px 0 4px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 6%, var(--card-bg));
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.5;
}
.plan-tip p { margin: 0 0 4px; }
.plan-tip span { display: block; font-size: 13px; }
.plan-tip strong { color: var(--text); }

/* ---- Version footer ----------------------------------------- */
/* "Your installed app is older than the web layer needs" — informational, so
   warning-tinted rather than danger-red: nothing is broken, an update just
   unlocks more. */
.stale-native {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 0; padding: 10px 12px;
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  font-size: 13.5px; line-height: 1.5; color: var(--text);
}
.stale-native .ico { color: var(--warning); flex: 0 0 auto; }

.version-info {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-soft);
  margin: 18px 0 24px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Splash + initial loader ------------------------------- */
.app-loader {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s ease-out;
}
.app-loader.hidden {
  opacity: 0;
  pointer-events: none;
}
.splash-content {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
  animation: splash-rise 0.45s ease-out;
}
@keyframes splash-rise {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.splash-logo {
  width: 80px; height: 80px;
  filter: drop-shadow(0 6px 20px rgba(37, 99, 235, 0.30));
}
.splash-wordmark {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 4px;
}
.splash-tagline {
  font-size: 14px;
  color: var(--text-soft);
  letter-spacing: 0.04em;
}
.splash-loading {
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
}
.app-loader-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.app-loader-text {
  font-weight: 500;
  color: var(--text-soft);
  font-size: 14px;
}

/* ---- Loading spinner ---------------------------------------- */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Sign-in screen ----------------------------------------- */
.signin-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 1000;
}
.signin-screen.hidden { display: none; }
.signin-content {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 10px;
  padding: 0 32px;
}
.signin-content .splash-logo {
  margin-bottom: 8px;
}
.signin-content .splash-wordmark,
.signin-content .splash-tagline {
  text-align: center;
}
/* Spinner shown on the splash while Firebase restores the session (before the
   sign-in buttons are revealed for genuinely signed-out users). */
.signin-spinner {
  display: flex; justify-content: center;
  margin-top: 40px;
}
.signin-spinner.hidden { display: none; }
/* Wrapper around the sign-in buttons + legal — keep them centered and
   content-sized like when they were direct children of .signin-content. */
#signinActions {
  display: flex; flex-direction: column; align-items: center;
  width: 100%;
}
#signinActions.hidden { display: none; }
.signin-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 28px;
  margin-top: 40px;
  background: #4285f4; color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: opacity .15s;
}
.signin-btn:hover { opacity: 0.92; }
.signin-btn svg { width: 20px; height: 20px; }
/* Apple sign-in button — black per Apple's HIG; sits just below Google. */
.signin-btn-apple { background: #000; margin-top: 14px; }
.signin-btn-apple svg { width: 16px; height: 18px; }

/* ---- Image picker ------------------------------------------- */
.image-picker {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 8px;
}
.image-picker label {
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-soft);
  transition: border-color .15s, color .15s;
}
.image-picker label:hover { border-color: var(--accent); color: var(--accent-text); }
.image-picker input[type=file] { display: none; }

/* ---- Meal photo thumbnails (multi-image) -------------------- */
.meal-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.meal-thumb { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--bg); }
.meal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meal-thumb-x {
  position: absolute; top: 2px; inset-inline-end: 2px;
  width: 20px; height: 20px; padding: 0; border: none; cursor: pointer;
  border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
  font-size: 12.5px; line-height: 20px; text-align: center;
}

/* ---- Onboarding wizard -------------------------------------- */
.onboarding-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  /* Column + align-items:center centers the wrap horizontally. We do NOT
     vertically center with justify-content:center — that clips the top of an
     overflowing form (title + name field) above the scroll origin, leaving it
     unreachable once the keyboard shrinks the viewport (S22 bug). The wrap's
     `margin: auto 0` centers it when it fits and top-anchors it when it
     doesn't, keeping every field scrollable into view. */
  display: flex; flex-direction: column; align-items: center;
  z-index: 900;
  padding: 24px 20px;
  overflow-y: auto;
}
.onboarding-screen.hidden { display: none; }
.onboarding-wrap {
  width: 100%; max-width: 400px;
  margin: auto 0;
  display: flex; flex-direction: column;
  gap: 24px;
}
.ob-dots {
  display: flex; justify-content: center; gap: 8px;
}
.ob-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background .2s;
}
.ob-dot.active { background: var(--accent); }
.ob-page { display: flex; flex-direction: column; gap: 20px; }
.ob-page.hidden { display: none; }
.ob-logo {
  width: 72px; height: 72px;
  border-radius: 18px;
  filter: drop-shadow(0 6px 20px rgba(37,99,235,.25));
  align-self: center;
}
.ob-title {
  font-size: 22px; font-weight: 800;
  color: var(--text);
  text-align: center; margin: 0;
}
.ob-subtitle {
  font-size: 15px; color: var(--text-soft);
  text-align: center; margin: -12px 0 0;
}
.ob-goal-cards,
.ob-pace-cards {
  display: flex; flex-direction: column; gap: 12px;
}
.ob-goal-card,
.ob-pace-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: right;
  font-family: inherit;
  transition: border-color .15s, background .15s;
  width: 100%;
}
.ob-goal-card.selected, .ob-goal-card:focus,
.ob-pace-card.selected, .ob-pace-card:focus {
  border-color: var(--accent);
  background: rgba(37,99,235,.06);
  outline: none;
}
.ob-goal-icon { font-size: 28px; flex-shrink: 0; }
.ob-goal-label {
  font-size: 16px; font-weight: 700;
  color: var(--text);
  flex: 1;
}
.ob-goal-desc {
  font-size: 13px; color: var(--text-soft);
  display: block; margin-top: 2px;
}
.ob-fields { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.ob-fields .form-group { width: 100%; }
.ob-fields .form-label {
  display: block;
  font-size: 15px; font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 6px;
  text-align: right;
}
.ob-fields .form-control {
  display: block;
  width: 100%; box-sizing: border-box;
  padding: 11px 14px;
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; font-family: inherit;
  text-align: right;
}
.ob-fields .form-control:focus {
  outline: none; border-color: var(--accent);
}
.ob-hint {
  font-size: 13px; color: var(--text-soft);
  margin-top: 4px;
}
.ob-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 4px;
}
.ob-nav .ob-back.hidden { visibility: hidden; }
.btn.ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-text); }
.ob-signout-row {
  text-align: center; padding-top: 8px;
}
.ob-bmr-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ob-bmr-header .form-label { margin-bottom: 0; }
.ob-auto-toggle { display: flex; align-items: center; gap: 5px; font-size: 14px; color: var(--text-soft); cursor: pointer; white-space: nowrap; }
.ob-auto-toggle input[type="checkbox"] { accent-color: var(--accent-text); width: 15px; height: 15px; cursor: pointer; }

.ob-gender-row { display: flex; gap: 10px; }
.ob-gender-btn {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: transparent; color: var(--text-soft);
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all .15s;
}
.ob-gender-btn.active {
  border-color: var(--accent); background: var(--accent);
  color: white;
}

/* Activity tier picker in onboarding step 2 — three stacked buttons,
   each with a title and small description. Same visual language as the
   gender row above, but vertical so the descriptions read cleanly. */
.ob-activity-row { display: flex; flex-direction: column; gap: 8px; }
.ob-activity-btn {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: transparent; color: var(--text);
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: all .15s;
  text-align: right;
  display: flex; flex-direction: column; align-items: stretch;
}
.ob-activity-btn.active {
  border-color: var(--accent); background: var(--accent); color: white;
}
.ob-activity-desc {
  display: block;
  font-size: 13px; font-weight: 500; margin-top: 3px; opacity: 0.85;
}

/* Activity-calibration interstitial — one-time hard-block surface for
   pre-existing users to pick a NEAT multiplier. Visually distinct from
   the generic modal so it reads as a calibration step, not a popup. */
.activity-cal-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.activity-cal-overlay.hidden { display: none; }
.activity-cal-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 18px;
  max-width: 480px; width: 100%;
  box-shadow: var(--shadow);
}
.activity-cal-title {
  margin: 0 0 12px 0;
  font-size: 18px; font-weight: 700;
  color: var(--text);
}
.activity-cal-body {
  margin: 0 0 16px 0;
  font-size: 15px; line-height: 1.55;
  color: var(--text-soft);
}
/* BMR recalibration block inside the interstitial — shown only when a
   refresh from current weight/height/age would change the stored BMR. */
.activity-cal-bmr {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.activity-cal-bmr.hidden { display: none; }
.activity-cal-bmr-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--text);
}
.activity-cal-bmr-row:last-of-type { margin-bottom: 0; }
.activity-cal-bmr-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.activity-cal-bmr-toggle input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent-text);
  cursor: pointer;
}

.activity-cal-tiers { display: flex; flex-direction: column; gap: 10px; }
.activity-cal-tier {
  width: 100%; padding: 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: transparent; color: var(--text);
  font-family: inherit;
  cursor: pointer; transition: all .15s;
  text-align: right;
  display: flex; flex-direction: column; gap: 4px;
}
.activity-cal-tier:hover { border-color: var(--accent); }
.activity-cal-tier-title  { font-size: 15px; font-weight: 700; }
.activity-cal-tier-desc   { font-size: 14px; color: var(--text-soft); }
.activity-cal-tier-burn   { font-size: 14px; font-weight: 600; color: var(--accent-text); margin-top: 4px; }
.activity-cal-foot {
  margin: 14px 0 0 0;
  font-size: 13px; color: var(--text-soft); text-align: center;
}

/* Auto-calc BMR toggle inside Settings — sits above the BMR input and
   disables it when checked. Matches the obAutoToggle style on onboarding. */
.auto-calc-toggle {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 15px;
  color: var(--text);
}
.auto-calc-toggle input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent-text);
  cursor: pointer;
}

/* Live "שריפה יומית כוללת" read-out under the activity dropdown — larger
   + blue so it reads as a primary value, not a tertiary hint. */
.effective-burn-display {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--c-water);
  margin-top: 8px;
}

/* Floating feedback button — fixed to the bottom-left of the viewport
   (RTL trailing edge, so it doesn't cover the primary "היום" tab on the
   bottom-right). z-index 28 sits above page content but below the bottom
   nav (25 — visually adjacent), modals (100), and onboarding overlays
   (900+) so it never competes with those flows. */
.feedback-fab {
  position: fixed;
  left: 16px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15);
  z-index: 28;
  transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.feedback-fab:hover { transform: scale(1.05); }
.feedback-fab:active { transform: scale(0.95); box-shadow: 0 2px 6px rgba(0,0,0,0.2); }

/* Empty state for brand-new users on the History tab — fewer than 2
   completed days means streak numbers are mostly zeros, which reads
   as failure rather than fresh start. */
.streaks-empty {
  padding: 12px 4px;
  font-size: 14px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.6;
}

.ob-signout-btn {
  background: transparent !important; border: none !important;
  font-size: 14px; color: var(--text-soft);
  cursor: pointer; font-family: inherit;
  text-decoration: underline; opacity: 0.7;
  padding: 4px 8px;
}
.ob-signout-btn:hover { opacity: 1; }

/* ---- Danger zone -------------------------------------------- */
.danger-zone-card { border: 1.5px solid var(--danger) !important; }
.danger-modal-root {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: flex-end; justify-content: center;
}
.danger-modal-root.hidden { display: none; }
.danger-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
}
.danger-modal-sheet {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px;
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px 36px;
  display: flex; flex-direction: column; gap: 14px;
}
.danger-modal-title {
  font-size: 18px; font-weight: 800;
  color: var(--text); margin: 0;
  text-align: center;
}
.danger-modal-body {
  font-size: 15px; color: var(--text-soft);
  text-align: center; margin: 0; line-height: 1.5;
}
.danger-backup-row { display: flex; gap: 10px; }
.danger-backup-row .btn { flex: 1; justify-content: center; }
.danger-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 4px 0;
}
.danger-confirm-label {
  font-size: 15px; color: var(--text-soft);
}
.danger-confirm-input {
  width: 100%; box-sizing: border-box;
  padding: 11px 14px;
  background: var(--bg); color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; font-family: inherit;
  text-align: right;
}
.danger-confirm-input:focus { outline: none; border-color: var(--danger); }
.danger-step2-btns { display: flex; gap: 10px; }
.danger-step2-btns .btn { flex: 1; justify-content: center; }

/* Behaviour → outcome findings ("מה משפיע עליך"). Each row is one comparison
   between two groups of days, tinted by whether the finding is in the user's
   favour. Deliberately plain sentences: these are conditional tendencies, not
   causal claims, so they read as observations rather than verdicts. */
.correl-card { padding: 14px 16px; }
.correl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.correl-ico { display: inline-flex; color: var(--accent-text); }
.correl-title { margin: 0; font-size: 15px; font-weight: 700; }
.correl-body { display: flex; flex-direction: column; gap: 9px; }
.correl-row {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1.55;
  background: var(--bg); border-inline-start: 3px solid var(--border);
}
.correl-row .ico { flex: 0 0 auto; margin-top: 2px; color: var(--text-soft); }
.correl-row.good { border-inline-start-color: var(--success); }
.correl-row.good .ico { color: var(--success); }
.correl-row.bad  { border-inline-start-color: var(--danger); }
.correl-row.bad .ico { color: var(--danger); }
.correl-empty { font-size: 13.5px; color: var(--text-soft); line-height: 1.6; }

/* Single-streak line on היום. Compact and warm rather than another card: it has
   to earn its place on an already-dense screen, so it's one row with a flame,
   the number, and a tap target for the full grid. */
.home-streak {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 12px; padding: 10px 13px;
  background: var(--card-bg); border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
  font-size: 14px; cursor: pointer;
}
.home-streak .hs-fire { font-size: 17px; line-height: 1; flex: 0 0 auto; }
.home-streak .hs-text { flex: 1 1 auto; color: var(--text-soft); line-height: 1.45; }
.home-streak .hs-text b { color: var(--text); font-weight: 800; }
.home-streak .hs-more { flex: 0 0 auto; color: var(--accent-text); font-weight: 700; font-size: 13px; }
.home-streak:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* No active run: same line, quieter. The warm border and lit flame are earned by
   a live streak — keeping them here would make "nothing at stake" look urgent.
   Class-on-class beats the base rule above, so the border override holds. */
.home-streak.hs-idle { border-color: var(--border); }
.home-streak.hs-idle .hs-fire { filter: grayscale(1); opacity: .55; }
