:root {
  --bg: #eaf1ff;
  --panel: rgba(248, 251, 255, 0.9);
  --panel-strong: #ffffff;
  --ink: #122033;
  --muted: #5d6f89;
  --accent: #195dff;
  --accent-2: #2e86ff;
  --accent-3: #74b6ff;
  --line: rgba(24, 53, 96, 0.12);
  --shadow: 0 24px 60px rgba(23, 46, 88, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(76, 141, 255, 0.28), transparent 28%),
    radial-gradient(circle at bottom right, rgba(155, 208, 255, 0.24), transparent 34%),
    linear-gradient(135deg, #eef5ff 0%, #f7fbff 45%, #eaf1ff 100%);
}

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

.app-shell {
  display: grid;
  grid-template-columns: 330px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 32px 24px;
  background:
    radial-gradient(circle at top right, rgba(104, 180, 255, 0.3), transparent 28%),
    linear-gradient(180deg, rgba(7, 27, 66, 0.98), rgba(14, 47, 108, 0.98));
  color: #eef5ff;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: hidden;
}

.sidebar h1 {
  margin: 0;
  font-family: "DM Serif Display", Georgia, serif;
  line-height: 1;
  color: #ffffff;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.9),
    1px -1px 0 rgba(0, 0, 0, 0.9),
    -1px 1px 0 rgba(0, 0, 0, 0.9),
    1px 1px 0 rgba(0, 0, 0, 0.9),
    0 4px 12px rgba(0, 0, 0, 0.22);
}

.hero-card h2,
.section-heading h3 {
  margin: 0;
  font-family: "DM Serif Display", Georgia, serif;
  line-height: 1;
  color: var(--ink);
  text-shadow: none;
}

.sidebar h1 {
  font-size: clamp(2.2rem, 4vw, 3.4rem);
}

.sidebar-copy,
.hero-copy,
.smart-panel p,
.footnote {
  color: rgba(248, 242, 232, 0.8);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.72;
}

.nav-pills {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
  margin-right: -8px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.nav-pills::-webkit-scrollbar {
  width: 8px;
}

.nav-pills::-webkit-scrollbar-track {
  background: transparent;
}

.nav-pills::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
}

.sidebar-brand {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #eef5ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 12px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.menu-toggle-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.menu-toggle-icon span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.nav-pills a {
  text-decoration: none;
  color: inherit;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: transform 180ms ease, background 180ms ease;
}

.nav-pills a:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-panel,
.card,
.hero-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar-panel {
  color: var(--ink);
  border-radius: 28px;
  padding: 20px;
}

.panel-label {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.main-content {
  padding: 28px;
  display: grid;
  gap: 24px;
}

.hero-card {
  border-radius: 34px;
  padding: 26px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.hero-card h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.hero-copy,
.footnote,
.smart-panel p {
  color: var(--muted);
}

.settings-footnote {
  color: var(--muted);
}

.hero-metrics,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.summary-item,
.mini-stat,
.result-box,
.meal-block,
.smart-panel,
.timeline-entry {
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.metric,
.summary-item {
  padding: 16px;
}

.metric strong,
.summary-item strong {
  display: block;
  font-size: 1.8rem;
  margin-top: 4px;
}

.grid.two-up {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.card {
  border-radius: 30px;
  padding: 24px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 18px;
}

.section-heading h3 {
  font-size: 2rem;
}

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

.stack-form,
.inline-form {
  display: grid;
  gap: 12px;
}

.date-toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.inline-form {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(31, 42, 31, 0.12);
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, #1754ff, #52a7ff);
  color: white;
  box-shadow: 0 12px 24px rgba(29, 101, 255, 0.22);
}

.secondary-button {
  background: linear-gradient(135deg, #0e3dbe, #3f88ff);
  color: white;
}

.ghost-button {
  background: rgba(31, 42, 31, 0.06);
  color: var(--ink);
}

.span-2 {
  grid-column: span 2;
}

.mini-stat,
.result-box {
  padding: 14px;
  min-height: 74px;
}

.chart-shell {
  margin: 18px 0;
  padding: 16px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(66, 126, 255, 0.1), rgba(255, 255, 255, 0.9));
}

#weight-chart {
  width: 100%;
  height: auto;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-entry {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.meal-sections {
  display: grid;
  gap: 14px;
}

.meal-block {
  padding: 16px;
}

.meal-block h4 {
  margin: 0 0 12px;
}

.meal-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.meal-item:first-of-type {
  border-top: 0;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.history-item:first-of-type {
  border-top: 0;
}

.history-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: end;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quantity-control button {
  min-width: 44px;
}

.quantity-input {
  width: 72px;
  text-align: center;
}

.history-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.meal-item h5 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.meal-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
}

.smart-grid {
  align-items: start;
}

.smart-panel {
  padding: 20px;
}

.smart-panel h4 {
  margin-top: 0;
  margin-bottom: 10px;
}

.camera-controls {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}

.meal-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.46);
  backdrop-filter: blur(4px);
  z-index: 70;
}

.meal-sheet {
  position: fixed;
  inset: auto 0 0;
  z-index: 80;
  padding: 16px 16px calc(118px + env(safe-area-inset-bottom, 0px));
}

.meal-sheet-card {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 30px 30px 0 0;
  background: #f9fbff;
  box-shadow: 0 -20px 60px rgba(16, 24, 40, 0.2);
  max-height: min(84vh, 920px);
  overflow-y: auto;
}

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

.meal-sheet-target {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(232, 239, 255, 0.92), rgba(245, 248, 255, 0.98));
  border: 1px solid rgba(138, 166, 214, 0.18);
}

.meal-sheet-target span {
  display: block;
  color: #7a879d;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meal-sheet-target strong {
  display: block;
  margin-top: 4px;
  color: #20304f;
  font-size: 1.35rem;
}

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

.meal-sheet-panel {
  min-height: 100%;
}

.barcode-launch-button {
  width: 100%;
  padding: 16px;
  border-radius: 24px;
  display: grid;
  justify-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(233, 239, 255, 0.95), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(138, 166, 214, 0.2);
  color: #1f2d4d;
}

.barcode-launch-art {
  width: min(100%, 220px);
  height: 74px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, transparent 0 8px, #20304f 8px 12px, transparent 12px 18px, #20304f 18px 20px, transparent 20px 26px, #20304f 26px 31px, transparent 31px 36px, #20304f 36px 39px, transparent 39px 47px, #20304f 47px 54px, transparent 54px 61px, #20304f 61px 64px, transparent 64px 72px, #20304f 72px 77px, transparent 77px 84px, #20304f 84px 92px, transparent 92px 99px, #20304f 99px 103px, transparent 103px 112px, #20304f 112px 119px, transparent 119px 126px, #20304f 126px 130px, transparent 130px 136px, #20304f 136px 144px, transparent 144px 152px, #20304f 152px 155px, transparent 155px 166px, #20304f 166px 172px, transparent 172px 181px, #20304f 181px 186px, transparent 186px 196px, #20304f 196px 201px, transparent 201px 100%);
  box-shadow: inset 0 0 0 1px rgba(138, 166, 214, 0.14);
}

body.meal-sheet-open {
  overflow: hidden;
}

#barcode-video,
#meal-sheet-barcode-video {
  width: 100%;
  min-height: 220px;
  border-radius: 20px;
  background: #0f1a2f;
  object-fit: cover;
  display: none;
}

.result-box strong {
  display: block;
  margin-bottom: 6px;
}

.app-shell {
  grid-template-columns: 300px 1fr;
}

body.dashboard-page {
  background:
    linear-gradient(180deg, #dcebff 0%, #eef5ff 26%, #f5f8ff 100%);
}

body.tools-page {
  background:
    linear-gradient(180deg, #dcebff 0%, #eef5ff 26%, #f5f8ff 100%);
}

body.support-page {
  background:
    linear-gradient(180deg, #dcebff 0%, #eef5ff 26%, #f5f8ff 100%);
}

.dashboard-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding-bottom: 120px;
}

.dashboard-page .hero-card h2,
.dashboard-page .section-heading h3,
.dashboard-page .tracker-title-row h3,
.dashboard-page .meal-card-title h4 {
  font-family: "Space Grotesk", "Segoe UI Variable", "Trebuchet MS", sans-serif;
}

.dashboard-page .card,
.dashboard-page .hero-card {
  background: #ffffff;
  border: 1px solid rgba(138, 166, 210, 0.18);
  box-shadow: 0 18px 44px rgba(48, 79, 135, 0.1);
  backdrop-filter: none;
}

.tools-page .card,
.tools-page .hero-card {
  background: #ffffff;
  border: 1px solid rgba(138, 166, 210, 0.18);
  box-shadow: 0 18px 44px rgba(48, 79, 135, 0.1);
  backdrop-filter: none;
}

.support-page .card,
.support-page .hero-card {
  background: #ffffff;
  border: 1px solid rgba(138, 166, 210, 0.18);
  box-shadow: 0 18px 44px rgba(48, 79, 135, 0.1);
  backdrop-filter: none;
}

.dashboard-utility-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 14px;
}

.tools-utility-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 14px;
}

.support-utility-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 14px;
}

.assistant-pill,
.burn-pill {
  min-height: 70px;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(136, 166, 214, 0.2);
  box-shadow: 0 14px 30px rgba(48, 79, 135, 0.08);
}

.assistant-pill {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.dashboard-utility-row .assistant-pill,
.tools-utility-row .assistant-pill,
.support-utility-row .assistant-pill {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.assistant-pill > div {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.dashboard-utility-row .assistant-avatar,
.tools-utility-row .assistant-avatar,
.support-utility-row .assistant-avatar {
  display: none !important;
}

.assistant-pill strong {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(1.7rem, 5.8vw, 2.65rem);
  line-height: 1.05;
  white-space: nowrap;
}

.assistant-pill strong,
.burn-pill strong {
  display: block;
  color: var(--ink);
}

.assistant-pill span {
  display: block;
  color: #5d6472;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.72rem, 2.6vw, 0.94rem);
  line-height: 1.2;
  white-space: nowrap;
}

.assistant-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2854ff, #62b0ff);
  color: #fff;
  font-weight: 700;
}

.burn-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.burn-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 110, 64, 0.12);
  color: #ff5d2f;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.date-strip-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
}

.date-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 58px;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding-block: 2px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.date-strip::-webkit-scrollbar {
  display: none;
}

.date-strip-nav {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(138, 166, 214, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: #4360a1;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(48, 79, 135, 0.08);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.date-chip {
  min-height: 84px;
  padding: 10px 8px;
  border-radius: 22px;
  border: 1px solid rgba(138, 166, 214, 0.18);
  background: rgba(255, 255, 255, 0.96);
  color: #8592aa;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  box-shadow: 0 12px 28px rgba(48, 79, 135, 0.06);
}

.date-chip strong {
  font-size: 1.4rem;
  line-height: 1;
  color: inherit;
}

.date-chip span {
  font-size: 0.78rem;
}

.date-chip.is-active {
  background: linear-gradient(180deg, #3d67ff, #2854ff);
  color: #ffffff;
}

@media (min-width: 721px) {
  .date-strip {
    grid-auto-columns: 72px;
    gap: 10px;
  }

  .date-chip {
    min-height: 100px;
    padding: 14px 10px;
    border-radius: 28px;
  }

  .date-chip strong {
    font-size: 1.8rem;
  }

  .date-chip span {
    font-size: 0.9rem;
  }
}

@media (min-width: 1024px) {
  .date-strip {
    grid-auto-columns: 84px;
    gap: 12px;
  }

  .date-chip {
    min-height: 116px;
    padding: 16px 12px;
    border-radius: 30px;
  }

  .date-chip strong {
    font-size: 2rem;
  }

  .date-chip span {
    font-size: 0.95rem;
  }
}

.dashboard-hero {
  padding: 26px;
}

.tools-hero {
  padding: 26px;
}

.support-hero {
  padding: 26px;
}

.dashboard-hero-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-edit-link,
.compact-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(54, 95, 255, 0.1);
  color: #2854ff;
  text-decoration: none;
  font-weight: 700;
}

.tracker-overview {
  display: grid;
  gap: 18px;
}

.tracker-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.tracker-kicker {
  display: block;
  margin-bottom: 8px;
  color: #8793a7;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tracker-title-row h3 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.05;
}

.tracker-title-row h3 a {
  color: #2c5cff;
  text-decoration: none;
}

.tracker-goal-mode {
  padding: 10px 14px;
  border-radius: 999px;
  background: #eef3ff;
  color: #50617f;
  font-size: 0.88rem;
  font-weight: 700;
}

.tracker-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: center;
}

.tracker-stat-stack {
  display: grid;
  gap: 14px;
}

.tracker-stat-card {
  padding: 16px 18px;
  border-radius: 24px;
  background: #f8fbff;
  border: 1px solid rgba(138, 166, 214, 0.16);
}

.tracker-stat-card span {
  display: block;
  margin-bottom: 6px;
  color: #8592aa;
  font-size: 0.92rem;
}

.tracker-stat-card strong {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.tracker-stat-card small {
  font-size: 0.56em;
  color: #4f607d;
}

.calorie-ring {
  --ring-progress: 0%;
  width: min(100%, 280px);
  aspect-ratio: 1;
  margin-inline: auto;
  border-radius: 50%;
  padding: 18px;
  background: conic-gradient(#2f61ff var(--ring-progress), #edf2ff 0);
  display: grid;
  place-items: center;
}

.calorie-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ffffff;
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(138, 166, 214, 0.14);
}

.calorie-ring-inner strong {
  display: block;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1;
}

.calorie-ring-inner span {
  color: #72819a;
  font-size: 1rem;
}

.macro-progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.macro-progress-card {
  padding: 16px;
  border-radius: 24px;
  background: #fbfcff;
  border: 1px solid rgba(138, 166, 214, 0.14);
}

.macro-progress-head {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.macro-progress-head span {
  color: #6a7c99;
}

.macro-progress-head strong {
  font-size: 1.05rem;
}

.macro-progress-track {
  height: 12px;
  border-radius: 999px;
  background: #edf1f8;
  overflow: hidden;
}

.macro-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.macro-progress-card.carbs .macro-progress-track span {
  background: linear-gradient(90deg, #ffb000, #ffc933);
}

.macro-progress-card.protein .macro-progress-track span {
  background: linear-gradient(90deg, #40c953, #6de063);
}

.macro-progress-card.fat .macro-progress-track span {
  background: linear-gradient(90deg, #ff7a00, #ff9800);
}

.dashboard-meals-card,
.dashboard-quick-add,
.dashboard-smart-tools,
.dashboard-progress-card {
  border-radius: 34px;
}

.tools-form-card {
  border-radius: 34px;
}

.support-card {
  border-radius: 34px;
}

.support-page .hero-card h2,
.support-page .section-heading h3 {
  font-family: "Space Grotesk", "Segoe UI Variable", "Trebuchet MS", sans-serif;
}

.support-page .hero-copy,
.support-page .footnote,
.support-page .history-copy {
  color: var(--muted);
}

.support-page .main-content {
  padding-bottom: 120px;
}

.support-page .metric,
.support-page .meal-block,
.support-page .history-item,
.support-page .mini-stat,
.support-page .result-box {
  background: #fbfcff;
  border: 1px solid rgba(138, 166, 214, 0.14);
}

.support-page .support-inner-panel {
  padding: 18px;
}

.support-page .meal-item,
.support-page .history-item {
  border-top-color: rgba(138, 166, 214, 0.14);
}

.support-page .profile-grid label,
.support-page .metric span {
  color: #6d7d97;
}

.support-page .settings-footnote {
  margin-top: 18px;
}

.journal-grid {
  align-items: start;
}

.journal-calendar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.journal-calendar-head strong {
  font-size: 1.08rem;
}

.journal-weekdays,
.journal-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.journal-weekdays {
  margin-bottom: 10px;
}

.journal-weekdays span {
  text-align: center;
  color: #7a879d;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.journal-day {
  min-height: 46px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid rgba(138, 166, 214, 0.14);
  color: #44526c;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0;
}

.journal-day.is-other-month {
  opacity: 0.42;
}

.journal-day.is-today {
  box-shadow: inset 0 0 0 2px rgba(61, 103, 255, 0.24);
}

.journal-day.has-entry::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2f61ff;
  position: absolute;
  margin-top: 28px;
}

.journal-day.is-selected {
  background: linear-gradient(180deg, #3d67ff, #2854ff);
  color: #fff;
}

.journal-day {
  position: relative;
}

.journal-date-toolbar {
  margin-top: 18px;
}

.journal-snapshot-grid {
  margin-bottom: 20px;
}

.journal-status-box {
  margin-top: 16px;
  min-height: 0;
}

.journal-media-panel {
  margin-top: 18px;
}

.journal-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.journal-image-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 18px;
  background: #eef3ff;
}

.journal-video-preview {
  margin-top: 10px;
}

.journal-video-preview video {
  width: 100%;
  max-height: 340px;
  border-radius: 22px;
  background: #0f1a2f;
}

.journal-empty-copy {
  color: #7a879d;
}

.tools-page .hero-card h2,
.tools-page .section-heading h3 {
  font-family: "Space Grotesk", "Segoe UI Variable", "Trebuchet MS", sans-serif;
}

.tools-page .hero-copy,
.tools-page .footnote {
  color: var(--muted);
}

.tools-page .main-content {
  padding-bottom: 120px;
}

.tools-page .summary-item {
  background: #fbfcff;
  border: 1px solid rgba(138, 166, 214, 0.14);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 170px;
}

.tools-page .summary-item strong {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  margin-bottom: 12px;
}

.tools-page .profile-grid label,
.tools-page .profile-grid span,
.tools-page .metric span {
  color: #6d7d97;
}

.tools-page .metric,
.tools-page .summary-item {
  border-radius: 24px;
}

.tools-page .info-trigger {
  margin-top: 0;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: #eef3ff;
  color: #2f61ff;
  font-weight: 700;
}

.tools-page .summary-support {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.tools-page .metric-subtitle {
  color: #6d7d97;
  line-height: 1.45;
}

.tools-page .summary-item.summary-alert-safe {
  background: #dff6df;
  border-color: rgba(69, 151, 92, 0.34);
}

.tools-page .summary-item.summary-alert-warning {
  background: #ffd9b0;
  border-color: rgba(219, 123, 21, 0.4);
}

.tools-page .summary-item.summary-alert-danger {
  background: #c62828;
  border-color: rgba(255, 220, 91, 0.5);
}

.tools-page .summary-item.summary-alert-danger > span,
.tools-page .summary-item.summary-alert-danger strong,
.tools-page .summary-item.summary-alert-danger .metric-subtitle {
  color: #ffe76b;
}

.tools-page .summary-item.summary-alert-danger .info-trigger {
  background: rgba(255, 231, 107, 0.16);
  color: #ffe76b;
}

.tools-page dialog::backdrop {
  background: rgba(12, 23, 48, 0.28);
  backdrop-filter: blur(3px);
}

.tools-page .info-dialog {
  border: 0;
  background: transparent;
  padding: 24px;
}

.tools-page .info-dialog-card {
  max-width: 760px;
  margin: auto;
  border-radius: 30px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid rgba(138, 166, 214, 0.18);
  box-shadow: 0 22px 48px rgba(26, 49, 92, 0.18);
}

.tools-page .dialog-copy {
  color: #53637d;
  line-height: 1.65;
}

.dashboard-log-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.dashboard-date-input {
  min-width: 220px;
}

.compact-button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
}

.dashboard-meal-sections {
  gap: 20px;
}

.dashboard-meal-card {
  padding: 24px;
  border-radius: 30px;
  background: #ffffff;
  border: 1px solid rgba(138, 166, 214, 0.14);
}

.meal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.meal-card-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.meal-card-title h4 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.meal-card-title p {
  margin: 4px 0 0;
  color: #97a2b4;
  font-size: 1rem;
}

.meal-card-icon,
.dashboard-food-avatar,
.mobile-tabbar-icon {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
}

.meal-card-icon {
  width: 46px;
  height: 46px;
  background: #eaf4ff;
  color: #2896ff;
}

.meal-add-button {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 50%;
  padding: 0;
  background: linear-gradient(180deg, #3d67ff, #2854ff);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 14px 24px rgba(40, 84, 255, 0.24);
}

.meal-card-progress {
  height: 12px;
  margin: 18px 0 10px;
  border-radius: 999px;
  background: #eef2f8;
  overflow: hidden;
}

.meal-card-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #46b9ff, #45b0ff);
}

.dashboard-meal-card.dinner .meal-card-progress span {
  background: linear-gradient(90deg, #ff8a1e, #ff9d00);
}

.dashboard-food-list {
  display: grid;
}

.dashboard-food-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px 0;
  border-top: 1px solid rgba(138, 166, 214, 0.14);
}

.dashboard-food-avatar {
  width: 52px;
  height: 52px;
  background: #f1f5fb;
  color: #6a7c99;
}

.dashboard-food-copy h5 {
  margin: 0 0 4px;
  font-size: clamp(1.15rem, 2.6vw, 1.9rem);
  line-height: 1.15;
}

.dashboard-food-copy p {
  margin: 0;
  color: #8592aa;
  font-size: 0.98rem;
}

.dashboard-empty-meal {
  margin: 16px 0 0;
  color: #8592aa;
}

.compact-menu-button {
  min-width: 48px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 999px;
  color: #95a1b3;
}

.mobile-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(239, 242, 255, 0.96);
  border-top: 1px solid rgba(138, 166, 214, 0.18);
  backdrop-filter: blur(18px);
}

.mobile-tabbar-link {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #9aa7be;
  text-decoration: none;
  font-size: 0.84rem;
}

.mobile-tabbar-button {
  font: inherit;
  padding: 0;
}

.mobile-tabbar-link .mobile-tabbar-icon {
  width: 42px;
  height: 42px;
  background: rgba(61, 103, 255, 0.12);
  color: #4266ff;
}

.mobile-tabbar-link--center .mobile-tabbar-icon {
  width: 64px;
  height: 64px;
  margin-top: -22px;
  background: linear-gradient(180deg, #3d67ff, #2854ff);
  color: #fff;
  box-shadow: 0 14px 26px rgba(40, 84, 255, 0.28);
}

.mobile-tabbar-icon--menu {
  width: 78px;
  height: 78px;
  margin-top: -30px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3d67ff, #2854ff);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: 0 16px 28px rgba(40, 84, 255, 0.3);
}

.mobile-tabbar-link.is-active,
.mobile-tabbar-link:hover {
  color: #4266ff;
}

.mobile-action-backdrop {
  position: fixed;
  inset: 0;
  z-index: 24;
  background: rgba(13, 25, 51, 0.24);
  backdrop-filter: blur(4px);
}

.mobile-action-menu {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 106px;
  z-index: 25;
  max-height: calc(100vh - 132px - env(safe-area-inset-top, 0px));
}

.mobile-action-menu-card {
  border-radius: 28px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(138, 166, 214, 0.2);
  box-shadow: 0 22px 44px rgba(26, 49, 92, 0.18);
  max-height: inherit;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.mobile-action-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mobile-action-menu-head strong {
  font-size: 1rem;
}

.mobile-action-close {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: #eef3ff;
  color: #3d67ff;
  font-weight: 700;
}

.mobile-action-list {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.mobile-action-item {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 18px;
  background: #f7faff;
  border: 1px solid rgba(138, 166, 214, 0.14);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

body.mobile-action-open {
  overflow: hidden;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }
}

@media (max-width: 720px) {
  .dashboard-page .sidebar {
    display: none;
  }

  .tools-page .sidebar {
    display: none;
  }

  .support-page .sidebar {
    display: none;
  }

  .dashboard-page .app-shell {
    grid-template-columns: 1fr;
  }

  .tools-page .app-shell {
    grid-template-columns: 1fr;
  }

  .support-page .app-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-page .main-content {
    padding: 18px 0 118px;
  }

  .tools-page .main-content {
    padding: 18px 0 118px;
  }

  .support-page .main-content {
    padding: 18px 0 118px;
  }

  .dashboard-utility-row {
    gap: 10px;
  }

  .assistant-pill,
  .burn-pill {
    min-height: 62px;
    padding: 10px 14px;
  }

  .assistant-pill strong {
    font-size: 1.46rem;
  }

  .assistant-pill span {
    font-size: 0.76rem;
  }

  .date-strip {
    grid-auto-columns: 58px;
    gap: 8px;
  }

  .date-chip {
    min-height: 84px;
    border-radius: 22px;
  }

  .dashboard-hero,
  .dashboard-meal-card,
  .dashboard-meals-card,
  .dashboard-quick-add,
  .dashboard-smart-tools,
  .dashboard-progress-card {
    border-radius: 28px;
  }

  .dashboard-hero {
    padding: 22px;
  }

  .tools-hero,
  .tools-form-card {
    border-radius: 28px;
  }

  .support-hero,
  .support-card {
    border-radius: 28px;
  }

  .tools-hero {
    padding: 22px;
  }

  .support-hero {
    padding: 22px;
  }

  .dashboard-hero-head,
  .tracker-title-row {
    grid-template-columns: 1fr;
    display: grid;
  }

  .tracker-main-grid,
  .macro-progress-grid {
    grid-template-columns: 1fr;
  }

  .calorie-ring {
    width: min(100%, 240px);
  }

  .dashboard-log-toolbar {
    align-items: stretch;
  }

  .dashboard-date-input {
    min-width: 0;
  }

  .meal-card-header {
    align-items: start;
  }

  .meal-card-title h4 {
    font-size: 1.4rem;
  }

  .meal-add-button {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .dashboard-food-item {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .dashboard-food-avatar {
    width: 44px;
    height: 44px;
  }

  .dashboard-food-copy h5 {
    font-size: 1.05rem;
  }

  .mobile-tabbar {
    display: grid;
  }

  .mobile-action-menu {
    left: 12px;
    right: 12px;
    bottom: 104px;
  }

  .sidebar {
    padding: 22px 18px;
  }

  .sidebar-brand {
    align-items: center;
  }

  .sidebar-copy {
    margin-bottom: 0;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav-pills {
    display: none;
    margin-top: 4px;
  }

  .sidebar.nav-open .nav-pills {
    display: grid;
  }

  .nav-pills a:hover {
    transform: none;
  }

  .main-content {
    padding: 18px;
  }

  .profile-grid,
  .meal-form {
    grid-template-columns: 1fr;
  }

  .meal-sheet {
    padding: 10px 10px calc(108px + env(safe-area-inset-bottom, 0px));
  }

  .meal-sheet-card {
    padding: 16px;
    border-radius: 26px 26px 0 0;
  }

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

  .meal-sheet-head {
    align-items: center;
  }

  .journal-calendar-head {
    flex-wrap: wrap;
  }

  .journal-image-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .hero-metrics,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .history-item {
    grid-template-columns: 1fr;
  }

  .history-actions {
    justify-content: start;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-content,
  .dashboard-page .main-content,
  .tools-page .main-content {
    padding: 16px 0 112px;
  }

  .support-page .main-content {
    padding: 16px 0 112px;
  }

  .mobile-tabbar {
    display: grid;
  }

  .mobile-action-menu {
    left: 12px;
    right: 12px;
    bottom: 100px;
  }

  .dashboard-main {
    max-width: none;
  }

  .hero-metrics,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.auth-page {
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(100%, 560px);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 34px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 30px;
  display: grid;
  gap: 22px;
}

.auth-card-wide {
  width: min(100%, 780px);
}

.auth-brand h1 {
  margin: 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
}

.auth-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label,
.account-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-form input,
.account-form input {
  width: 100%;
}

.auth-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-form-grid .span-2 {
  grid-column: span 2;
}

.auth-alert {
  border-radius: 22px;
  padding: 14px 16px;
  border: 1px solid transparent;
}

.auth-alert p {
  margin: 0;
}

.auth-alert p + p {
  margin-top: 6px;
}

.auth-alert-error {
  background: rgba(255, 235, 235, 0.92);
  border-color: rgba(211, 84, 84, 0.28);
  color: #8c2323;
}

.auth-alert-success {
  background: rgba(231, 255, 237, 0.92);
  border-color: rgba(42, 167, 82, 0.24);
  color: #19673a;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.auth-links a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.account-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.account-cta-row .primary-button,
.account-cta-row .secondary-button {
  text-decoration: none;
}

.is-guest-locked .sidebar,
.is-guest-locked .mobile-tabbar,
.is-guest-locked .mobile-action-menu,
.is-guest-locked .mobile-action-backdrop {
  visibility: hidden;
  pointer-events: none;
}

.is-guest-locked .main-content {
  filter: blur(18px) saturate(0.9);
  pointer-events: none;
  user-select: none;
}

.guest-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.guest-gate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(236, 243, 255, 0.62);
  backdrop-filter: blur(8px);
}

.guest-gate-card {
  position: relative;
  width: min(100%, 620px);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 34px;
  box-shadow: 0 28px 80px rgba(24, 40, 84, 0.2);
  padding: 32px;
  display: grid;
  gap: 18px;
  text-align: center;
}

.guest-gate-card h2 {
  margin: 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3rem);
}

.guest-gate-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.guest-gate-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.guest-gate-actions a {
  text-decoration: none;
}

@media (max-width: 720px) {
  .auth-shell {
    padding: 16px;
  }

  .auth-card {
    border-radius: 28px;
    padding: 22px;
  }

  .auth-form-grid,
  .account-summary-grid {
    grid-template-columns: 1fr;
  }

  .auth-form-grid .span-2 {
    grid-column: auto;
  }

  .guest-gate {
    padding: 16px;
  }

  .guest-gate-card {
    border-radius: 28px;
    padding: 24px;
  }
}
