/* ── Makro Takip Sayfası ───────────────────────────────────────────────────── */

.macros-view {
  max-width: 720px;
  padding-bottom: 40px;
}

.macros-view .view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.macros-view .view-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Tab Navigasyon ──────────────────────────────────────────────────────── */

.macro-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.macro-tabs::-webkit-scrollbar { display: none; }

.macro-tab {
  flex: 1;
  min-width: 80px;
  padding: 8px 12px;
  border: none;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.macro-tab:hover { background: rgba(0,0,0,.06); color: var(--text-1); }
.macro-tab.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* ── Özet Kartı ──────────────────────────────────────────────────────────── */

.macro-summary-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 16px;
  overflow: hidden;
}

.macro-loading {
  text-align: center;
  color: var(--text-3);
  padding: 20px 0;
  font-size: 14px;
}

/* ── msum: Yeni özet kart tasarımı ─────────────────────────────────────── */

.msum-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Kalori hero */
.msum-cal-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #fff5f0 0%, #fef9f5 100%);
  border-bottom: 1px solid var(--border);
}

/* SVG gauge */
.msum-gauge-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.msum-gauge {
  width: 100%;
  height: 100%;
}

.msum-gauge-bg {
  fill: none;
  stroke: #f1e8e3;
  stroke-width: 8;
}

.msum-gauge-fg {
  fill: none;
  stroke: #c4622d;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.msum-gauge-fg.over { stroke: #ef4444; }

.msum-gauge-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.msum-cal-num {
  font-size: 22px;
  font-weight: 800;
  color: #c4622d;
  line-height: 1;
}
.msum-cal-num.over { color: #ef4444; }

.msum-cal-unit {
  font-size: 10px;
  font-weight: 600;
  color: #c4622d99;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Cal details */
.msum-cal-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.msum-cal-target {
  font-size: 12px;
  color: var(--text-3);
}
.msum-cal-target strong {
  color: var(--text-2);
  font-weight: 700;
}

.msum-cal-remaining {
  font-size: 16px;
  font-weight: 700;
  color: #16a34a;
}
.msum-cal-remaining.over {
  color: #ef4444;
  font-size: 14px;
}

.msum-meal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.msum-meal-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.msum-meal-chip.breakfast { background: #fff7ed; color: #ea580c; }
.msum-meal-chip.lunch     { background: #fefce8; color: #ca8a04; }
.msum-meal-chip.dinner    { background: #eef2ff; color: #4f46e5; }
.msum-meal-chip.snack     { background: #fdf4ff; color: #9333ea; }

/* Makro çubukları */
.msum-macros {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.msum-macro-row {
  display: grid;
  grid-template-columns: 110px 1fr 72px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.msum-macro-row:last-child { border-bottom: none; }

.msum-macro-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.msum-macro-icon { font-size: 14px; line-height: 1; }

.msum-macro-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.msum-macro-bar-wrap {
  height: 7px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}

.msum-macro-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}
.msum-macro-bar.protein { background: #3b82f6; }
.msum-macro-bar.carbs   { background: #f59e0b; }
.msum-macro-bar.fat     { background: #22c55e; }
.msum-macro-bar.fiber   { background: #a855f7; }

.msum-macro-nums {
  display: flex;
  align-items: baseline;
  gap: 2px;
  justify-content: flex-end;
}
.msum-macro-nums.over .msum-cur { color: #ef4444; }

.msum-cur {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}
.msum-sep {
  font-size: 11px;
  color: var(--text-3);
}
.msum-tgt {
  font-size: 11px;
  color: var(--text-3);
}

/* Şeker & Sodyum */
.msum-secondary {
  display: flex;
  gap: 0;
  padding: 10px 20px;
}

.msum-sec-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  margin: 0 4px;
}
.msum-sec-item:first-child { margin-left: 0; }
.msum-sec-item:last-child  { margin-right: 0; }

.msum-sec-item.sugar  { background: #fdf2f8; border: 1px solid #fce7f3; }
.msum-sec-item.sodium { background: #f0f9ff; border: 1px solid #e0f2fe; }

.msum-sec-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }

.msum-sec-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.msum-sec-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.msum-sec-val {
  font-size: 14px;
  font-weight: 700;
}
.msum-sec-item.sugar  .msum-sec-val { color: #db2777; }
.msum-sec-item.sodium .msum-sec-val { color: #0284c7; }

@media (max-width: 400px) {
  .msum-cal-hero { gap: 12px; }
  .msum-gauge-wrap { width: 84px; height: 84px; }
  .msum-cal-num { font-size: 18px; }
  .msum-macro-row { grid-template-columns: 90px 1fr 60px; }
}

/* ── Besin Arama ─────────────────────────────────────────────────────────── */

.quick-add-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.quick-add-section h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 12px;
}

.food-search-box {
  position: relative;
}

.food-search-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.18s;
}
.food-search-box input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}
.search-results.active { display: block; }

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-2); }

.search-result-item .food-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 4px;
}

.food-macros {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
}

.search-no-result,
.search-error {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}
.search-error { color: #ef4444; }

/* ── Tüketim Listesi ─────────────────────────────────────────────────────── */

.meal-consumption {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.meal-consumption h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 12px;
}

.meal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.meal-tabs::-webkit-scrollbar { display: none; }

.meal-tab {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.meal-tab:hover { border-color: var(--primary); color: var(--primary); }
.meal-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.consumed-list { display: flex; flex-direction: column; gap: 8px; }

.no-items {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  padding: 16px 0;
  margin: 0;
}

.consumed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.consumed-food-info { flex: 1; min-width: 0; }

.consumed-food-info .food-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-amount {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.consumed-macros {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.consumed-macros .cal {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.macro-detail {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.delete-consumed-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.delete-consumed-btn:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #ef4444;
}

/* ── Geçmiş Grafik ───────────────────────────────────────────────────────── */

.history-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.history-section h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 16px;
}

.history-chart { width: 100%; }

.info-text {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  padding: 20px 0;
  margin: 0;
}

.history-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding-bottom: 24px;
  position: relative;
}

.history-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  gap: 4px;
}

.bar-container {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  min-height: 0;
}

.bar {
  width: 100%;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  opacity: 0.75;
  min-height: 4px;
  transition: height 0.4s ease;
}

.bar-label {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
  white-space: nowrap;
}

.bar-value {
  font-size: 10px;
  color: var(--text-2);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

/* ── Geçmiş: Yeni Tasarım (hday-*) ─────────────────────────────────────── */

.hday-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hday-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

/* Header */
.hday-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.hday-datewrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hday-dayname {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}

.hday-daydate {
  font-size: 12px;
  color: var(--text-3);
}

/* Kalori badge */
.hday-cal-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

.hday-cal-num {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
}
.hday-cal-unit {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hday-cal-badge.good .hday-cal-num,
.hday-cal-badge.good .hday-cal-unit { color: #16a34a; }
.hday-cal-badge.low  .hday-cal-num,
.hday-cal-badge.low  .hday-cal-unit { color: #c4622d; }
.hday-cal-badge.over .hday-cal-num,
.hday-cal-badge.over .hday-cal-unit { color: #ef4444; }

/* Kalori bar */
.hday-cal-track {
  height: 4px;
  background: var(--surface-2);
  margin: 0 16px;
  border-radius: 99px;
  overflow: hidden;
}

.hday-cal-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}
.hday-cal-fill.good { background: #16a34a; }
.hday-cal-fill.low  { background: #c4622d; }
.hday-cal-fill.over { background: #ef4444; }

.hday-cal-caption {
  font-size: 11px;
  color: var(--text-3);
  padding: 4px 16px 10px;
}

.hday-cal-diff.good { color: #16a34a; font-weight: 600; }
.hday-cal-diff.low  { color: #c4622d; }
.hday-cal-diff.over { color: #ef4444; font-weight: 600; }

/* Makro çubukları */
.hday-macros {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
  padding: 8px 16px;
}

.hday-mrow {
  display: grid;
  grid-template-columns: 20px 56px 1fr 80px;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.hday-mrow:last-child { border-bottom: none; }

.hday-micon { font-size: 13px; line-height: 1; text-align: center; }

.hday-mlabel {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.hday-mtrack {
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}

.hday-mfill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}
.hday-mfill.protein { background: #3b82f6; }
.hday-mfill.carbs   { background: #f59e0b; }
.hday-mfill.fat     { background: #22c55e; }
.hday-mfill.fiber   { background: #a855f7; }

.hday-mval {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
  text-align: right;
  display: flex;
  align-items: baseline;
  gap: 2px;
  justify-content: flex-end;
}
.hday-mval small { font-size: 10px; font-weight: 400; color: var(--text-3); }
.hday-mval.ok   { color: var(--text-1); }
.hday-mval.low  { color: #f59e0b; }
.hday-mval.high { color: #ef4444; }

/* Şeker & Sodyum */
.hday-extras {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}

.hday-extra {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 12px;
}
.hday-extra.sugar  { background: #fdf2f8; border: 1px solid #fce7f3; }
.hday-extra.sodium { background: #f0f9ff; border: 1px solid #e0f2fe; }

.hday-extra-label {
  flex: 1;
  color: var(--text-3);
  font-size: 11px;
}

.hday-extra-val { font-weight: 700; }
.hday-extra.sugar  .hday-extra-val { color: #db2777; }
.hday-extra.sodium .hday-extra-val { color: #0284c7; }

/* Öğün dağılımı */
.hday-meals {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.hday-meal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 70px;
  padding: 6px 8px;
  border-radius: 10px;
}

.hday-meal span   { font-size: 11px; color: var(--text-3); }
.hday-meal strong { font-size: 13px; font-weight: 700; }

.hday-meal.bf { background: #fff7ed; }
.hday-meal.bf strong { color: #ea580c; }
.hday-meal.ln { background: #fefce8; }
.hday-meal.ln strong { color: #ca8a04; }
.hday-meal.dn { background: #eef2ff; }
.hday-meal.dn strong { color: #4f46e5; }
.hday-meal.sn { background: #fdf4ff; }
.hday-meal.sn strong { color: #9333ea; }

/* ── Hesaplayıcı ─────────────────────────────────────────────────────────── */

.calculator-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.calculator-section h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 16px;
}

.calculator-form { display: flex; flex-direction: column; gap: 14px; }

.ingredients-input { display: flex; flex-direction: column; gap: 8px; }

.ingredient-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ing-name {
  flex: 2;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.ing-name:focus { border-color: var(--primary); background: var(--surface); }

.ing-amount {
  flex: 1;
  padding: 8px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.ing-amount:focus { border-color: var(--primary); background: var(--surface); }

.ing-unit {
  flex: 1;
  padding: 8px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 13px;
  outline: none;
  min-width: 0;
  cursor: pointer;
}
.ing-unit:focus { border-color: var(--primary); }

.btn-remove-ingredient {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
.btn-remove-ingredient:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #ef4444;
}

.btn-add-ingredient {
  align-self: flex-start;
  font-size: 13px;
  padding: 6px 14px;
}

.calculator-result {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.calculator-result h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 0 0 12px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.result-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
}

.per-serving {
  font-size: 13px;
  color: var(--text-2);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  gap: 6px;
}

/* ── Birim Dönüşümleri ───────────────────────────────────────────────────── */

.units-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.units-section h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0;
}

.units-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}
.units-search input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.units-list { display: flex; flex-direction: column; gap: 6px; }

.unit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.unit-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
}

.unit-details {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.btn-delete-unit {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.btn-delete-unit:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #ef4444;
}

/* ── Makro Modal (class tabanlı, macros.js tarafından oluşturulan) ──────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

@media (min-width: 540px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

.modal-overlay .modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 -4px 32px rgba(0,0,0,.15);
  animation: slide-up 0.22s ease;
}

@media (min-width: 540px) {
  .modal-overlay .modal-content {
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    animation: modal-fade 0.2s ease;
  }
}

@keyframes slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes modal-fade {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.modal-overlay .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.modal-overlay .modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}

.modal-overlay .modal-body {
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-overlay .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modal-overlay .form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0;
}

.modal-overlay .form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.modal-overlay .form-group input,
.modal-overlay .form-group select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.modal-overlay .form-group input:focus,
.modal-overlay .form-group select:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.modal-overlay .btn {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

/* ── Hata ve boş durum ────────────────────────────────────────────────────── */

.error {
  color: #ef4444;
  font-size: 14px;
  text-align: center;
  padding: 16px 0;
}

/* ── Tarif Detay Makro Önizleme ───────────────────────────────────────────── */

.macro-preview-section {
  margin-top: 16px;
}

.macro-preview-loading {
  font-size: 12px;
  color: var(--text-3, #9ca3af);
  font-style: italic;
}

.macro-preview-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.macro-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2, #475569);
}

.macro-preview-subtitle {
  font-size: 11px;
  color: var(--text-3, #9ca3af);
}

.macro-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.macro-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  min-width: 72px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
}

.macro-chip .chip-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3, #9ca3af);
  margin-bottom: 2px;
}

.macro-chip .chip-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1, #1e293b);
}

.macro-chip.calories { border-color: #fcd9c9; background: #fff5f0; }
.macro-chip.calories .chip-label { color: #c4622d; }
.macro-chip.calories .chip-value { color: #c4622d; }

.macro-chip.protein { border-color: #bfdbfe; background: #eff6ff; }
.macro-chip.protein .chip-label { color: #2563eb; }
.macro-chip.protein .chip-value { color: #2563eb; }

.macro-chip.carbs { border-color: #fde68a; background: #fffbeb; }
.macro-chip.carbs .chip-label { color: #d97706; }
.macro-chip.carbs .chip-value { color: #d97706; }

.macro-chip.fat { border-color: #bbf7d0; background: #f0fdf4; }
.macro-chip.fat .chip-label { color: #16a34a; }
.macro-chip.fat .chip-value { color: #16a34a; }

.macro-chip.fiber { border-color: #e9d5ff; background: #faf5ff; }
.macro-chip.fiber .chip-label { color: #7c3aed; }
.macro-chip.fiber .chip-value { color: #7c3aed; }

.macro-chip.sugar { border-color: #fce7f3; background: #fdf2f8; }
.macro-chip.sugar .chip-label { color: #db2777; }
.macro-chip.sugar .chip-value { color: #db2777; }

.macro-chip.sodium { border-color: #e0f2fe; background: #f0f9ff; }
.macro-chip.sodium .chip-label { color: #0284c7; }
.macro-chip.sodium .chip-value { color: #0284c7; }

/* ── FAZ 4.2: Raporlar ────────────────────────────────────────────────────── */

.reports-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.reports-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.reports-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}

.report-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.report-period-btn {
  padding: 6px 14px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.report-period-btn.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.report-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.report-nav-btn {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.report-nav-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.report-period-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.report-content {
  min-height: 200px;
}

.report-loading {
  text-align: center;
  color: var(--text-3);
  padding: 40px 0;
}

/* Report Grid */
.report-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Report Cards */
.report-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 500px) {
  .report-cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

.rcard {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.rcard-icon {
  font-size: 24px;
  line-height: 1;
}

.rcard-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rcard-label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rcard-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
}

.rcard-sub {
  font-size: 10px;
  color: var(--text-3);
}

.rcard.calories { border-color: #fcd9c9; background: #fff5f0; }
.rcard.calories .rcard-value { color: #c4622d; }
.rcard.protein { border-color: #bfdbfe; background: #eff6ff; }
.rcard.protein .rcard-value { color: #2563eb; }
.rcard.carbs { border-color: #fde68a; background: #fffbeb; }
.rcard.carbs .rcard-value { color: #d97706; }
.rcard.fat { border-color: #bbf7d0; background: #f0fdf4; }
.rcard.fat .rcard-value { color: #16a34a; }
.rcard.days { border-color: #e9d5ff; background: #faf5ff; }
.rcard.days .rcard-value { color: #7c3aed; }
.rcard.adherence { border-color: #fecaca; background: #fef2f2; }
.rcard.adherence .rcard-value { color: #dc2626; }

/* Report Subtitle */
.report-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin: 0 0 12px;
}

/* Trend Chart */
.trend-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 140px;
}

.trend-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.trend-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  min-height: 0;
}

.trend-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height 0.4s ease;
  min-height: 8px;
}

.trend-bar.ok { background: #22c55e; }
.trend-bar.low { background: #f59e0b; }
.trend-bar.over { background: #ef4444; }

.trend-label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
}

.trend-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

/* Meal Distribution */
.meal-dist-section {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.meal-dist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 500px) {
  .meal-dist-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.mdist-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.mdist-icon { font-size: 20px; }

.mdist-label {
  font-size: 11px;
  color: var(--text-3);
}

.mdist-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}

.mdist-card.breakfast { background: #fff7ed; }
.mdist-card.breakfast .mdist-value { color: #ea580c; }
.mdist-card.lunch { background: #fefce8; }
.mdist-card.lunch .mdist-value { color: #ca8a04; }
.mdist-card.dinner { background: #eef2ff; }
.mdist-card.dinner .mdist-value { color: #4f46e5; }
.mdist-card.snack { background: #fdf4ff; }
.mdist-card.snack .mdist-value { color: #9333ea; }

/* Insights */
.insights-section {
  background: linear-gradient(135deg, #fefce8 0%, #fffbeb 100%);
  border: 1.5px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 14px;
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.insight-item {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  padding: 8px 12px;
  background: rgba(255,255,255,.6);
  border-radius: 8px;
}

/* Weekly Summaries (Monthly Report) */
.weekly-summaries {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.week-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.week-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.week-cal {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.week-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wbar-label {
  font-size: 12px;
  width: 20px;
}

.wbar-track {
  flex: 1;
  height: 6px;
  background: var(--surface);
  border-radius: 99px;
  overflow: hidden;
}

.wbar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.wbar-fill.protein { background: #3b82f6; }
.wbar-fill.carbs { background: #f59e0b; }
.wbar-fill.fat { background: #22c55e; }

/* ── FAZ 4.3: Makro Analizi ───────────────────────────────────────────────── */

.analysis-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.analysis-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
}

.analysis-period-select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.analysis-period-select:focus {
  border-color: var(--primary);
}

.analysis-content {
  min-height: 200px;
}

.analysis-loading {
  text-align: center;
  color: var(--text-3);
  padding: 40px 0;
}

/* Analysis Grid */
.analysis-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.analysis-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.analysis-card.full-width {
  grid-column: 1 / -1;
}

.analysis-card h3.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 14px;
}

/* Score Card */
.score-card {
  text-align: center;
  padding: 24px 16px;
  border-width: 2px;
}

.score-card.good {
  border-color: #22c55e;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.score-card.medium {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.score-card.low {
  border-color: #ef4444;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.score-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.score-emoji {
  font-size: 24px;
  line-height: 1;
}

.score-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.score-value {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
}

.score-card.good .score-value { color: #16a34a; }
.score-card.medium .score-value { color: #d97706; }
.score-card.low .score-value { color: #dc2626; }

.score-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 12px;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  color: #dc2626;
}

/* Macro Scores */
.macro-scores {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.macro-score-row {
  display: grid;
  grid-template-columns: 80px 1fr 40px;
  align-items: center;
  gap: 10px;
}

.macro-score-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.macro-score-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}

.macro-score-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

.macro-score-fill.good { background: #22c55e; }
.macro-score-fill.medium { background: #f59e0b; }
.macro-score-fill.low { background: #ef4444; }

.macro-score-value {
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.macro-score-value.good { color: #16a34a; }
.macro-score-value.medium { color: #d97706; }
.macro-score-value.low { color: #dc2626; }

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 12px;
}

.trend-badge.good {
  background: #f0fdf4;
  color: #16a34a;
}

.trend-badge.warning {
  background: #fef2f2;
  color: #dc2626;
}

.trend-badge.neutral {
  background: var(--surface-2);
  color: var(--text-3);
}

/* Weekly Comparison */
.weekly-comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 500px) {
  .weekly-comparison-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.week-compare-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s;
}

.week-compare-card.current {
  border-color: var(--primary);
  border-width: 2px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.week-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.week-score {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
}

.week-score.good { color: #16a34a; }
.week-score.medium { color: #d97706; }
.week-score.low { color: #dc2626; }

.week-cals {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  text-align: center;
}

.week-macros {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.week-macros span {
  font-size: 10px;
  color: var(--text-3);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Analysis Lists */
.analysis-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.list-item {
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.list-item.strength {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.list-item.weakness {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.strengths-card .card-title {
  color: #166534;
}

.weaknesses-card .card-title {
  color: #991b1b;
}

/* Recommendations */
.recommendations-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.recommendation-item {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
}

.rec-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.rec-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}

.macro-focus {
  display: flex;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.focus-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.focus-item.best {
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.focus-item.attention {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.focus-icon {
  font-size: 16px;
}

.focus-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.focus-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .analysis-card {
    padding: 14px;
  }
  
  .score-value {
    font-size: 36px;
  }
  
  .macro-score-row {
    grid-template-columns: 60px 1fr 35px;
  }
  
  .macro-score-label {
    font-size: 11px;
  }
  
  .weekly-comparison-grid {
    grid-template-columns: 1fr;
  }
  
  .macro-focus {
    flex-direction: column;
  }
}
