/* ==========================================================================
   CalPALL — temel stil katmanı (Faz 1)
   Tek vurgu rengi: --accent. Değiştirmek için sadece :root içindeki
   --accent değerini güncelle (türevler color-mix ile otomatik hesaplanır).
   ========================================================================== */

/* --- 1. Sıfırlama ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-wrap: break-word;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); }

/* --- 2. Tema değişkenleri ------------------------------------------------ */
:root,
[data-theme="light"] {
  color-scheme: light;
  --accent: #bf3d16;
  --accent-soft: rgba(191, 61, 22, 0.12);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 32%, transparent);
  --on-accent: #ffffff;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --surface-3: #e4e9ef;
  --text: #101419;
  --text-muted: #5b6675;
  --border: #e0e5ec;
  --ring-track: #e6eaf0;
  --success: #147d4f;
  --warn: #9a5b06;
  --danger: #b23123;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 28px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.22);
}

[data-theme="dark"] {
  color-scheme: dark;
  --accent: #ff6a3d;
  --accent-soft: rgba(255, 106, 61, 0.16);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 36%, transparent);
  --on-accent: #1a0d07;
  --bg: #0b0e12;
  --surface: #141920;
  --surface-2: #1b212a;
  --surface-3: #232a35;
  --text: #edf1f7;
  --text-muted: #98a3b3;
  --border: #242c38;
  --ring-track: #222a35;
  --success: #3fce92;
  --warn: #e2a552;
  --danger: #ef6d5d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.65);
}

:root {
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --header-h: 56px;
  --tabbar-h: 62px;
  --rail-w: 248px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- 3. Erişilebilirlik -------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

/* --- 4. Uygulama iskeleti ------------------------------------------------ */
.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-width: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  padding-top: calc(var(--sp-2) + env(safe-area-inset-top, 0px));
  min-height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.app-title {
  flex: 1;
  text-align: center;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.app-content {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--sp-4);
  padding-bottom: calc(var(--tabbar-h) + var(--sp-8) + env(safe-area-inset-bottom, 0px));
  outline: none;
}

/* --- 5. Alt sekme çubuğu (mobil) ---------------------------------------- */
.tab-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  min-height: 48px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 550;
  cursor: pointer;
  transition: color 0.16s var(--ease);
}
.tab-btn[aria-current="page"] { color: var(--accent); }
.tab-btn:hover { color: var(--text); }
.tab-btn--primary {
  flex: 0 0 auto;
  align-self: center;
  width: 52px;
  height: 52px;
  min-height: 52px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow);
  margin: 0 6px;
}
.tab-btn--primary:hover { color: var(--on-accent); }
.tab-btn--primary .tab-btn__label { display: none; }

/* --- 6. Yan menü (masaüstü) ---------------------------------------------- */
.side-rail {
  display: none;
}

@media (min-width: 900px) {
  .app-shell { grid-template-columns: var(--rail-w) 1fr; }
  .side-rail {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding: var(--sp-5) var(--sp-4);
    border-right: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    height: 100dvh;
  }
  .rail-brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    font-weight: 700;
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
  }
  .brand-mark {
    width: 32px; height: 32px;
    border-radius: 10px;
    background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ffb27a));
    box-shadow: var(--shadow-sm);
  }
  .rail-nav { display: flex; flex-direction: column; gap: 2px; }
  .rail-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 10px var(--sp-3);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 550;
    text-decoration: none;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
  }
  .rail-link:hover { background: var(--surface-2); color: var(--text); }
  .rail-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
  .rail-link--primary {
    justify-content: center;
    background: var(--accent);
    color: var(--on-accent);
    margin-bottom: var(--sp-3);
    box-shadow: var(--shadow-sm);
  }
  .rail-link--primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: var(--on-accent); }
  .rail-note {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: var(--sp-3);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
  }
  .tab-bar { display: none; }
  .app-content { padding: var(--sp-5); padding-bottom: var(--sp-6); }
  .app-header { padding-inline: var(--sp-5); }
  .app-title { text-align: left; }
}

/* --- 7. Butonlar --------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--quiet { background: transparent; color: var(--text-muted); }
.btn--quiet:hover { color: var(--text); }
.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 0.875rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* --- 8. Kartlar ve düzen yardımcıları ------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.card--flat { box-shadow: none; }
.card--pad-lg { padding: var(--sp-5); }

.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack--lg { gap: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 0.8125rem; }
.tiny { font-size: 0.75rem; }
.center { text-align: center; }
.mono-num { font-variant-numeric: tabular-nums; }

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 650;
}

.info-banner {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}
.info-banner strong { color: var(--text); }

.empty-state {
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  color: var(--text-muted);
}
.empty-state__icon {
  width: 56px; height: 56px;
  margin: 0 auto var(--sp-3);
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
}

/* --- 9. Form elemanları -------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.input, .select {
  min-height: 44px;
  width: 100%;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.input:focus, .select:focus { border-color: var(--accent); outline-offset: 1px; }
textarea.input { min-height: 96px; padding: 10px 12px; resize: vertical; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.switch-row:last-child { border-bottom: 0; }
.switch {
  position: relative;
  width: 46px; height: 28px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-3);
  cursor: pointer;
  transition: background 0.18s var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.seg__btn {
  border: 0;
  background: none;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.seg__btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* --- 10. Kalori halkası ve makro çubukları -------------------------------- */
.ring-wrap { display: grid; place-items: center; position: relative; }
.ring { transform: rotate(-90deg); }
.ring__track { stroke: var(--ring-track); fill: none; }
.ring__value {
  stroke: var(--accent);
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s var(--ease);
}
.ring__center {
  position: absolute;
  text-align: center;
  display: grid;
  gap: 2px;
}
.ring__number { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.ring__caption { font-size: 0.75rem; color: var(--text-muted); }

.macro-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}
.macro {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.macro__name { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.macro__value { font-size: 1.125rem; font-weight: 700; }
.macro__bar { height: 6px; border-radius: var(--radius-pill); background: var(--ring-track); overflow: hidden; }
.macro__fill { height: 100%; border-radius: var(--radius-pill); background: var(--accent); transition: width 0.5s var(--ease); }

/* --- 11. Gün şeridi ------------------------------------------------------ */
.day-strip {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.day-chip {
  flex: 0 0 auto;
  width: 52px;
  padding: var(--sp-2) 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  justify-items: center;
  gap: 4px;
  cursor: pointer;
  scroll-snap-align: center;
}
.day-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.day-chip__label { font-size: 0.6875rem; color: var(--text-muted); font-weight: 600; }
.day-chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ring-track); }
.day-chip__dot--on { background: var(--accent); }

/* --- 12. Yemek listesi ---------------------------------------------------- */
.meal-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.meal-item:last-child { border-bottom: 0; }
.meal-item__thumb {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  object-fit: cover;
  flex: 0 0 auto;
}
.meal-item__name { font-weight: 600; }
.meal-item__meta { font-size: 0.8125rem; color: var(--text-muted); }
.meal-item__kcal { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Öğe bazında gram düzenleme (Faz 4): öğe satırı + gramaj girişi. */
.meal-item--editable { align-items: flex-start; }
.meal-item--editable .input { margin-top: 6px; max-width: 140px; }
.meal-item--editable .meal-item__kcal { white-space: nowrap; padding-top: 2px; }

/* Toplam kalori/makro göstergesi. */
.totals-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.totals-row__cell { display: flex; flex-direction: column; gap: 2px; text-align: center; }

/* Barkod kamerası önizlemesi. */
.barcode-video {
  width: 100%;
  max-height: 42vh;
  border-radius: var(--radius);
  background: #000;
  object-fit: cover;
}

/* Öğün grupları: başlık + grup toplamı, ardından kayıtlar. */
.meal-group { padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.meal-group:last-child { border-bottom: 0; }
.meal-group > .row { margin-bottom: var(--sp-1); }

/* --- 13. Su takibi ------------------------------------------------------- */
.water-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.water-dot {
  width: 22px; height: 30px;
  border-radius: 5px 5px 9px 9px;
  border: 1.5px solid var(--accent-line);
  background: var(--surface-2);
}
.water-dot--on { background: color-mix(in srgb, var(--accent) 60%, var(--surface)); border-color: var(--accent); }

/* --- 14. Kurulum banner'ı ------------------------------------------------- */
/* Üstte konumlanır: alt sekme çubuğu ve onboarding CTA'sı ile çakışmaz. */
.install-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 8px);
  z-index: 40;
  width: min(560px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: toast-in 0.2s var(--ease);
}
.install-banner[hidden] { display: none; }
.install-banner__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.install-banner__text span { font-size: 0.8125rem; color: var(--text-muted); }
.install-banner__actions { display: flex; gap: var(--sp-2); flex: 0 0 auto; }
@media (max-width: 520px) {
  .install-banner { flex-direction: column; align-items: stretch; }
}

/* --- 15. Bottom sheet ----------------------------------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 10, 14, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: sheet-fade 0.18s var(--ease);
}
.sheet {
  width: min(560px, 100%);
  max-height: 88dvh;
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--sp-4);
  padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-lg);
  animation: sheet-up 0.22s var(--ease);
}
.sheet__handle {
  width: 40px; height: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  margin: 0 auto var(--sp-3);
}
.sheet__title { font-size: 1.0625rem; font-weight: 700; margin-bottom: var(--sp-3); }
.sheet__actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.sheet__actions .btn { flex: 1; }
@media (min-width: 900px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: var(--radius-lg); }
}

@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }

/* --- 16. Toast ------------------------------------------------------------ */
.toast-root {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
  font-weight: 550;
  box-shadow: var(--shadow);
  animation: toast-in 0.2s var(--ease);
}
.toast--error { background: var(--danger); color: #fff; }
.toast--success { background: var(--success); color: #fff; }
.toast--action { display: flex; align-items: center; gap: var(--sp-3); }
.toast__action {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  font-size: 0.8125rem;
  cursor: pointer;
}
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- 16b. Bağlantı / sürüm göstergesi -------------------------------------- */
.conn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 650;
  white-space: nowrap;
}
.conn-chip[hidden] { display: none; }
.conn-chip__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.conn-chip--warn {
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
  color: var(--warn);
}
.conn-chip--ok { color: var(--success); }

/* --- 17. Yükleme iskeleti ------------------------------------------------- */
.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* --- 18. Grafik iskeleti -------------------------------------------------- */
.chart-box {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* --- 19. Ayarlar --------------------------------------------------------- */
.kv { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 7px 0; font-size: 0.875rem; }
.kv + .kv { border-top: 1px solid var(--border); }
.kv__k { color: var(--text-muted); }
.kv__v { font-weight: 600; text-align: right; }

/* --- 20. Onboarding ------------------------------------------------------- */
.onboarding {
  min-height: calc(100dvh - var(--header-h) - var(--sp-6) - var(--tabbar-h));
  display: grid;
  align-content: center;
  gap: var(--sp-4);
  text-align: center;
}
.onboarding__title { font-size: 1.75rem; font-weight: 750; letter-spacing: -0.02em; }
.onboarding__lede { color: var(--text-muted); max-width: 34ch; margin: 0 auto; }
.onboarding__marks { display: flex; justify-content: center; gap: var(--sp-4); flex-wrap: wrap; }
.onboarding__mark { display: grid; justify-items: center; gap: 6px; width: 108px; font-size: 0.8125rem; color: var(--text-muted); }
.onboarding__mark-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
}
.onboarding .btn--block { max-width: 320px; margin-inline: auto; }

/* --- 21b. Onboarding formu ------------------------------------------------ */
.onboarding--form {
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
}
.onboarding--form .onboarding__title,
.onboarding--form .onboarding__lede { margin-inline: 0; text-align: left; }
.onboarding--form .onboarding__lede { max-width: 52ch; }

/* Onboarding sırasında gezinme çubukları gizlenir: ilk akışta menü
   teklif etmeyiz ve CTA asla sekme çubuğunun altında kalmaz. */
body[data-route="onboarding"] .tab-bar,
body[data-route="onboarding"] .side-rail { display: none !important; }
body[data-route="onboarding"] .app-shell { grid-template-columns: 1fr !important; }
body[data-route="onboarding"] .app-content { padding-bottom: var(--sp-5); }
body[data-route="onboarding"] .onboarding { min-height: calc(100dvh - var(--header-h) - var(--sp-4)); }

/* CTA yapışkan: her viewport yüksekliğinde erişilebilir kalır. */
.onboarding-nav {
  position: sticky;
  bottom: 0;
  z-index: 15;
  margin: var(--sp-4) calc(var(--sp-4) * -1) calc(var(--sp-4) * -1);
  padding: var(--sp-3) var(--sp-4);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}

.progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.35s var(--ease);
}

.stepper {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.stepper::-webkit-scrollbar { display: none; }
.stepper__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 56px;
  color: var(--text-muted);
}
.stepper__dot {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 700;
}
.stepper__label { font-size: 0.6875rem; font-weight: 600; text-align: center; }
.stepper__item.is-current { color: var(--accent); }
.stepper__item.is-current .stepper__dot { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.stepper__item.is-done .stepper__dot { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

.seg--wrap { flex-wrap: wrap; }
.seg--wrap .seg__btn { flex: 1 1 auto; }

.diet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-2);
}
.diet-card {
  display: grid;
  gap: 4px;
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.diet-card:hover { border-color: var(--accent-line); }
.diet-card.is-selected { border-color: var(--accent); background: var(--accent-soft); }

.range {
  width: 100%;
  accent-color: var(--accent);
  height: 28px;
}

.assumptions {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  background: var(--surface-2);
  font-size: 0.875rem;
}
.assumptions summary { cursor: pointer; font-weight: 600; }
.assumptions ul { margin-top: var(--sp-2); padding-left: var(--sp-4); list-style: disc; }
.assumptions li + li { margin-top: 4px; }

.info-banner--error { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.info-banner--warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }

/* --- 21. Yazdırma --------------------------------------------------------- */
@media print {
  .app-header, .tab-bar, .side-rail, .install-banner { display: none !important; }
  .app-content { padding: 0; }
}
