/* CalDef white and burgundy redesign */
:root {
  --primary-color: #7f1d3a;
  --primary-hover: #64162d;
  --primary-soft: #f9e8ee;
  --primary-tint: #fff5f7;
  --secondary-color: #64748b;
  --success-color: #1b8a5a;
  --warning-color: #b7791f;
  --danger-color: #c2410c;
  --bg-primary: #ffffff;
  --bg-secondary: #fffaf8;
  --bg-tertiary: #f8eef1;
  --surface: #ffffff;
  --text-primary: #24151a;
  --text-secondary: #76666c;
  --border-color: #eadde1;
  --shadow: 0 12px 30px rgba(58, 24, 35, 0.08);
  --shadow-lg: 0 22px 55px rgba(58, 24, 35, 0.14);
  --border-radius: 8px;
  --transition: all 0.2s ease;
}

[data-theme="dark"] {
  --primary-color: #7f1d3a;
  --primary-hover: #64162d;
  --bg-primary: #ffffff;
  --bg-secondary: #fffaf8;
  --bg-tertiary: #f8eef1;
  --surface: #ffffff;
  --text-primary: #24151a;
  --text-secondary: #76666c;
  --border-color: #eadde1;
  --shadow: 0 12px 30px rgba(58, 24, 35, 0.08);
  --shadow-lg: 0 22px 55px rgba(58, 24, 35, 0.14);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg-secondary);
}

body {
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-secondary) 52%, #ffffff 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #9f284e 0%, #6f1934 100%);
}

.splash-content {
  text-align: center;
  color: #ffffff;
  animation: splashFadeIn 0.7s ease both;
}

.splash-logo i {
  display: block;
  margin-bottom: 1rem;
  font-size: 3.75rem;
}

.splash-logo h1 {
  font-size: clamp(2.3rem, 8vw, 4rem);
  font-weight: 800;
  letter-spacing: 0;
}

.splash-tagline {
  margin: 0.75rem 0 2rem;
  opacity: 0.9;
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.loading-dots span {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: #ffffff;
  animation: dotBounce 1.2s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes splashFadeIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dotBounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.app-container.loaded {
  opacity: 1;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(127, 29, 58, 0.12);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.header-content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--primary-color);
  font-size: 1.35rem;
  font-weight: 800;
}

.logo i {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--primary-color);
  border-radius: 50%;
  box-shadow: 0 10px 25px rgba(127, 29, 58, 0.24);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle,
.language-select {
  min-height: 2.65rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--primary-color);
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(58, 24, 35, 0.06);
  transition: var(--transition);
}

.theme-toggle {
  width: 2.65rem;
  display: grid;
  place-items: center;
}

.language-select {
  padding: 0 0.9rem;
}

.theme-toggle:hover,
.language-select:hover {
  border-color: rgba(127, 29, 58, 0.32);
  transform: translateY(-1px);
}

.main-content {
  flex: 1;
  padding-bottom: 92px;
}

.container {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.landing-hero {
  min-height: calc(100vh - 7rem);
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.landing-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(2rem, 5vw, 4rem);
}

.landing-copy h2 {
  max-width: 12ch;
  color: var(--primary-color);
  font-size: clamp(3rem, 6vw, 5.4rem);
  line-height: 0.98;
  font-weight: 800;
}

.landing-copy p {
  max-width: 34rem;
  margin-top: 1.3rem;
  color: var(--text-secondary);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-start-btn {
  min-width: 13rem;
  min-height: 4rem;
  margin-top: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  border-radius: 999px;
  color: #ffffff;
  background: var(--primary-color);
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 18px 36px rgba(127, 29, 58, 0.24);
  transition: var(--transition);
}

.hero-start-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.landing-gallery {
  min-height: calc(100vh - 7rem);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(220px, 1fr);
  gap: 1rem;
  padding: clamp(1rem, 3vw, 2rem);
  background: var(--primary-color);
}

.gallery-card {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(58, 24, 35, 0.2);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(0.92) contrast(0.95);
}

.gallery-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(36, 21, 26, 0.05), rgba(36, 21, 26, 0.54));
}

.gallery-card figcaption {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 1;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.32);
}

.gallery-card strong {
  display: block;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-card span {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.setup-card {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: clamp(1.15rem, 4vw, 2rem);
  border: 1px solid rgba(127, 29, 58, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-lg);
  scroll-margin-top: 6rem;
}

.welcome-eyebrow,
.dashboard-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
  color: var(--primary-color);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-copy h2 {
  color: var(--text-primary);
  line-height: 0.98;
  font-weight: 800;
}

.dashboard-copy h2 {
  max-width: 16ch;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.dashboard-copy p {
  max-width: 42rem;
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

.welcome-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.welcome-stats div {
  min-height: 5.2rem;
  padding: 1rem;
  border: 1px solid rgba(127, 29, 58, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.welcome-stats strong {
  display: block;
  color: var(--primary-color);
  font-size: 1.15rem;
}

.welcome-stats span {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.setup-panel {
  min-width: 0;
}

.setup-form,
.food-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.personal-info-section,
.body-measurements-section,
.goals-section,
.food-entry-card,
.todays-food-log,
.daily-calorie-goal-section,
.metrics-section,
.daily-notes-section,
.progress-chart,
.food-log,
.summary-card,
.notes-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.personal-info-section,
.body-measurements-section,
.goals-section {
  padding: clamp(1rem, 3vw, 1.35rem);
}

.setup-card .form-row.three-columns,
.setup-card .form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setup-card .personal-info-section .form-row,
.setup-card .goals-section .form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setup-card .body-measurements-section .form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setup-card .goals-section .goals-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.setup-card .goals-section .goals-row .form-group:nth-child(3) {
  grid-column: 1 / -1;
}

.setup-card .goals-section .input-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.25rem;
  gap: 0.45rem;
}

.setup-card .goals-section #targetWeightUnit {
  min-width: 0;
  padding-inline: 0.5rem;
}

.setup-card .goals-section #timeGoal {
  min-width: 0;
  padding-inline: 0.7rem;
}

.personal-info-section h3,
.body-measurements-section h3,
.goals-section h3,
.food-entry-card h3,
.todays-food-log h3,
.goal-header h3,
.metrics-section h3,
.notes-header h3,
.progress-chart h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 800;
}

.personal-info-section h3,
.body-measurements-section h3,
.goals-section h3 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.personal-info-section h3::before,
.body-measurements-section h3::before,
.goals-section h3::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--primary-color);
  box-shadow: 0 0 0 5px var(--primary-soft);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.form-row.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-description {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.goal-guidance {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(127, 29, 58, 0.16);
  border-radius: 8px;
  color: var(--primary-color);
  background: var(--primary-tint);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-group input,
.form-group select,
.notes-content textarea,
.notes-card textarea {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  color: var(--text-primary);
  background: #ffffff;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.notes-content textarea:focus,
.notes-card textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(127, 29, 58, 0.12);
}

.form-group input::placeholder,
.notes-content textarea::placeholder {
  color: #a99aa0;
}

.input-with-unit {
  display: flex;
  gap: 0.5rem;
}

.input-with-unit input {
  flex: 1;
}

.input-with-unit select {
  width: auto;
  min-width: 5.3rem;
}

.unit-display {
  min-width: 4rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--primary-color);
  background: var(--primary-tint);
  font-weight: 800;
}

.btn-primary,
.btn-secondary,
.btn-small {
  min-height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.85rem 1.25rem;
  font-weight: 800;
  transition: var(--transition);
}

.btn-primary {
  width: 100%;
  color: #ffffff;
  background: var(--primary-color);
  box-shadow: 0 14px 28px rgba(127, 29, 58, 0.22);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary,
.btn-small {
  color: var(--primary-color);
  background: var(--primary-tint);
  border-color: rgba(127, 29, 58, 0.16);
}

.btn-secondary:hover,
.btn-small:hover {
  background: var(--primary-soft);
}

.autocomplete-container {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  z-index: 1000;
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

.autocomplete-item {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
}

.autocomplete-item:last-child {
  border-bottom: 0;
}

.autocomplete-item:hover,
.autocomplete-item.highlighted {
  background: var(--primary-tint);
}

.autocomplete-item.selected {
  color: #ffffff;
  background: var(--primary-color);
}

.name-item,
.profile-name {
  font-weight: 700;
}

.profile-details {
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.setup-results {
  margin-top: 1.4rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid rgba(27, 138, 90, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, #f4fff9, #ffffff);
}

.setup-results h3 {
  margin-bottom: 1rem;
  color: var(--success-color);
  text-align: center;
  font-size: 1.35rem;
}

.result-card {
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid rgba(27, 138, 90, 0.16);
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
  box-shadow: 0 10px 24px rgba(27, 138, 90, 0.08);
}

.result-hero {
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent),
    var(--primary-color);
  box-shadow: 0 18px 36px rgba(127, 29, 58, 0.24);
}

.result-header h4 {
  color: var(--text-primary);
}

.result-hero h4,
.result-hero .result-subtitle,
.result-hero .result-value {
  color: #ffffff;
}

.result-value,
.goal-value {
  color: var(--primary-color);
  font-size: clamp(2.25rem, 8vw, 3.5rem);
  line-height: 1;
  font-weight: 800;
}

.result-subtitle,
.goal-subtitle {
  color: var(--text-secondary);
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.result-metrics div {
  min-height: 5.2rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
}

.result-metrics span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-metrics strong {
  display: block;
  margin-top: 0.4rem;
  color: var(--primary-color);
  font-size: 1.55rem;
  line-height: 1.1;
}

.safety-guidance {
  display: grid;
  gap: 0.75rem;
}

.guidance-card {
  display: flex;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border-color);
}

.guidance-card::before {
  content: "";
  width: 0.65rem;
  min-width: 0.65rem;
  border-radius: 999px;
  background: var(--success-color);
}

.guidance-card.warning::before {
  background: var(--warning-color);
}

.guidance-card strong {
  color: var(--text-primary);
}

.guidance-card p {
  margin-top: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.guidance-list {
  display: grid;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.guidance-list span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guidance-list i {
  color: var(--primary-color);
}

.chart-container {
  min-height: 300px;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-secondary);
}

.chart-placeholder {
  width: 100%;
  padding: 1rem;
  color: var(--text-secondary);
  text-align: center;
}

.chart-placeholder canvas {
  max-width: 100%;
  height: auto;
}

.pinned-notification {
  position: sticky;
  top: 5rem;
  z-index: 10;
  margin-bottom: 1rem;
  border: 1px solid rgba(127, 29, 58, 0.16);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  color: var(--text-primary);
  font-weight: 700;
}

.notification-content i {
  color: var(--primary-color);
}

.tracker-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.dashboard-copy,
.dashboard-goal {
  border: 1px solid rgba(127, 29, 58, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.dashboard-copy {
  padding: clamp(1.25rem, 4vw, 2rem);
}

.dashboard-goal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.35rem;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent),
    var(--primary-color);
}

.dashboard-goal span,
.dashboard-goal small {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.dashboard-goal strong {
  margin: 0.35rem 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1;
}

.food-entry-card,
.todays-food-log,
.daily-calorie-goal-section,
.metrics-section,
.daily-notes-section {
  margin-top: 1rem;
  padding: clamp(1rem, 3vw, 1.4rem);
}

.food-entry-card {
  margin-top: 0;
}

#recipeDisplay {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid rgba(127, 29, 58, 0.16);
  border-radius: 8px;
  color: var(--text-secondary);
  background: var(--primary-tint);
}

#recipeDisplay h4 {
  margin-bottom: 0.45rem;
  color: var(--primary-color);
}

.todays-food-log .section-header,
.notes-header,
.history-day-header,
.meal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.todays-food-log .section-header {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.daily-total {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  color: var(--primary-color);
  background: var(--primary-tint);
  font-weight: 800;
}

.total-calories {
  color: var(--primary-color);
}

.food-entries-container,
.food-entries,
.meal-items,
.notes-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.food-entry,
.food-item,
.history-food-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  transition: var(--transition);
}

.food-entry:hover,
.food-item:hover,
.metric-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(58, 24, 35, 0.08);
}

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

.food-name {
  color: var(--text-primary);
  font-weight: 800;
}

.food-details,
.food-quantity {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.food-calories {
  flex: 0 0 auto;
  color: var(--primary-color);
  font-weight: 800;
}

.no-entries-message,
.no-entries,
.no-data-message {
  padding: 1.5rem;
  border: 1px dashed rgba(127, 29, 58, 0.22);
  border-radius: 8px;
  color: var(--text-secondary);
  background: var(--primary-tint);
  text-align: center;
}

.daily-calorie-goal-section {
  background:
    linear-gradient(135deg, rgba(127, 29, 58, 0.08), transparent 70%),
    #ffffff;
}

.goal-card,
.goal-header {
  text-align: center;
}

.remaining-calories {
  width: fit-content;
  max-width: 100%;
  margin: 1rem auto 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(127, 29, 58, 0.16);
  border-radius: 999px;
  color: var(--text-secondary);
  background: #ffffff;
  font-weight: 700;
}

.remaining-value {
  margin: 0 0.25rem;
  color: var(--primary-color);
  font-size: 1.25rem;
  font-weight: 800;
}

.metrics-grid,
.summary-stats,
.calorie-highlights,
.goals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.metric-box,
.stat-card,
.goal-item,
.calorie-highlight {
  min-height: 8rem;
  padding: 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
  transition: var(--transition);
}

.metric-icon {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  color: var(--primary-color);
  background: var(--primary-soft);
}

.metric-icon i {
  font-size: 1.35rem;
}

.metric-value,
.stat-value,
.calorie-value {
  color: var(--primary-color);
  font-size: 2rem;
  line-height: 1.05;
  font-weight: 800;
}

.metric-label,
.stat-unit,
.goal-item span:first-child,
.calorie-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
}

.notes-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.notes-content textarea,
.notes-card textarea {
  min-height: 135px;
  resize: vertical;
  background: var(--bg-secondary);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  border-top: 1px solid rgba(127, 29, 58, 0.13);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.nav-item {
  flex: 1;
  min-height: 4.35rem;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.78rem;
  font-weight: 800;
  transition: var(--transition);
}

.nav-item i {
  font-size: 1.15rem;
}

.nav-item.active {
  color: var(--primary-color);
  background: linear-gradient(180deg, var(--primary-tint), transparent);
}

.nav-item.disabled {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.progress-bar {
  flex: 1;
  height: 0.75rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-tertiary);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.progress-fill.on-target {
  background: var(--success-color);
}

.progress-fill.over-target {
  background: var(--danger-color);
}

.progress-text {
  min-width: 3rem;
  color: var(--primary-color);
  text-align: right;
  font-weight: 800;
}

.meal-group,
.history-day-card,
.history-entry,
.history-details,
.history-header {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.meal-header,
.history-day-header,
.history-header {
  padding: 1rem;
  color: var(--primary-color);
  font-weight: 800;
  background: var(--primary-tint);
}

.meal-items {
  padding: 0.75rem;
}

.action-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 9999;
  min-width: 140px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.action-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.food-actions {
  position: relative;
  z-index: 1;
}

.action-menu-btn,
.close-btn {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--text-secondary);
  background: transparent;
  transition: var(--transition);
}

.action-menu-btn:hover,
.close-btn:hover {
  color: var(--primary-color);
  background: var(--primary-tint);
}

.action-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 0;
  color: var(--text-primary);
  background: transparent;
  text-align: left;
}

.action-item:hover {
  background: var(--primary-tint);
}

.action-item.delete-btn:hover {
  color: var(--danger-color);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(36, 21, 26, 0.34);
  backdrop-filter: blur(8px);
}

.modal-content {
  width: min(600px, 100%);
  max-height: 82vh;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-body {
  max-height: 64vh;
  overflow-y: auto;
  padding: 1.25rem;
}

.entry-date,
.history-date {
  color: var(--primary-color);
  font-weight: 800;
}

.entry-notes,
.history-notes-content,
.history-calories {
  color: var(--text-secondary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-within {
  color: #166534;
  background: #dcfce7;
}

.status-below {
  color: #854d0e;
  background: #fef3c7;
}

.status-exceeded {
  color: #9a3412;
  background: #ffedd5;
}

.difference-positive {
  color: var(--danger-color);
  font-weight: 800;
}

.difference-negative {
  color: var(--success-color);
  font-weight: 800;
}

.notification {
  border-radius: 8px;
  background: var(--primary-color);
  color: #ffffff;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(127, 29, 58, 0.28);
  outline-offset: 2px;
}

/* Current page layout */
html {
  scroll-behavior: smooth;
}

body {
  overflow: hidden;
}

.main-content {
  height: calc(100vh - 4.4rem - 4.35rem);
  padding-bottom: 0;
  overflow: hidden;
}

.page.active {
  height: 100%;
  overflow: hidden;
}

body[data-page="loginPage"] .main-content {
  height: calc(100vh - 4.4rem);
}

body[data-page="loginPage"] .bottom-nav {
  display: none;
}

body[data-page="loginPage"] .container,
body[data-page="setupPage"] .setup-container,
body[data-page="trackerPage"] .tracker-layout {
  height: 100%;
}

body[data-page="trackerPage"] .header-content {
  max-width: 1380px;
  padding: 0.55rem 1rem;
}

body[data-page="trackerPage"] .logo {
  font-size: 1.2rem;
}

body[data-page="trackerPage"] .logo i {
  width: 2rem;
  height: 2rem;
}

body[data-page="trackerPage"] .main-content {
  height: calc(100dvh - 3.2rem - 3.3rem);
}

body[data-page="trackerPage"] .bottom-nav .nav-item {
  min-height: 3.3rem;
  gap: 0.1rem;
  font-size: 0.72rem;
}

.landing-hero {
  height: 100%;
  min-height: 0;
  margin-bottom: 0;
  overflow: hidden;
}

.login-form {
  width: min(420px, 100%);
  display: grid;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.login-form .hero-start-btn {
  width: 100%;
  border: 0;
}

.login-note {
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 700;
}

.landing-gallery {
  height: 100%;
  min-height: 0;
}

.setup-card {
  max-height: 100%;
  overflow-y: auto;
  padding: clamp(1rem, 2vw, 1.35rem);
}

.setup-page-heading {
  margin-bottom: 0.75rem;
  padding: 0.15rem 0.25rem 0.55rem;
  border-bottom: 1px solid var(--border-color);
}

.setup-page-heading h2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--primary-color);
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.1;
}

.setup-page-heading p {
  max-width: 48rem;
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.setup-card .form-row.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.setup-form,
.food-form {
  gap: 0.85rem;
}

.personal-info-section,
.body-measurements-section,
.goals-section,
.food-entry-card,
.todays-food-log,
.daily-calorie-goal-section,
.metrics-section,
.daily-notes-section {
  padding: 1rem;
}

.personal-info-section h3,
.body-measurements-section h3,
.goals-section h3,
.food-entry-card h3,
.todays-food-log h3,
.goal-header h3,
.metrics-section h3,
.notes-header h3 {
  margin-bottom: 0.75rem;
}

.form-row {
  gap: 0.75rem;
}

.form-group {
  gap: 0.35rem;
}

.form-group input,
.form-group select,
.notes-content textarea,
.notes-card textarea {
  min-height: 2.8rem;
  padding: 0.72rem 0.85rem;
}

.setup-results {
  margin-top: 1rem;
  padding: 1rem;
}

.setup-card.results-ready #setupForm {
  display: none;
}

.setup-card.results-ready .setup-page-heading {
  margin-bottom: 0.75rem;
}

.result-card {
  padding: 1rem;
}

.chart-container {
  min-height: 210px;
}

.tracker-layout {
  display: grid;
  width: min(1180px, calc(100vw - 2rem));
  height: 100%;
  min-height: 0;
  grid-template-columns: minmax(410px, 0.95fr) minmax(520px, 1.05fr);
  gap: 0.7rem;
  padding: 0.65rem 0;
  align-items: stretch;
  overflow: hidden;
}

.tracker-left,
.tracker-right {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
}

.tracker-dashboard {
  margin-bottom: 0;
  gap: 0.75rem;
  flex: 0 0 clamp(9rem, 21dvh, 12.4rem);
  min-height: 0;
}

.dashboard-copy {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.15rem 1.25rem;
}

.dashboard-copy h2 {
  max-width: 18ch;
  font-size: clamp(1.75rem, 2.65vw, 2.65rem);
}

.dashboard-copy p {
  max-width: 34rem;
  margin-top: 0.65rem;
  font-size: 0.95rem;
}

.dashboard-goal {
  padding: 1rem;
}

.tracker-right .food-entry-card {
  flex: 0 0 auto;
}

.tracker-right .todays-food-log {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tracker-right .food-entries-container {
  min-height: 0;
  overflow-y: auto;
}

.food-entry-card,
.todays-food-log,
.daily-calorie-goal-section,
.metrics-section,
.daily-notes-section {
  margin-top: 0;
}

.todays-food-log .food-entry {
  padding: 0.6rem 0;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}

.todays-food-log .food-entry:hover {
  transform: none;
  box-shadow: none;
}

.metrics-grid {
  gap: 0.6rem;
}

.metric-box {
  min-height: 6.2rem;
  padding: 0.72rem 0.6rem;
}

.metric-icon {
  width: 1.9rem;
  height: 1.9rem;
  margin-bottom: 0.28rem;
}

.metric-value {
  color: var(--primary-color);
  font-size: 1.65rem;
  line-height: 1;
}

.tracker-left .notes-content textarea {
  min-height: 5.2rem;
  max-height: 6.5rem;
}

.tracker-left .notes-content {
  gap: 0.65rem;
}

body[data-page="trackerPage"] .daily-calorie-goal-section {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(150px, 0.88fr);
  gap: 0.65rem;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="trackerPage"] .daily-calorie-goal-section .goal-card,
body[data-page="trackerPage"] .daily-calorie-goal-section .remaining-card {
  min-height: clamp(6.6rem, 10.5dvh, 8.2rem);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

body[data-page="trackerPage"] .daily-calorie-goal-section .goal-card {
  display: grid;
  place-items: center;
  padding: 0.75rem;
}

body[data-page="trackerPage"] .daily-calorie-goal-section h3 {
  margin-bottom: 0.2rem;
  font-size: 0.88rem;
}

body[data-page="trackerPage"] .daily-calorie-goal-section .goal-value {
  font-size: clamp(2rem, 3.35vw, 2.85rem);
  line-height: 1;
}

body[data-page="trackerPage"] .daily-calorie-goal-section .goal-subtitle {
  font-size: 0.8rem;
}

body[data-page="trackerPage"] .daily-calorie-goal-section .remaining-card {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 0.75rem;
  text-align: center;
  background: linear-gradient(135deg, var(--primary-color), #9b3150);
  color: #ffffff;
}

body[data-page="trackerPage"] .daily-calorie-goal-section .remaining-label,
body[data-page="trackerPage"] .daily-calorie-goal-section .remaining-unit {
  font-size: 0.82rem;
  font-weight: 800;
}

body[data-page="trackerPage"] .daily-calorie-goal-section .remaining-value {
  color: #ffffff;
  font-size: clamp(1.9rem, 3.05vw, 2.7rem);
  font-weight: 900;
  line-height: 1;
}

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

/* Tracker space cleanup */
body[data-page="trackerPage"] .tracker-dashboard {
  display: block;
}

body[data-page="trackerPage"] .dashboard-copy {
  min-height: 0;
}

body[data-page="trackerPage"] .metrics-section {
  flex: 0 0 clamp(6.9rem, 11dvh, 8.2rem);
  display: flex;
  flex-direction: column;
}

body[data-page="trackerPage"] .metrics-grid {
  flex: 1;
}

body[data-page="trackerPage"] .metric-box {
  height: 100%;
  align-content: center;
}

.habit-cards {
  flex: 0 0 clamp(8.6rem, 15dvh, 11.2rem);
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.habit-card {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--primary-color);
  box-shadow: 0 12px 25px rgba(58, 24, 35, 0.13);
}

.habit-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: brightness(0.72) saturate(1.02);
  transform: scale(1.03);
}

.habit-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(36, 21, 26, 0.03), rgba(36, 21, 26, 0.62)),
    linear-gradient(90deg, rgba(127, 29, 58, 0.18), transparent);
}

.habit-card figcaption {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  left: 0.75rem;
  z-index: 1;
  color: #ffffff;
  font-size: clamp(0.68rem, 0.75vw, 0.82rem);
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 2px 12px rgba(36, 21, 26, 0.5);
  text-transform: uppercase;
}

.habit-card strong,
.habit-card span {
  display: block;
}

.habit-card strong {
  font-size: clamp(0.9rem, 1.1vw, 1.15rem);
  letter-spacing: 0.04em;
}

.habit-card span {
  margin-top: 0.12rem;
  font-size: clamp(0.66rem, 0.78vw, 0.82rem);
}

.dashboard-remaining {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(127, 29, 58, 0.16);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--primary-tint);
  font-weight: 800;
}

.dashboard-remaining strong {
  color: var(--primary-color);
  font-size: 1.25rem;
}

body[data-page="trackerPage"] .notes-header {
  gap: 0.75rem;
}

body[data-page="trackerPage"] .notes-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

body[data-page="trackerPage"] .notes-actions .btn-primary,
body[data-page="trackerPage"] .notes-actions .btn-secondary {
  flex: 0 0 2.25rem;
  width: 2.35rem;
  max-width: 2.35rem;
  min-height: 2.35rem;
  height: 2.35rem;
  padding: 0;
  font-size: 0.82rem;
  box-shadow: none;
  overflow: hidden;
}

body[data-page="trackerPage"] .notes-actions i {
  font-size: 0.85rem;
}

body[data-page="trackerPage"] .daily-notes-section {
  flex: 1 1 clamp(4.8rem, 8dvh, 5.9rem);
  min-height: 4.7rem;
  display: flex;
  flex-direction: column;
  padding: 0.72rem 1rem 0.78rem;
}

body[data-page="trackerPage"] .daily-notes-section h3 {
  margin-bottom: 0;
}

body[data-page="trackerPage"] .tracker-left .notes-content textarea {
  flex: 1;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  resize: none;
}

body[data-page="trackerPage"] .todays-food-log {
  flex: 1 1 auto;
  min-height: 0;
  padding-bottom: 0.75rem;
}

body[data-page="trackerPage"] .food-entries-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body[data-page="trackerPage"] .todays-food-log .section-header {
  margin-bottom: 0.65rem;
  padding-bottom: 0.65rem;
}

body[data-page="trackerPage"] .food-entries-container {
  gap: 0;
}

body[data-page="trackerPage"] .no-entries-message,
body[data-page="trackerPage"] .no-entries {
  padding: 0.85rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body[data-page="trackerPage"] #trackerPage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0.4rem 0 1.1rem;
}

body[data-page="trackerPage"] .tracker-layout {
  flex: 0 1 auto;
  max-height: calc(100% - 1.5rem);
  margin: 0 auto;
}

body[data-page="trackerPage"] .tracker-left,
body[data-page="trackerPage"] .tracker-right {
  align-self: stretch;
}

body[data-page="trackerPage"] .tracker-right .todays-food-log {
  height: auto;
}

body[data-page="trackerPage"] .notes-content {
  flex: 1;
  min-height: 0;
}

body[data-page="trackerPage"] .app-container {
  height: 100dvh;
  min-height: 0;
}

body[data-page="trackerPage"] .main-content,
body[data-page="trackerPage"] #trackerPage {
  min-height: 0;
}

body[data-page="trackerPage"] .tracker-layout {
  width: min(1180px, calc(100vw - 3rem));
  height: calc(100% - 1.5rem);
}

/* Setup page planner panel */
body[data-page="setupPage"] .setup-card {
  width: min(1280px, 100%);
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.1fr);
  gap: 1rem;
  overflow: hidden;
}

.setup-intro-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  overflow: hidden;
  border: 1px solid rgba(127, 29, 58, 0.12);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(127, 29, 58, 0.09), rgba(255, 255, 255, 0.86));
}

.setup-intro-panel h2 {
  max-width: 13ch;
  color: var(--text-primary);
  font-size: clamp(2rem, 3.8vw, 3.6rem);
  line-height: 0.98;
  font-weight: 800;
}

.setup-intro-panel p {
  max-width: 34rem;
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
}

.setup-intro-panel .welcome-stats {
  grid-template-columns: 1fr;
  margin-top: 1.25rem;
}

.setup-intro-panel .welcome-stats div {
  min-height: 4.5rem;
  padding: 0.85rem 1rem;
}

body[data-page="setupPage"] .setup-panel {
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.2rem;
}

body[data-page="setupPage"] .setup-page-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.96);
}

body[data-page="setupPage"] .setup-page-heading h2 {
  margin-bottom: 0;
}

/* Compact setup results */
body[data-page="setupPage"] .setup-card.results-ready {
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.1fr);
}

.setup-card.results-ready .setup-panel {
  overflow-y: auto;
}

.setup-card.results-ready .setup-results {
  display: block;
  border-color: var(--border-color);
  background: #ffffff;
}

.setup-card.results-ready .setup-results h3 {
  margin-bottom: 0.65rem;
  color: var(--text-primary);
  font-size: 1.1rem;
  text-align: left;
}

.result-topline {
  display: grid;
  grid-template-columns: minmax(260px, 0.92fr) minmax(260px, 1.08fr);
  gap: 0.65rem;
  align-items: stretch;
  margin-bottom: 0.6rem;
}

.setup-card.results-ready .result-hero {
  min-height: 9.3rem;
  display: grid;
  place-items: center;
  margin-bottom: 0;
}

.setup-card.results-ready .result-value {
  font-size: clamp(2.7rem, 5vw, 4.25rem);
}

.setup-card.results-ready .result-metrics {
  grid-template-columns: 1fr;
  gap: 0.45rem;
  margin-bottom: 0;
}

.setup-card.results-ready .result-metrics div {
  min-height: 2.75rem;
  padding: 0.5rem 0.7rem;
}

.setup-card.results-ready .result-metrics strong {
  margin-top: 0.15rem;
  font-size: 1.25rem;
}

.result-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  align-items: stretch;
}

.result-chart-card {
  margin-bottom: 0;
}

.result-chart-card h4 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.setup-card.results-ready .chart-container {
  min-height: 190px;
  margin-top: 0.2rem;
  padding: 0.25rem;
  background: #ffffff;
}

.setup-card.results-ready .chart-placeholder {
  height: 100%;
  padding: 0;
}

.setup-card.results-ready .chart-placeholder canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.setup-card.results-ready .safety-guidance {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 0.55rem;
  align-content: stretch;
}

.setup-card.results-ready .guidance-card {
  min-height: 100%;
  padding: 0.6rem;
}

.setup-card.results-ready .guidance-card p,
.setup-card.results-ready .guidance-list {
  font-size: 0.76rem;
  line-height: 1.18;
}

.setup-card.results-ready .guidance-list {
  padding: 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--primary-tint);
}

.setup-card.results-ready #calculateFoodsBtn {
  min-height: 2.75rem;
  margin-top: 0.55rem !important;
}

/* Login page viewport fix */
body[data-page="loginPage"] .header {
  display: none;
}

body[data-page="loginPage"] .main-content {
  height: 100vh;
}

body[data-page="loginPage"] .container {
  width: 100%;
  max-width: none;
  padding: 0;
}

body[data-page="loginPage"] .landing-hero {
  width: min(1720px, calc(100vw - clamp(1.5rem, 4vw, 4rem)));
  height: 100%;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1rem, 1.8vw, 1.5rem);
  align-items: center;
}

body[data-page="loginPage"] .landing-copy {
  height: min(820px, calc(100vh - 5rem));
  justify-content: center;
  padding: clamp(1.5rem, 3.4vw, 3rem);
}

body[data-page="loginPage"] .welcome-eyebrow {
  margin-bottom: 0.75rem;
}

body[data-page="loginPage"] .landing-copy h2 {
  max-width: 11ch;
  font-size: clamp(3.2rem, 5.1vw, 4.9rem);
  line-height: 0.96;
}

body[data-page="loginPage"] .landing-copy p {
  max-width: 32rem;
  margin-top: 1rem;
  font-size: clamp(0.98rem, 1.55vw, 1.12rem);
  line-height: 1.45;
}

body[data-page="loginPage"] .login-form {
  width: min(360px, 100%);
  gap: 0.6rem;
  margin-top: 1.05rem;
}

body[data-page="loginPage"] .login-form label {
  text-align: left;
  font-size: 0.8rem;
}

body[data-page="loginPage"] .login-form input {
  min-height: 2.85rem;
  padding: 0.7rem 0.85rem;
}

body[data-page="loginPage"] .login-note {
  margin-top: 0.2rem;
  line-height: 1.35;
}

body[data-page="loginPage"] .login-form .hero-start-btn {
  min-height: 3.3rem;
  margin-top: 0.25rem;
}

body[data-page="loginPage"] .landing-gallery {
  grid-auto-rows: minmax(0, 1fr);
  padding: clamp(0.9rem, 2vw, 1.5rem);
  height: min(820px, calc(100vh - 5rem));
  align-self: center;
}

body[data-page="loginPage"] .gallery-card {
  min-height: 0;
}

body[data-page="loginPage"] .gallery-card strong {
  font-size: 1.05rem;
}

body[data-page="loginPage"] .gallery-card span {
  font-size: 0.75rem;
}

@media (max-width: 900px) {
  .landing-hero,
  .landing-gallery,
  .setup-card,
  .form-row,
  .form-row.three-columns,
  .tracker-dashboard,
  .metrics-grid,
  .summary-stats,
  .calorie-highlights,
  .goals-grid {
    grid-template-columns: 1fr;
  }

  .landing-gallery {
    min-height: auto;
  }

  .welcome-stats {
    grid-template-columns: 1fr;
  }

  .setup-card .form-row.three-columns,
  .setup-card .form-row {
    grid-template-columns: 1fr;
  }

  .setup-card .goals-section .goals-row {
    grid-template-columns: 1fr;
  }

  body[data-page="setupPage"] .setup-card {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .setup-intro-panel {
    min-height: auto;
  }

  .result-metrics {
    grid-template-columns: 1fr;
  }

  body[data-page="trackerPage"] .habit-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .header-content {
    padding: 0.8rem 1rem;
  }

  .container {
    padding: 0.85rem;
  }

  .setup-card {
    padding: 0.8rem;
  }

  .landing-copy {
    padding: 2rem 0.5rem;
  }

  .landing-gallery {
    grid-auto-rows: 180px;
    padding: 0.85rem;
  }

  .landing-copy h2 {
    max-width: 10ch;
    font-size: 3rem;
  }

  .dashboard-copy h2 {
    max-width: 100%;
  }

  .todays-food-log .section-header,
  .notes-header,
  .food-entry,
  .food-item,
  .history-day-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .daily-total,
  .remaining-calories {
    width: 100%;
    justify-content: center;
  }

  .input-with-unit {
    flex-direction: column;
  }

  .input-with-unit select,
  .unit-display {
    width: 100%;
  }
}

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

@media print {
  .header,
  .bottom-nav,
  .theme-toggle,
  .language-select {
    display: none;
  }

  .main-content {
    padding-bottom: 0;
  }

  .container {
    width: 100%;
    padding: 0;
  }
}
