:root {
  --bg: #FBF9F5;
  --surface: #FFFFFF;
  --surface-soft: #F3EFE7;
  --border: #E5DFD3;
  --text: #1F2933;
  --text-muted: #5C6670;
  --primary: #235D43;
  --primary-dark: #194531;
  --primary-soft: #E8F3ED;
  --sugar-red: #C81E1E;
  --sugar-red-bg: #FEF2F2;
  --sugar-red-border: #FECACA;
  --warn: #B45309;
  --warn-bg: #FFFBEB;
  --warn-border: #FDE68A;
  --ok: #15803D;
  --ok-bg: #F0FDF4;
  --ok-border: #BBF7D0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(31, 41, 51, 0.06);
  --nav-h: 68px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 74px);
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
.mb-12 { margin-bottom: 12px; }

/* iOS Safari / PWA 上端の強制ブラー抑止（WebKit 10px超判定を利用し描画自体は透明化） */
.ios-blur-fix {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  z-index: 2147483647;
  pointer-events: none;
  background-color: #FBF9F5;
  -webkit-background-clip: text;
  background-clip: text;
}

/* ヘッダー */
.app-header {
  background: var(--primary);
  color: #FFFFFF;
  padding: calc(14px + env(safe-area-inset-top)) 16px 13px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

@media (display-mode: standalone) {
  .app-header {
    padding-top: calc(18px + env(safe-area-inset-top));
  }
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #FBF9F5;
  color: var(--sugar-red);
  font-weight: 800;
  font-size: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.app-subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  opacity: 0.9;
}

.header-status {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.16);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #86EFAC;
}

/* メイン */
.app-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px 24px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 検索エリア */
.search-sticky {
  background: var(--bg);
  padding-bottom: 6px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.search-icon {
  padding-left: 12px;
  font-size: 18px;
  user-select: none;
}

.search-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 13px 10px;
  font-size: 16px;
}

.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.clear-btn {
  border: none;
  background: var(--surface-soft);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-right: 8px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 14px;
}

.quick-words {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.quick-words::-webkit-scrollbar { display: none; }

.quick-word {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13.5px;
  white-space: nowrap;
  cursor: pointer;
}
.quick-word:active { background: var(--primary-soft); }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.toggle-chip {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
}

.toggle-chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.chip-icon {
  font-weight: 800;
}

.sort-select {
  margin-left: auto;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13.5px;
  min-height: 38px;
}

.group-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
}
.group-chips::-webkit-scrollbar { display: none; }

.group-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.group-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 6px 2px 10px;
}

.unit-note {
  font-size: 12px;
}

/* 食品カード */
.food-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.food-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.food-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.food-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text-muted);
}

.badge-zero {
  background: var(--ok-bg);
  color: var(--ok);
  border: 1px solid var(--ok-border);
}

.badge-custom {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.badge-upper {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}

.food-name {
  margin: 2px 0 0;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.fav-btn {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  color: #CBD5E1;
  flex-shrink: 0;
}
.fav-btn.active { color: #EAB308; }

.food-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.food-metric-box {
  display: flex;
  flex-direction: column;
}

.food-metric-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.food-metric-num {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.food-metric-num small {
  font-size: 14px;
  font-weight: 700;
  margin-left: 2px;
}

.sugar-red { color: var(--sugar-red) !important; font-weight: 800; }
.sugar-red-label { color: var(--sugar-red); font-weight: 700; }
.carbs-dark { color: #1E293B; font-weight: 800; }

/* 調味料のさじ換算ボックス */
.spoon-box {
  margin-top: 9px;
  padding: 8px 10px;
  background: #F4F9F6;
  border: 1px solid #CBE4D6;
  border-radius: 9px;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.spoon-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.spoon-title {
  color: var(--primary-dark);
  font-weight: 700;
}

.spoon-vals {
  font-variant-numeric: tabular-nums;
}

/* カード下部アクション */
.food-card-actions {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.detail-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 4px;
  cursor: pointer;
}

.food-detail-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 13.5px;
  color: var(--text-muted);
}

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

.detail-note {
  font-size: 12.5px;
  color: var(--warn);
  background: var(--warn-bg);
  padding: 6px 8px;
  border-radius: 6px;
  margin-top: 6px;
}

/* ボタン共通 */
.btn {
  border: none;
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: var(--surface);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-ghost {
  background: var(--surface-soft);
  color: var(--text-muted);
}

.btn-add {
  background: var(--primary);
  color: #FFFFFF;
  padding: 9px 14px;
  font-size: 14.5px;
  min-height: 42px;
  border-radius: 10px;
}

.btn-sm {
  padding: 8px 13px;
  font-size: 13.5px;
  min-height: 44px;
}

.btn-lg {
  padding: 13px 18px;
  font-size: 16px;
  min-height: 50px;
}

.btn-full { width: 100%; }

.btn-text-danger {
  border: none;
  background: transparent;
  color: var(--sugar-red);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 8px;
}

.btn-text-muted {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
}

.load-more-wrap {
  margin-top: 14px;
}

/* カード共通 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.section-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.muted-small {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* 食事区分タブ */
.meal-type-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.meal-type-btn {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 4px;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
}

.meal-type-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

/* 合計サマリー */
.summary-numbers {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px 0 12px;
}

.summary-metric {
  text-align: center;
  flex: 1;
}

.metric-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 700;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.metric-value small {
  font-size: 16px;
  margin-left: 2px;
}

.summary-divider {
  width: 1px;
  height: 46px;
  background: var(--border);
}

.summary-sub {
  display: flex;
  justify-content: space-around;
  font-size: 14px;
  color: var(--text-muted);
  padding: 10px 0 4px;
  border-top: 1px solid var(--border);
}

/* 目標ゲージ */
.goal-gauge-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gauge-item {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
}

.gauge-head {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.gauge-track {
  position: relative;
  height: 12px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.gauge-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.gauge-fill.ok { background: var(--ok); }
.gauge-fill.under { background: #2563EB; }
.gauge-fill.over { background: var(--sugar-red); }

.gauge-msg {
  font-size: 13.5px;
  font-weight: 700;
}
.gauge-msg.ok { color: var(--ok); }
.gauge-msg.under { color: #1D4ED8; }
.gauge-msg.over { color: var(--sugar-red); }

.goal-unset-box {
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 12px;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 選んだ食品リスト */
.meal-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meal-item-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg);
}

.meal-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.meal-item-name {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
}

.meal-item-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  padding: 2px 6px;
  cursor: pointer;
}

.meal-item-bottom {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.meal-item-grams {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mini-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.mini-input {
  width: 72px;
  height: 34px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.meal-item-vals {
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  display: flex;
  gap: 10px;
}

.save-meal-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.save-date-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.input-date {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--surface);
  font-weight: 600;
}

/* 目標設定タブ */
.daily-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.daily-total-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.daily-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 700;
}

.daily-value {
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.notice-inline {
  font-size: 13px;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 12px;
}

.goal-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.goal-meal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.goal-meal-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-dark);
}

.goal-range-row {
  display: grid;
  grid-template-columns: 78px 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.goal-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}

.save-meal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* いつものメニュー（マイセット） */
.quick-sets-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-set-chip-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-set-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.quick-set-info {
  min-width: 0;
  flex: 1;
}

.quick-set-name {
  font-weight: 800;
  font-size: 15px;
  margin: 0 0 2px;
}

.quick-set-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.segment-control.segment-3 {
  grid-template-columns: repeat(3, 1fr);
}

.segment-control.segment-3 .segment-btn {
  font-size: 13.5px;
  padding: 10px 4px;
}

.meal-sets-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meal-set-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg);
}

.meal-set-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.meal-set-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}

.meal-set-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 8px;
}

.portion-box {
  margin-top: 9px;
  padding: 8px 10px;
  background: #F4F9F6;
  border: 1px solid #CBE4D6;
  border-radius: 9px;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* セグメント切り替え（記録／いつものメニュー／自分の食品） */
.segment-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface-soft);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.segment-btn {
  border: none;
  background: transparent;
  padding: 10px 8px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-muted);
  cursor: pointer;
}

.segment-btn.active {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.subpanel { display: none; }
.subpanel.active { display: block; }

/* 記録一覧 */
.history-day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.history-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.history-date {
  font-size: 16px;
  font-weight: 800;
}

.history-day-sum {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.history-entry {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.history-entry:last-child { margin-bottom: 0; }

.history-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.meal-tag {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12.5px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 6px;
}

.history-items-text {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.history-entry-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* 自分の食品フォーム */
.form-group { margin-bottom: 12px; }
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 5px;
}

.field-label-inline {
  font-size: 14.5px;
  font-weight: 700;
}

.req {
  font-size: 11px;
  background: var(--sugar-red-bg);
  color: var(--sugar-red);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.input-text {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
  font-size: 16px;
}

.input-sugar {
  border-color: var(--sugar-red-border);
  color: var(--sugar-red);
  font-weight: 700;
}

.hint-text {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: -4px 0 12px;
}

.custom-food-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--bg);
  margin-top: 10px;
}

.custom-food-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.custom-food-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

/* 情報タブ */
.info-text {
  margin: 8px 0 10px;
  font-size: 14.5px;
}

.step-list {
  margin: 8px 0 0;
  padding-left: 22px;
  font-size: 14.5px;
}
.step-list li { margin-bottom: 6px; }

.info-bullets {
  margin: 6px 0 0;
  padding-left: 20px;
  font-size: 14px;
}
.info-bullets li { margin-bottom: 8px; }

.disclaimer-box {
  background: var(--surface-soft);
  border-left: 4px solid var(--primary);
  padding: 12px;
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  color: var(--text);
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.file-label {
  cursor: pointer;
}

/* 空状態・ローディング */
.empty-state, .loading-box {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
}

.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}

.empty-desc {
  font-size: 14px;
  margin: 0 0 14px;
}

/* フローティング食事バー */
.floating-meal-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
  padding: 0 12px;
  z-index: 40;
  pointer-events: none;
}

.floating-meal-btn {
  pointer-events: auto;
  width: 100%;
  max-width: 692px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #1F2933;
  color: #FFFFFF;
  border: none;
  border-radius: 14px;
  padding: 11px 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.floating-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.floating-tag {
  background: var(--primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
}

.floating-count {
  font-size: 13px;
  opacity: 0.9;
}

.floating-nums {
  display: flex;
  gap: 12px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.floating-nums .sugar-red {
  color: #FCA5A5 !important;
}

.floating-go {
  font-size: 13px;
  font-weight: 700;
  color: #86EFAC;
  white-space: nowrap;
}

/* 下部ナビゲーション */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 50;
}

.nav-btn {
  position: relative;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 2px;
}

.nav-btn.active {
  color: var(--primary);
  font-weight: 800;
}

.nav-icon {
  font-size: 21px;
  line-height: 1;
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 22px);
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--sugar-red);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* モーダル（ボトムシート） */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.2);
  max-height: 88vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-group {
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
}

.modal-title {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.modal-close {
  border: none;
  background: var(--surface-soft);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.modal-spoon-info {
  background: #F4F9F6;
  border: 1px solid #CBE4D6;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--primary-dark);
  margin-bottom: 12px;
}

.modal-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.preset-btn {
  border: 1.5px solid var(--border);
  background: var(--bg);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
}

.preset-btn.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.modal-amount-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stepper-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.stepper-input {
  width: 92px;
  height: 42px;
  border: 1.5px solid var(--primary);
  border-radius: 10px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.modal-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  margin-bottom: 16px;
}

.preview-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 700;
}

.preview-val {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* トースト */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 68px);
  background: #1F2933;
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 120;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .metric-value { font-size: 28px; }
  .food-metric-num { font-size: 22px; }
  .floating-nums { gap: 8px; font-size: 13px; }
}
