/* dashboard-page.css — ページ固有スタイル */

/* dashboard-page.css — ダッシュボード固有スタイル
   Extracted from dashboard.html inline <style> */

/* ジュースサブタイプボタン */

/* --- next block --- */

/* ★ 共通スタイル (root, body, nav, card, badge等) は style.css に移動 */

/* ページ固有スタイル */

/* メインコンテンツ (ダッシュボードは幅1200px) */

.container {
  max-width: 1200px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 0;
}

.stats-toggle-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.stats-toggle-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.stats-toggle-tab:hover {
  color: var(--fg);
}

.stats-toggle-tab.active {
  color: var(--acc);
  border-bottom-color: var(--acc);
}

.stat-card {
  background: linear-gradient(180deg, #0b1221, #0c1220);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.stat-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--acc);
  margin-bottom: 4px;
}

.stat-label {
  color: var(--muted);
  font-size: 14px;
}

.record-item {
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: all 0.2s;
}

.record-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.record-image {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 0.2s;
}

.record-image:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3);
}

/* 複数写真レイアウト */

.record-images-wrap {
  position: relative;
  flex-shrink: 0;
}

.record-sub-thumbs {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}

.record-sub-thumb {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.record-sub-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  color: var(--muted);
}

.record-photo-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

/* 国名バッジ（日本以外で撮影された写真） */

.country-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff;
  letter-spacing: 0.3px;
  white-space: nowrap;
  line-height: 1.6;
}

[data-theme="light"] .country-badge {
  background: linear-gradient(135deg, #ea580c, #dc2626);
}

/* モーダル内の追加写真ギャラリー */

.modal-sub-images {
  display: flex;
  gap: 8px;
  padding: 10px 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.modal-sub-images::before {
  content: '📷 写真一覧';
  display: block;
  position: absolute;
  top: -4px;
  left: 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.modal-sub-images {
  padding-top: 20px;
}

.modal-sub-image {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modal-sub-image:hover {
  border-color: var(--acc);
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.2);
}

.modal-sub-image.active {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.25), 0 4px 16px rgba(34, 211, 238, 0.3);
  transform: scale(1.05);
}

.record-content {
  flex: 1;
}

.record-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--fg);
}

.record-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.record-nutrition {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.nutrition-pill {
  background: rgba(34, 211, 238, 0.1);
  color: var(--acc);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.btn {
  background: var(--acc);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: #06b6d4;
  transform: translateY(-1px);
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

/* グラフタブ */

.chart-tab {
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--fg);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.chart-tab:hover {
  background: #374151;
  border-color: rgba(255, 255, 255, 0.2);
}

.chart-tab.active {
  background: rgba(34, 211, 238, 0.1);
  border-color: var(--acc);
  color: var(--acc);
}

/* ===== 栄養サマリーセクション ===== */

.nutrition-summary-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.pfc-donut-area {
  flex: 0 0 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pfc-donut-area canvas {
  width: 140px !important;
  height: 140px !important;
}

.pfc-donut-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  text-align: center;
}

.nutrition-highlights {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.nh-item {
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nh-item-label {
  font-size: 11px;
  color: var(--muted);
}

.nh-item-value {
  font-size: 16px;
  font-weight: 700;
}

.nh-item-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 4px;
  overflow: hidden;
}

.nh-item-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ===== PFC目標セレクター ===== */

.pfc-goal-btn {
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.pfc-goal-btn:hover {
  border-color: var(--acc);
  color: var(--fg);
}

.pfc-goal-btn.active {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--acc);
  color: var(--acc);
  font-weight: 700;
}

/* PFC比較バー */

.pfc-compare-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.pfc-compare-label {
  width: 16px;
  font-weight: 700;
  text-align: center;
}

.pfc-compare-bar-track {
  flex: 1;
  height: 16px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  position: relative;
  overflow: visible;
}

.pfc-compare-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  position: relative;
}

.pfc-compare-target-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.pfc-compare-values {
  width: 100px;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.pfc-compare-values .current {
  font-weight: 700;
  color: var(--fg);
}

/* PFC教育ガイド */

.pfc-guide-details {
  margin-top: 2px;
}

.pfc-guide-content {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pfc-guide-item {
  background: var(--pill);
  border-radius: 8px;
  padding: 10px 12px;
  border-left: 4px solid;
}

.pfc-guide-item h4 {
  font-size: 13px;
  margin: 0 0 4px 0;
}

.pfc-guide-item p {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.pfc-guide-item .food-examples {
  font-size: 11px;
  color: var(--acc);
  margin-top: 4px;
}

/* ===== チャートメインタブ ===== */

.chart-main-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0;
}

.chart-main-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.chart-main-tab:hover {
  color: var(--fg);
}

.chart-main-tab.active {
  color: var(--acc);
  border-bottom-color: var(--acc);
}

.chart-sub-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .nutrition-summary-row {
    flex-direction: column;
    align-items: center;
  }

  .pfc-donut-area {
    flex: none;
  }

  .nutrition-highlights {
    width: 100%;
  }

  .chart-main-tab {
    padding: 8px 14px;
    font-size: 13px;
  }
}

/* カロリー配分チャート */

.dist-chart-container {
  padding: 8px 0;
}

.dist-period-label {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 16px;
}

.dist-bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.dist-bar-label {
  width: 60px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  text-align: right;
  flex-shrink: 0;
}

.dist-bar-track {
  flex: 1;
  height: 28px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.dist-bar-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  transition: width 0.6s ease;
  min-width: 0;
}

.dist-bar-fill span {
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.dist-bar-kcal {
  width: 75px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  text-align: left;
}

.dist-ideal-line {
  position: absolute;
  top: 0;
  height: 100%;
  width: 2px;
  background: rgba(255, 255, 255, 0.4);
  z-index: 2;
}

.dist-ideal-line::after {
  content: attr(data-label);
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
}

.dist-total-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dist-total-label {
  font-size: 13px;
  color: var(--muted);
}

.dist-total-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--acc);
}

.dist-ideal-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.dist-ideal-item {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.dist-ideal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dist-no-data {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 60px 0;
}

[data-theme="light"] .dist-bar-track {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .dist-total-row {
  border-top-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .dist-ideal-line {
  background: rgba(0, 0, 0, 0.3);
}

/* ページネーション */

.pagination-btn {
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--fg);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  min-width: 40px;
}

.pagination-btn:hover {
  background: #374151;
  border-color: rgba(255, 255, 255, 0.2);
}

.pagination-btn.active {
  background: var(--acc);
  border-color: var(--acc);
  color: #0f172a;
  font-weight: 600;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* モーダルウィンドウ */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  overflow-y: auto;
  animation: fadeIn 0.3s;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: linear-gradient(180deg, #0b1221, #0c1220);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--acc);
  margin: 0;
}

.modal-close {
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--fg);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 24px;
}

.modal-close:hover {
  background: #374151;
  transform: rotate(90deg);
}

.modal-edit-btn {
  background: var(--acc);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-edit-btn:hover {
  background: #06b6d4;
  transform: translateY(-1px);
}

.modal-edit-btn.editing {
  background: var(--green);
}

.modal-delete-btn {
  background: var(--pill);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--red);
  transform: translateY(-1px);
}

.modal-header>div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.edit-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

.edit-table th,
.edit-table td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.edit-table th {
  background: var(--pill);
  font-weight: 600;
  color: var(--acc);
  font-size: 12px;
}

.edit-table input,
.edit-table textarea {
  width: 100%;
  padding: 8px;
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--fg);
  font-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
}

.edit-table .ing-name-textarea {
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  word-break: break-all;
  min-height: 36px;
}

.edit-table .ing-name-display {
  font-size: 13px;
  line-height: 1.4;
  color: var(--fg);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  min-width: 40px;
}

.edit-table .ing-name-display:hover,
.edit-table .ing-name-display:active {
  background: rgba(34, 211, 238, 0.08);
}

.edit-table .ing-name-display::after {
  content: ' ✏️';
  font-size: 10px;
  opacity: 0.5;
}

@media (max-width: 768px) {
  .edit-table .ing-name-display {
    font-size: 12px;
  }
}

.edit-table input:focus,
.edit-table textarea:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.1);
}

.edit-table .delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s;
  white-space: nowrap;
}

.edit-table .delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--red);
}

/* ===== グラム数ステッパーUI（dashboard） ===== */

.grams-stepper {
  display: flex;
  align-items: center;
  gap: 1px;
  justify-content: center;
}

.grams-stepper-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.grams-stepper-btn:active {
  transform: scale(0.9);
  background: rgba(34, 211, 238, 0.2);
}

.grams-stepper-value {
  min-width: 36px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  padding: 4px 1px;
  border-radius: 6px;
  transition: background 0.15s;
  line-height: 1.2;
}

.grams-stepper-value:hover {
  background: rgba(34, 211, 238, 0.1);
  color: var(--acc);
}

@media (max-width:768px) {
  .grams-stepper-btn {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }

  .grams-stepper-value {
    min-width: 38px;
    font-size: 13px;
    padding: 4px 1px;
  }
}

/* ===== グラム数編集モーダル（dashboard） ===== */

.grams-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: gramsModalFadeIn 0.2s ease-out;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

@keyframes gramsModalFadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

.grams-modal-sheet {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 0 0 env(safe-area-inset-bottom, 16px) 0;
  animation: gramsSheetSlideUp 0.25s ease-out;
  max-height: 85vh;
  overflow-y: auto;
}

@keyframes gramsSheetSlideUp {
  from {
    transform: translateY(100%)
  }

  to {
    transform: translateY(0)
  }
}

.grams-modal-handle {
  width: 40px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  margin: 10px auto 6px;
}

.grams-modal-header {
  padding: 8px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.grams-modal-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grams-modal-sub {
  font-size: 12px;
  color: var(--muted);
}

.grams-modal-body {
  padding: 16px 20px 20px;
}

.grams-modal-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.grams-modal-stepper-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.grams-modal-stepper-btn:active {
  transform: scale(0.92);
  background: rgba(34, 211, 238, 0.25);
  border-color: var(--acc);
}

.grams-modal-stepper-display {
  text-align: center;
  min-width: 100px;
}

.grams-modal-stepper-display .grams-big {
  font-size: 40px;
  font-weight: 800;
  color: var(--acc);
  line-height: 1;
}

.grams-modal-stepper-display .grams-unit {
  font-size: 18px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 2px;
}

.grams-modal-stepper-display .grams-kcal {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.grams-step-selector {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.grams-step-btn {
  padding: 5px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.grams-step-btn.active {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--acc);
  color: var(--acc);
}

.grams-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.grams-preset-chip {
  padding: 10px 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.grams-preset-chip:hover,
.grams-preset-chip:active {
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.1);
  color: var(--acc);
}

.grams-preset-chip.selected {
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.15);
  color: var(--acc);
}

.grams-direct-input {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.grams-direct-input input {
  flex: 1;
  padding: 12px 14px;
  font-size: 20px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: var(--fg);
  text-align: center;
  box-sizing: border-box;
}

.grams-direct-input input:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.grams-direct-input .grams-input-unit {
  font-size: 16px;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

.grams-modal-confirm {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--acc), #06b6d4);
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.grams-modal-confirm:active {
  transform: scale(0.98);
}

[data-theme="light"] .grams-stepper-btn {
  border-color: rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .grams-stepper-btn:active {
  background: rgba(255, 136, 0, 0.15);
}

[data-theme="light"] .grams-stepper-value:hover {
  background: rgba(255, 136, 0, 0.08);
  color: #ff8800;
}

[data-theme="light"] .grams-modal-sheet {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .grams-modal-stepper-btn {
  border-color: rgba(0, 0, 0, 0.15);
  background: #f8f9fa;
}

[data-theme="light"] .grams-modal-stepper-btn:active {
  background: rgba(255, 136, 0, 0.15);
  border-color: #ff8800;
}

[data-theme="light"] .grams-step-btn.active {
  background: rgba(255, 136, 0, 0.1);
  border-color: #ff8800;
  color: #ff8800;
}

[data-theme="light"] .grams-preset-chip:hover,
[data-theme="light"] .grams-preset-chip.selected {
  border-color: #ff8800;
  background: rgba(255, 136, 0, 0.08);
  color: #ff8800;
}

[data-theme="light"] .grams-modal-confirm {
  background: linear-gradient(135deg, #ff8800, #ff6600);
  color: #fff;
}

.dish-name-input {
  width: 100%;
  padding: 10px;
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--fg);
  font-size: 14px;
  box-sizing: border-box;
  margin-bottom: 8px;
}

.dish-name-input:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.1);
}

.add-ingredient-btn {
  background: var(--green);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.add-ingredient-btn:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

/* ======= 食材追加モーダル ======= */

.add-ingredient-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.add-ingredient-modal {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: addModalFadeIn 0.2s ease-out;
}

@keyframes addModalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.add-ingredient-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.add-ingredient-header h3 {
  margin: 0;
  color: var(--acc);
  font-size: 18px;
}

.add-ingredient-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.add-ingredient-close:hover {
  color: var(--fg);
}

.add-ingredient-body {
  padding: 24px;
}

.add-ingredient-field {
  margin-bottom: 20px;
}

.add-ingredient-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.add-ingredient-field input[type="text"],
.add-ingredient-field input[type="number"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--fg);
  box-sizing: border-box;
  transition: all 0.2s;
}

.add-ingredient-field input:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

.grams-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.grams-presets button {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.grams-presets button:hover {
  background: rgba(34, 211, 238, 0.15);
  border-color: var(--acc);
  color: var(--acc);
}

.add-ingredient-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.add-ingredient-cancel {
  flex: 1;
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--muted) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.add-ingredient-submit {
  flex: 2;
  background: linear-gradient(135deg, #06b6d4, #22d3ee) !important;
  color: #0f172a !important;
}

.save-changes-btn {
  background: var(--acc);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-top: 16px;
}

.save-changes-btn:hover {
  background: #06b6d4;
  transform: translateY(-1px);
}

.nutrition-detail-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  margin-top: 8px;
}

.nutrition-detail-table th,
.nutrition-detail-table td {
  padding: 6px;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nutrition-detail-table th {
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
}

.nutrition-detail-table td {
  color: var(--fg);
  font-weight: 500;
}

.nutrition-detail-table th:first-child,
.nutrition-detail-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--acc);
}

.modal-body {
  padding: 20px;
}

.modal-image {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.3);
}

.modal-section {
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  position: relative;
}

.modal-section+.modal-section {
  margin-top: 4px;
}

.modal-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  letter-spacing: 0.02em;
}

.modal-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.modal-info-item {
  background: var(--pill);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-info-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.modal-info-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--acc);
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-tag {
  background: rgba(34, 211, 238, 0.1);
  color: var(--acc);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 14px;
  border: 1px solid rgba(34, 211, 238, 0.2);
}

/* レスポンシブ対応 */

@media (max-width: 768px) {
  /* ★ 共通レスポンシブ (nav, body) は style.css に移動 */

  /* ★ .container は style.css のデフォルト (16px) を使用 */

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .record-item {
    flex-direction: row;
    text-align: left;
    padding: 10px;
    margin-bottom: 6px;
    gap: 10px;
  }

  .record-image {
    width: 60px;
    height: 60px;
  }

  .record-images-wrap {
    flex-shrink: 0;
  }

  .record-sub-thumbs {
    justify-content: center;
    margin-top: 6px;
  }

  .record-sub-thumb {
    width: 32px;
    height: 32px;
  }

  .modal-content {
    max-width: 100%;
    margin: 0;
    border-radius: 12px;
  }

  .modal-title {
    font-size: 20px;
  }

  .modal-info-grid {
    grid-template-columns: 1fr;
  }

  .edit-table {
    font-size: 11px;
  }

  .edit-table th,
  .edit-table td {
    padding: 6px 4px;
  }

  .edit-table input {
    font-size: 12px;
    padding: 4px;
  }

  /* モバイルでP/F/C列を非表示 */
  .edit-table .col-pfc {
    display: none;
  }

  .nutrition-detail-table {
    font-size: 10px;
  }

  .nutrition-detail-table th,
  .nutrition-detail-table td {
    padding: 4px 2px;
  }

  .modal-edit-btn {
    font-size: 12px;
    padding: 6px 12px;
  }

  .chart-tab {
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* ===== 栄養値編集モーダル フィールド ===== */

.nutr-group-label {
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nutr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.nutr-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nutr-label {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.nutr-unit {
  font-size: 9px;
  color: var(--muted);
  opacity: 0.7;
}

.nutr-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--fg);
  box-sizing: border-box;
}

.nutr-input:focus {
  outline: none;
  border-color: var(--acc);
  background: rgba(34, 211, 238, 0.06);
}

@media (max-width: 420px) {
  .nutr-grid {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }

  .nutr-input {
    padding: 5px 6px;
    font-size: 13px;
  }

  .nutr-label {
    font-size: 10px;
  }

  .nutr-group-label {
    font-size: 10px;
    margin-top: 8px;
    margin-bottom: 4px;
  }

  .grams-modal-body {
    padding: 10px 10px 14px;
  }
}

@media (max-width: 340px) {
  .nutr-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* ===== iPhone SE / 小画面 (375px) 用コンパクトモード ===== */

@media (max-width: 420px) {
  .container {
    padding: 2px 4px !important;
  }

  .modal-content {
    padding: 8px !important;
  }

  .edit-table th,
  .edit-table td {
    padding: 3px 2px;
    font-size: 11px;
  }

  .edit-table th {
    font-size: 10px;
  }

  .badge {
    padding: 1px 4px;
    font-size: 9px;
    margin-right: 2px;
  }

  .grams-stepper {
    gap: 0;
  }

  .grams-stepper-btn {
    width: 24px;
    height: 24px;
    font-size: 13px;
  }

  .grams-stepper-value {
    min-width: 30px;
    font-size: 12px;
    padding: 2px 0;
  }

  .edit-table .ing-name-display {
    font-size: 11px;
    padding: 2px 3px;
  }

  .edit-table .ing-name-display::after {
    content: '';
  }

  .edit-table .delete-btn {
    padding: 3px 5px;
    font-size: 10px;
  }
}

/* ★ 共通バッジスタイルは style.css に移動 */

/* ===== Calendar ===== */

.calendar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.cal-month {
  font-size: 18px;
  font-weight: 700;
  color: var(--acc);
  min-width: 140px;
  text-align: center;
}

[data-theme="light"] .cal-month {
  color: #ff8800;
}

.cal-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.cal-date-input {
  background: var(--pill);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 14px;
}

.cal-nav-btn {
  background: var(--pill);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all .2s;
}

.cal-nav-btn:hover {
  background: #374151;
  border-color: rgba(255, 255, 255, 0.2);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  user-select: none;
}

.cal-weekday,
.cal-day {
  text-align: center;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 12px;
}

.cal-weekday {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.cal-day {
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 64px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
}

.cal-day.muted {
  opacity: .4;
}

.cal-day.today {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

.cal-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--acc);
  box-shadow: 0 0 8px rgba(34, 211, 238, .5);
}

[data-theme="light"] .cal-dot {
  background: #ff8800;
  box-shadow: 0 0 6px rgba(255, 136, 0, 0.6);
}

.cal-count {
  font-size: 11px;
  color: var(--muted);
}

.cal-day.clickable {
  cursor: pointer;
  transition: transform .1s;
}

.cal-day.clickable:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.2);
}

.cal-hint {
  color: var(--muted);
  margin-top: 8px;
  font-size: 12px;
}

.cal-hint .cal-hint-dot {
  color: var(--acc);
  font-size: 14px;
}

[data-theme="light"] .cal-hint .cal-hint-dot {
  color: #ff8800;
}

/* ===== Horizontal Gallery ===== */

.gallery-wrap {
  position: relative;
}

.gallery-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 40px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.gallery-strip::-webkit-scrollbar {
  height: 8px;
}

.gallery-strip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}

.gallery-item {
  min-width: 200px;
  max-width: 200px;
  flex: 0 0 auto;
  scroll-snap-align: start;
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
}

.gallery-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: #0002;
}

.gallery-meta {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.gallery-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: var(--pill);
  color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#galPrev {
  left: 4px;
}

#galNext {
  right: 4px;
}

.gallery-arrow:hover {
  background: #374151;
  border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width:768px) {
  .gallery-item {
    min-width: 160px;
    max-width: 160px;
  }

  .gallery-thumb {
    height: 120px;
  }
}

/* === Compact Calendar === */

#calendarCard .calendar-header {
  gap: 8px;
  margin-bottom: 8px;
}

#calendarCard .cal-month {
  font-size: 16px;
  min-width: auto;
}

#calendarCard .cal-actions {
  gap: 6px;
}

#calendarCard .cal-nav-btn {
  padding: 4px 8px;
  border-radius: 6px;
}

#calendarCard .cal-date-input {
  padding: 4px 6px;
  font-size: 13px;
}

#calendarCard .calendar-grid {
  gap: 4px;
}

#calendarCard .cal-weekday,
#calendarCard .cal-day {
  font-size: 11px;
  padding: 6px 0;
}

#calendarCard .cal-day {
  min-height: 44px;
}

#calendarCard .cal-count {
  font-size: 10px;
}

#calendarCard .cal-hint {
  font-size: 11px;
}

/* モバイルでもさらにギュッと */

@media (max-width: 768px) {

  #calendarCard .cal-weekday,
  #calendarCard .cal-day {
    font-size: 10px;
    padding: 4px 0;
  }

  #calendarCard .cal-day {
    min-height: 36px;
  }
}

/* === Modal Prev/Next arrows === */

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
}

.modal-nav:hover {
  background: #374151;
}

.modal-nav.prev {
  left: 8px;
}

.modal-nav.next {
  right: 8px;
}

/* === Modal Prev/Next arrows: viewport に固定 === */

.modal-nav {
  position: fixed;
  /* ← fixed に変更（viewport基準） */
  top: var(--modal-nav-top, 58%);
  /* 中央より少し下（調整したければ % を変えてOK） */
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2100;
  /* コンテンツより前に出す */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.modal-nav:hover {
  background: #374151;
}

.modal-nav.prev {
  left: calc(env(safe-area-inset-left, 0px) + 12px);
}

.modal-nav.next {
  right: calc(env(safe-area-inset-right, 0px) + 12px);
}

/* 端に来たら無効表示 */

.modal-nav[disabled] {
  opacity: .35;
  pointer-events: none;
}

/* モバイルは少し下げる＆小さく */

@media (max-width: 768px) {
  .modal-nav {
    top: var(--modal-nav-top, 62%);
    width: 42px;
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #detailModal .modal-content {
    transition: none !important;
    animation: none !important;
  }
}

/* --- Calendar buttons: compact on mobile --- */

@media (max-width: 768px) {

  /* 配置も詰める */
  #calendarCard .calendar-header {
    gap: 6px;
  }

  #calendarCard .cal-actions {
    gap: 6px;
  }

  /* ナビ矢印を小さく */
  #calendarCard .cal-nav-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1;
  }

  /* 今日／解除ボタン（btn-smが大きかった場合の上書き） */
  #calendarCard .btn {
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.1;
    border-radius: 6px;
    height: 34px;
  }

  #calendarCard .btn.btn-sm {
    padding: 6px 8px;
    font-size: 12px;
    height: 30px;
  }

  /* 日付ピッカーも小さく */
  #calendarCard .cal-date-input {
    padding: 4px 6px;
    font-size: 12px;
    height: 30px;
    border-radius: 6px;
  }
}

@media (max-width: 480px) {

  /* さらにコンパクト（スマホ狭幅） */
  #calendarCard .calendar-header {
    gap: 4px;
  }

  #calendarCard .cal-month {
    font-size: 14px;
  }

  #calendarCard .cal-nav-btn {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  #calendarCard .btn {
    padding: 6px 8px;
    font-size: 12px;
    height: 30px;
  }

  #calendarCard .btn.btn-sm {
    padding: 4px 6px;
    font-size: 11.5px;
    height: 28px;
  }

  #calendarCard .cal-date-input {
    padding: 3px 6px;
    font-size: 12px;
    height: 28px;
  }

  /* ボタン群を折返してもきれいに並ぶように */
  #calendarCard .cal-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* ===== Stats cards: compact on mobile ===== */

@media (max-width: 768px) {

  /* 2列にしてギュッと */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
    border-radius: 10px;
  }

  .stat-icon {
    font-size: 22px;
    margin-bottom: 6px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 12px;
  }
}

/* 超狭幅（～480px）は2列コンパクトグリッドに */

@media (max-width: 480px) {
  .stats-grid {
    /* 2列グリッド（省スペース） */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 0;
  }

  .stat-card {
    /* コンパクトに */
    padding: 10px 8px;
    min-width: unset;
  }

  /* アイコンは小さく表示 */
  .stat-icon {
    display: block;
    font-size: 18px;
    margin-bottom: 4px;
  }

  .stat-value {
    font-size: 18px;
    margin-bottom: 2px;
  }

  .stat-label {
    font-size: 10px;
    line-height: 1.3;
  }
}

/* ===== Modal action buttons & section header (mobile) ===== */

@media (max-width: 768px) {
  .modal-header {
    padding: 12px;
  }

  .modal-title {
    font-size: 18px;
  }

  .modal-edit-btn,
  .modal-delete-btn {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    line-height: 1.1;
  }

  .modal-close {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .modal-header>div {
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .modal-header {
    padding: 10px;
  }

  .modal-title {
    font-size: 16px;
  }

  .modal-edit-btn,
  .modal-delete-btn {
    padding: 5px 8px;
    font-size: 11.5px;
  }

  .modal-close {
    width: 34px;
    height: 34px;
    font-size: 17px;
  }
}

/* 認識した食材のタイトル行＋編集ボタン */

.modal-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 12px;
}

.modal-section-header .modal-section-title {
  margin: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.modal-section-header .modal-edit-btn {
  margin: 0;
  flex-shrink: 0;
}

/* === Records view toggle (List/Grid) === */

.records-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.view-toggle {
  background: var(--pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--fg);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
}

.view-toggle.active {
  border-color: var(--acc);
  color: var(--acc);
  background: rgba(34, 211, 238, .1);
}

#recentRecords.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

#recentRecords.view-grid .record-item {
  flex-direction: column;
  align-items: stretch;
  margin: 0;
  padding: 0;
}

#recentRecords.view-grid .record-image {
  width: 100%;
  height: 160px;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

#recentRecords.view-grid .record-content {
  padding: 12px
}

#recentRecords.view-grid .record-meta {
  margin: 4px 0 8px
}

#recentRecords.view-grid .record-nutrition {
  gap: 8px
}

@media (max-width:768px) {
  #recentRecords.view-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  #recentRecords.view-grid .record-image {
    height: 120px;
  }
}

/* ========== アドバイスセクション ========== */

.advice-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.advice-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.advice-toggle-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}

.advice-toggle-icon {
  font-size: 14px;
  color: var(--muted);
  transition: transform 0.3s;
}

.advice-toggle-icon.open {
  transform: rotate(90deg);
}

.advice-body {
  padding: 0 16px 16px;
}

.advice-block {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.advice-block-header {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--cyan);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(34, 211, 238, 0.05);
}

.advice-block-content {
  padding: 14px 16px;
}

/* テンプレートサマリー */

.advice-praise {
  color: var(--green);
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.6;
}

.advice-improvement {
  color: var(--yellow, #fbbf24);
  padding: 6px 0;
  font-size: 14px;
  line-height: 1.6;
}

.advice-summary-msg {
  color: var(--muted);
  font-size: 13px;
  padding: 4px 0;
}

.advice-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.advice-stat-item {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.advice-stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.advice-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}

/* AIボタン */

.advice-ai-btn {
  width: 100%;
  padding: 14px 20px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s;
}

.advice-ai-btn:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
  transform: translateY(-1px);
}

.advice-ai-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.advice-ai-btn .ai-btn-icon {
  font-size: 20px;
}

.advice-ai-btn.loading .ai-btn-icon {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* AI結果 */

.ai-result {
  line-height: 1.7;
  font-size: 14px;
  color: var(--fg);
}

.ai-result h4 {
  color: var(--cyan);
  margin: 14px 0 6px;
  font-size: 15px;
}

.ai-result ul {
  padding-left: 20px;
  margin: 6px 0;
}

.ai-result li {
  margin-bottom: 4px;
}

.ai-cache-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.2);
  color: var(--green);
  margin-bottom: 8px;
}

.loading-small {
  text-align: center;
  color: var(--muted);
  padding: 10px;
  font-size: 13px;
}

.advice-no-data {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 12px;
}

/* ========== 新機能: アコーディオンセクション ========== */

/* 食べた割合スライダー */

/* ドリンクリスト */

/* 乳製品アンケート */

.plant-based-choice {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.plant-based-choice button {
  flex: 1;
  min-width: 80px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.plant-based-choice button.selected {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.plant-based-choice button:hover {
  border-color: rgba(34, 197, 94, 0.3);
}

.usage-reasons-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

/* 砂糖 +/- ボタン */

@media (max-width: 768px) {
  .sugar-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .sugar-value {
    min-width: 35px;
    font-size: 13px;
  }
}

/* 浮動保存ボタン */

.floating-save-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 2200;
  background: linear-gradient(135deg, var(--acc), #06b6d4);
  color: #0f172a;
  border: none;
  border-radius: 50px;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.4);
  transition: all 0.3s;
  display: none;
  align-items: center;
  gap: 8px;
}

.floating-save-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(34, 211, 238, 0.6);
  background: linear-gradient(135deg, #06b6d4, var(--acc));
}

.floating-save-btn:active {
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .floating-save-btn {
    bottom: 20px;
    right: 20px;
    padding: 14px 24px;
    font-size: 14px;
  }

  /* 砂糖入力欄をモバイルで縦並びに */
  .sugar-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
}

/* ==================================================
   ライトモード包括的オーバーライド
   シアン(34,211,238) → オレンジ(255,136,0)に統一
================================================== */

[data-theme="light"] .nutrition-pill {
  background: rgba(255, 136, 0, 0.1);
  border-color: rgba(255, 136, 0, 0.25);
}

[data-theme="light"] .view-toggle.active {
  background: rgba(255, 136, 0, 0.12);
}

[data-theme="light"] .stat-card {
  background: #ffffff;
  border: 1px solid rgba(255, 136, 0, 0.2);
}

[data-theme="light"] .stats-toggle-tabs {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .stats-toggle-tab {
  color: #9ca3af;
}

[data-theme="light"] .stats-toggle-tab.active {
  color: #0369a1;
  border-bottom-color: #0369a1;
}

[data-theme="light"] .nh-item {
  background: #f8f9fa;
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .nh-item-bar {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .chart-main-tabs {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .chart-main-tab {
  color: #6b7280;
}

[data-theme="light"] .chart-main-tab:hover {
  color: #111827;
}

[data-theme="light"] .chart-main-tab.active {
  color: #0369a1;
  border-bottom-color: #0369a1;
}

[data-theme="light"] .pfc-goal-btn {
  background: #f1f5f9;
  border-color: rgba(0, 0, 0, 0.1);
  color: #6b7280;
}

[data-theme="light"] .pfc-goal-btn.active {
  background: rgba(3, 105, 161, 0.1);
  border-color: #0369a1;
  color: #0369a1;
}

[data-theme="light"] .pfc-compare-bar-track {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .pfc-compare-target-marker {
  background: #1e293b;
}

[data-theme="light"] .pfc-guide-item {
  background: #f8f9fa;
}

[data-theme="light"] .record-image:hover {
  box-shadow: 0 4px 12px rgba(255, 136, 0, 0.3);
}

/* アコーディオン - 全て同じライムグリーンで統一 */

[data-theme="light"] .edit-table th {
  background: linear-gradient(135deg, rgba(159, 255, 0, 0.2), rgba(184, 255, 66, 0.12));
  border-bottom-color: rgba(159, 255, 0, 0.4);
  color: var(--fg);
}

[data-theme="light"] .edit-field {
  background: rgba(255, 136, 0, 0.06);
  border-color: rgba(255, 136, 0, 0.2);
}

[data-theme="light"] .survey-header {
  border-color: rgba(159, 255, 0, 0.5);
  background: linear-gradient(135deg, rgba(159, 255, 0, 0.25), rgba(184, 255, 66, 0.2));
}

/* ========== 料理修正オーバーレイ（dashboard用） ========== */

.modal-photo-container {
  position: relative;
  cursor: pointer;
  margin-bottom: 20px;
}

.modal-photo-container .photo-tap-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.modal-dish-correct-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInOverlay 0.25s ease;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-dish-correct-content {
  background: var(--card);
  border-radius: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.6);
}

.modal-dish-correct-header {
  padding: 20px 20px 10px;
  text-align: center;
}

.modal-dish-correct-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 2px;
}

.modal-dish-correct-subtitle {
  font-size: 11px;
  color: var(--muted);
}

.modal-dish-photo-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 16px 4px;
  overflow-x: auto;
  align-items: center;
}

.modal-dish-photo-tabs .photo-tab {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.15);
  opacity: 0.6;
  transition: all 0.2s;
  flex-shrink: 0;
}

.modal-dish-photo-tabs .photo-tab:hover {
  opacity: 0.85;
  border-color: rgba(255, 255, 255, 0.4);
}

.modal-dish-photo-tabs .photo-tab.active {
  opacity: 1;
  border-color: var(--acc);
  box-shadow: 0 0 8px rgba(0, 230, 200, 0.3);
}

.modal-dish-photo-tabs .photo-tab-label {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin-top: 2px;
}

.modal-dish-correct-photo {
  padding: 8px 16px;
  position: relative;
}

.modal-dish-correct-photo img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: block;
}

.modal-photo-labels-overlay {
  position: absolute;
  border-radius: 12px;
  pointer-events: none;
}

.modal-photo-labels-overlay.mode-bar {
  left: 16px;
  right: 16px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7) 30%);
  border-radius: 0 0 12px 12px;
}

.modal-photo-labels-overlay.mode-bbox {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.modal-photo-labels-overlay.mode-bbox .modal-photo-label {
  position: absolute;
  transform: translate(-50%, -50%);
}

.modal-photo-label {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  white-space: nowrap;
  z-index: 2;
}

.modal-photo-label:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, 0.5);
}

.modal-photo-label .label-minus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: white;
  flex-shrink: 0;
}

.modal-photo-label.marked-delete {
  background: rgba(239, 68, 68, 0.6);
  border-color: rgba(239, 68, 68, 0.8);
  text-decoration: line-through;
}

.modal-photo-label.marked-delete .label-minus {
  background: rgba(255, 255, 255, 0.3);
  color: #fecaca;
}

.modal-dish-card-list {
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-dish-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: all 0.2s;
}

.modal-dish-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.modal-dish-card.marked-delete {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  opacity: 0.6;
}

.modal-dish-card.marked-delete .modal-dish-card-name {
  text-decoration: line-through;
  color: var(--muted);
}

.modal-dish-card-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.modal-dish-card-info {
  flex: 1;
  min-width: 0;
}

.modal-dish-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-dish-card-meta {
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
}

.modal-dish-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.modal-dish-action-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
}

.modal-dish-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.modal-dish-action-btn.action-rename:hover {
  background: rgba(34, 211, 238, 0.15);
  color: #22d3ee;
}

.modal-dish-action-btn.action-delete {
  color: #f87171;
}

.modal-dish-action-btn.action-delete:hover {
  background: rgba(239, 68, 68, 0.15);
}

.modal-dish-action-btn.action-delete.active {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4);
}

.modal-dish-card-edit-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(34, 211, 238, 0.06);
  border: 1.5px solid rgba(34, 211, 238, 0.4);
  border-radius: 6px;
  color: var(--fg);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}

.modal-dish-card-edit-input:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.15);
}

.modal-dish-correct-delete-info {
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.08);
  margin: 4px 16px;
  border-radius: 8px;
}

.modal-dish-correct-footer {
  display: flex;
  gap: 10px;
  padding: 12px 20px 20px;
}

.modal-dish-correct-close-btn {
  flex: 1;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-dish-correct-close-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.modal-dish-correct-delete-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-dish-correct-delete-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.modal-dish-correct-delete-btn:not(:disabled):hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* --- next block --- */

/* シェアモーダル */

.share-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.share-modal-overlay.active {
  display: flex;
}

.share-modal {
  background: var(--card, #1a1b2e);
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: shareModalIn 0.3s ease;
}

@keyframes shareModalIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.share-modal-header h3 {
  margin: 0;
  font-size: 17px;
}

.share-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.share-modal-body {
  padding: 16px 20px;
}

/* トグルスイッチ */

.share-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.share-option:last-child {
  border-bottom: none;
}

.share-option-label {
  font-size: 14px;
  color: var(--text);
}

.share-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.share-toggle input {
  display: none;
}

.share-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  transition: background 0.25s;
}

.share-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s;
}

.share-toggle input:checked+.share-toggle-slider {
  background: var(--acc, #22d3ee);
}

.share-toggle input:checked+.share-toggle-slider::after {
  transform: translateX(20px);
}

/* プレビューエリア */

.share-preview-area {
  margin-top: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 8px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}

.share-preview-area img {
  max-width: 100%;
  border-radius: 8px;
}

.share-preview-placeholder {
  text-align: center;
  padding: 30px;
  color: var(--muted);
  font-size: 13px;
}

/* アクションボタン */

.share-actions {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.share-action-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.share-action-btn.primary {
  background: var(--acc, #22d3ee);
  color: #0a0a1a;
}

.share-action-btn.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.share-action-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.share-action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.share-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 共有カード（生成用、非表示） */

.share-card-render {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 420px;
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
}

.share-card {
  background: linear-gradient(145deg, #0f1128, #1a1b3e);
  color: #e8e8f0;
  padding: 24px;
  border-radius: 16px;
}

.share-card-header {
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.share-card-header .share-date {
  font-size: 13px;
  color: #8b8fa3;
  margin-bottom: 4px;
}

.share-card-header .share-title {
  font-size: 18px;
  font-weight: 700;
}

.share-card-meal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.share-card-meal:last-child {
  border-bottom: none;
}

.share-card-meal-icon {
  font-size: 20px;
  width: 28px;
  text-align: center;
}

.share-card-meal-photo {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
}

.share-card-meal-info {
  flex: 1;
}

.share-card-meal-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.share-card-meal-kcal {
  font-size: 13px;
  color: #8b8fa3;
}

.share-card-total {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px solid rgba(34, 211, 238, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.share-card-total-label {
  font-size: 13px;
  color: #8b8fa3;
}

.share-card-total-value {
  font-size: 24px;
  font-weight: 700;
  color: #22d3ee;
}

.share-card-pfc {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.share-card-pfc-item {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.share-card-pfc-item .pfc-label {
  font-size: 10px;
  color: #8b8fa3;
  margin-bottom: 2px;
}

.share-card-pfc-item .pfc-value {
  font-size: 14px;
  font-weight: 600;
}

.share-card-pfc-item.p .pfc-value {
  color: #f472b6;
}

.share-card-pfc-item.f .pfc-value {
  color: #fbbf24;
}

.share-card-pfc-item.c .pfc-value {
  color: #34d399;
}

.share-card-detail-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.share-card-detail-item {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  font-size: 11px;
  color: #8b8fa3;
}

.share-card-watermark {
  text-align: center;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: #555;
  letter-spacing: 0.5px;
}

/* 今日共有ボタン */

.share-today-btn {
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: var(--acc, #22d3ee);
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.share-today-btn:hover {
  background: rgba(34, 211, 238, 0.2);
  transform: translateY(-1px);
}

/* ライトモード対応 */

[data-theme="light"] .share-modal {
  background: #fff;
}

[data-theme="light"] .share-modal-header {
  border-bottom-color: #e5e7eb;
}

[data-theme="light"] .share-modal-close {
  color: #999;
}

[data-theme="light"] .share-option {
  border-bottom-color: #f0f0f0;
}

[data-theme="light"] .share-toggle-slider {
  background: #d1d5db;
}

[data-theme="light"] .share-preview-area {
  border-color: #e5e7eb;
}

[data-theme="light"] .share-actions {
  border-top-color: #e5e7eb;
}

[data-theme="light"] .share-action-btn.secondary {
  background: #f3f4f6;
  color: #333;
}

[data-theme="light"] .share-today-btn {
  background: rgba(0, 136, 255, 0.08);
  border-color: rgba(0, 136, 255, 0.2);
  color: #0088ff;
}