/* ============================
   Rebuilders — monochrome journal UI
   ============================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #ffffff;
  --bg2: #ffffff;
  --bg3: #f4f4f5;
  --bg4: #e4e4e7;
  --card: #ffffff;
  --card2: #fafafa;
  --border: rgba(24, 24, 27, 0.11);
  --border-strong: rgba(24, 24, 27, 0.2);
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --accent: #18181b;
  --accent2: #27272a;
  --accent-soft: #f4f4f5;
  --accent-glow: rgba(24, 24, 27, 0.1);
  --green: #52525b;
  --green-dim: #f4f4f5;
  --orange: #52525b;
  --orange-dim: #f4f4f5;
  --pink: #52525b;
  --pink-dim: #f4f4f5;
  --blue: #52525b;
  --blue-dim: #f4f4f5;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: none;
  --shadow-sm: none;
  /* 외부 폰트 요청 없음 */
  --font: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR',
    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --transition: 0.18s ease;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html,
body {
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  color: var(--text-primary);
  overflow: hidden;
}

.phone-frame {
  width: 100%;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: var(--safe-top);
}

/* Status */
.status-bar {
  display: none;
}

.status-time {
  font-size: 14px;
  font-weight: 700;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.7;
}

/* Content */
.app-content,
.view-panel {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: max(16px, var(--safe-right));
  padding-left: max(16px, var(--safe-left));
  scroll-behavior: smooth;
  min-height: 0;
}

.app-content::-webkit-scrollbar,
.view-panel::-webkit-scrollbar {
  display: none;
}

.view-panel[hidden] {
  display: none !important;
}

.content-end-spacer {
  height: 24px;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 2px 12px;
}

.home-brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: var(--text-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.home-brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

/* ============================
   STATS · CALENDAR
   ============================ */
.stats-page-head {
  padding: 16px 2px 12px;
}

.profile-page-head {
  position: relative;
  padding-right: 48px;
}

.profile-close {
  position: absolute;
  top: 14px;
  right: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #18181b;
  font: 500 22px/1 var(--font);
  cursor: pointer;
}

.stats-page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.stats-page-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.cal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px 12px 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.cal-month-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.cal-month-label {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
  text-align: center;
}

.cal-weekdays span {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
}

.cal-weekdays span:first-child,
.cal-weekdays span:last-child {
  color: var(--text-muted);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 42px;
  padding: 4px 0 6px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-family: var(--font);
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.cal-day:hover {
  background: var(--bg3);
}

.cal-day-num {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.cal-day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
}

.cal-day.has-log .cal-day-dot {
  background: var(--accent);
}

/* 목표 대비 배경색 */
.cal-day.level-under {
  background: var(--bg3);
}

.cal-day.level-under .cal-day-dot {
  background: var(--text-primary);
}

.cal-day.level-ok {
  background: var(--bg3);
}

.cal-day.level-ok .cal-day-dot {
  background: var(--text-primary);
}

.cal-day.level-over {
  background: var(--bg3);
}

.cal-day.level-over .cal-day-dot {
  background: var(--text-primary);
}

.cal-day.is-outside {
  color: #c4bbb0;
}

.cal-day.is-outside.level-under,
.cal-day.is-outside.level-ok,
.cal-day.is-outside.level-over {
  opacity: 0.55;
}

.cal-day.is-today .cal-day-num {
  color: var(--accent2);
  font-weight: 800;
}

.cal-day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1.5px var(--text-primary);
}

.cal-day.is-selected {
  box-shadow: inset 0 0 0 2px var(--text-primary);
  transform: scale(1.02);
}

.cal-day.is-selected .cal-day-num {
  color: var(--accent2);
  font-weight: 800;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  justify-content: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.cal-legend-item .dot,
.cal-legend-item .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.cal-legend-item .dot {
  border-radius: 50%;
}

.cal-legend-item .swatch.level-under,
.cal-legend-item .swatch.level-ok,
.cal-legend-item .swatch.level-over {
  background: var(--text-muted);
}

.cal-legend-item .dot.is-today {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--accent);
}

.stats-day-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.stats-day-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.stats-day-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.stats-day-date {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.stats-day-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 750;
}

.stats-day-badge[hidden] {
  display: none !important;
}

.stats-day-badge.level-under {
  background: var(--bg3);
  color: var(--text-secondary);
}

.stats-day-badge.level-ok {
  background: var(--accent-soft);
  color: var(--accent2);
}

.stats-day-badge.level-over {
  background: var(--bg3);
  color: var(--text-secondary);
}

.stats-open-day-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 750;
  font-family: var(--font);
  cursor: pointer;
}

.stats-open-day-btn:hover {
  background: var(--bg4);
}

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

.stats-metric {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-metric-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.stats-metric-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stats-day-empty {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 4px 2px 0;
}

/* 최근 7일 차트 */
.stats-week-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

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

.stats-week-head .stats-section-title {
  margin-bottom: 0;
}

.stats-week-hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.week-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
  min-height: 140px;
}

.week-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  padding: 0;
  font-family: var(--font);
  cursor: pointer;
  min-width: 0;
}

.week-bar-track {
  position: relative;
  width: 100%;
  height: 100px;
  background: var(--bg3);
  border-radius: 10px 10px 6px 6px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border: 1px solid var(--border);
}

.week-bar {
  width: 58%;
  min-height: 0;
  border-radius: 6px 6px 3px 3px;
  background: var(--text-primary);
  transition: height 0.35s ease;
}

.week-col.level-under .week-bar {
  background: var(--text-primary);
}

.week-col.level-ok .week-bar {
  background: var(--text-primary);
}

.week-col.level-over .week-bar {
  background: var(--text-primary);
}

.week-col.is-empty .week-bar {
  height: 0 !important;
}

.week-target-line {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 0;
  border-top: 1.5px dashed rgba(40, 30, 20, 0.28);
  pointer-events: none;
  z-index: 1;
}

.week-col-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--text-secondary);
}

.week-col-cal {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.week-col.is-selected .week-bar-track {
  box-shadow: inset 0 0 0 1.5px var(--text-primary);
  background: var(--bg3);
}

.week-col.is-selected .week-col-label {
  color: var(--accent2);
}

.stats-month-summary {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.stats-section-title {
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
}

.stats-month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stats-month-item {
  text-align: center;
  padding: 12px 6px;
  background: var(--bg3);
  border-radius: 14px;
  border: 1px solid var(--border);
}

.stats-month-num {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}

.stats-month-cap {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-secondary);
}

.placeholder-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 20px 24px;
  gap: 8px;
}

.placeholder-emoji {
  font-size: 40px;
  margin-bottom: 4px;
}

.placeholder-title {
  font-size: 18px;
  font-weight: 800;
}

.placeholder-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 12px;
}

.placeholder-cta {
  max-width: 220px;
  margin-bottom: 0;
}

/* ============================
   PROFILE PAGE
   ============================ */
.profile-summary-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: var(--text-primary);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.profile-summary-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  min-width: 0;
}

.profile-summary-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.profile-summary-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.profile-summary-value {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.profile-summary-value small {
  font-size: 10px;
  font-weight: 650;
  color: var(--text-muted);
  margin-left: 1px;
}

.profile-form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.profile-settings-form {
  margin: 4px 0 16px;
}

.profile-form-card .settings-save-btn {
  margin-bottom: 0;
}

.profile-save-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
}

.profile-save-hint[hidden] {
  display: none !important;
}

.language-settings-copy {
  display: block;
  margin: 0 0 12px;
}

.language-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.language-option {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg3);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.language-option.active {
  color: var(--accent2);
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

.data-transfer-card {
  margin-top: 12px;
}

.data-transfer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.data-transfer-sub {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
}

.local-data-badge {
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: 99px;
  color: var(--text-secondary);
  background: var(--green-dim);
  font-size: 10px;
  font-weight: 800;
}

.data-action-btn {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg3);
  color: var(--text-primary);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.data-action-btn:hover {
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

.data-action-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.data-export-btn {
  border-color: var(--border);
  background: var(--bg3);
}

.data-action-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent2);
  background: var(--accent-soft);
  font-size: 17px;
  font-weight: 800;
}

.data-export-btn .data-action-icon {
  color: var(--text-secondary);
  background: var(--green-dim);
}

.data-action-btn>span:last-child,
.data-import-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.data-action-btn strong,
.data-import-copy strong {
  font-size: 13px;
  font-weight: 800;
}

.data-action-btn small,
.data-import-copy small {
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-muted);
  font-weight: 600;
}

.data-import-box {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 12px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}

.data-mode-label {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.data-mode-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
}

.import-preview {
  margin-top: 3px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--accent-soft);
}

.import-preview[hidden] {
  display: none !important;
}

.import-preview-title {
  font-size: 13px;
  font-weight: 800;
}

.import-preview-meta {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.import-preview-issues {
  margin: 8px 0 0 17px;
  font-size: 10px;
  line-height: 1.45;
  color: #9a3412;
}

.import-preview-issues:empty {
  display: none;
}

.import-preview-actions {
  display: grid;
  grid-template-columns: 1.45fr 0.75fr;
  gap: 7px;
  margin-top: 11px;
}

.import-preview-actions .settings-save-btn,
.import-preview-actions .modal-close-btn {
  min-height: 42px;
  margin: 0;
  padding: 9px 7px;
  font-size: 12px;
}

.data-transfer-note {
  margin-top: 11px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--text-muted);
  text-align: center;
}

.data-transfer-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

/* Top bar */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 4px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: var(--text-primary);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.15;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.profile-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  padding: 8px 12px;
  min-width: 108px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  font-family: var(--font);
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.profile-chip:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.profile-chip-main {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.profile-chip-main small,
.profile-chip-meta small {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 1px;
}

.profile-chip-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}

.profile-chip-meta {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Date */
.date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 10px;
}

.date-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.date-text {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.2px;
}

.date-badge {
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  padding: 3px 8px;
  border-radius: 99px;
}

.date-badge[hidden],
.go-today-btn[hidden] {
  display: none !important;
}

.go-today-btn {
  border: none;
  background: var(--accent-soft);
  color: var(--accent2);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font);
  padding: 4px 10px;
  border-radius: 99px;
  cursor: pointer;
}

.nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

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

.nav-btn:active {
  transform: scale(0.95);
}

/* ============================
   DAY SUMMARY — 칼로리 박스
   ============================ */
.day-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card);
  border: none;
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 0;
  box-shadow: var(--shadow);
}

.summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.main-avatar {
  position: relative;
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  display: grid;
  place-items: end center;
  overflow: visible;
  border: none;
  border-radius: 0;
  background: transparent;
}

.pixel-avatar {
  width: 96px;
  height: 96px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.ring-meter {
  width: 142px;
  height: 142px;
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 142px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-family: var(--font);
  cursor: pointer;
  border-radius: 50%;
}

.ring-meter:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
}

.ring-svg {
  width: 142px;
  height: 142px;
  transform: rotate(-90deg);
  overflow: visible;
}

.ring-bg {
  fill: transparent;
  stroke: var(--bg4);
  stroke-width: 7;
}

.ring-fg {
  fill: none;
  stroke: var(--text-primary);
  stroke-width: 7;
  stroke-linecap: round;
}

.ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0 20px;
  pointer-events: none;
}

.ring-metric-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  order: 2;
}

.ring-metric-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  font-variant-numeric: tabular-nums;
  order: 1;
}

.ring-metric-value strong {
  color: var(--text-primary);
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.6px;
}

.ring-metric-value small {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 650;
}

.health-glance {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}

.health-glance>div {
  min-width: 0;
  padding: 0 5px;
  border-right: 1px solid var(--border);
  text-align: center;
}

.health-glance>div:last-child {
  border-right: 0;
}

.health-glance span,
.health-glance strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-glance span {
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 700;
}

.health-glance strong {
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.macros-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.macro-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 6px;
  align-items: center;
  gap: 6px 4px;
  min-width: 0;
}

.macro-label {
  grid-column: 1;
  grid-row: 1;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  width: auto;
}

.macro-bar-track {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  height: 6px;
  background: var(--bg4);
  border-radius: 99px;
  overflow: hidden;
}

.macro-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.macro-bar.carbs,
.macro-bar.protein,
.macro-bar.fat {
  background: var(--text-primary);
}

.macro-val {
  grid-column: 2;
  grid-row: 1;
  font-size: 10px;
  font-weight: 750;
  color: var(--text-secondary);
  width: auto;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Section */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.section-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.clear-day-btn {
  flex-shrink: 0;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 750;
  font-family: var(--font);
  cursor: pointer;
  transition: color var(--transition), transform var(--transition), opacity var(--transition);
}

.clear-day-btn:hover:not(:disabled) {
  color: var(--text-primary);
}

.clear-day-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.clear-day-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: transparent;
  color: var(--text-muted);
}

.timeline-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timeline-edit-btn,
.timeline-snack-add {
  flex-shrink: 0;
  padding: 6px 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 750;
  font-family: var(--font);
  cursor: pointer;
  transition: color var(--transition), transform var(--transition);
}

.timeline-edit-btn:hover,
.timeline-snack-add:hover {
  color: var(--accent2);
}

.timeline-edit-btn:active {
  transform: scale(0.97);
}

.timeline-edit-btn[aria-pressed="true"] {
  color: var(--accent2);
}

.day-clear-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding: 0 2px;
}

/* Meals timeline — 원·선 같은 축 */
.meals-section {
  --tl-x: 13px;
  /* 타임라인 중심 x */
  --tl-dot: 10px;
  /* 원 지름 */
  --tl-gutter: 30px;
  /* 카드 왼쪽 여백 */
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.app-ready .meals-section {
  opacity: 1;
}

.storage-unavailable {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: var(--bg, #fffaf6);
}

.storage-unavailable[hidden] {
  display: none;
}

.storage-unavailable-card {
  width: min(100%, 420px);
  padding: 32px 26px;
  border: 1px solid rgba(96, 67, 52, 0.12);
  border-radius: 24px;
  background: #fff;
  box-shadow: none;
  text-align: center;
}

.storage-unavailable-icon {
  display: block;
  font-size: 38px;
  margin-bottom: 12px;
}

.storage-unavailable-card h1 {
  margin: 0 0 12px;
  font-size: 21px;
  color: var(--text, #332923);
}

.storage-unavailable-card p {
  margin: 0;
  color: var(--text-sub, #756760);
  line-height: 1.6;
}

.storage-unavailable-card .storage-unavailable-help {
  margin: 10px 0 22px;
  font-size: 13px;
}

.meals-section::before {
  content: '';
  position: absolute;
  left: calc(var(--tl-x) - 1px);
  top: 18px;
  bottom: 18px;
  width: 0;
  /* 홈 시간 박스(#view-home .timeline-time-button)와 동일: 1.5px solid #c8c8c8 */
  border-left: 1.5px solid #c8c8c8;
  pointer-events: none;
  z-index: 0;
}

.meal-card,
.snack-card {
  position: relative;
  z-index: 1;
  margin-left: var(--tl-gutter);
}

/* Snack cards */
.snack-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: visible;
  box-shadow: var(--shadow-sm);
}

.snack-card.has-items {
  background: var(--card);
  border-color: var(--border);
}

.snack-card.drop-target,
.meal-card.drop-target {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.snack-header {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px 4px 2px;
  min-height: 40px;
}

.snack-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 4px 6px;
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: inherit;
}

.snack-main:hover {
  background: var(--bg3);
}

.snack-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.snack-name {
  font-size: 12px;
  font-weight: 750;
  color: var(--text-primary);
}

/* 칼로리는 식사명 바로 뒤에 간단한 텍스트로 둔다. */
.meal-kcal,
.snack-slot-kcal {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 750;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  margin-left: 0;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.snack-slot-kcal:empty {
  display: none;
}

.snack-slot-foods {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding-left: 19px;
}

.snack-card[hidden] {
  display: none !important;
}

.snack-card.drop-placeholder {
  display: block !important;
  min-height: 64px;
  opacity: 0.72;
  border: 1px dashed var(--text-muted);
}

.snack-card.drop-placeholder .snack-header {
  min-height: 62px;
}

.snack-card.drop-placeholder .snack-slot-foods {
  color: var(--accent2);
  font-weight: 700;
}

/* snack add */
.snack-add-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin: 12px 0 0;
  padding: 6px 4px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
}

.snack-add-line {
  flex: 1;
  height: 1px;
  background: var(--bg4);
}

.snack-add-text {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px dashed rgba(40, 30, 20, 0.2);
  background: var(--card);
}

.snack-add-link:hover {
  color: var(--accent);
}

.snack-add-link:hover .snack-add-text {
  border-color: var(--border-strong);
  background: var(--accent-soft);
}

/* snack timing modal */
.modal-snack-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
}

.modal-snack-selector[hidden] {
  display: none !important;
}

.modal-snack-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.modal-snack-options {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.modal-snack-opt {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font);
  color: var(--text-secondary);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.modal-snack-opt.active {
  color: var(--accent2);
  background: var(--accent-soft);
  border-color: var(--border-strong);
}

/* drag */
.drag-handle {
  width: 28px;
  height: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: grab;
  touch-action: none;
  opacity: 0.65;
}

.drag-handle:hover {
  opacity: 1;
  color: var(--accent);
  background: var(--accent-soft);
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle.is-disabled {
  opacity: 0.25;
  pointer-events: none;
}

/* 평소에는 기록을 읽는 화면으로 두고, 편집을 켰을 때만 이동 제어를 노출한다. */
body:not(.timeline-editing) .drag-handle {
  display: none;
}

body:not(.timeline-editing) .food-drag-handle,
body:not(.timeline-editing) .food-actions {
  display: none;
}

.meal-drag-ghost {
  position: fixed;
  z-index: 220;
  pointer-events: none;
  transform: scale(1.02);
  opacity: 0.94;
  box-shadow: none;
}

.meal-drag-active {
  user-select: none;
  -webkit-user-select: none;
}

/* 타임라인 점 바로 아래의 작은 섭취 시각 */
.timeline-time-control {
  position: absolute;
  z-index: 3;
  left: calc(var(--tl-x) - var(--tl-gutter));
  top: 32px;
  width: 44px;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 750;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.snack-card .timeline-time-control {
  top: 27px;
}

.snack-card.drop-placeholder .timeline-time-control {
  display: none;
}

.timeline-time-button {
  width: 100%;
  padding: 2px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  letter-spacing: -0.2px;
  text-align: center;
  pointer-events: none;
}

.timeline-editing .timeline-time-button {
  border: 1px solid var(--border);
  background: var(--card);
  pointer-events: auto;
  cursor: pointer;
}

/* Meal cards */
.meal-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: visible;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

/* 카드 기준: 원 중심 = 타임라인 축(--tl-x), 세로 = 헤더 타이틀 줄 */
.meal-card::before {
  content: '';
  position: absolute;
  left: calc(var(--tl-x) - var(--tl-gutter) - var(--tl-dot) / 2);
  top: 18px;
  /* meal-header 패딩 + 타이틀 줄 중앙에 맞춤 */
  width: var(--tl-dot);
  height: var(--tl-dot);
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid #c9bfb2;
  box-sizing: border-box;
  z-index: 2;
  pointer-events: none;
}

.meal-card.has-items::before {
  background: var(--text-primary);
  border-color: var(--text-primary);
}

/* 간식도 작은 원으로 같은 축에 */
.snack-card::before {
  content: '';
  position: absolute;
  left: calc(var(--tl-x) - var(--tl-gutter) - 3px);
  top: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c9bfb2;
  z-index: 2;
  pointer-events: none;
}

.snack-card.has-items::before {
  background: var(--text-primary);
}

.meal-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.meal-card.expanded {
  border-color: var(--border-strong);
}

.meal-card .meal-header {
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--card);
}

.meal-card:not(.expanded) .meal-header {
  border-radius: var(--radius);
}

.meal-card .meal-items {
  background: var(--card);
  border-radius: 0 0 var(--radius) var(--radius);
}

.meal-header {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 10px 10px 2px;
}

.meal-info-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: inherit;
}

.meal-info-btn:hover {
  background: var(--bg3);
}

.meal-info-btn:disabled {
  cursor: default;
}

.meal-info-btn:disabled:hover {
  background: transparent;
}

.meal-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.meal-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.meal-foods {
  font-size: 12px;
  color: var(--text-secondary);
  padding-left: 21px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.meal-foods:empty {
  display: none;
}

.add-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.add-btn-sm {
  width: 28px;
  height: 28px;
}

.add-btn:hover {
  background: var(--text-primary);
  color: #fff;
  border-color: var(--text-primary);
}

.add-btn:active {
  transform: scale(0.94);
}

/* Food items */
.meal-items {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  border-top: 0 solid transparent;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
}

.meal-card.expanded .meal-items,
.snack-card.expanded .meal-items {
  max-height: 480px;
  opacity: 1;
  border-top: 1px solid var(--border);
  padding: 8px 10px 12px;
  overflow-y: auto;
}

.food-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 9px 8px 9px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.food-item.newly-added {
  animation: slideIn 0.22s ease;
}

.food-item:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.food-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.food-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-cal {
  font-size: 12px;
  font-weight: 750;
  color: var(--text-secondary);
  background: var(--bg4);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 8px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.food-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.food-drag-handle,
.food-edit,
.food-del {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.food-drag-handle:hover,
.food-edit:hover {
  color: var(--accent2);
  background: var(--accent-soft);
}

.food-edit {
  transform: none;
}

.food-del:hover {
  color: var(--pink);
  background: var(--pink-dim);
}

.food-del img {
  opacity: 0.75;
}

.food-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.food-drag-handle {
  touch-action: none;
  cursor: grab;
}

.food-drag-handle:active {
  cursor: grabbing;
}

.food-drag-ghost {
  z-index: 230;
  opacity: 0.96;
}

.macro-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 6px;
}

.carbs-tag,
.protein-tag,
.fat-tag,
.sugar-tag,
.fiber-tag,
.sat-fat-tag,
.trans-fat-tag,
.cholesterol-tag,
.sodium-tag {
  background: var(--bg4);
  color: var(--text-secondary);
}

/* Bottom nav */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px max(8px, var(--safe-right)) calc(16px + var(--safe-bottom)) max(8px, var(--safe-left));
  background: rgba(255, 253, 250, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 12px;
  font-family: var(--font);
}

.nav-item span {
  font-size: 10px;
  font-weight: 700;
}

.nav-item:hover {
  color: var(--text-secondary);
}

.nav-item.active {
  color: var(--accent2);
  background: var(--accent-soft);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 20, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-sheet {
  width: 100%;
  min-width: 0;
  background: var(--bg2);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 12px 20px calc(28px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: calc(78dvh - var(--safe-top));
  overflow-y: auto;
}

.modal-sheet::-webkit-scrollbar {
  display: none;
}

.modal-overlay.open .modal-sheet {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: #ddd6cc;
  border-radius: 99px;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.2px;
  margin-bottom: 14px;
}

.food-modal-sheet {
  max-height: calc(86dvh - var(--safe-top));
}

.food-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.food-tab {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg3);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.food-tab.active {
  color: #fff;
  background: #18181b;
  border-color: #18181b;
}

.food-tab-panel {
  display: none;
}

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

.search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 13px 14px 13px 42px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
}

.search-input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.quick-add-label {
  font-size: 11px;
  font-weight: 750;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.quick-foods {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.quick-food-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font);
  cursor: pointer;
}

.quick-food-chip:hover {
  background: var(--accent-soft);
  border-color: var(--border-strong);
  color: var(--accent2);
}

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

.chip-name {
  font-size: 14px;
  font-weight: 750;
  color: var(--text-primary);
}

.chip-serving {
  font-size: 11px;
  color: var(--text-muted);
}

.chip-source {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  width: fit-content;
}

.chip-source.source-local {
  background: var(--bg4);
  color: var(--text-secondary);
}

.chip-source.source-mine {
  background: var(--bg4);
  color: var(--text-secondary);
}

.chip-source.source-ref {
  background: var(--bg4);
  color: var(--text-secondary);
}

/* toast */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: min(340px, calc(100vw - 32px));
}

.toast {
  padding: 12px 14px;
  border-radius: 12px;
  background: #1c1917;
  color: #fafaf9;
  font-size: 13px;
  font-weight: 650;
  font-family: var(--font);
  box-shadow: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  background: #9f1239;
}

.toast-info {
  background: #1c1917;
}

.chip-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.chip-meta>span:first-child {
  font-size: 13px;
  font-weight: 800;
  color: var(--accent2);
}

.chip-macros {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.quick-food-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.quick-food-row .quick-food-chip {
  flex: 1;
}

.custom-food-actions {
  width: 52px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-edit-btn,
.custom-delete-btn {
  flex: 1;
  min-height: 30px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 750;
  font-family: var(--font);
  cursor: pointer;
}

.custom-edit-btn {
  color: var(--accent2);
}

.custom-delete-btn {
  color: var(--pink);
}

.modal-close-btn {
  width: 100%;
  padding: 13px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
}

.modal-close-btn:hover {
  background: var(--bg4);
  color: var(--text-primary);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 8px 0 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.settings-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text-primary);
  font-family: var(--font);
}

.settings-input:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.settings-save-btn {
  width: 100%;
  padding: 13px;
  background: var(--text-primary);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  font-family: var(--font);
  cursor: pointer;
  margin-bottom: 10px;
}

.custom-food-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  margin-bottom: 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.custom-macro-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.food-empty-state,
.food-online-state {
  padding: 14px;
  background: var(--bg3);
  border: 1px dashed rgba(40, 30, 20, 0.16);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.food-section-label {
  margin-top: 4px;
}

.meal-detail-sheet,
.food-edit-sheet,
.time-edit-sheet {
  max-height: calc(82dvh - var(--safe-top));
  overflow-y: auto;
}

.time-edit-sheet {
  width: min(calc(100% - 32px), 320px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  transform: translateY(10px) scale(0.98);
}

.modal-overlay.open .time-edit-sheet {
  transform: translateY(0) scale(1);
}

.time-edit-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 16px;
}

.time-edit-field span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}

#time-edit-modal {
  align-items: center;
  padding: 16px;
}

@media (max-width: 359px) {

  .app-content,
  .view-panel {
    padding-right: max(12px, var(--safe-right));
    padding-left: max(12px, var(--safe-left));
  }

  .app-topbar {
    gap: 8px;
  }

  .brand-block {
    gap: 7px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .profile-chip {
    min-width: 100px;
    padding: 7px 9px;
  }

  .day-summary {
    padding: 12px;
  }

  .calorie-panel {
    gap: 6px;
  }

  .calorie-box {
    padding: 10px 8px;
  }

  .calorie-box-value {
    font-size: 18px;
  }

  .ring-meter,
  .ring-svg {
    width: 64px;
    height: 64px;
  }

  .nav-item {
    padding-right: 10px;
    padding-left: 10px;
  }

  .modal-sheet {
    padding-right: 16px;
    padding-left: 16px;
  }
}

/* ============================
   RESPONSIVE & LIBRARY POLISH — v52
   좁은 화면 정렬·게이지 규칙·검색/통계 허브
   ============================ */
#view-home .player-card {
  width: auto;
  min-width: 0;
  margin-inline: clamp(0px, 2.4vw, 12px);
  padding-inline: clamp(8px, 3.8vw, 18px);
  grid-template-columns: minmax(0, 1fr) clamp(70px, 23vw, 88px) minmax(0, 1fr);
  gap: clamp(3px, 1.5vw, 8px);
  justify-self: stretch;
}

#view-home .player-card>*,
#view-home .player-measurements,
#view-home .player-card .health-glance {
  min-width: 0;
}

#view-home .player-card .main-avatar,
#view-home .player-card .pixel-avatar {
  width: clamp(70px, 23vw, 88px);
}

#view-home .player-card .health-glance {
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

#view-home .player-card .health-glance strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-home .kcal-bar-track,
#view-home .macro-bar-track {
  height: 9px;
  border: 1.5px solid #18181b;
  border-radius: 3px;
}

#view-home .macro-row {
  grid-template-rows: auto 9px;
}

.meal-page-header {
  position: sticky;
  z-index: 4;
  top: 0;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  background: #fff;
}

.meal-page-back {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 750;
}

.meal-page-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

#view-home .kcal-meter {
  align-items: center;
}

.meal-page-header {
  position: sticky;
  z-index: 4;
  top: 0;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  background: #fff;
}

.meal-page-back {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 750;
}

.meal-page-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.meal-page-add svg {
  flex: 0 0 auto;
}

.search-hub-head {
  padding: 24px 2px 16px;
}

.search-hub-head p {
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.1px;
}

.search-hub-head h1 {
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.7px;
}

.search-hub-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  border-radius: 12px;
  background: var(--bg3);
}

.search-hub-tab {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.search-hub-tab.active {
  background: #18181b;
  color: #fff;
}

.search-hub-panel {
  padding-top: 16px;
}

.search-hub-input-wrap {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1.5px solid #18181b;
  border-radius: 13px;
  color: var(--text-secondary);
  background: #fff;
}

.search-hub-input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
}

.search-hub-note {
  margin: 9px 2px 14px;
  color: var(--text-muted);
  font-size: 11px;
}

.search-hub-results,
.search-index-grid {
  display: grid;
  gap: 8px;
}

.search-result-item,
.search-index-item {
  width: 100%;
  min-width: 0;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: #fff;
  color: var(--text-primary);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
}

.search-result-copy {
  min-width: 0;
}

.search-result-copy strong,
.search-result-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-copy strong {
  font-size: 14px;
  font-weight: 800;
}

.search-result-copy small {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.search-result-kcal {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 800;
}

.search-result-kcal small {
  margin-left: 2px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 650;
}

.search-index-intro {
  margin-bottom: 14px;
  padding: 16px;
  border-radius: 14px;
  background: var(--bg3);
}

.search-index-intro span {
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1px;
}

.search-index-intro h2 {
  margin: 4px 0;
  font-size: 20px;
  font-weight: 850;
}

.search-index-intro p,
.search-hub-empty {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.stats-metric-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stats-metric-label i {
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #18181b;
  color: #fff;
  font-size: 8px;
  font-style: normal;
  font-weight: 850;
}

.cal-day {
  gap: 2px;
  padding-bottom: 4px;
}

.cal-day-kcal {
  min-height: 9px;
  max-width: 100%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 7px;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
}

.cal-day.level-under {
  background: #eef6f0;
}

.cal-day.level-ok {
  background: #fff6d8;
}

.cal-day.level-over {
  background: #fdeaea;
}

.cal-day.level-under .cal-day-kcal {
  color: #477253;
}

.cal-day.level-ok .cal-day-kcal {
  color: #8a6a08;
}

.cal-day.level-over .cal-day-kcal {
  color: #a34343;
}

.cal-legend-item .swatch.level-under {
  background: #7da98a;
}

.cal-legend-item .swatch.level-ok {
  background: #d2a72d;
}

.cal-legend-item .swatch.level-over {
  background: #d66b6b;
}

.week-line-plot {
  position: relative;
}

.week-line-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.week-line-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid #18181b;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}

.week-line-dot.is-selected {
  width: 12px;
  height: 12px;
  background: #18181b;
}

@media (max-width: 359px) {
  #view-home .player-card {
    margin-inline: 0;
    padding-inline: 8px;
    grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr);
    gap: 3px;
  }

  #view-home .player-card .main-avatar,
  #view-home .player-card .pixel-avatar {
    width: 70px;
  }

  #view-home .level-bubble {
    padding-inline: 5px;
    font-size: 8px;
  }

  #view-home .player-measurements p,
  #view-home .player-measurements p strong,
  #view-home .player-card .health-glance strong {
    font-size: 10px;
  }

  .meal-page-header {
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 6px;
  }

  .meal-page-back {
    gap: 4px;
    font-size: 10px;
  }

  .meal-page-add {
    padding-inline: 8px;
  }

  .meal-page-add span {
    font-size: 9px;
  }

  .stats-week-head {
    display: block;
  }

  .stats-week-hint {
    margin-top: 4px;
  }
}

/* ============================
   v57 · interaction and information architecture pass
   ============================ */
.cal-day.is-today::before {
  display: none;
}

.cal-day.is-today .cal-day-dot {
  border: 1.5px solid #18181b;
  background: #fff;
}

.cal-day.is-today.has-log .cal-day-dot {
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px #18181b;
}

#view-home .day-summary {
  height: 324px;
  min-height: 324px;
  grid-template-rows: 41px 157px 42px 26px 4px 26px;
}

#view-home .kcal-meter {
  height: 38px;
  min-height: 38px;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 17px 11px;
  align-items: end;
  gap: 4px 8px;
  padding: 2px 12px 0;
  overflow: visible;
}

#view-home .kcal-meter-label {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  line-height: 12px;
}

#view-home .kcal-bar-track {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  height: 10px;
  align-self: end;
  overflow: visible;
}

#view-home .kcal-meter-value {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  justify-self: end;
  line-height: 10px;
}

.kcal-target-marker {
  position: absolute;
  z-index: 3;
  top: -3px;
  bottom: -3px;
  width: 2px;
  border-radius: 2px;
  background: #c33d3d;
  transform: translateX(-1px);
}

.kcal-over-bubble {
  position: absolute;
  z-index: 4;
  bottom: 15px;
  padding: 3px 6px;
  border-radius: 6px;
  background: #c33d3d;
  color: #fff;
  font-size: 8px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
}

.kcal-over-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  border: 3px solid transparent;
  border-top-color: #c33d3d;
  transform: translateX(-50%);
}

.kcal-over-bubble.is-near-end {
  transform: translateX(-100%);
}

.kcal-over-bubble.is-near-end::after {
  left: calc(100% - 5px);
}

.timeline-editing #view-home .meal-card.expanded .meal-header>.drag-handle,
.timeline-editing #view-home .snack-card.expanded .snack-header>.drag-handle {
  display: none !important;
}

.food-purpose-strip>span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  text-align: center;
}

.search-hub-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, auto)) minmax(96px, 1fr);
  gap: 4px;
  padding: 3px;
  overflow: visible;
}

.search-hub-index-tab {
  margin-left: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
}

.search-discovery-section {
  display: grid;
  gap: 7px;
  margin-top: 18px;
}

.search-discovery-section:first-child {
  margin-top: 2px;
}

.search-discovery-section h3 {
  margin: 0 2px 2px;
  font-size: 12px;
  font-weight: 850;
}

.collection-section>header {
  position: relative;
}

#collection-create {
  position: static;
  display: grid;
  place-items: center;
  min-height: 32px;
  margin: 14px auto 4px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--text-primary);
  font: 800 10px/1 var(--font);
  cursor: pointer;
}

.collection-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.collection-card-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
}

.collection-card-actions button {
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: #18181b;
  color: #fff;
  font: 800 10px/1 var(--font);
  cursor: pointer;
}

.collection-card-actions .collection-edit {
  padding: 0 14px;
  background: #fff;
  color: #18181b;
}

.collection-card-actions>button:first-child:not(.collection-edit) {
  background: #18181b;
  color: #fff;
}

.collection-card-actions button:disabled {
  border-color: var(--border);
  background: #f3f3f4 !important;
  color: var(--text-muted) !important;
  cursor: not-allowed;
}

.collection-card-copy .is-editing {
  min-width: 140px;
  padding: 4px 6px;
  border: 1px dashed #18181b;
  border-radius: 5px;
  outline: 0;
  background: #fff;
}

.collection-evolution {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px 86px;
  align-items: stretch;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f7f7f8;
}

.collection-evolution[hidden] {
  display: none;
}

.collection-card>.collection-evolution-toggle {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0 0 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #18181b;
  font: 900 20px/1 var(--font);
  cursor: pointer;
  transition: transform 160ms ease;
}

.collection-card>.collection-evolution-toggle[aria-expanded="true"] {
  transform: rotate(180deg);
  padding: 4px 0 0;
}

.collection-card>.collection-card-remove {
  position: absolute;
  z-index: 2;
  right: 3px;
  bottom: -37px;
  width: auto;
  min-height: 30px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: 700 13px/1.2 var(--font);
  cursor: pointer;
}

.collection-evolution-stage {
  min-width: 0;
}

.collection-evolution-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 1px;
}

.collection-ingredient-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.collection-ingredient-tile {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 4px 5px;
  border: 1px solid #d6d6d9;
  border-radius: 8px;
  background: #fff;
}

.collection-ingredient-image,
.collection-result-image {
  display: grid;
  place-items: center;
}

.collection-ingredient-image {
  width: 30px;
  height: 30px;
}

.collection-ingredient-image .food-index-image,
.collection-result-image .food-index-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.collection-ingredient-image svg,
.collection-result-image svg {
  width: 22px;
  height: 22px;
}

.collection-ingredient-name {
  overflow: hidden;
  font-size: 8px;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.collection-ingredient-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 1px solid #18181b;
  border-radius: 50%;
  background: #fff;
  color: #18181b;
  font: 800 11px/1 var(--font);
  cursor: pointer;
}

.collection-evolution-arrow {
  align-self: center;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}

.collection-evolution-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 1px solid #18181b;
  border-radius: 9px;
  background: #fff;
  text-align: center;
}

.collection-result-image {
  width: 44px;
  height: 44px;
}

.collection-evolution-result strong {
  margin-top: 4px;
  font-size: 8px;
  line-height: 1.2;
}

.collection-ingredient-empty {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.4;
}

@media (max-width: 380px) {
  .collection-evolution {
    grid-template-columns: minmax(0, 1fr) 14px 74px;
    padding: 8px;
  }

  .collection-ingredient-list {
    grid-template-columns: 1fr;
  }
}

.shopping-group article>.shopping-action {
  min-height: 26px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg3);
  color: var(--text-secondary);
  font: 800 8px/1.1 var(--font);
  cursor: pointer;
}

.shopping-group article.is-progressing {
  border-color: var(--border-strong);
  background: var(--bg3);
}

.shopping-fridge {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

#shopping-fridge-list {
  display: grid;
  gap: 7px;
}

.shopping-fridge-empty {
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 11px;
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
}

.shopping-fridge article.is-complete {
  opacity: 1;
  background: var(--bg3);
}

.shopping-fridge article.is-complete strong {
  text-decoration: none;
}

.food-modal-sheet {
  position: relative;
}

.modal-x-btn {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #fff;
  color: #18181b;
  font: 500 21px/1 var(--font);
  cursor: pointer;
}

.modal-snack-selector {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.modal-snack-select {
  width: 100%;
  min-height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text-primary);
  font: 750 11px/1 var(--font);
}

.modal-overlay.snack-dialog .food-modal-sheet {
  max-height: min(72dvh, 620px);
}

.modal-overlay.snack-dialog .quick-foods {
  max-height: 250px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.custom-advanced-toggle {
  grid-column: 1 / -1;
  min-height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg3);
  color: var(--text-primary);
  font: 800 11px/1 var(--font);
  cursor: pointer;
}

.custom-advanced-field[hidden] {
  display: none !important;
}

.food-dex-hero svg {
  width: clamp(116px, 34vw, 164px);
  height: clamp(116px, 34vw, 164px);
  stroke-width: 0.9;
}

.food-dex-index-link {
  min-height: 42px;
  margin-top: 18px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font: 800 11px/1 var(--font);
  cursor: pointer;
}

.food-dex-history {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg3);
}

.food-dex-history>span {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1.2px;
}

.food-dex-history>strong {
  font-size: 18px;
}

.food-dex-history>em {
  align-self: center;
  padding: 5px 8px;
  border-radius: 99px;
  background: #18181b;
  color: #fff;
  font-size: 9px;
  font-style: normal;
  font-weight: 850;
}

@media (max-width: 430px) {
  .search-hub-tabs {
    grid-template-columns: repeat(3, minmax(66px, 1fr));
  }

  .search-hub-index-tab {
    grid-column: 1 / -1;
    margin: 4px 0 0;
  }
}

/* v58 — stats, collection and editing polish */
.cal-day .cal-day-dot {
  display: none;
}

.cal-day.is-today .cal-day-dot {
  display: block;
  width: 5px;
  height: 5px;
  border: 0;
  background: #18181b;
  box-shadow: none;
}

.cal-day.is-today.has-log .cal-day-dot {
  box-shadow: none;
}

.cal-legend-item .swatch.level-under {
  background: #169c5a;
}

.cal-legend-item .swatch.level-ok {
  background: #e4ad00;
}

.cal-legend-item .swatch.level-over {
  background: #d83b3b;
}

.stats-day-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-calorie-hero {
  position: relative;
  grid-column: 1 / -1;
  min-height: 92px;
  justify-content: center;
  padding: 16px 18px;
}

.stats-calorie-hero .stats-metric-label {
  font-size: 12px;
}

.stats-calorie-hero .stats-metric-value {
  font-size: 27px;
  line-height: 1;
}

.stats-calorie-hero .stats-day-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  margin: 0;
}

.stats-day-badge.level-under {
  background: #dcf5e8;
  color: #087641;
}

.stats-day-badge.level-ok {
  background: #fff0b5;
  color: #755700;
}

.stats-day-badge.level-over {
  background: #ffe1e1;
  color: #b32424;
}

.stats-day-metrics>.stats-metric:not(.stats-calorie-hero) {
  padding: 9px 8px;
}

.stats-day-metrics>.stats-metric:not(.stats-calorie-hero) .stats-metric-label {
  font-size: 9px;
}

.stats-day-metrics>.stats-metric:not(.stats-calorie-hero) .stats-metric-value {
  font-size: 13px;
}

.week-line-compare {
  fill: none;
  stroke: #c7c9ce;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.week-line-dot.is-demo {
  opacity: .45;
}

.week-line-day strong small {
  margin-left: 1px;
  font-size: 7px;
  opacity: .65;
}

#view-home .kcal-bar-track {
  background: #dedfe2;
}

#view-home .kcal-bar-fill {
  background: #18181b;
}

#view-home .kcal-over-fill {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  border-radius: 0 99px 99px 0;
  background: #d83b3b;
}

#view-home .kcal-target-marker {
  z-index: 4;
  background: #18181b;
}

#view-home .kcal-meter {
  height: 44px;
  min-height: 44px;
  grid-template-rows: 18px 14px;
  row-gap: 6px;
}

#view-home .kcal-meter-value {
  padding-top: 1px;
  white-space: nowrap;
}

#view-home .day-summary {
  height: 332px;
  min-height: 332px;
  grid-template-rows: 41px 157px 48px 26px 4px 26px;
}

#view-home .meals-section::before {
  background: #c4c4c4;
}

#view-home .snack-card,
#view-home .snack-card.has-items {
  border-style: solid;
}

.search-purpose-strip>button {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: #fff;
  color: var(--text-primary);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.search-discovery-section {
  position: relative;
}

.search-discovery-section.is-collapsed .discovery-extra {
  display: none;
}

.search-discovery-section.is-collapsed::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 30px;
  left: 0;
  height: 42px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff);
}

.search-discovery-more {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.collection-subtabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 12px 0;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg3);
}

.collection-subtabs button {
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.collection-subtabs button.active {
  background: #18181b;
  color: #fff;
}

.collection-products {
  display: grid;
  gap: 8px;
}

.collection-product-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text-primary);
  text-align: left;
}

.collection-product-item span {
  display: grid;
  gap: 2px;
}

.collection-product-item small,
.collection-products-empty p {
  color: var(--text-muted);
  font-size: 10px;
}

.collection-products-empty {
  padding: 28px 16px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  text-align: center;
}

.collection-products-empty p {
  margin-top: 6px;
  line-height: 1.5;
}

.food-dex-hero-wrap {
  position: relative;
}

.food-dex-hero-wrap .food-dex-index-link {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: auto;
  margin: 0;
}

.food-dex-history {
  margin-top: 22px;
}

.food-edit-sheet {
  position: relative;
}

.meal-detail-grid {
  display: block;
}

.meal-edit-section {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.meal-edit-section:first-child {
  padding-top: 4px;
  border-top: 0;
}

.meal-edit-section h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.meal-serving-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(90px, .8fr);
  gap: 8px;
}

.meal-primary-nutrients {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.meal-advanced-nutrients {
  margin-top: 12px;
}

.meal-advanced-nutrients summary {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.meal-advanced-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.meal-serving-unit {
  width: 100%;
}

.meal-detail-actions {
  grid-template-columns: 1fr 1.2fr;
}

@media (max-width: 359px) {
  .stats-day-metrics>.stats-metric:not(.stats-calorie-hero) {
    padding-inline: 5px;
  }

  .stats-day-metrics>.stats-metric:not(.stats-calorie-hero) .stats-metric-label {
    font-size: 8px;
  }

  .meal-primary-nutrients {
    grid-template-columns: 1fr;
  }
}

/* ============================
   COACH, LIBRARY & CALENDAR — v56
   ============================ */
#view-home .player-card .health-glance>div {
  grid-template-columns: minmax(48px, auto) 15px;
}

#view-home .player-card .health-glance strong {
  grid-column: 1;
  grid-row: 1;
  text-align: right;
}

#view-home .player-card .health-glance .vital-icon {
  grid-column: 2;
  grid-row: 1;
}

#view-home .kcal-meter-value em {
  margin-left: 5px;
  padding: 1px 4px;
  border: 1px solid #18181b;
  border-radius: 99px;
  color: #18181b;
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
}

#view-home .kcal-meter.is-over .kcal-bar-track {
  background: repeating-linear-gradient(135deg, #fff 0 4px, #e4e4e7 4px 7px);
  box-shadow: 0 0 0 1px #18181b;
}

.cal-month-picker-wrap {
  position: relative;
  min-width: 150px;
  min-height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  cursor: pointer;
}

.cal-month-picker-wrap:focus-within {
  outline: 2px solid #18181b;
  outline-offset: 2px;
}

#cal-month-picker {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.cal-day.level-under,
.cal-day.level-ok,
.cal-day.level-over {
  background: transparent;
}

.cal-day.is-today:not(.is-selected) {
  box-shadow: none;
}

.cal-day.is-today::before {
  content: '';
  position: absolute;
  top: 4px;
  right: calc(50% - 15px);
  width: 5px;
  height: 5px;
  border: 1.5px solid #18181b;
  border-radius: 50%;
  background: #fff;
}

.cal-day .cal-day-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: transparent;
}

.cal-day.level-under .cal-day-dot {
  background: #6ba59a;
}

.cal-day.level-ok .cal-day-dot {
  background: #b7a04c;
}

.cal-day.level-over .cal-day-dot {
  background: #c56e7f;
}

.cal-legend-item .swatch {
  border-radius: 50%;
}

.cal-legend-item .swatch.level-under {
  background: #6ba59a;
}

.cal-legend-item .swatch.level-ok {
  background: #b7a04c;
}

.cal-legend-item .swatch.level-over {
  background: #c56e7f;
}

.modal-overlay.snack-dialog {
  align-items: center;
  padding: max(16px, var(--safe-top)) max(16px, var(--safe-right)) max(16px, var(--safe-bottom)) max(16px, var(--safe-left));
}

.modal-overlay.snack-dialog .food-modal-sheet {
  width: min(100%, 430px);
  max-height: min(84dvh, 720px);
  padding-bottom: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  transform: translateY(8px) scale(0.98);
}

.modal-overlay.snack-dialog.open .food-modal-sheet {
  transform: translateY(0) scale(1);
}

.modal-overlay.snack-dialog .modal-handle {
  display: none;
}

.search-suggestions,
.food-purpose-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 3px 0 11px;
  scrollbar-width: none;
}

.search-suggestions::-webkit-scrollbar,
.food-purpose-strip::-webkit-scrollbar {
  display: none;
}

.search-suggestions>span,
.food-purpose-strip>strong {
  flex: 0 0 auto;
  margin-right: 2px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 800;
}

.search-suggestions button,
.food-purpose-strip span {
  flex: 0 0 auto;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: #fff;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 9px;
  font-weight: 700;
}

.search-suggestions button {
  cursor: pointer;
}

.food-purpose-strip {
  margin-top: -3px;
  padding-bottom: 12px;
}

.search-index-grid:not(.is-product-list) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.search-category-card {
  padding: 10px;
  border-radius: 12px;
}

.search-category-card .search-index-icon {
  width: 48px;
  height: 48px;
}

.search-category-card .search-index-icon svg {
  width: 29px;
  height: 29px;
}

.search-category-card>strong {
  font-size: 12px;
}

.search-category-card>small {
  display: none;
}

.search-index-grid.is-product-list {
  grid-template-columns: 1fr;
  gap: 7px;
}

.search-index-grid.is-product-list .search-index-product {
  aspect-ratio: auto;
  min-height: 70px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  gap: 2px 10px;
  padding: 10px 12px;
}

.search-index-product .search-index-icon {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  margin: 0;
}

.search-index-product .search-index-category {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

.search-index-product>strong {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
}

.search-index-product .search-index-meta {
  grid-column: 3;
  grid-row: 1 / 3;
}

.collection-section>header,
.shopping-section>header {
  margin-bottom: 14px;
}

.collection-section>header>span,
.shopping-section>header>span {
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1.2px;
}

.collection-section>header h2,
.shopping-section>header h2 {
  margin-top: 3px;
  font-size: 21px;
  font-weight: 900;
}

.collection-section>header p,
.shopping-section>header p {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
}

.collection-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid #18181b;
  border-radius: 15px;
  margin-bottom: 42px;
}

.collection-card-copy {
  padding-right: 24px;
}

.shopping-fridge .collection-fridge-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 11px 38px 11px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
}

.shopping-fridge .collection-fridge-item.is-editing {
  grid-template-columns: minmax(0, 1fr) auto;
}

.collection-fridge-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, 0.45fr);
  gap: 7px;
}

.collection-fridge-marker {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #18181b;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.collection-fridge-status {
  padding: 4px 8px;
  border-radius: 99px;
  background: var(--bg3);
  color: var(--text-secondary);
  font-size: 8px;
  font-weight: 800;
}

.collection-fridge-save {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: #18181b;
  color: #fff;
  font: 800 10px/1 var(--font);
}

.collection-fridge-remove {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: 900 17px/1 var(--font);
}

.collection-card-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #18181b;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.collection-card-copy span {
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 800;
}

.collection-card-copy h3 {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 900;
}

.collection-card-copy p {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.5;
}

.collection-nutrition {
  grid-column: 1 / 3;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.collection-nutrition strong {
  font-size: 14px;
}

.collection-nutrition span {
  color: var(--text-muted);
  font-size: 9px;
}

.collection-card>button {
  grid-column: 1 / 3;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.shopping-group {
  margin-top: 13px;
}

.shopping-group h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 850;
}

.shopping-group h3 span {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg3);
  color: var(--text-muted);
  font-size: 8px;
}

.shopping-group article {
  min-height: 67px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.shopping-group article strong {
  font-size: 12px;
  font-weight: 850;
}

.shopping-group article p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.4;
}

.shopping-group article>span {
  padding: 3px 6px;
  border-radius: 99px;
  background: var(--bg3);
  color: var(--text-secondary);
  font-size: 8px;
  font-weight: 800;
}

.shopping-dot,
.shopping-check {
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #fff;
}

.shopping-check {
  position: relative;
  cursor: pointer;
}

.shopping-check.is-complete::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
}

.shopping-check.is-complete {
  background: #18181b;
}

.shopping-group article.is-complete {
  opacity: 0.5;
}

.shopping-group article.is-complete strong {
  text-decoration: line-through;
}

.agent-page-head>span {
  right: 36px;
}

.agent-help-btn {
  position: absolute;
  right: 1px;
  bottom: 18px;
  width: 27px;
  height: 27px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #fff;
  color: #18181b;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.agent-composer {
  grid-template-columns: minmax(0, 1fr) 38px 38px;
}

.agent-composer .agent-voice {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: #18181b;
}

.agent-composer .agent-voice.is-listening {
  background: #18181b;
  color: #fff;
  animation: voicePulse 1s ease-in-out infinite;
}

.agent-composer .agent-voice:disabled {
  opacity: 0.3;
}

@keyframes voicePulse {
  50% {
    transform: scale(0.92);
  }
}

.agent-help-overlay {
  position: fixed;
  z-index: 150;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 24, 27, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.agent-help-overlay[hidden] {
  display: none;
}

.agent-help-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.agent-help-card {
  position: relative;
  width: min(100%, 360px);
  padding: 20px;
  border: 1px solid #18181b;
  border-radius: 17px;
  background: #fff;
}

.agent-help-card>span {
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1.2px;
}

.agent-help-card h2 {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 900;
}

.agent-help-card>p {
  margin: 9px 0 15px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.6;
}

.agent-help-card dl {
  display: grid;
  gap: 8px;
}

.agent-help-card dl div {
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--bg3);
}

.agent-help-card dt {
  font-size: 10px;
  font-weight: 850;
}

.agent-help-card dd {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 9px;
}

.agent-help-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--bg3);
  color: #18181b;
  font-size: 19px;
  cursor: pointer;
}

@media (max-width: 359px) {
  .search-index-grid:not(.is-product-list) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-page-head h1 {
    max-width: 220px;
    font-size: 21px;
  }
}

.meal-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.meal-detail-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meal-detail-field.is-wide {
  grid-column: 1 / -1;
}

.meal-detail-description {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

.meal-detail-field span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.meal-detail-input-wrap {
  position: relative;
}

.meal-detail-input {
  width: 100%;
  padding-right: 32px;
}

.meal-detail-input-wrap small {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 10px;
}

.meal-detail-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.meal-detail-actions .settings-save-btn,
.meal-detail-actions .modal-close-btn {
  margin: 0;
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
}

.custom-description-input {
  min-height: 74px;
  resize: vertical;
  line-height: 1.5;
}

/* 음식 도감 — 앱 전체 화면을 덮는 읽기 전용 상세 */
.food-dex {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.food-dex[hidden] {
  display: none;
}

.food-dex.open {
  opacity: 1;
  transform: translateY(0);
}

.food-dex-open {
  overflow: hidden;
}

.food-dex-header {
  min-height: calc(54px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) max(16px, var(--safe-right)) 10px max(16px, var(--safe-left));
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.food-dex-header span {
  grid-column: 2;
  text-align: center;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 1.8px;
}

.food-dex-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: inherit;
  font: 700 20px/1 var(--font);
  cursor: pointer;
}

.food-dex-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px max(20px, var(--safe-right)) calc(34px + var(--safe-bottom)) max(20px, var(--safe-left));
}

.food-dex-number {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 1.5px;
}

.food-dex-hero {
  height: min(34dvh, 280px);
  display: grid;
  place-items: center;
  color: var(--text-primary);
  font-size: clamp(84px, 28vw, 132px);
  filter: grayscale(1);
}

.food-dex-category {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
}

.food-dex h2 {
  margin-top: 5px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -1.2px;
}

.food-dex-serving {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 750;
}

.food-dex-description {
  margin-top: 18px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

.food-dex-nutrition {
  margin-top: 28px;
  border-top: 2px solid var(--text-primary);
}

.food-dex-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--text-primary);
}

.food-dex-section-head h3 {
  font-size: 16px;
}

.food-dex-section-head span {
  color: var(--text-muted);
  font-size: 10px;
}

.food-dex-nutrition-grid>div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.food-dex-nutrition-grid span {
  color: var(--text-secondary);
  font-size: 12px;
}

.food-dex-nutrition-grid strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.food-dex-nutrition-grid small {
  margin-left: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

/* ============================
   ARCHIVE CATALOG DIRECTION
   Reference: museum object card / bilingual inventory label
   ============================ */
/*
:root {
  --bg: #eeeeee;
  --bg2: #ffffff;
  --bg3: #f2f2f2;
  --bg4: #dcdcdc;
  --card: #ffffff;
  --card2: #fafafa;
  --border: rgba(24, 24, 24, 0.22);
  --border-strong: #181818;
  --accent: #168aa3;
  --accent2: #0e7187;
  --accent-soft: #e6f2f4;
  --accent-glow: rgba(22, 138, 163, 0.14);
  --radius: 3px;
  --radius-sm: 2px;
  --shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  --shadow-sm: 0 3px 8px rgba(0, 0, 0, 0.1);
}

html,
body,
.phone-frame { background: var(--bg); }

#view-home { padding-bottom: 8px; }

.home-brand {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0 12px;
  padding: 18px 0 12px;
  color: var(--text-primary);
}

.archive-index,
.archive-title {
  display: grid;
  grid-template-rows: 32px 32px;
  min-width: 0;
}

.archive-index span,
.archive-title > * {
  display: flex;
  align-items: center;
  border-bottom: 1.5px solid var(--text-primary);
}

.archive-index span {
  color: var(--accent2);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.archive-title > * {
  justify-content: flex-end;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-title strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.archive-title span {
  font-size: 15px;
  font-weight: 750;
}

.day-summary {
  gap: 0;
  padding: 14px;
  border: 1px solid rgba(24, 24, 24, 0.18);
  border-radius: 2px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.summary-top {
  min-height: 164px;
  gap: 12px;
  padding: 12px;
  background: #ededed;
}

.main-avatar {
  width: 142px;
  height: 142px;
  flex-basis: 142px;
  border: 0;
  border-radius: 0;
  background: #e4e4e4;
}

.avatar-head {
  top: 24px;
  width: 38px;
  height: 38px;
}

.avatar-body {
  bottom: -18px;
  width: 94px;
  height: 86px;
  background: var(--accent);
}

.ring-meter,
.ring-svg {
  width: 126px;
  height: 126px;
}

.ring-meter { flex-basis: 126px; }
.ring-bg { stroke: #ffffff; stroke-width: 8; }
.ring-fg { stroke: var(--accent); stroke-width: 8; }
.ring-metric-value strong { font-size: 22px; }
.ring-cycle-indicator i.active { background: var(--accent); }

.macros-panel {
  display: block;
  padding: 7px 0 0;
  border-top: 0;
}

.macro-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 70px;
  grid-template-rows: 29px;
  gap: 8px;
  align-items: center;
  border-bottom: 1.5px solid var(--text-primary);
}

.macro-label,
.macro-bar-track,
.macro-val {
  grid-row: 1;
}

.macro-label {
  grid-column: 1;
  font-size: 12px;
  font-weight: 800;
}

.macro-bar-track {
  grid-column: 2;
  width: 100%;
  height: 5px;
  border-radius: 0;
  background: #d7d7d7;
}

.macro-bar {
  border-radius: 0;
  background: var(--accent) !important;
}

.macro-val {
  grid-column: 3;
  width: auto;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-primary);
}

.date-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  padding: 0;
  margin: 14px 0 16px;
  border: 1px solid var(--text-primary);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.date-header .nav-btn {
  width: 41px;
  height: 40px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.date-header .nav-btn:first-child { border-right: 1px solid var(--text-primary); }
.date-header .nav-btn:last-child { border-left: 1px solid var(--text-primary); }

.date-display { min-width: 0; }
.date-text { font-size: 14px; font-weight: 800; }
.date-badge,
.go-today-btn { border-radius: 0; }

.section-head {
  align-items: flex-end;
  margin: 0 0 6px;
  padding: 0 0 5px;
  border-bottom: 2px solid var(--text-primary);
}

.section-title {
  font-size: 16px;
  line-height: 1;
}

.section-title::after {
  content: ' / Meal records';
  font-size: 11px;
  font-weight: 650;
  color: var(--text-muted);
}

.timeline-actions { gap: 10px; }
.timeline-edit-btn,
.timeline-snack-add,
.clear-day-btn {
  padding: 3px 0;
  border-radius: 0;
  font-size: 11px;
}

.meals-section {
  --tl-gutter: 0px;
  gap: 0;
  padding: 0;
  border: 1px solid var(--text-primary);
  background: var(--card);
  box-shadow: var(--shadow);
}

.meals-section::before { display: none; }

.meal-card,
.snack-card {
  margin-left: 0;
  border: 0;
  border-bottom: 1px solid var(--text-primary);
  border-radius: 0;
  background: var(--card);
  box-shadow: none;
}

.meal-card:hover,
.snack-card:hover {
  border-color: var(--text-primary);
  box-shadow: none;
}

.meal-card.expanded { border-color: var(--text-primary); }

.meal-card .meal-header,
.meal-card:not(.expanded) .meal-header,
.meal-card .meal-items,
.snack-card .snack-header {
  border-radius: 0;
  background: var(--card);
}

.meal-header,
.snack-header {
  min-height: 58px;
  padding: 8px 9px 8px 54px;
}

.meal-info-btn,
.snack-main {
  gap: 2px;
  padding: 2px 6px;
  border-radius: 0;
}

.meal-info-btn:hover,
.snack-main:hover { background: #f1f1f1; }

.meal-title-row,
.snack-title-row { gap: 5px; }

.meal-emoji,
.snack-emoji { display: none; }

.meal-name,
.snack-name {
  font-size: 14px;
  font-weight: 800;
}

.meal-kcal,
.snack-slot-kcal {
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 700;
}

.meal-foods,
.snack-slot-foods {
  padding-left: 0;
  font-size: 11px;
}

.meal-card::before,
.snack-card::before {
  left: 18px;
  top: 15px;
  width: 7px;
  height: 7px;
  border: 1.5px solid #929292;
  background: var(--card);
}

.meal-card.has-items::before,
.snack-card.has-items::before {
  border-color: var(--accent);
  background: var(--accent);
}

.timeline-time-control,
.snack-card .timeline-time-control {
  left: 22px;
  top: 31px;
  width: 42px;
  transform: translateX(-50%);
  font-size: 8px;
}

.add-btn,
.add-btn-sm {
  width: 27px;
  height: 27px;
  border: 1px solid var(--text-primary);
  border-radius: 0;
  background: var(--card);
  color: var(--text-primary);
}

.add-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.meal-card.expanded .meal-items,
.snack-card.expanded .meal-items {
  padding: 8px 10px 10px 54px;
  border-top: 1px solid var(--text-primary);
}

.food-item {
  border-radius: 0;
  background: #f1f1f1;
}

.food-cal,
.macro-tag { border-radius: 0; }

.snack-card.drop-placeholder {
  min-height: 58px;
  border: 1px dashed var(--accent);
  background: var(--accent-soft);
}

.timeline-editing .drag-handle {
  position: absolute;
  top: 13px;
  left: 40px;
  display: flex;
}

.timeline-editing .meal-header,
.timeline-editing .snack-header { padding-left: 72px; }

.timeline-editing .timeline-time-input {
  width: 54px;
  margin-left: -6px;
  border-radius: 0;
}

.day-clear-row {
  margin-top: 7px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--text-primary);
}

.bottom-nav {
  border-top: 1.5px solid var(--text-primary);
  background: rgba(255, 255, 255, 0.96);
}

.nav-item {
  border-radius: 0;
  background: transparent;
}

.nav-item.active {
  color: var(--accent2);
  background: transparent;
}

.cal-card,
.stats-day-card,
.profile-summary-card,
.profile-form-card,
.language-settings-card,
.data-transfer-card {
  border-radius: 2px;
}

@media (max-width: 359px) {
  .home-brand { grid-template-columns: 46px minmax(0, 1fr); }
  .archive-title strong { font-size: 16px; }
  .archive-title span { font-size: 13px; }
  .day-summary { padding: 10px; }
  .summary-top { min-height: 145px; padding: 9px; gap: 8px; }
  .main-avatar { width: 126px; height: 126px; flex-basis: 126px; }
  .ring-meter,
  .ring-svg { width: 116px; height: 116px; }
  .ring-meter { flex-basis: 116px; }
  .ring-metric-value strong { font-size: 19px; }
  .macro-row { grid-template-columns: 40px minmax(0, 1fr) 66px; gap: 6px; }
}
*/

/* ============================
   HOME DRAFT — pixel status card
   2026-07-19 reference layout
   ============================ */
#view-home {
  padding-bottom: 10px;
}

#view-home .home-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 2px 22px;
}

#view-home .home-brand-name {
  margin: 0;
  font-size: clamp(30px, 9vw, 38px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1.8px;
}

.home-utilities {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-utility-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
}

.home-utility-btn:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

#view-home .day-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 14px 16px;
  margin: 0 0 22px;
  border: 0;
  border-radius: 24px;
  background: #f1f1f1;
  box-shadow: none;
}

#view-home .date-header {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  min-height: 58px;
  padding: 0;
}

#view-home .date-header .nav-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #111;
}

#view-home .date-header .nav-btn svg {
  width: 11px;
  height: 20px;
}

#view-home .date-display {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

#view-home .date-badge {
  order: 1;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #8c8c8c;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.1;
}

#view-home .date-text {
  order: 2;
  font-size: 20px;
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -0.7px;
}

#view-home .go-today-btn {
  order: 3;
  margin-top: 2px;
  padding: 1px 6px;
  border: 1px solid #b6b6b6;
  border-radius: 99px;
  background: #fff;
  color: #555;
  font-size: 9px;
}

.player-card {
  min-height: 156px;
  display: grid;
  grid-template-columns: minmax(72px, 1fr) 100px minmax(70px, 1fr);
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
  border-radius: 19px;
  background: #fff;
}

.player-measurements {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
  padding-bottom: 10px;
  color: #202020;
}

.player-measurements p {
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.25;
}

.player-measurements p span {
  font-weight: 900;
}

.player-measurements p strong {
  font-size: 13px;
  font-weight: 550;
}

.level-bubble {
  position: relative;
  align-self: flex-start;
  margin: 0 0 auto;
  padding: 5px 7px 4px;
  border: 2px solid #18181b;
  background: #fff;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.level-bubble::after {
  content: '';
  position: absolute;
  right: 8px;
  bottom: -7px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #18181b;
  border-bottom: 2px solid #18181b;
  background: #fff;
  transform: skewY(38deg);
}

.player-card .main-avatar {
  width: 100px;
  height: 132px;
  display: grid;
  place-items: end center;
  align-self: end;
  overflow: visible;
  background: transparent;
  border: 0;
}

.player-card .pixel-avatar {
  width: 96px;
  height: 128px;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: grayscale(1) contrast(1.1);
}

.player-card .health-glance {
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 0;
  border: 0;
}

.player-card .health-glance>div {
  min-width: 0;
  min-height: 30px;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 3px 2px;
  border: 0;
  border-bottom: 1.5px solid #18181b;
  text-align: left;
}

.player-card .health-glance strong {
  display: block;
  overflow: hidden;
  color: #222;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vital-icon {
  display: block;
  color: #2c2c2c;
}

.kcal-meter {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: #111;
  font-family: var(--font);
  cursor: pointer;
}

.kcal-meter:focus-visible {
  outline: 2px solid #18181b;
  outline-offset: 4px;
}

.kcal-meter-label {
  font-size: 16px;
  font-weight: 850;
  text-align: left;
}

.kcal-bar-track {
  width: 100%;
  height: 15px;
  overflow: hidden;
  border: 2px solid #18181b;
  border-radius: 5px;
  background: #fff;
}

.kcal-bar-fill {
  display: block;
  height: 100%;
  background: #18181b;
  transition: width 0.12s linear;
}

.kcal-meter-value {
  color: #333;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kcal-meter-value strong {
  font-weight: 700;
}

#view-home .macros-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  border: 0;
}

#view-home .macro-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 7px;
  align-items: center;
  gap: 5px 3px;
  min-width: 0;
}

#view-home .macro-label {
  grid-column: 1;
  grid-row: 1;
  overflow: hidden;
  color: #222;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-home .macro-val {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  color: #555;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-home .macro-bar-track {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 1.5px solid #18181b;
  border-radius: 3px;
  background: #fff;
}

#view-home .macro-bar {
  height: 100%;
  border-radius: 0;
  background: #18181b;
}

#view-home .section-head {
  justify-content: flex-end;
  min-height: 32px;
  margin: 0 0 8px;
  padding: 0 2px;
}

#view-home .section-title {
  display: none;
}

#view-home .timeline-actions {
  gap: 18px;
}

#view-home .timeline-edit-btn,
#view-home .timeline-snack-add {
  padding: 4px 0;
  color: #1f1f1f;
  font-size: 14px;
  font-weight: 600;
}

#view-home .timeline-edit-btn[aria-pressed="true"] {
  color: #000;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 4px;
}

#view-home .meals-section {
  --tl-x: 25px;
  --tl-dot: 9px;
  --tl-gutter: 62px;
  --btn-h: 36px;
  /* 보키 높이 증가 */
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

#view-home .meals-section::before {
  left: calc(var(--tl-x) - 2px);
  top: 34px;
  bottom: 34px;
  width: 4px;
  background: #1c1c1e;
  /* 검정색 실선 */
}

#view-home .meal-card,
#view-home .snack-card {
  min-height: 72px;
  margin-left: var(--tl-gutter);
  overflow: visible;
  border: 2px solid #1c1c1e;
  border-radius: 10px;
  background: #faf9f7;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}

#view-home .snack-card,
#view-home .snack-card.has-items {
  border-color: #1c1c1e;
  background: #faf9f7;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}

#view-home .meal-card:hover,
/* 카드는 그대로 유지 (투명도 제거) */
#view-home .meal-card.expanded {
  border-color: #1c1c1e;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}


#view-home .meal-card .meal-header,
#view-home .meal-card:not(.expanded) .meal-header {
  min-height: 69px;
  padding: 12px 14px;
  border-radius: 8px 8px 0 0;
  background: transparent;
  /* 카드 배경이 보여야 모서리가 짜리지 않음 */
}

#view-home .snack-card .snack-header {
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 8px 8px 0 0;
  background: transparent;
}

#view-home .meal-info-btn,
#view-home .snack-main {
  gap: 5px;
  padding: 2px 0;
  border-radius: 0;
}

#view-home .meal-info-btn:hover,
#view-home .snack-main:hover {
  background: transparent;
}

#view-home .meal-title-row,
#view-home .snack-title-row {
  gap: 10px;
}

#view-home .meal-name {
  color: #111;
  font-size: 17px;
  font-weight: 850;
  letter-spacing: -0.45px;
}

#view-home .snack-name {
  color: #111;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -0.3px;
}

#view-home .meal-kcal,
#view-home .snack-slot-kcal {
  color: #929292;
  font-size: 13px;
  font-weight: 550;
}

#view-home .meal-foods,
#view-home .snack-slot-foods {
  max-width: 100%;
  padding-left: 2px;
  color: #8c8c8c;
  font-size: 12px;
  line-height: 1.2;
}

#view-home .meal-card::before,
#view-home .snack-card::before {
  left: calc(var(--tl-x) - var(--tl-gutter) - var(--tl-dot) / 2);
  top: 30px;
  width: var(--tl-dot);
  height: var(--tl-dot);
  border: 1.5px solid #b8b0a6;
  background: #fff;
}

/* 먹은 끼니는 동그라미를 검정색으로 채움 */
#view-home .meal-card.has-items::before,
#view-home .snack-card.has-items::before {
  border-color: #1c1c1e;
  background: #1c1c1e;
}

#view-home .timeline-time-control,
#view-home .snack-card .timeline-time-control {
  left: calc(var(--tl-x) - var(--tl-gutter));
  top: 22px;
  width: 56px;
  transform: translateX(-50%);
  color: #a2a2a2;
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
}

#view-home .timeline-time-button {
  height: var(--btn-h);
  min-height: var(--btn-h);
  max-height: var(--btn-h);
  width: 100%;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 1.5px solid #c8c8c8;
  border-radius: 3px;
  background: #fff;
  /* 안먹은 카드: 흰색 */
  color: #999;
  letter-spacing: -0.2px;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* 먹은 카드: 회색 */
#view-home .meal-card.has-items .timeline-time-button,
#view-home .snack-card.has-items .timeline-time-button {
  border-color: #b0aea9;
  background: #e8e6e3;
  color: #666;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

/* 현재 시간대 도트: 검정색 */
#view-home .meal-card.is-current::before,
#view-home .snack-card.is-current::before {
  border-color: #1c1c1e;
  background: #1c1c1e;
}

/* 현재 시간대: 검정색 + 화살표 박스 (다른 라벨과 동일 너비/패딩) */
#view-home .meal-card.is-current .timeline-time-button,
#view-home .snack-card.is-current .timeline-time-button {
  border-color: #1c1c1e;
  background: #1c1c1e;
  color: #fff;
  width: calc(100% + 5px);
  /* 오른쪽으로 12px 더 길게 */
  padding: 0 5px;
  border-radius: 0;
  clip-path: polygon(3px 0,
      calc(100% - 8px) 0,
      calc(100% - 5px) 15%,
      100% 50%,
      calc(100% - 5px) 85%,
      calc(100% - 8px) 100%,
      3px 100%,
      0 calc(100% - 3px),
      0 3px);
}

#view-home .timeline-editing .timeline-time-button,
.timeline-editing #view-home .timeline-time-button {
  pointer-events: auto;
}

#view-home .meal-header>.add-btn,
#view-home .snack-header>.add-btn {
  display: none;
}

.timeline-editing #view-home .drag-handle {
  position: absolute;
  top: 20px;
  right: 10px;
  left: auto;
  display: flex;
}

.timeline-editing #view-home .meal-header,
.timeline-editing #view-home .snack-header {
  padding-right: 48px;
}

#view-home .meal-card.expanded .meal-items,
#view-home .snack-card.expanded .meal-items {
  margin-top: 0;
  padding: 6px 22px 12px;
  gap: 0;
  /* 제품 간 간격 제거하여 줄노트처럼 붙임 */
  border-top: none;
  border-radius: 0 0 8px 8px;
}

#view-home .food-item {
  border: none;
  border-top: 1px solid #1c1c1e;
  border-bottom: 1px solid #1c1c1e;
  margin-top: -1px;
  /* 겹치는 선 합침 */
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#view-home .day-clear-row {
  margin-top: 10px;
  padding-right: 2px;
}

.modal-record-selector {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 12px;
}

.modal-record-selector[hidden] {
  display: none !important;
}

.modal-record-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.modal-record-opt {
  min-height: 36px;
  padding: 7px 3px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.modal-record-opt.active {
  border-color: #18181b;
  background: #18181b;
  color: #fff;
}

.bottom-nav {
  min-height: 74px;
  padding: 9px max(14px, var(--safe-right)) calc(10px + var(--safe-bottom)) max(14px, var(--safe-left));
  border: 0;
  background: #1e1e1e;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.bottom-nav .nav-item {
  flex: 1 1 0;
  width: auto;
  max-width: 72px;
  height: 52px;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: #efefef;
}

.bottom-nav .nav-item svg,
.bottom-nav .nav-item .nav-icon {
  width: 27px;
  height: 27px;
  object-fit: contain;
  display: block;
}

/* 다크 하단 바: 흑색 SVG 에셋을 밝게 */
.bottom-nav .nav-item .nav-icon {
  filter: invert(1) brightness(1.05);
  opacity: 0.88;
}

.bottom-nav .nav-item.active .nav-icon {
  opacity: 1;
}

.bottom-nav .nav-item .nav-chat-icon text {
  pointer-events: none;
}

.home-utility-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.food-edit img,
.food-del img,
.card-clear-record img {
  width: 15px;
  height: 15px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.bottom-nav .nav-item span {
  display: none;
}

.bottom-nav .nav-item.active {
  border-color: #4b4b4b;
  background: #080808;
  color: #fff;
}

@media (max-width: 359px) {
  #view-home .home-brand {
    padding-top: 18px;
    padding-bottom: 16px;
  }

  #view-home .day-summary {
    padding-right: 10px;
    padding-left: 10px;
  }

  .player-card {
    grid-template-columns: minmax(66px, 1fr) 88px minmax(64px, 1fr);
    padding-right: 10px;
    padding-left: 10px;
  }

  .player-card .main-avatar {
    width: 88px;
  }

  .player-card .pixel-avatar {
    width: 86px;
  }

  .level-bubble {
    font-size: 9px;
  }

  .kcal-meter {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 6px;
  }

  .kcal-meter-value {
    font-size: 10px;
  }

  #view-home .meals-section {
    --tl-gutter: 58px;
  }
}

/* ============================
   HOME FLOW REFINEMENTS — v46
   ============================ */
#view-home .day-summary {
  gap: 14px;
  padding: 14px 16px 18px;
}

#view-home .date-display {
  display: grid;
  grid-template-rows: 14px auto;
  place-items: center;
  gap: 2px;
  position: relative;
}

#view-home .date-badge,
#view-home .go-today-btn {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  margin: 0;
}

#view-home .date-text {
  grid-column: 1;
  grid-row: 2;
}

#view-home .go-today-btn {
  padding: 0 7px;
  line-height: 14px;
}

#view-home .player-card {
  padding: 16px 18px;
}

#view-home .kcal-meter,
#view-home .macros-panel {
  padding-right: 4px;
  padding-left: 4px;
}

#view-home .meals-section::before {
  display: none;
}

#view-home .meal-header>.add-btn,
#view-home .snack-header>.add-btn {
  width: 30px;
  height: 30px;
  display: flex;
  border: 1.5px solid #18181b;
  border-radius: 50%;
  background: #fff;
  color: #18181b;
}

#view-home .meal-header>.add-btn:hover,
#view-home .snack-header>.add-btn:hover {
  background: #18181b;
  color: #fff;
}

.timeline-editing #view-home .meal-header>.add-btn,
.timeline-editing #view-home .snack-header>.add-btn {
  display: none;
}

#view-home .meal-card .meal-items,
#view-home .snack-card .meal-items {
  display: none !important;
}

#view-home .meal-card.expanded,
#view-home .snack-card.expanded {
  min-height: 72px;
}

#view-home .snack-card.drop-placeholder .snack-header {
  min-height: 56px;
}

#view-home .snack-card.drop-placeholder .snack-slot-foods {
  display: none;
}

/* 끼니별 음식 관리 페이지 */
.meal-detail-page {
  padding-top: 0;
  padding-bottom: 26px;
  background: #fff;
}

.meal-page-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 86px;
  border-bottom: 1px solid #dfdfdf;
}

.meal-page-back {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #18181b;
  cursor: pointer;
}

.meal-page-heading {
  min-width: 0;
}

.meal-page-date {
  display: block;
  margin-bottom: 2px;
  color: #8a8a8a;
  font-size: 11px;
  font-weight: 650;
}

.meal-page-heading h1 {
  overflow: hidden;
  font-size: 25px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-page-add,
.meal-page-empty-add {
  padding: 9px 12px;
  border: 1.5px solid #18181b;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.meal-page-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 20px 0 26px;
  padding: 16px 10px;
  border-radius: 16px;
  background: #f2f2f2;
}

.meal-page-summary>div {
  min-width: 0;
  padding: 0 8px;
  border-right: 1px solid #d0d0d0;
  text-align: center;
}

.meal-page-summary>div:last-child {
  border-right: 0;
}

.meal-page-summary span,
.meal-page-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-page-summary span {
  margin-bottom: 5px;
  color: #777;
  font-size: 9px;
  font-weight: 700;
}

.meal-page-summary strong {
  color: #18181b;
  font-size: 14px;
  font-weight: 850;
}

.meal-page-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.meal-page-list-head h2 {
  flex-shrink: 0;
  font-size: 17px;
  font-weight: 850;
}

.meal-page-list-head span {
  color: #888;
  font-size: 9px;
  text-align: right;
}

.meal-page-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meal-page-items .food-item {
  min-height: 78px;
  padding: 14px;
  border: 1.5px solid #18181b;
  border-radius: 14px;
  background: #fff;
}

.meal-page-items .food-name {
  font-size: 16px;
  font-weight: 850;
}

.meal-page-items .food-cal {
  border: 0;
  background: #ededed;
}

body:not(.timeline-editing) #view-meal-detail .food-actions,
#view-meal-detail .food-actions {
  display: flex;
}

#view-meal-detail .food-drag-handle {
  display: none;
}

.timeline-editing #view-meal-detail .food-drag-handle {
  display: flex;
}

#view-meal-detail .food-edit,
#view-meal-detail .food-del {
  width: 32px;
  height: 32px;
  border: 1px solid #d5d5d5;
  border-radius: 9px;
  color: #18181b;
}

.meal-page-empty-add {
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  background: #fff;
  color: #18181b;
}

body.meal-page-open .bottom-nav {
  display: none;
}

/* 최근 7일: 막대 대신 선과 투명 면 */
.week-chart {
  display: block;
  min-height: 142px;
}

.week-line-plot {
  width: 100%;
  height: 112px;
  overflow: hidden;
}

.week-line-plot svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.week-line-target {
  stroke: rgba(24, 24, 27, 0.32);
  stroke-width: 1.5;
  stroke-dasharray: 8 7;
}

.week-line-area {
  fill: rgba(24, 24, 27, 0.12);
}

.week-line-path {
  fill: none;
  stroke: #18181b;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.week-line-dot {
  fill: #fff;
  stroke: #18181b;
  stroke-width: 3;
}

.week-line-dot.is-selected {
  fill: #18181b;
}

.week-line-labels {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.week-line-day {
  min-width: 0;
  padding: 3px 1px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #777;
  font-family: var(--font);
  cursor: pointer;
}

.week-line-day span,
.week-line-day strong {
  display: block;
}

.week-line-day span {
  margin-bottom: 2px;
  font-size: 10px;
  font-weight: 800;
}

.week-line-day strong {
  overflow: hidden;
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
}

.week-line-day.is-selected {
  background: #18181b;
  color: #fff;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    padding-right: 12px;
    padding-left: 12px;
  }

  #view-home .player-card {
    padding-right: 12px;
    padding-left: 12px;
  }

  .meal-page-add {
    padding-right: 8px;
    padding-left: 8px;
    font-size: 10px;
  }
}

/* ============================
   FIGMA HOME PROPORTIONS — v47
   좌표 복사가 아닌 반응형 간격 규칙
   ============================ */
#view-home {
  --home-edge: clamp(16px, 7.12vw, 28px);
  padding-right: max(var(--home-edge), var(--safe-right));
  padding-left: max(var(--home-edge), var(--safe-left));
}

#view-home .home-brand {
  padding: 24px 0 22px;
}

#view-home .day-summary {
  gap: 10px;
  margin-right: 0;
  margin-left: 0;
  padding: 10px 14px 16px;
  border-radius: 17px;
}

#view-home .date-header {
  min-height: 40px;
}

#view-home .date-header .nav-btn {
  width: 36px;
  height: 36px;
}

#view-home .date-badge {
  font-size: 10px;
}

#view-home .date-text {
  font-size: 17px;
}

#view-home .player-card {
  min-height: 155px;
  margin-right: 10px;
  margin-left: 10px;
  padding: 14px 18px;
  border-radius: 10px;
}

#view-home .kcal-meter,
#view-home .macros-panel {
  padding-right: 10px;
  padding-left: 10px;
}

#view-home .section-head {
  min-height: 30px;
  margin-bottom: 8px;
  padding-right: 6px;
  padding-left: 6px;
}

#view-home .meals-section {
  --tl-x: 22px;
  --tl-gutter: 56px;
  --tl-dot: 8px;
  gap: 10px;
}

#view-home .meals-section::before {
  display: block;
  left: calc(var(--tl-x) - 0.5px);
  top: 32px;
  bottom: 32px;
  width: 1px;
  background: repeating-linear-gradient(to bottom,
      #c9c9c9 0 7px,
      transparent 7px 11px);
}

#view-home .meal-card,
#view-home .snack-card {
  min-height: 66px;
  border-radius: 10px;
  /* 모바일에서도 모서리 유지 */
}

#view-home .snack-card,
#view-home .snack-card.has-items {
  min-height: 54px;
}

#view-home .meal-card .meal-header,
#view-home .meal-card:not(.expanded) .meal-header {
  min-height: 63px;
  padding: 10px 18px;
  border-radius: 0;
}

#view-home .snack-card .snack-header {
  min-height: 51px;
  padding: 8px 18px;
  border-radius: 0;
}

#view-home .meal-name,
#view-home .snack-name {
  font-size: 16px;
}

#view-home .meal-kcal,
#view-home .snack-slot-kcal {
  font-size: 12px;
}

#view-home .meal-foods,
#view-home .snack-slot-foods {
  font-size: 11px;
}

#view-home .meal-card::before,
#view-home .snack-card::before {
  top: 29px;
}

#view-home .snack-card::before {
  top: 23px;
}

#view-home .timeline-time-control,
#view-home .snack-card .timeline-time-control {
  left: calc(var(--tl-x) - var(--tl-gutter));
  top: 20px;
  width: 50px;
  font-size: 10px;
}

#view-home .snack-card .timeline-time-control {
  top: 14px;
}

#view-home .meals-section {
  --btn-h: 22px;
  /* 작은 화면 버튼 높이 변경 */
}

#view-home .timeline-time-button {
  padding: 0 6px;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    padding-right: 12px;
    padding-left: 12px;
  }

  #view-home .player-card {
    margin-right: 6px;
    margin-left: 6px;
    padding-right: 10px;
    padding-left: 10px;
  }

  #view-home .kcal-meter,
  #view-home .macros-panel {
    padding-right: 6px;
    padding-left: 6px;
  }

  #view-home .meals-section {
    --tl-gutter: 52px;
    --tl-x: 20px;
  }
}

/* ============================
   FIGMA HOME MATCH — v48
   393 × 852 기준점을 유동 레이아웃으로 변환
   ============================ */
#view-home .home-brand {
  height: 103px;
  min-height: 103px;
  padding: 18px 0 25px;
  align-items: center;
}

#view-home .home-brand-name {
  font-size: clamp(32px, 9.16vw, 36px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1.8px;
}

#view-home .home-utilities {
  gap: 6px;
  margin-top: -6px;
}

#view-home .home-utility-btn {
  width: 42px;
  height: 42px;
}

#view-home .home-utility-btn svg {
  width: 34px;
  height: 34px;
}

#view-home .day-summary {
  height: 285px;
  min-height: 285px;
  display: grid;
  grid-template-rows: 41px 155px 24px 15px 7px 21px;
  gap: 0;
  margin-bottom: 14px;
  padding: 10px 14px 12px;
  overflow: hidden;
}

#view-home .date-header {
  grid-row: 1;
  height: 41px;
  min-height: 41px;
}

#view-home .date-display {
  font-family: var(--font);
}

#view-home .date-text {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.8px;
}

#view-home .player-card {
  grid-row: 2;
  width: auto;
  height: 155px;
  min-height: 155px;
  margin: 0 12px;
}

#view-home .player-card .health-glance strong {
  font-size: 13px;
}

#view-home .kcal-meter {
  grid-row: 4;
  height: 15px;
  min-height: 15px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 6px;
  padding: 0 12px;
}

#view-home .kcal-meter-label {
  font-size: 16px;
  line-height: 15px;
}

#view-home .kcal-bar-track {
  height: 14px;
}

#view-home .kcal-meter-value {
  font-family: var(--font);
  font-size: 10px;
}

#view-home .macros-panel {
  grid-row: 6;
  height: 21px;
  gap: 9px;
  padding: 0 12px;
}

#view-home .macro-row {
  grid-template-rows: 9px 7px;
  gap: 5px 3px;
}

#view-home .section-head {
  height: 30px;
  min-height: 30px;
  margin-bottom: 8px;
}

#view-home .meals-section {
  --tl-x: 22px;
  --tl-gutter: 56px;
  --tl-dot: 8px;
  gap: 10px;
}

#view-home .meal-card {
  min-height: 64px;
}

#view-home .snack-card,
#view-home .snack-card.has-items {
  min-height: 46px;
}

#view-home .meal-card .meal-header,
#view-home .meal-card:not(.expanded) .meal-header {
  min-height: 61px;
  padding: 10px 20px;
}

#view-home .snack-card .snack-header {
  min-height: 43px;
  padding: 6px 20px;
}

#view-home .meal-name,
#view-home .snack-name {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

#view-home .meal-kcal,
#view-home .snack-slot-kcal {
  font-family: var(--font);
  font-size: 13px;
}

#view-home .meal-foods,
#view-home .snack-slot-foods {
  padding-left: 0;
  font-family: var(--font);
  font-size: 11px;
}

#view-home .timeline-time-control,
#view-home .snack-card .timeline-time-control {
  width: 43px;
}

#view-home .meals-section {
  --btn-h: 20px;
  /* 초소형 화면 버튼 높이 변경 */
}

#view-home .timeline-time-button {
  width: 43px;
  padding: 0 4px;
  font-size: 10px;
}

.bottom-nav {
  min-height: 90px;
  padding: 9px max(8px, var(--safe-right)) calc(10px + var(--safe-bottom)) max(8px, var(--safe-left));
}

.bottom-nav .nav-item {
  flex: 1 1 0;
  width: auto;
  max-width: 89px;
  height: 71px;
  border-radius: 13px;
}

.bottom-nav .nav-item svg {
  width: 36px;
  height: 36px;
}

@media (max-width: 359px) {
  #view-home .home-brand {
    height: 94px;
    min-height: 94px;
  }

  #view-home .day-summary {
    height: 278px;
    min-height: 278px;
    grid-template-rows: 38px 150px 22px 15px 7px 20px;
    padding-top: 8px;
    padding-bottom: 18px;
  }

  #view-home .player-card {
    height: 150px;
    min-height: 150px;
  }

  #view-home .kcal-meter,
  #view-home .macros-panel {
    padding-right: 6px;
    padding-left: 6px;
  }

  .bottom-nav .nav-item svg {
    width: 32px;
    height: 32px;
  }
}

/* ============================
   REFRESH STABILITY — v49
   로딩 중 폭 변화와 타임라인 깜빡임 방지
   ============================ */
#view-home .kcal-meter {
  grid-template-columns: 30px minmax(0, 1fr) 76px;
  column-gap: 0;
}

#view-home .kcal-meter-label {
  width: 30px;
  overflow: visible;
  font-size: 15px;
  white-space: nowrap;
}

#view-home .kcal-meter-value {
  width: 76px;
  min-width: 76px;
  padding-left: 7px;
  text-align: right;
}

#view-home .meals-section,
.app-ready #view-home .meals-section {
  opacity: 1;
  transition: none;
}

/* ============================
   HOME TYPOGRAPHY SYSTEM — v50
   시스템 서체 하나와 제한된 굵기 단계만 사용
   ============================ */
#view-home,
.bottom-nav,
#view-home button {
  font-family: var(--font);
}

#view-home .home-brand-name {
  font-family: var(--font);
  font-size: clamp(32px, 8.9vw, 35px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1.4px;
}

#view-home .date-display,
#view-home .level-bubble,
#view-home .kcal-meter-value,
#view-home .meal-name,
#view-home .snack-name,
#view-home .meal-kcal,
#view-home .snack-slot-kcal,
#view-home .meal-foods,
#view-home .snack-slot-foods {
  font-family: var(--font);
}

#view-home .date-badge {
  color: #8a8a8f;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
}

#view-home .date-text {
  color: #18181b;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.35px;
  font-variant-numeric: tabular-nums;
}

#view-home .level-bubble {
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.2px;
}

#view-home .player-measurements p,
#view-home .player-measurements p strong,
#view-home .player-card .health-glance strong {
  font-size: 12px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

#view-home .player-measurements p span {
  font-weight: 800;
}

#view-home .player-measurements p strong,
#view-home .player-card .health-glance strong {
  font-weight: 600;
}

#view-home .kcal-meter-label {
  font-size: 14px;
  font-weight: 800;
  line-height: 15px;
  letter-spacing: -0.3px;
}

#view-home .kcal-meter-value {
  color: #3f3f46;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.15px;
  font-variant-numeric: tabular-nums;
}

#view-home .kcal-meter-value strong {
  font-weight: 700;
}

#view-home .macro-label {
  color: #27272a;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.15px;
}

#view-home .macro-val {
  color: #71717a;
  font-size: 8px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.1px;
  font-variant-numeric: tabular-nums;
}

#view-home .timeline-edit-btn,
#view-home .timeline-snack-add {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

#view-home .meal-title-row,
#view-home .snack-title-row {
  align-items: baseline;
  gap: 8px;
}

#view-home .meal-name {
  color: #18181b;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.35px;
}

#view-home .snack-name {
  color: #18181b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

#view-home .meal-kcal,
#view-home .snack-slot-kcal {
  color: #8a8a8f;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.15px;
  font-variant-numeric: tabular-nums;
}

#view-home .meal-info-btn,
#view-home .snack-main {
  gap: 4px;
}

#view-home .meal-foods,
#view-home .snack-slot-foods {
  color: #8a8a8f;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.1px;
}

#view-home .snack-card .snack-header {
  padding-top: 6px;
  padding-bottom: 6px;
  min-height: 48px;
}

#view-home .timeline-time-button {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.15px;
  font-variant-numeric: tabular-nums;
}

.bottom-nav .nav-item {
  font-family: var(--font);
}

/* ============================
   HOME DETAIL REFINEMENTS — v51
   날짜·활동량·영양소·드래그 정렬
   ============================ */
#view-home .date-display {
  height: 41px;
  grid-template-rows: 12px 29px;
  gap: 0;
}

#view-home .date-badge,
#view-home .go-today-btn {
  grid-row: 1;
}

#view-home .date-text {
  grid-row: 2;
  align-self: center;
}

#view-home .date-header .nav-btn {
  transform: translateY(5px);
}

#view-home .player-card {
  grid-template-columns: minmax(76px, 1fr) 88px minmax(76px, 1fr);
}

#view-home .player-card .main-avatar {
  width: 88px;
  height: 132px;
}

#view-home .player-card .pixel-avatar {
  width: 88px;
  height: 132px;
  object-fit: contain;
  object-position: center bottom;
  filter: none;
}

#view-home .player-card .health-glance {
  width: max-content;
  max-width: 100%;
  align-self: stretch;
  justify-self: end;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 3px;
  padding-bottom: 10px;
}

#view-home .player-card .health-glance>div {
  width: 100%;
  min-height: 18px;
  grid-template-columns: 15px auto;
  gap: 5px;
  padding: 0;
  border: 0;
  text-align: left;
}

#view-home .player-card .health-glance strong {
  overflow: visible;
  text-align: left;
  text-overflow: clip;
}

#view-home .kcal-meter {
  grid-template-columns: 28px minmax(0, 1fr) 76px;
  column-gap: 6px;
}

#view-home .kcal-meter-label {
  width: 28px;
}

#view-home .kcal-meter-value {
  padding-left: 0;
}

#view-home .day-summary {
  grid-template-rows: 41px 155px 24px 15px 2px 26px;
}

#view-home .macros-panel {
  height: 26px;
  gap: 10px;
}

#view-home .macro-row {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 9px 10px;
  gap: 3px 5px;
}

#view-home .macro-label {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
}

#view-home .macro-bar-track {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

#view-home .macro-val {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  text-align: right;
}

.timeline-editing #view-home .drag-handle {
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

#view-home .snack-card.drop-placeholder {
  min-height: 34px;
}

#view-home .snack-card.drop-placeholder .snack-header {
  min-height: 31px;
  padding-top: 2px;
  padding-bottom: 2px;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    grid-template-rows: 38px 150px 22px 15px 2px 25px;
  }

  #view-home .player-card {
    grid-template-columns: minmax(66px, 1fr) 82px minmax(66px, 1fr);
  }

  #view-home .player-card .main-avatar,
  #view-home .player-card .pixel-avatar {
    width: 82px;
  }
}

/* v53 — 마지막 캐스케이드에서 반응형 크기 규칙을 확정 */
#view-home .player-card {
  width: auto;
  min-width: 0;
  margin-inline: clamp(0px, 2.4vw, 12px);
  padding-inline: clamp(8px, 3.8vw, 18px);
  grid-template-columns: minmax(0, 1fr) clamp(70px, 23vw, 88px) minmax(0, 1fr);
  gap: clamp(3px, 1.5vw, 8px);
  justify-self: stretch;
}

#view-home .player-card>*,
#view-home .player-measurements,
#view-home .player-card .health-glance {
  min-width: 0;
}

#view-home .player-card .main-avatar,
#view-home .player-card .pixel-avatar {
  width: clamp(70px, 23vw, 88px);
}

#view-home .player-card .health-glance {
  width: 100%;
  max-width: none;
  justify-self: stretch;
}

#view-home .player-card .health-glance strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-home .kcal-bar-track,
#view-home .macro-bar-track {
  height: 9px;
  border: 1.5px solid #18181b;
  border-radius: 3px;
}

/* 상세 화면의 복귀·검색 행동은 항상 보이는 헤더에 둔다. */
.meal-page-header {
  position: sticky;
  z-index: 4;
  top: 0;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  background: #fff;
}

.meal-page-back {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 750;
}

.meal-page-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

@media (max-width: 359px) {
  #view-home .player-card {
    margin-inline: 0;
    padding-inline: 8px;
    grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr);
    gap: 3px;
  }

  #view-home .player-card .main-avatar,
  #view-home .player-card .pixel-avatar {
    width: 70px;
  }

  #view-home .level-bubble {
    padding-inline: 5px;
    font-size: 8px;
  }

  #view-home .player-measurements p,
  #view-home .player-measurements p strong,
  #view-home .player-card .health-glance strong {
    font-size: 10px;
  }

  .meal-page-header {
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 6px;
  }

  .meal-page-back {
    gap: 4px;
    font-size: 10px;
  }

  .meal-page-add {
    padding-inline: 8px;
  }

  .meal-page-add span {
    font-size: 9px;
  }
}

/* ============================
   HOME FLOW & LIBRARY — v54
   읽기/편집 동선, 3주 달력, 푸드북, AI 공간
   ============================ */
#view-home .day-summary {
  height: 303px;
  min-height: 303px;
  grid-template-rows: 41px 163px 32px 15px 4px 26px;
}

#view-home .date-header .nav-btn {
  width: 40px;
  height: 40px;
  transform: translateY(2px);
}

#view-home .date-header .nav-btn svg {
  width: 9px;
  height: 16px;
}

#view-home .player-card {
  height: 155px;
  min-height: 155px;
  margin-top: 8px;
}

#view-home .player-card .health-glance {
  width: 100%;
  justify-self: start;
  align-items: flex-start;
  text-align: left;
}

#view-home .player-card .health-glance>div {
  width: auto;
  max-width: 100%;
  grid-template-columns: 15px minmax(0, auto);
  justify-content: start;
  text-align: left;
}

#view-home .player-card .health-glance strong {
  text-align: left;
}

/* 평상시에는 홈에서 목록을 펼치고, 편집 시 상세 관리 페이지를 사용한다. */
#view-home .meal-card.expanded .meal-items,
#view-home .snack-card.expanded .meal-items {
  display: flex !important;
  max-height: 420px;
  opacity: 1;
  overflow-y: auto;
  padding: 6px 22px 12px;
  gap: 0;
  border-top: none;
  border-radius: 0 0 8px 8px;
}

#view-home .meal-card.expanded,
#view-home .snack-card.expanded {
  min-height: 118px;
}

#view-home .meal-items .food-item {
  min-height: 48px;
  height: auto;
  padding: 8px 4px;
  border: none;
  border-top: 1px solid #1c1c1e;
  border-bottom: 1px solid #1c1c1e;
  margin-top: -1px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #4a4845;
}

#view-home .meal-items .food-name {
  font-size: 12.5px;
  font-weight: 550;
  color: #4a4845;
}

#view-home .meal-items .food-cal {
  font-size: 11.5px;
  font-weight: 500;
  color: #6a6762;
  margin-left: auto;
}

.search-hub-tabs {
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  overflow-x: auto;
  scrollbar-width: none;
}

.search-hub-tabs::-webkit-scrollbar,
.search-index-categories::-webkit-scrollbar {
  display: none;
}

.search-index-categories {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 0 0 12px;
  padding: 1px 0 3px;
}

.search-index-category-btn {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  background: #fff;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.search-index-category-btn.active {
  border-color: #18181b;
  background: #18181b;
  color: #fff;
}

.search-index-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.search-index-item {
  aspect-ratio: 1 / 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 4px;
  padding: 13px;
  overflow: hidden;
  text-align: left;
}

.search-index-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin: 0 0 auto;
  border-radius: 50%;
  background: var(--bg3);
}

.search-index-icon svg {
  width: 24px;
  height: 24px;
}

.search-index-category {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
}

.search-index-item>strong {
  width: 100%;
  overflow: hidden;
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-index-meta {
  color: var(--text-muted);
  font-size: 9px;
  white-space: nowrap;
}

.library-empty-state {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  text-align: center;
}

.library-empty-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border: 1.5px solid #18181b;
  border-radius: 14px;
  font-size: 21px;
  font-weight: 900;
}

.library-empty-state h2 {
  font-size: 19px;
  font-weight: 850;
}

.library-empty-state p {
  max-width: 270px;
  margin: 7px 0 18px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.library-empty-state button {
  padding: 10px 13px;
  border: 0;
  border-radius: 10px;
  background: var(--bg3);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 750;
}

.cal-expand-toggle {
  width: 100%;
  min-height: 36px;
  margin-top: 8px;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.agent-page-head {
  position: relative;
  padding: 24px 2px 18px;
}

.agent-page-head p {
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1.2px;
}

.agent-page-head h1 {
  margin-top: 3px;
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.7px;
}

.agent-page-head>span {
  position: absolute;
  right: 2px;
  bottom: 20px;
  padding: 5px 8px;
  border-radius: 99px;
  background: var(--bg3);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 750;
}

.agent-welcome-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1.5px solid #18181b;
  border-radius: 17px;
}

.agent-mark {
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #18181b;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.agent-welcome-card h2 {
  font-size: 16px;
  font-weight: 850;
}

.agent-welcome-card p {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.agent-shortcuts {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.agent-shortcuts button {
  min-height: 64px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: #fff;
  color: var(--text-primary);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
}

.agent-shortcuts strong {
  font-size: 14px;
  font-weight: 850;
}

.agent-shortcuts span {
  color: var(--text-muted);
  font-size: 10px;
}

.agent-composer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--bg3);
}

.agent-composer input,
.agent-composer button {
  border: 0;
  background: transparent;
  font-family: var(--font);
}

.agent-composer input {
  min-width: 0;
  padding: 0 7px;
  color: var(--text-muted);
  font-size: 11px;
}

.agent-composer button {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #d4d4d8;
  color: #fff;
  font-size: 18px;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    height: 294px;
    min-height: 294px;
    grid-template-rows: 38px 158px 28px 15px 3px 25px;
  }

  #view-home .player-card {
    height: 150px;
    min-height: 150px;
  }

  .search-hub-tab {
    font-size: 11px;
  }
}

/* ============================
   INLINE EDIT & DEMO FLOW — v55
   홈 편집·카테고리 도감·로컬 에이전트 데모
   ============================ */
#view-home .day-summary {
  height: 314px;
  min-height: 314px;
  grid-template-rows: 41px 163px 32px 26px 4px 26px;
}

#view-home .player-card .health-glance {
  width: max-content;
  max-width: 100%;
  justify-self: end;
  align-items: stretch;
  text-align: right;
}

#view-home .player-card .health-glance>div {
  width: 100%;
  grid-template-columns: 15px minmax(48px, auto);
  justify-content: end;
}

#view-home .player-card .health-glance strong {
  text-align: right;
}

#view-home .kcal-meter {
  height: 26px;
  min-height: 26px;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 10px 10px;
  gap: 3px 7px;
  padding: 0 12px;
}

#view-home .kcal-meter-label {
  grid-column: 1;
  grid-row: 1;
  width: auto;
  font-size: 14px;
  line-height: 10px;
}

#view-home .kcal-bar-track {
  grid-column: 2;
  grid-row: 1;
  height: 9px;
}

#view-home .kcal-meter-value {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  padding: 0;
  font-size: 9px;
  line-height: 10px;
}

.search-index-categories[hidden] {
  display: none;
}

.search-index-categories {
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  overflow: visible;
  padding: 0;
}

.search-index-back {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.search-index-current {
  font-size: 14px;
  font-weight: 850;
}

.search-category-card {
  aspect-ratio: 1 / 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 4px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: #fff;
  color: var(--text-primary);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
}

.search-category-card .search-index-icon {
  margin-bottom: auto;
}

.search-category-card>strong {
  font-size: 15px;
  font-weight: 900;
}

.search-category-count {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 750;
}

.search-category-card>small {
  width: 100%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-day-meals {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.stats-day-meals[hidden] {
  display: none;
}

.stats-day-meal-link {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--text-primary);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
}

.stats-day-meal-link span,
.stats-day-meal-link strong {
  font-size: 12px;
  font-weight: 800;
}

.stats-day-meal-link small {
  color: var(--text-muted);
  font-size: 9px;
}

.stats-day-meal-link i {
  font-size: 19px;
  font-style: normal;
  line-height: 1;
}

#view-ai {
  padding-bottom: 0;
}

.agent-methods {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.agent-method {
  min-width: 0;
  min-height: 108px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
}

.agent-method.active {
  border-color: #18181b;
}

.agent-method strong,
.agent-method span {
  display: block;
}

.agent-method strong {
  font-size: 12px;
  font-weight: 850;
}

.agent-method span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 750;
}

.agent-method p {
  margin-top: 9px;
  color: var(--text-secondary);
  font-size: 9px;
  line-height: 1.45;
}

/* Messenger-style chat */
#view-ai:not([hidden]) {
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

#view-ai[hidden] {
  display: none !important;
}

#view-ai .agent-page-head {
  flex: 0 0 auto;
  padding: 18px 0 25px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  background: #ffffff;
}

#view-ai .agent-page-head p {
  letter-spacing: 0.4px;
  text-transform: none;
  font-size: 11px;
  font-weight: 600;
  color: #8e8e93;
}

#view-ai .agent-page-head h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #000;
}

#view-ai .agent-page-head>span,
#view-ai .agent-page-head>small {
  display: none;
}

#view-ai .agent-log {
  flex: 1 1 auto;
  max-height: none;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 16px 14px 12px;
  overflow-y: auto;
  background: #ffffff;
}

#view-ai .agent-composer {
  margin-top: auto;
}

.agent-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: fit-content;
  max-width: 88%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #000;
  font-size: 15px;
  line-height: 1.35;
}

.agent-message.is-agent {
  align-self: flex-start;
}

.agent-message.is-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.agent-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}

.agent-message-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.agent-message.is-user .agent-message-body {
  align-items: flex-end;
}

.agent-bubble {
  max-width: 100%;
  padding: 9px 13px;
  border-radius: 18px;
  background: #e9e9eb;
  color: #000;
  word-break: break-word;
}

.agent-message.is-user .agent-bubble {
  background: #007aff;
  color: #fff;
  border-bottom-right-radius: 5px;
}

.agent-message.is-agent .agent-bubble {
  border-bottom-left-radius: 5px;
}

.agent-bubble-text {
  display: block;
}

.agent-confirm {
  display: inline-flex;
  margin-top: 0;
  padding: 8px 14px;
  border: 0;
  border-radius: 16px;
  background: #007aff;
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.agent-confirm:disabled {
  opacity: 0.55;
}

#view-ai .agent-composer {
  position: sticky;
  right: auto;
  bottom: auto;
  left: auto;
  margin: 0 8px calc(12px + var(--safe-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 34px;
  gap: 6px;
  align-items: center;
  padding: 6px 8px 6px 14px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.06);
}

#view-ai .agent-composer input {
  order: 1;
}

#view-ai .agent-composer .agent-voice {
  order: 2;
}

#view-ai .agent-composer #agent-send {
  order: 3;
}

#view-ai .agent-composer input {
  min-height: 34px;
  padding: 0 4px;
  color: #000;
  font-size: 16px;
  background: transparent;
}

#view-ai .agent-composer input::placeholder {
  color: #8e8e93;
}

#view-ai .agent-composer .agent-voice,
#view-ai .agent-composer #agent-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #007aff;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
}

#view-ai .agent-composer .agent-voice {
  background: #e9e9eb;
  color: #000;
}

#view-ai .agent-composer .agent-voice.is-listening {
  background: #ff3b30;
  color: #fff;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    height: 305px;
    min-height: 305px;
    grid-template-rows: 38px 158px 28px 26px 3px 25px;
  }

  .agent-methods {
    grid-template-columns: 1fr;
  }

  .agent-method {
    min-height: 74px;
  }
}

/* v56 cascade lock: keep the newest responsive decisions last. */
#view-home .player-card .health-glance>div {
  grid-template-columns: minmax(48px, auto) 15px;
  justify-content: end;
}

#view-home .player-card .health-glance strong {
  grid-column: 1;
  text-align: right;
}

#view-home .player-card .health-glance .vital-icon {
  grid-column: 2;
}

.search-index-grid:not(.is-product-list) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.search-category-card {
  padding: 10px;
  border-radius: 12px;
}

.search-category-card .search-index-icon {
  width: 48px;
  height: 48px;
}

.search-category-card>strong {
  font-size: 12px;
}

.search-category-card>small {
  display: none;
}

.agent-page-head>span {
  right: 36px;
}

.agent-composer {
  grid-template-columns: minmax(0, 1fr) 38px 38px;
}

.agent-composer .agent-voice {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: #18181b;
}

.agent-composer .agent-voice.is-listening {
  background: #18181b;
  color: #fff;
}

@media (max-width: 359px) {
  .search-index-grid:not(.is-product-list) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-page-head h1 {
    max-width: 180px;
    font-size: 21px;
    line-height: 1.1;
  }
}

/* v57 final cascade lock */
.cal-day.is-today::before {
  display: none !important;
}

.cal-day.is-today .cal-day-dot {
  border: 1.5px solid #18181b;
  background: #fff;
}

.cal-day.is-today.has-log .cal-day-dot {
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px #18181b;
}

#view-home .day-summary {
  height: 324px;
  min-height: 324px;
  grid-template-rows: 41px 157px 42px 26px 4px 26px;
}

#view-home .kcal-meter {
  height: 38px;
  min-height: 38px;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 17px 11px;
  align-items: end;
  gap: 4px 8px;
  padding: 2px 12px 0;
  overflow: visible;
}

#view-home .kcal-meter-label {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  line-height: 12px;
}

#view-home .kcal-bar-track {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  height: 10px;
  align-self: end;
  overflow: visible;
}

#view-home .kcal-meter-value {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  justify-self: end;
  line-height: 10px;
}

.search-hub-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr)) minmax(86px, 1fr);
  gap: 4px;
  padding: 3px;
  overflow: visible;
}

.search-hub-index-tab {
  margin-left: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
}

.food-purpose-strip>span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  text-align: center;
}

.modal-overlay.snack-dialog .food-modal-sheet {
  max-height: min(72dvh, 620px);
}

.modal-overlay.snack-dialog .quick-foods {
  max-height: 250px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.timeline-editing #view-home .meal-card.expanded .meal-header>.drag-handle,
.timeline-editing #view-home .snack-card.expanded .snack-header>.drag-handle {
  display: none !important;
}

@media (max-width: 430px) {
  .search-hub-tabs {
    grid-template-columns: repeat(3, minmax(48px, 1fr)) 76px;
  }

  .search-hub-tab {
    min-height: 38px;
    padding-inline: 3px;
    font-size: 9px;
  }

  .search-hub-index-tab {
    grid-column: auto;
    margin: 0 0 0 5px;
  }
}

/* v58 final cascade lock */
.cal-day .cal-day-dot {
  display: none !important;
}

.cal-day.is-today .cal-day-dot {
  display: block !important;
  width: 5px;
  height: 5px;
  border: 0 !important;
  background: #18181b !important;
  box-shadow: none !important;
}

.cal-day.is-today.has-log .cal-day-dot {
  box-shadow: none !important;
}

.cal-legend-item .swatch.level-under {
  background: #169c5a !important;
}

.cal-legend-item .swatch.level-ok {
  background: #e4ad00 !important;
}

.cal-legend-item .swatch.level-over {
  background: #d83b3b !important;
}

#view-home .day-summary {
  height: 332px;
  min-height: 332px;
  grid-template-rows: 41px 157px 48px 26px 4px 26px;
}

#view-home .kcal-meter {
  height: 44px;
  min-height: 44px;
  grid-template-rows: 18px 14px;
  row-gap: 6px;
}

#view-home .kcal-bar-track {
  background: #dedfe2 !important;
}

#view-home .kcal-bar-fill {
  background: #18181b !important;
}

#view-home .kcal-target-marker {
  background: #18181b !important;
}

/* timeline line is set in the main section above */

#view-home .snack-card,
#view-home .snack-card.has-items {
  border-style: solid !important;
}

.collection-ingredient-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 8px;
}

.collection-ingredient-picker button {
  min-width: 52px;
  border: 0;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
}

.food-dex-badges {
  grid-column: 1 / -1;
  justify-self: end;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.food-dex-badge-list {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.6;
}

/* v59 — simplify search and tighten state feedback */
.search-hub-head {
  position: relative;
  padding-right: 42px;
}

.search-hub-close {
  position: absolute;
  top: 22px;
  right: 0;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: #18181b;
  font: 500 21px/1 var(--font);
  cursor: pointer;
}

.search-hub-tabs {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px;
  padding: 0 !important;
  overflow: visible !important;
  background: transparent !important;
}

.search-hub-main-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg3);
}

.search-hub-index-tab {
  min-width: 78px;
  margin: 0 !important;
  border: 1px solid var(--border-strong) !important;
  background: #fff;
}

.search-hub-index-tab.active {
  background: #18181b;
  color: #fff;
}

.search-purpose-strip>button.active {
  border-color: #18181b;
  background: #18181b;
  color: #fff;
}

.purpose-results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.purpose-results-head span {
  color: var(--text-muted);
  font-size: 9px;
}

.search-discovery-more {
  display: none !important;
}

.shopping-group article {
  grid-template-columns: minmax(0, 1fr) auto;
}

.shopping-group.is-priority article {
  grid-template-columns: 22px minmax(0, 1fr) auto;
}

.shopping-group[hidden] {
  display: none !important;
}

.cal-legend {
  border-top: 0 !important;
}

.cal-expand-toggle {
  border-top: 0 !important;
}

.cal-day.level-under .cal-day-kcal {
  color: #169c5a !important;
}

.cal-day.level-ok .cal-day-kcal {
  color: #a67c00 !important;
}

.cal-day.level-over .cal-day-kcal {
  color: #d83b3b !important;
}

#view-home .day-summary {
  height: 340px;
  min-height: 340px;
  grid-template-rows: 41px 157px 54px 28px 4px 28px;
}

#view-home .kcal-bar-track {
  height: 10px;
  border: 1px solid #18181b !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  background: #dedfe2 !important;
}

#view-home .kcal-bar-fill {
  border-radius: 999px 0 0 999px;
}

#view-home .kcal-meter:not(.is-over) .kcal-bar-fill {
  border-radius: 999px;
}

#view-home .kcal-over-fill {
  top: 0;
  bottom: 0;
  border-radius: 0 999px 999px 0;
}

#view-home .macros-panel {
  margin-top: 7px;
}

.collection-demo-product {
  margin-top: 14px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font: 800 11px/1 var(--font);
  cursor: pointer;
}

@media (max-width: 359px) {
  .search-hub-tabs {
    gap: 5px;
  }

  .search-hub-main-tabs .search-hub-tab {
    font-size: 8px;
  }

  .search-hub-index-tab {
    min-width: 68px;
    font-size: 8px;
  }
}

/* v60 — compact nutrition hierarchy, clearer food branding, simpler agent */
[hidden] {
  display: none !important;
}

#view-home .day-summary {
  height: 318px;
  min-height: 318px;
  grid-template-rows: 41px 157px 53px 32px;
  align-content: start;
  row-gap: 0;
}

#view-home .player-card {
  margin-bottom: 0;
}

#view-home .kcal-meter {
  height: 49px;
  min-height: 49px;
  margin-top: -6px;
  grid-template-rows: 22px 13px;
  row-gap: 6px;
  padding-top: 2px;
}

#view-home .kcal-bar-track {
  height: 14px;
  border-radius: 999px !important;
}

#view-home .kcal-bar-fill,
#view-home .kcal-over-fill {
  min-height: 100%;
}

#view-home .macros-panel {
  margin-top: 0;
  align-self: start;
}

#view-home .macro-bar-track,
#view-home .macro-bar {
  border-radius: 999px !important;
}

#view-home .macro-bar-track {
  overflow: hidden;
}

.search-hub-head h1 {
  font-size: 28px;
  letter-spacing: -0.8px;
}

.search-hub-close {
  border: 0 !important;
  background: transparent !important;
}

.search-hub-tab,
.search-hub-main-tabs .search-hub-tab,
.search-hub-index-tab {
  min-height: 42px;
  font-size: 11px !important;
  line-height: 1.1;
}

.search-hub-index-tab {
  min-width: 76px;
}

#collection-create {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.agent-page-head {
  padding-bottom: 12px;
}

.agent-welcome-card {
  display: block;
  padding: 14px 15px;
  border: 0;
  border-radius: 14px;
  background: var(--bg3);
}

.agent-welcome-card h2 {
  font-size: 15px;
}

.agent-welcome-card p {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.45;
}

.agent-log {
  margin-top: 12px;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    height: 306px;
    min-height: 306px;
    grid-template-rows: 38px 150px 52px 31px;
  }

  .search-hub-tabs {
    gap: 5px;
  }

  .search-hub-main-tabs .search-hub-tab,
  .search-hub-index-tab {
    font-size: 10px !important;
  }

  .search-hub-index-tab {
    min-width: 66px;
  }
}

/* v61 — align calorie meter with its target marker and protect value spacing */
#view-home .day-summary {
  grid-template-rows: 41px 155px 56px 34px;
}

#view-home .date-header {
  grid-row: 1;
}

#view-home .player-card {
  grid-row: 2;
}

#view-home .kcal-meter {
  grid-row: 3;
  height: 50px;
  min-height: 50px;
  margin-top: 6px;
  grid-template-rows: 20px 12px;
  row-gap: 8px;
  align-self: start;
  overflow: visible;
}

#view-home .kcal-bar-track {
  align-self: center;
}

#view-home .kcal-meter-value {
  position: relative;
  z-index: 2;
  min-height: 12px;
  line-height: 12px;
}

#view-home .macros-panel {
  grid-row: 4;
  margin-top: 6px;
}

#view-home .kcal-over-bubble {
  bottom: 20px;
}

#view-home .kcal-over-bubble.is-near-end {
  transform: translateX(-75%);
}

#view-home .kcal-over-bubble.is-near-end::after {
  left: 75%;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    grid-template-rows: 38px 150px 54px 33px;
  }

  #view-home .kcal-meter {
    height: 48px;
    min-height: 48px;
    margin-top: 4px;
  }
}

/* v62 final cascade lock */
#view-home .day-summary {
  height: 308px;
  min-height: 308px;
  grid-template-rows: 41px 145px 55px 34px;
}

#view-home .player-card {
  position: relative;
  isolation: isolate;
  height: 145px;
  min-height: 145px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

#view-home .main-avatar {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: 90px;
  height: 126px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#view-home .pixel-avatar {
  width: 88px;
  height: 120px;
}

#view-home .player-measurements,
#view-home .player-card .health-glance {
  position: relative;
  z-index: 1;
}

#view-home .player-measurements {
  grid-column: 1;
}

#view-home .player-card .health-glance {
  grid-column: 2;
  justify-self: end;
}

#view-home .kcal-meter {
  margin-top: 2px;
}

#food-modal-x {
  border: 0;
  background: transparent;
}

.food-dex-hero-wrap .food-dex-index-link {
  top: 8px;
  right: 0;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px 3px 3px 999px;
  font-size: 10px;
}

.collection-card-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.collection-card-actions .collection-edit {
  width: 100%;
  padding: 0 8px;
}

.agent-log:empty {
  display: none;
}

@media (max-width: 380px) {
  #view-home .meal-items .food-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 7px 8px;
  }

  #view-home .meal-items .food-main {
    display: contents;
  }

  #view-home .meal-items .food-name {
    grid-column: 1;
    grid-row: 1;
  }

  #view-home .meal-items .food-cal {
    grid-column: 2;
    grid-row: 1;
    margin-left: 0;
    justify-self: end;
  }

  #view-home .meal-items .food-macros {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
  }

  #view-home .meal-items .food-actions {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }
}

@media (max-width: 359px) {
  #view-home .day-summary {
    height: 296px;
    min-height: 296px;
    grid-template-rows: 38px 138px 54px 33px;
  }

  #view-home .player-card {
    height: 138px;
    min-height: 138px;
  }
}

/* v63 — keep the calorie gauge clear of the white player card */
#view-home .day-summary {
  height: 318px;
  min-height: 318px;
  grid-template-rows: 41px 145px 61px 34px;
}

#view-home .kcal-meter {
  height: 51px;
  min-height: 51px;
  margin-top: 10px;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    height: 306px;
    min-height: 306px;
    grid-template-rows: 38px 138px 60px 33px;
  }

  #view-home .kcal-meter {
    height: 52px;
    min-height: 52px;
    margin-top: 8px;
  }
}

/* v64 — one-line calorie meter with reserved room for the over-target bubble */
#view-home .day-summary {
  height: 303px;
  min-height: 303px;
  grid-template-rows: 41px 145px 47px 34px;
}

#view-home .kcal-meter {
  height: 47px;
  min-height: 47px;
  margin-top: 0;
  padding: 0 12px 5px;
  grid-template-columns: auto minmax(88px, 1fr) auto;
  grid-template-rows: 14px;
  align-content: end;
  align-items: center;
  column-gap: 8px;
  row-gap: 0;
}

#view-home .kcal-meter-label,
#view-home .kcal-bar-track,
#view-home .kcal-meter-value {
  grid-row: 1;
  align-self: center;
}

#view-home .kcal-meter-label {
  grid-column: 1;
}

#view-home .kcal-bar-track {
  grid-column: 2;
  height: 14px;
}

#view-home .kcal-meter-value {
  grid-column: 3;
  min-width: 78px;
  justify-self: end;
  text-align: right;
  font-size: 9px;
  line-height: 14px;
}

#view-home .kcal-over-bubble {
  bottom: 20px;
}

#view-home .macros-panel {
  margin-top: 1px;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    height: 292px;
    min-height: 292px;
    grid-template-rows: 38px 138px 47px 33px;
  }

  #view-home .kcal-meter {
    height: 47px;
    min-height: 47px;
    margin-top: 0;
    padding-right: 8px;
    padding-left: 8px;
    grid-template-columns: auto minmax(64px, 1fr) auto;
    column-gap: 6px;
  }

  #view-home .kcal-meter-value {
    min-width: 72px;
    font-size: 8px;
  }
}

/* v65 — move nutrition meters down while reclaiming bottom whitespace */
#view-home .day-summary {
  padding-bottom: 8px;
  grid-template-rows: 41px 145px 55px 34px;
}

#view-home .kcal-meter {
  height: 55px;
  min-height: 55px;
}

@media (max-width: 359px) {
  #view-home .day-summary {
    padding-bottom: 8px;
    grid-template-rows: 38px 138px 55px 33px;
  }

  #view-home .kcal-meter {
    height: 55px;
    min-height: 55px;
  }
}

/* v66 — supplied brand, calorie-state characters, and Foodex imagery */
#view-home .home-brand-name {
  display: flex;
  align-items: center;
  width: clamp(132px, 39vw, 164px);
  margin: 0;
}

#view-home .home-brand-logo {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

#view-home .main-avatar {
  overflow: hidden;
  background: #fff;
  top: calc(50% - 4px);
}

#view-home .player-card .pixel-avatar,
#view-home .pixel-avatar {
  width: 70px;
  height: 101px;
  object-fit: contain;
  object-position: center;
  image-rendering: auto;
  filter: brightness(1.12) contrast(1.12);
}

.food-dex-hero.has-food-image {
  filter: none;
}

.food-dex-image {
  display: block;
  width: clamp(112px, 34vw, 154px);
  height: clamp(112px, 34vw, 154px);
  max-width: 54%;
  max-height: 68%;
  object-fit: contain;
  object-position: center;
  image-rendering: pixelated;
}

/* v67 — Foodex card/list display toggle */
.search-index-viewbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 10px;
}

.search-index-viewbar>span {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
}

.search-index-view-toggle {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg3);
}

.search-index-view-btn {
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font: 700 10px/1 var(--font);
  cursor: pointer;
}

.search-index-view-btn.active {
  background: #18181b;
  color: #fff;
}

.search-index-grid.is-list-layout:not(.is-product-list) {
  grid-template-columns: 1fr;
  gap: 7px;
}

.search-index-grid.is-list-layout:not(.is-product-list) .search-category-card {
  aspect-ratio: auto;
  min-height: 70px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  gap: 2px 10px;
  padding: 10px 12px;
}

.search-index-grid.is-list-layout:not(.is-product-list) .search-category-card .search-index-icon {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  margin: 0;
}

.search-index-grid.is-list-layout:not(.is-product-list) .search-category-card>strong {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

.search-index-grid.is-list-layout:not(.is-product-list) .search-category-card .search-category-count {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
}

.search-index-grid.is-list-layout:not(.is-product-list) .search-category-card>small {
  display: block;
  grid-column: 3;
  grid-row: 1 / 3;
  width: auto;
  max-width: 96px;
}

.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card {
  aspect-ratio: 1 / 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 4px;
  padding: 10px;
}

.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card .search-index-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  margin-bottom: auto;
}

.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card .search-index-category {
  font-size: 9px;
  flex-shrink: 0;
}

.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card>strong {
  font-size: 13px;
  line-height: 1.2;
  flex-shrink: 0;
}

.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card .search-index-meta {
  font-size: 10px;
  flex-shrink: 0;
}

.search-index-icon .food-index-image {
  display: block;
  width: 80%;
  height: 80%;
  margin: auto;
  object-fit: contain;
  object-position: center;
  image-rendering: auto;
  mix-blend-mode: multiply;
  transform: scale(1);
  transform-origin: center;
}

.search-index-icon .food-index-note {
  width: 48%;
  height: 48%;
  margin-left: 10%;
  margin-right: auto;
  opacity: 0.52;
  filter: grayscale(1);
  mix-blend-mode: normal;
  transform: translateY(3px);
}

.search-index-product .search-index-icon,
.search-category-card .search-index-icon {
  overflow: visible;
  border-radius: 0 !important;
  background: transparent;
  clip-path: none;
}

/* 이미지 비율별 시각 크기 보정 */
.food-index-image[src*="tofu.jpg"],
.food-index-image[src*="Sushi.jpg"] {
  transform: scale(1.05);
}

.food-index-image[src*="almond.jpg"] {
  transform: scale(0.90);
}

.food-index-image[src*="protein_bar.jpg"] {
  transform: scale(1.10);
}

.food-index-image[src*="cherry_tomato.jpg"],
.food-index-image[src*="tomato.jpg"],
.food-index-image[src*="oatmeal.jpg"] {
  transform: scale(1.08);
}

.food-index-image[src*="coffee.jpg"] {
  transform: scale(1.08);
}

.food-index-image[src*="zero-sugar_cola.jpg"] {
  transform: scale(0.78);
}

.food-index-image[src*="banana.jpg"],
.food-index-image[src*="avocado.jpg"],
.food-index-image[src*="pizza.jpg"],
.food-index-image[src*="chicken_breast.jpg"] {
  transform: scale(0.94);
}


.food-index-image[src*="hamburger.jpg"] {
  transform: scale(0.82);
}

.food-index-image[src*="Donuts.jpg"] {
  transform: scale(0.86);
}

.food-index-image[src*="cake.jpg"] {
  transform: scale(0.84);
}

/* Foodex is a destination tab in the page header, not a dismissible modal. */
.search-hub-head {
  position: relative;
  padding-right: 52px;
}

.search-hub-head>.search-hub-close {
  position: absolute;
  top: 18px;
  right: 0;
  width: 36px;
  height: 36px;
  display: none;
  place-items: center;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #18181b;
  font: 500 22px/1 var(--font);
  cursor: pointer;
}

/* 홈 → 음식 검색 모드에서만 닫기 버튼 표시 */
#view-search[data-hub-mode="search"] .search-hub-close {
  display: grid;
}

#view-search[data-hub-mode="fridge"] .search-hub-close,
#view-search[data-hub-mode="foodex"] .search-hub-close {
  display: none !important;
}

.search-hub-head>.search-hub-index-tab {
  position: absolute;
  top: 24px;
  right: 0;
  min-width: 76px;
  min-height: 42px;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
}

.search-hub-tabs {
  display: block !important;
  padding: 3px !important;
  overflow: visible !important;
}

.search-hub-main-tabs {
  width: 100%;
}

/* Hub modes: search | fridge | foodex */
/* 홈 검색: 검색 + 내 제품 */
#view-search[data-hub-mode="search"] .fridge-mode-tab,
#view-search[data-hub-mode="search"] [data-search-panel="shopping"],
#view-search[data-hub-mode="search"] [data-search-panel="stock"],
#view-search[data-hub-mode="search"] [data-search-panel="store"] {
  display: none !important;
}

/* 내 냉장고: 장보기 + 창고 + 스토어 */
#view-search[data-hub-mode="fridge"] .search-mode-tab,
#view-search[data-hub-mode="fridge"] [data-search-panel="search"],
#view-search[data-hub-mode="fridge"] [data-search-panel="products"] {
  display: none !important;
}

#view-search[data-hub-mode="fridge"] .search-hub-close {
  display: none !important;
}

/* 푸드피디아 내부 탭: Foodex | 레시피 */
.foodex-page-tabs {
  display: none;
  gap: 6px;
  padding: 0 max(16px, var(--safe-right)) 10px max(16px, var(--safe-left));
}

#view-search[data-hub-mode="foodex"] .foodex-page-tabs {
  display: flex;
}

.foodex-page-tab {
  flex: 1 1 0;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text-secondary);
  font: 700 13px/1 var(--font);
  cursor: pointer;
}

.foodex-page-tab.active {
  border-color: #18181b;
  background: #18181b;
  color: #fff;
}

#foodex-library[data-foodex-tab="recipe"] .foodex-search-toggle,
#foodex-library[data-foodex-tab="recipe"] .foodex-search-bar {
  display: none !important;
}

#foodex-library[data-foodex-tab="index"] [data-foodex-panel="recipe"],
#foodex-library[data-foodex-tab="recipe"] [data-foodex-panel="index"] {
  display: none !important;
}

#foodex-library[data-foodex-tab="recipe"] [data-foodex-panel="recipe"],
#foodex-library[data-foodex-tab="index"] [data-foodex-panel="index"] {
  display: block;
}

.stock-howto {
  margin: 0 4px 12px;
  padding: 12px 14px 12px 28px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.stock-howto li+li {
  margin-top: 6px;
}

.stock-howto strong {
  color: var(--text-primary);
}

.stock-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 4px 10px;
}

.stock-add-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #18181b;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font: 700 13px/1 var(--font);
  cursor: pointer;
}

.store-placeholder {
  margin: 12px 4px 24px;
  padding: 28px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  text-align: center;
}

.store-placeholder h2 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
}

.store-placeholder p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

#view-search[data-hub-mode="foodex"] {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#view-search[data-hub-mode="foodex"] #search-hub-head,
#view-search[data-hub-mode="foodex"] .search-hub-tabs,
#view-search[data-hub-mode="foodex"] .search-hub-panel {
  display: none !important;
}

.foodex-library {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--bg);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.foodex-library[hidden] {
  display: none !important;
}

.foodex-library.open {
  opacity: 1;
  transform: translateY(0);
}

/* 하단 Foodex 탭: 앱 콘텐츠 영역 안에만 두고 하단 네비는 가리지 않음 */
#view-search[data-hub-mode="foodex"] .foodex-library.is-page {
  position: relative;
  inset: auto;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  z-index: 0;
  opacity: 1;
  transform: none;
  transition: none;
}

.foodex-library-open {
  overflow: hidden;
}

.bottom-nav {
  position: relative;
  z-index: 200;
}

.foodex-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.foodex-search-toggle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: #f4f4f5;
  color: #18181b;
  cursor: pointer;
}

.foodex-search-toggle[aria-expanded="true"] {
  background: #18181b;
  color: #fff;
}

.foodex-search-bar {
  padding: 0 max(16px, var(--safe-right)) 10px max(16px, var(--safe-left));
}

.foodex-search-bar[hidden] {
  display: none !important;
}

#view-search[data-hub-mode="foodex"] .foodex-library-header {
  height: 103px;
  min-height: 103px;
  box-sizing: border-box;
  padding: 18px 0 25px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.foodex-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.foodex-brand-logo-wrap {
  display: flex;
  align-items: center;
  width: clamp(132px, 39vw, 164px);
  flex: 0 0 clamp(132px, 39vw, 164px);
  margin: 0;
  padding: 0;
}

.foodex-brand-logo {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
  margin: 0;
  padding: 0;
}

#foodex-library-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.1;
  white-space: nowrap;
}

#view-search[data-hub-mode="foodex"] .foodex-library-scroll {
  padding-bottom: 16px;
}

/* 채팅 탭 안내 · 텔레그램 CTA */
.chat-guide-card {
  margin: 0 16px 12px;
  padding: 16px 16px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
}

.chat-guide-card h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.chat-guide-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.chat-guide-steps li+li {
  margin-top: 6px;
}

.chat-guide-steps strong {
  color: var(--text-primary);
}

.chat-telegram-actions {
  margin: 0 16px 14px;
  display: grid;
  gap: 8px;
}

.chat-telegram-btn,
.chat-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  font: 700 14px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
}

.chat-telegram-btn {
  border: 0;
  background: #229ed9;
  color: #fff;
}

.chat-share-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-primary);
}

.chat-telegram-note {
  margin: 2px 2px 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.foodex-library-header {
  min-height: calc(72px + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + var(--safe-top)) max(16px, var(--safe-right)) 12px max(16px, var(--safe-left));
  background: var(--bg);
}

.foodex-library-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.8px;
}

.foodex-library-close {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font: 500 24px/1 var(--font);
  cursor: pointer;
}

.foodex-library-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px max(16px, var(--safe-right)) calc(24px + var(--safe-bottom)) max(16px, var(--safe-left));
}

/* Keep the calendar's today marker out of the date/kcal text flow. */
.cal-day {
  position: relative;
}

.cal-day.is-today .cal-day-dot {
  position: absolute !important;
  right: 7px;
  bottom: 5px;
  margin: 0 !important;
}

.search-index-sort select {
  min-height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text-secondary);
  font: 750 10px/1 var(--font);
}

.macro-bar-track {
  position: relative;
  overflow: hidden;
}

.macro-bar {
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
}

.macro-over-fill {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  background: #e23d3d;
  border-radius: 0 999px 999px 0;
}

.macro-target-marker {
  position: absolute;
  z-index: 3;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: #18181b;
  transform: translateX(-1px);
}

#view-home .kcal-over-fill,
#view-home .kcal-over-bubble {
  background: #e23d3d !important;
}

#view-home .kcal-over-bubble::after {
  border-top-color: #e23d3d !important;
}

#view-home .food-item {
  flex-wrap: nowrap;
}

#view-home .food-macros {
  flex-wrap: nowrap;
  gap: 7px;
  overflow: hidden;
  white-space: nowrap;
}

#view-home .macro-tag {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
}

#view-home .food-cal {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
}

.card-record-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
}

.card-time-edit,
.card-clear-record {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--text-primary);
  font: 750 15px/1 var(--font);
  cursor: pointer;
}

.card-clear-record {
  display: none;
  color: #d83b3b;
}

.timeline-editing .card-clear-record {
  display: inline-flex;
}

.timeline-editing .card-time-edit {
  display: none;
}

.food-dex-edit-record {
  width: 100%;
  min-height: 46px;
  margin-top: 18px;
  border: 0;
  border-radius: 12px;
  background: #18181b;
  color: #fff;
  font: 800 13px/1 var(--font);
  cursor: pointer;
}

/* Macro overage uses the same visual grammar as the calorie meter. */
#view-home .macro-bar-track {
  height: 9px;
  overflow: visible;
  border-radius: 999px;
  background: #dedfe2;
  box-shadow: none;
}

#view-home .macro-bar {
  border-radius: 999px 0 0 999px;
  background: #18181b;
}

#view-home .macro-bar-track:not(.is-over) .macro-bar {
  border-radius: 999px;
}

#view-home .macro-bar-track.is-over .macro-bar {
  border-radius: 999px 0 0 999px !important;
}

#view-home .macro-over-fill {
  right: 0;
  left: auto;
  top: 0;
  bottom: 0;
  border-radius: 0 3px 3px 0;
  background: #e23d3d;
  box-shadow: -1px 0 0 #e23d3d;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

#view-home .macro-target-marker {
  z-index: 4;
  top: -2px;
  bottom: -2px;
  width: 2px;
  border-radius: 2px;
  background: #18181b;
  transition: none;
}

#view-home .macro-bar,
#view-home .macro-over-fill {
  transition: none;
}

#view-home .home-brand-logo {
  image-rendering: auto;
}

#view-home .meal-card.has-items .timeline-time-button,
#view-home .snack-card.has-items .timeline-time-button {
  pointer-events: auto;
  cursor: pointer;
}

.time-period-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 12px;
  padding: 3px;
  border-radius: 11px;
  background: var(--bg3);
}

.time-period-toggle button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font: 750 12px/1 var(--font);
  cursor: pointer;
}

.time-period-toggle button.active {
  background: #18181b;
  color: #fff;
}

.time-quick-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.time-quick-fields label {
  display: grid;
  gap: 5px;
}

.time-quick-fields label>span,
.time-edit-field>span {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 750;
}

.time-quick-fields select,
#time-edit-input {
  min-height: 44px;
}

/* v64 — collection controls and compact home editing alignment */
#view-search .collection-subpanel>#collection-create {
  position: static;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  margin: 14px auto 4px;
  border: 1px solid #18181b;
  border-radius: 50%;
  background: #fff;
  color: #18181b;
  font-size: 22px;
  line-height: 1;
}

.timeline-editing #view-home .drag-handle {
  right: auto;
  left: 8px;
}

.timeline-editing #view-home .meal-card .meal-header,
.timeline-editing #view-home .meal-card:not(.expanded) .meal-header,
.timeline-editing #view-home .snack-card .snack-header {
  padding-right: 14px;
  padding-left: 44px;
}

#view-home .card-time-edit {
  width: 28px;
  height: 28px;
  border: 1px solid #18181b;
  border-radius: 50%;
  background: #fff;
  color: #18181b;
  font-size: 14px;
}

#view-home .card-clear-record {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #18181b;
  font-size: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: normal;
  line-height: 1;
}

#view-home .card-clear-record:hover {
  color: #555;
}

.timeline-editing #view-home .card-clear-record {
  display: inline-flex;
  color: #18181b;
}

.timeline-editing #view-home .card-time-edit {
  display: none;
}

#view-home .food-detail-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

#view-home .food-detail-line .food-cal {
  order: 1;
  flex: 0 0 auto;
  color: #555;
  font-size: 10px;
  font-weight: 700;
}

#view-home .food-detail-line .food-macros {
  order: 2;
  flex: 1 1 auto;
  min-width: 0;
  gap: 5px;
}

#view-home .food-detail-line .macro-tag {
  color: #777;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: -0.15px;
}

#view-home .food-drag-handle,
#view-home .food-edit,
#view-home .food-del {
  width: 28px;
  height: 28px;
  font-size: 15px;
}

.meal-card.drop-target,
.snack-card.drop-target {
  position: relative;
}

.meal-card.drop-target::after,
.snack-card.drop-target::after {
  content: attr(data-dropzone-text);
  position: absolute;
  inset: 4px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(250, 249, 247, 0.95);
  color: #1c1c1e;
  font-size: 12px;
  font-weight: 750;
  border: 1.5px dashed #1c1c1e;
  border-radius: 4px;
  pointer-events: none;
  box-sizing: border-box;
  text-align: center;
  padding: 0 12px;
}

/* ============================
   iMessage chat lock (last cascade)
   ============================ */
#view-ai:not([hidden]) {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
  padding-bottom: 0 !important;
  background: #ffffff !important;
}

#view-ai[hidden] {
  display: none !important;
}

/* 헤더 물음표: 회색 외곽 원형 */
#view-ai .agent-help-btn {
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: 30px !important;
  height: 30px !important;
  border: 1.5px solid #a1a1aa !important;
  border-radius: 50% !important;
  background: #fff !important;
  color: #71717a !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  display: grid !important;
  place-items: center !important;
  position: relative !important;
  margin: 0 !important;
}

#view-ai .agent-page-head {
  position: relative !important;
  height: 103px !important;
  min-height: 103px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  background: #ffffff !important;
  border-bottom: 1px solid var(--border) !important;
  padding: 18px 0 25px 0 !important;
}

#view-ai .agent-page-head>p,
#view-ai .agent-page-head>span,
#view-ai .agent-page-head>small {
  display: none !important;
}

#view-ai .agent-brand-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

#view-ai .agent-brand-logo-wrap {
  display: flex !important;
  align-items: center !important;
  width: clamp(132px, 39vw, 164px) !important;
  flex: 0 0 clamp(132px, 39vw, 164px) !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* 홈 탭 로고와 동일 구조 및 크기 */
#view-ai .agent-brand-logo {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  image-rendering: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

#view-ai .agent-page-head h1,
#view-ai #agent-page-title {
  margin: 0 !important;
  color: var(--text-primary) !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  letter-spacing: -0.3px !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

#view-ai .agent-log {
  flex: 1 1 auto !important;
  min-height: 120px !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 18px 14px 8px !important;
  overflow-y: auto !important;
  background: #ffffff !important;
  gap: 12px !important;
}

/* 3배너는 로그 밖 — 대화해도 항상 보임 */
#view-ai .chat-action-banners {
  flex: 0 0 auto !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
  width: auto !important;
  margin: 0 14px 10px !important;
}

/* 입력창: 하단 여백 + 검정 외곽선 (홈 톤) */
#view-ai .agent-composer {
  position: relative !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  flex: 0 0 auto !important;
  margin: 0 14px calc(18px + var(--safe-bottom)) !important;
  margin-top: auto !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 34px 34px !important;
  gap: 6px !important;
  align-items: center;
  padding: 8px 10px 8px 14px !important;
  border: 1.5px solid #18181b !important;
  border-radius: 14px !important;
  background: #fff !important;
  box-shadow: none !important;
  z-index: 5;
}

#view-ai .agent-composer input {
  order: 1;
  min-width: 0 !important;
  width: 100% !important;
  color: var(--text-primary) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}

#view-ai .agent-composer input::placeholder {
  color: var(--text-muted) !important;
  font-size: 13px !important;
}

#view-ai .agent-composer .agent-voice {
  order: 2;
  border: 1px solid var(--border-strong) !important;
  background: #fff !important;
  color: #18181b !important;
  border-radius: 50% !important;
  width: 34px !important;
  height: 34px !important;
}

#view-ai .agent-composer .agent-voice.is-listening {
  background: #18181b !important;
  color: #fff !important;
  border-color: #18181b !important;
}

#view-ai .agent-composer #agent-send {
  order: 3;
  border: 0 !important;
  background: #18181b !important;
  color: #fff !important;
  border-radius: 50% !important;
  width: 34px !important;
  height: 34px !important;
}

/* 메신저: 로봇 + 둥근 말풍선 (왼쪽 상단 모서리를 로봇 머리에 맞춤, 꼬리 없음) */
#view-ai .agent-message {
  display: flex !important;
  align-items: flex-start !important;
  gap: 8px !important;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: 14px !important;
  max-width: 92% !important;
}

#view-ai .agent-message.is-user {
  background: transparent !important;
  color: inherit !important;
  align-self: flex-end !important;
  flex-direction: row-reverse !important;
  align-items: flex-end !important;
  margin-top: 0 !important;
}

#view-ai .agent-message.is-agent {
  align-self: flex-start !important;
  align-items: flex-start !important;
  margin-top: 14px !important;
}

#view-ai .agent-avatar {
  width: 40px !important;
  height: 40px !important;
  flex: 0 0 40px !important;
  display: block !important;
  object-fit: contain !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
  /* 살짝 위로 */
  margin-top: -4px !important;
}

#view-ai .agent-message.is-greeting {
  max-width: 100% !important;
  width: 100%;
  align-items: flex-start !important;
}

#view-ai .agent-message.is-greeting .agent-message-body {
  flex: 1 1 auto;
  width: 100%;
  max-width: calc(100% - 48px);
  position: relative !important;
}

#view-ai .agent-message-body {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 6px !important;
  min-width: 0 !important;
  position: relative !important;
}

#view-ai .agent-message.is-user .agent-message-body {
  align-items: flex-end !important;
}

/* 닉네임 — 말풍선 위 */
#view-ai .agent-name {
  position: absolute;
  left: 2px;
  top: -15px;
  display: block;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.1px;
  white-space: nowrap;
}

#view-ai .agent-message.is-user .agent-name {
  display: none;
}

/* 말풍선 — 대화 시작 시 크기 기준으로 통일 */
#view-ai .agent-bubble {
  position: relative !important;
  display: block !important;
  margin-top: 0 !important;
  padding: 12px 14px !important;
  border: 2px solid #1c1c1e !important;
  border-radius: 10px 10px 10px 3px !important;
  background: #faf9f7 !important;
  color: #1f1f1f !important;
  line-height: 1.45 !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10) !important;
}

#view-ai .agent-bubble-text,
#view-ai .agent-message,
#view-ai .agent-confirm {
  font-size: 14px !important;
}

#view-ai .agent-message.is-agent .agent-bubble::before,
#view-ai .agent-message.is-agent .agent-bubble::after {
  display: none !important;
  content: none !important;
}

#view-ai .agent-message.is-user .agent-bubble {
  background: #1c1c1e !important;
  color: #fff !important;
  border: 2px solid #1c1c1e !important;
  /* 오른쪽(나) — 오른쪽 아래 모서리만 덜 라운딩 */
  border-radius: 10px 10px 3px 10px !important;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.16) !important;
}

#view-ai .agent-message.is-greeting .agent-bubble-text {
  font-size: 14px !important;
  font-weight: 700 !important;
  letter-spacing: -0.2px;
  color: #1f1f1f;
}

#view-ai .agent-name {
  font-size: 12px !important;
}

#view-ai .agent-composer input {
  font-size: 14px !important;
}

#view-ai .chat-banner-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 68px;
  padding: 12px 8px;
  border: 0;
  border-radius: 10px;
  background: #f0eeeb;
  color: #1f1f1f;
  text-decoration: none;
  text-align: center;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: none;
}

#view-ai .chat-banner-btn:active {
  background: #e6e3de;
  transform: none;
  box-shadow: none;
}

#view-ai .chat-banner-icon {
  display: none !important;
}

#view-ai .chat-banner-btn strong {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

#view-ai .chat-banner-btn small {
  color: #52525b;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
}

#view-ai .chat-banner-btn.is-connected {
  border: 0;
  background: #e8e6e2;
}

#view-ai .agent-hint-text {
  display: none !important;
}

#view-ai .agent-confirm {
  margin-top: 2px !important;
  border: 2px solid #1c1c1e !important;
  background: #1c1c1e !important;
  color: #fff !important;
  border-radius: 10px !important;
  font-weight: 800 !important;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.12) !important;
}

/* 입력창도 식사 카드 문법 */
#view-ai .agent-composer {
  border: 2px solid #1c1c1e !important;
  border-radius: 10px !important;
  background: #faf9f7 !important;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10) !important;
  padding: 8px 10px 8px 14px !important;
}

#view-ai .agent-composer #agent-send {
  background: #1c1c1e !important;
  border-radius: 8px !important;
}

#view-ai .agent-composer .agent-voice {
  border: 1.5px solid #1c1c1e !important;
  background: #fff !important;
  border-radius: 8px !important;
}

/* 각 탭 컨테이너의 15px 양옆 패딩 통일 (홈 탭 제외) */
#view-search {
  padding-left: 15px !important;
  padding-right: 15px !important;
}

#view-ai {
  padding-left: 15px !important;
  padding-right: 15px !important;
}

#view-stats {
  padding-left: 15px !important;
  padding-right: 15px !important;
}

/* 음식 검색 / 내 냉장고 헤더 정렬 및 스타일 */
.search-hub-head {
  height: 103px !important;
  min-height: 103px !important;
  box-sizing: border-box !important;
  padding: 18px 0 25px 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  border-bottom: 1px solid var(--border) !important;
  background: #ffffff !important;
}

.search-brand-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.search-brand-logo-wrap {
  display: flex !important;
  align-items: center !important;
  width: clamp(132px, 39vw, 164px) !important;
  flex: 0 0 clamp(132px, 39vw, 164px) !important;
  margin: 0 !important;
  padding: 0 !important;
}

.search-brand-logo {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  image-rendering: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

#search-hub-title {
  margin: 0 !important;
  color: var(--text-primary) !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  letter-spacing: -0.3px !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

/* 통계 페이지 헤더 정렬 및 스타일 */
.stats-page-head {
  height: 103px !important;
  min-height: 103px !important;
  box-sizing: border-box !important;
  padding: 18px 0 25px 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  border-bottom: 1px solid var(--border) !important;
  background: #ffffff !important;
}

.stats-brand-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.stats-brand-logo-wrap {
  display: flex !important;
  align-items: center !important;
  width: clamp(132px, 39vw, 164px) !important;
  flex: 0 0 clamp(132px, 39vw, 164px) !important;
  margin: 0 !important;
  padding: 0 !important;
}

.stats-brand-logo {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  image-rendering: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

#stats-page-title-text {
  margin: 0 !important;
  color: var(--text-primary) !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  letter-spacing: -0.3px !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
}

.stats-page-sub {
  margin: 12px 0 8px !important;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
}

/* 검색/냉장고 탭에 따른 버튼 노출 조건 */
#view-search[data-hub-mode="search"] #fridge-settings-btn {
  display: none !important;
}

#view-search[data-hub-mode="fridge"] #search-hub-close {
  display: none !important;
}

/* ============================
   v68 — final UI/UX consistency pass
   ============================ */

/* Shared page headers: keep utilities pinned to the right. */
#view-ai .agent-page-head {
  justify-content: space-between !important;
}

#view-ai .agent-page-head .home-utilities {
  position: static !important;
  margin-left: auto !important;
}

#view-ai .agent-help-btn {
  position: static !important;
  width: 40px !important;
  height: 40px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text-primary) !important;
}

#view-ai .agent-help-btn .home-utility-icon {
  display: block;
  width: 22px;
  height: 22px;
}

/* Profile heading: description belongs directly below the title. */
#view-profile .profile-page-head {
  position: relative !important;
  height: auto !important;
  min-height: 96px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  align-content: center !important;
  justify-content: stretch !important;
  gap: 4px !important;
  padding: 18px 48px 16px 0 !important;
}

#view-profile .profile-page-head .stats-page-title {
  grid-row: 1;
  margin: 0 !important;
  line-height: 1.15;
}

#view-profile .profile-page-head .stats-page-sub {
  grid-row: 2;
  margin: 0 !important;
  line-height: 1.45;
}

#view-profile .profile-page-head .profile-close {
  top: 26px;
}

/* Language selection and the inactive transfer feature stay concise. */
.language-option {
  border-radius: 10px;
}

.data-transfer-card.is-condensed > .data-action-btn,
.data-transfer-card.is-condensed > .data-import-box,
.data-transfer-card.is-condensed > .data-transfer-note {
  display: none !important;
}

.data-transfer-card.is-condensed .data-transfer-head {
  margin-bottom: 12px;
}

.data-transfer-coming {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 12px 14px;
  border: 1.5px solid #1c1c1e;
  border-radius: 10px;
  background: #faf9f7;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}

.data-transfer-coming strong {
  font-size: 13px;
  font-weight: 800;
}

.data-transfer-coming small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
  text-align: right;
}

.profile-product-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin: 32px 0 18px;
  color: rgba(24, 24, 27, 0.24);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 1.2px;
}

.profile-product-meta small {
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.4px;
}

/* Chat shortcuts use the same outlined card language as Home. */
#view-ai .chat-banner-btn,
#view-ai .chat-banner-btn.is-connected {
  min-height: 64px;
  border: 1.5px solid #1c1c1e;
  border-radius: 10px;
  background: #faf9f7;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}

#view-ai .chat-banner-btn:active {
  background: #eeeeec;
  transform: translate(1px, 1px);
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.10);
}

#view-ai .agent-composer {
  grid-template-columns: minmax(0, 1fr) 36px 34px !important;
}

#view-ai .agent-composer .agent-voice {
  width: 36px !important;
  height: 36px !important;
}

#view-ai .agent-composer .agent-voice svg {
  width: 20px;
  height: 20px;
}

/* Fridge: repair the item grid and align its cards with Home/Chat. */
#view-search[data-hub-mode="fridge"] .search-brand-row {
  flex: 1 1 auto !important;
}

#view-search[data-hub-mode="fridge"] #search-hub-title {
  flex: 0 0 auto;
}

#view-search[data-hub-mode="fridge"] .shopping-section > header {
  margin-bottom: 16px;
}

#view-search[data-hub-mode="fridge"] .shopping-section > header h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

#view-search[data-hub-mode="fridge"] .shopping-section > header p {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
}

#view-search[data-hub-mode="fridge"] .shopping-group article {
  grid-template-columns: 22px minmax(0, 1fr) auto !important;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid #1c1c1e;
  border-radius: 10px;
  background: #faf9f7;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}

#view-search[data-hub-mode="fridge"] .shopping-group article > div {
  min-width: 0;
}

#view-search[data-hub-mode="fridge"] .shopping-group article p {
  margin-top: 4px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#view-search[data-hub-mode="fridge"] .shopping-group article > .shopping-action {
  max-width: 78px;
  white-space: nowrap;
}

.store-placeholder {
  border: 1.5px solid #1c1c1e;
  border-radius: 10px;
  background: #faf9f7;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}

/* Foodex: a fixed search field, plain intro, and folder-like category cards. */
#view-search[data-hub-mode="foodex"] .foodex-library-scroll {
  padding-top: 10px;
}

#view-search[data-hub-mode="foodex"] .search-index-intro {
  margin: 2px 0 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#view-search[data-hub-mode="foodex"] .search-index-intro h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

#view-search[data-hub-mode="foodex"] .foodex-search-bar {
  margin: 0 0 12px;
  padding: 0;
}

#view-search[data-hub-mode="foodex"] .search-index-viewbar {
  margin: 10px 0 12px;
}

.search-index-grid:not(.is-list-layout):not(.is-product-list) {
  padding-top: 7px;
}

.search-index-grid:not(.is-list-layout) .search-category-card {
  position: relative;
  overflow: visible !important;
  border: 1.5px solid #1c1c1e;
  border-radius: 10px;
  background: #faf9f7;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}

.search-index-grid:not(.is-list-layout) .search-category-card::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 10px;
  width: 31px;
  height: 7px;
  box-sizing: border-box;
  border: 1.5px solid #1c1c1e;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: #faf9f7;
  pointer-events: none;
}

.search-index-icon .food-index-note {
  width: 60%;
  height: 60%;
  margin: 0 auto;
  opacity: 0.62;
  transform: translateY(-2px);
}

/* Stats: match the same monochrome outlined surface system. */
#view-stats .cal-card,
#view-stats .stats-day-card,
#view-stats .stats-week-card,
#view-stats .stats-month-summary {
  border: 1.5px solid #1c1c1e;
  border-radius: 10px;
  background: #faf9f7;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}

#view-stats .stats-month-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

#view-stats .stats-month-cap {
  font-size: 9px;
  line-height: 1.3;
}

.cal-day.is-today:not(.is-selected) {
  border: 1px solid rgba(24, 24, 27, 0.34) !important;
  box-shadow: none !important;
}

.cal-day.is-today:not(.is-selected)::before {
  display: none !important;
}

/* ============================
   v69 — browser feedback refinement
   ============================ */

/* AI header and manual */
#view-ai .agent-page-head .home-utilities {
  gap: 2px !important;
}

.agent-help-card dl {
  margin-bottom: 0;
}

.agent-help-card dd {
  line-height: 1.45;
}

.agent-help-card > .settings-save-btn {
  margin-top: 16px;
  margin-bottom: 0;
}

/* Profile */
#view-profile .profile-page-head {
  border-bottom: 0 !important;
}

#view-profile .profile-summary-card {
  padding: 14px 16px;
}

#view-profile .profile-summary-grid {
  width: 100%;
}

/* Foodex sort controls */
.search-index-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.search-index-sort > .sr-only {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 750;
}

.search-index-sort select {
  font-size: 12px;
}

/* Folder silhouette on both category and food cards. */
.search-index-grid:not(.is-list-layout):not(.is-product-list) {
  column-gap: 10px;
  row-gap: 18px;
  padding-top: 8px;
}

.search-index-grid:not(.is-list-layout) .search-category-card,
.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card {
  position: relative;
  overflow: visible !important;
  border: 1.5px solid #1c1c1e;
  border-radius: 10px;
  background: #faf9f7;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.10);
}

.search-index-grid:not(.is-list-layout) .search-category-card::before,
.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card::before {
  content: "";
  position: absolute;
  top: -8px;
  right: -1.5px;
  width: 43px;
  height: 8px;
  box-sizing: border-box;
  border: 1.5px solid #1c1c1e;
  border-bottom: 0;
  border-radius: 5px 9px 0 0;
  background: #faf9f7;
  pointer-events: none;
}

/* Food detail behaves like an in-Foodex page and clears the bottom navigation. */
.food-dex {
  transform: translateX(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.food-dex.open {
  transform: translateX(0);
}

.food-dex-content {
  padding-bottom: calc(116px + var(--safe-bottom));
  overscroll-behavior: contain;
}

.food-dex-hero-wrap .food-dex-index-link {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #fff;
}

.food-dex-index-link img {
  width: 18px;
  height: 18px;
}

/* Recipe collection spacing and controls. */
.collection-card {
  margin-bottom: 22px;
}

#view-search .collection-subpanel > #collection-create {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  margin: 6px auto 4px;
  border: 1.5px solid #18181b;
  font-size: 20px;
}

.collection-card > .collection-card-remove {
  bottom: -28px;
}

.collection-card > .collection-evolution-toggle {
  transform-origin: center;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.collection-card > .collection-evolution-toggle[aria-expanded="true"] {
  transform: scaleY(-1);
}

.collection-ingredient-tile {
  grid-template-columns: 24px minmax(0, 1fr);
}

.collection-ingredient-image {
  width: 24px;
  height: 24px;
}

.collection-ingredient-image .food-index-note {
  width: 55%;
  height: 55%;
  transform: none;
}

.collection-evolution-result {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.collection-result-card {
  min-height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: 1px solid #18181b;
  border-radius: 9px;
  background: #fff;
  text-align: center;
}

.collection-result-card strong {
  margin-top: 4px;
  font-size: 8px;
  line-height: 1.2;
}

/* Calendar and fridge details. */
.cal-day.is-selected,
.cal-day.is-today.is-selected {
  border: 1px solid rgba(24, 24, 27, 0.38) !important;
  box-shadow: none !important;
}

#view-search[data-hub-mode="fridge"] .search-hub-main-tabs .search-hub-tab {
  font-size: 13px !important;
  font-weight: 800;
}

#view-search[data-hub-mode="fridge"] .store-placeholder {
  border: 0;
  background: transparent;
  box-shadow: none;
}

/* ============================
   v70 — final browser-comment cleanup
   ============================ */

/* Search stays available below the three food-source tabs. */
.modal-food-search {
  margin-bottom: 12px;
}

#view-search[data-hub-mode="search"] .search-hub-main-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Let folder tabs clear the scroll track and neighboring cards. */
#view-search[data-hub-mode="foodex"] .foodex-library-scroll {
  scrollbar-width: none;
}

#view-search[data-hub-mode="foodex"] .foodex-library-scroll::-webkit-scrollbar {
  display: none;
}

#view-search[data-hub-mode="foodex"] .search-index-grid:not(.is-list-layout) {
  width: calc(100% - 4px);
  margin-right: 4px;
  overflow: visible;
}

.search-index-sort > .sr-only {
  font-size: 10px;
}

/* Detail fallback uses the same note artwork as Other cards. */
.food-dex-hero > .food-index-note {
  width: clamp(72px, 21vw, 96px);
  height: clamp(72px, 21vw, 96px);
  object-fit: contain;
  opacity: 0.62;
}

.food-dex-nutrition-grid .nutrition-not-reported {
  color: var(--text-muted);
  font-weight: 650;
}

/* Page headers sit cleanly without a divider or detached subtitle. */
#view-stats .stats-page-head,
#view-ai .agent-page-head {
  border-bottom: 0 !important;
}

/* Recipe typography follows the Foodex intro scale. */
#foodex-library [data-foodex-panel="recipe"] .collection-section > header {
  margin: 2px 0 14px;
}

#foodex-library [data-foodex-panel="recipe"] .collection-section > header h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

#foodex-library [data-foodex-panel="recipe"] .collection-section > header p {
  margin: 0;
  font-size: 11px;
}

.collection-nutrition span {
  line-height: 1.35;
  text-align: right;
}

/* Use the Home meal-card plus and a softer chevron silhouette. */
#view-search .collection-subpanel > #collection-create {
  padding: 0;
  font-size: 0;
}

#view-search .collection-subpanel > #collection-create svg {
  display: block;
}

.collection-card > .collection-evolution-toggle {
  padding: 0;
  font-size: 0;
}

.collection-card > .collection-evolution-toggle svg {
  width: 18px;
  height: 18px;
  overflow: visible;
}

.collection-card > .collection-evolution-toggle path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================
   v71 — interaction and folder-shape corrections
   ============================ */

/* Direct registration belongs to the search page, not a modal. */
.search-inline-custom-panel {
  padding-bottom: calc(96px + var(--safe-bottom));
}

.search-inline-custom-head {
  margin-bottom: 14px;
}

.search-inline-custom-head h2 {
  margin: 0 0 5px;
  font-size: 20px;
  font-weight: 900;
}

.search-inline-custom-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

#search-inline-custom-host .custom-food-form {
  padding-bottom: 18px;
}

/* Build one continuous folder outline instead of a tab over a rounded box. */
.search-index-grid:not(.is-list-layout) .search-category-card,
.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card {
  border-radius: 10px 0 10px 10px;
}

.search-index-grid:not(.is-list-layout) .search-category-card::before,
.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card::before {
  z-index: 1;
  border-radius: 6px 8px 0 0;
}

.search-index-grid:not(.is-list-layout) .search-category-card::after,
.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: -1px;
  right: 1px;
  width: 40px;
  height: 3px;
  background: #faf9f7;
  pointer-events: none;
}

.search-index-grid:not(.is-list-layout) .search-category-card > *,
.search-index-grid:not(.is-list-layout) .search-index-product.is-product-card > * {
  position: relative;
  z-index: 2;
}

/* Only the selected calendar day gets an outline; today keeps its dot. */
.cal-day.is-today:not(.is-selected) {
  border: 1px solid transparent !important;
  box-shadow: none !important;
}

/* Match the recipe description to the Foodex intro copy. */
#foodex-library [data-foodex-panel="recipe"] .collection-section > header p {
  font-size: 12px;
  line-height: 1.5;
}

/* Keep the Home-style plus visible after language updates. */
#view-search .collection-subpanel > #collection-create svg {
  width: 12px;
  height: 12px;
  overflow: visible;
  color: #18181b;
}

/* ============================
   v72 — stats controls and compact form copy
   ============================ */

/* The visible month label owns the click; the transparent input only supplies the native picker. */
#cal-month-picker {
  pointer-events: none;
}

/* Today's dot stays centered independently of the selected-day outline. */
.cal-day.is-today .cal-day-dot {
  left: 50% !important;
  right: auto !important;
  bottom: 4px !important;
  transform: translateX(-50%);
}

/* Treat the line explanation as a caption below the chart. */
.stats-week-card .stats-week-head {
  display: block;
  margin-bottom: 6px;
}

.stats-week-card .stats-week-hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
}

.serving-conversion-label {
  align-self: center;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.25;
}

/* ============================
   v125 — form and shopping controls
   ============================ */

#custom-food-form input.settings-input,
#custom-food-form select.settings-input,
#custom-food-form textarea.settings-input {
  background: #fff;
}

.shopping-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -2px 4px 10px;
}

.shopping-add-btn,
.shopping-item-save {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #18181b;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font: 800 12px/1 var(--font);
  cursor: pointer;
}

#view-search[data-hub-mode="fridge"] .shopping-group article:not(.collection-fridge-item):not(.shopping-item-editor) {
  grid-template-columns: 22px minmax(0, 1fr) auto 24px !important;
}

.shopping-remove,
.shopping-item-cancel {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: 700 18px/1 var(--font);
  cursor: pointer;
}

#view-search[data-hub-mode="fridge"] .shopping-group article.shopping-item-editor {
  grid-template-columns: minmax(0, 1fr) auto 24px !important;
  min-height: 58px;
}

.shopping-item-editor .shopping-item-name {
  min-width: 0;
  background: #fff;
}

#view-search[data-hub-mode="fridge"] .shopping-fridge .collection-fridge-item.is-editing {
  grid-template-columns: minmax(0, 1fr) 32px !important;
  gap: 8px;
  padding: 10px !important;
}

.shopping-fridge .collection-fridge-item.is-editing .collection-fridge-fields {
  grid-column: 1 / -1;
}

.shopping-fridge .collection-fridge-item.is-editing .collection-fridge-save {
  grid-column: 1;
}

.shopping-fridge .collection-fridge-item.is-editing .collection-fridge-remove {
  position: static;
  grid-column: 2;
  align-self: stretch;
  width: 32px;
  height: auto;
  transform: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}

@media (max-width: 380px) {
  .collection-fridge-fields {
    grid-template-columns: 1fr;
  }

  #view-search[data-hub-mode="fridge"] .shopping-group article:not(.collection-fridge-item):not(.shopping-item-editor) {
    grid-template-columns: 20px minmax(0, 1fr) 22px !important;
  }

  #view-search[data-hub-mode="fridge"] .shopping-group article:not(.collection-fridge-item):not(.shopping-item-editor) > .shopping-action {
    grid-column: 2;
    justify-self: start;
  }

  #view-search[data-hub-mode="fridge"] .shopping-group article:not(.collection-fridge-item):not(.shopping-item-editor) > .shopping-remove {
    grid-column: 3;
    grid-row: 1;
  }
}

/* ============================
   v126 — shopping spacing and folder polish
   ============================ */

#view-search[data-hub-mode="fridge"] .shopping-group > article + article {
  margin-top: 9px;
}

#view-search[data-hub-mode="fridge"] .shopping-group article > .shopping-action {
  min-height: 29px;
  padding: 4px 9px;
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
}

#view-search[data-hub-mode="fridge"] .shopping-fridge .collection-fridge-item:not(.is-editing) {
  grid-template-columns: 24px minmax(0, 1fr) auto 28px !important;
  gap: 10px;
  padding: 12px !important;
}

.shopping-fridge .collection-fridge-item:not(.is-editing) .collection-fridge-marker {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: #18181b;
  font-size: 11px;
}

.shopping-fridge .collection-fridge-item:not(.is-editing) .collection-fridge-status {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  font-size: 10px;
  white-space: nowrap;
}

.shopping-fridge .collection-fridge-item:not(.is-editing) .collection-fridge-remove {
  position: static;
  width: 28px;
  height: 28px;
  transform: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
}

#view-search[data-hub-mode="foodex"] .search-index-grid:not(.is-list-layout):not(.is-product-list) {
  column-gap: 12px;
  row-gap: 20px;
  padding-top: 9px;
}

#view-search[data-hub-mode="foodex"] .foodex-library-scroll {
  padding-bottom: calc(112px + var(--safe-bottom));
}

#view-search[data-hub-mode="foodex"] .search-index-grid:not(.is-list-layout) .search-category-card::before,
#view-search[data-hub-mode="foodex"] .search-index-grid:not(.is-list-layout) .search-index-product.is-product-card::before {
  top: -7px;
  right: -1.5px;
  width: 48px;
  height: 7px;
  border-radius: 6px 8px 0 0;
}

#view-search[data-hub-mode="foodex"] .search-index-grid:not(.is-list-layout) .search-category-card::after,
#view-search[data-hub-mode="foodex"] .search-index-grid:not(.is-list-layout) .search-index-product.is-product-card::after {
  right: 1px;
  width: 45px;
}

/* Public web shell: keep the app at a mobile reading width on desktop. */
@media (min-width: 481px) {
  html,
  body {
    background: #eeeeee;
  }

  body {
    display: flex;
    justify-content: center;
  }

  .phone-frame,
  .storage-unavailable {
    width: 480px;
    max-width: 100%;
    border-inline: 1px solid #dddddd;
    background: var(--bg);
  }

  .modal-overlay,
  .agent-help-overlay {
    right: auto;
    left: 50%;
    width: 480px;
    max-width: 100%;
    transform: translateX(-50%);
  }

  .food-dex,
  .foodex-library:not(.is-page) {
    right: auto;
    left: 50%;
    width: 480px;
    max-width: 100%;
    transform: translate(-50%, 12px);
  }

  .food-dex.open,
  .foodex-library:not(.is-page).open {
    transform: translate(-50%, 0);
  }
}
