/* CaloriEat — premium health-app UI layer (loads after style.css) */

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

:root {
  /* Neutral, minimal palette (overrides style.css when loaded second) */
  --ce-bg: #0c0e0d;
  --ce-surface: #141816;
  --ce-surface-elevated: #1b201e;
  --ce-border: #2a302e;
  --ce-text: #e6eae8;
  --ce-text-muted: #8b9691;
  --ce-link: #9ebfb4;
  --ce-primary: #5a8f7b;
  --ce-primary-hover: #6fa08e;
  --ce-primary-deep: #4a7a68;
  --ce-accent: #7a9e92;
  --ce-header-start: #1a2220;
  --ce-header-end: #24302c;
  --ce-danger: #c45c5c;
  --ce-glow: rgba(90, 143, 123, 0.18);
  --ce-card-blur: rgba(20, 24, 22, 0.72);
  --ce-success-soft: rgba(90, 143, 123, 0.14);
  --ce-input-bg: rgba(0, 0, 0, 0.28);
  --ce-chart-protein: #6b8cae;
  --ce-chart-carbs: #8aa4a0;
  --ce-chart-fat: #c4a574;
  --ce-chart-sugar: #b87a6a;
  --ce-chart-breakfast: #c9a227;
  --ce-chart-lunch: #d4b84a;
  --ce-chart-dinner: #5a9278;
  --ce-chart-snack: #8a7a9a;
  --ce-chart-fruits: #b87a8f;
  --ce-chart-veggies: #5a9278;
  --ce-chart-grains: #a68f6e;
  --ce-chart-proteins: #6b8cae;
  --ce-chart-processed: #b8835a;
  --ce-chart-sugary: #a85a5a;
}

/* ——— Page backdrop (layered gradients + subtle food imagery) ——— */
html {
  scrollbar-color: var(--ce-primary-deep) var(--ce-surface);
  scrollbar-width: thin;
  background-color: var(--ce-bg);
  min-height: 100%;
}

body {
  position: relative;
  z-index: 0;
  min-height: 100vh;
  background-color: var(--ce-bg);
  background-image:
    linear-gradient(180deg, rgba(12, 14, 13, 0.9) 0%, rgba(10, 12, 11, 0.92) 100%),
    radial-gradient(ellipse 115% 65% at 88% -8%, rgba(90, 143, 123, 0.16), transparent 52%),
    radial-gradient(ellipse 90% 50% at -6% 102%, rgba(74, 122, 104, 0.12), transparent 48%),
    url("https://images.unsplash.com/photo-1543339308-43e59d6b73a6?auto=format&w=1600&q=55"),
    linear-gradient(168deg, #101614 0%, var(--ce-bg) 45%, #0a0c0b 100%);
  background-size: auto, auto, auto, cover, auto;
  /* Photo anchored to bottom-right so detail shows in the corner, not behind centered cards */
  background-position: center, center, center, 92% 88%, center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* ——— Scrollbars (theme) ——— */

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: var(--ce-surface);
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--ce-primary) 0%, var(--ce-primary-deep) 100%);
  border-radius: 999px;
  border: 2px solid var(--ce-surface);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: var(--ce-primary-hover);
}

/* ——— App shell ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0;
  color: #fff;
  text-align: left;
  background: linear-gradient(180deg, var(--ce-header-start) 0%, var(--ce-header-end) 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header .header-top-row {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: relative;
  text-align: left;
}

.site-header .header-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  min-width: 0;
}

.header-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

/* Core shortcuts in the bar; full list stays in the hamburger */
.header-top-row__cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
  flex: 1 1 auto;
  min-width: 0;
}

.header-core-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.15rem 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.header-core-nav__link {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.55rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.header-core-nav__link:hover,
.header-core-nav__link:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  outline: none;
}

.header-core-nav__profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--ce-border);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.header-core-nav__profile:hover,
.header-core-nav__profile:focus-visible {
  background: rgba(90, 143, 123, 0.22);
  border-color: rgba(90, 143, 123, 0.55);
  color: #fff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(90, 143, 123, 0.25);
}

.header-core-nav__profile-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.site-header .menu-icon {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  display: flex !important;
}

.site-header .dropdown {
  display: none;
  position: absolute !important;
  left: auto !important;
  right: 0 !important;
  top: calc(100% + 6px) !important;
  min-width: min(220px, calc(100vw - 2rem));
  max-width: min(320px, calc(100vw - 1.25rem));
  max-height: min(70dvh, 32rem);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 500;
  padding: 0.35rem 0;
  margin: 0;
  background-color: var(--ce-surface-elevated) !important;
  border: 1px solid var(--ce-border) !important;
  border-radius: var(--ce-radius);
  box-shadow: var(--ce-shadow) !important;
}

.site-header .dropdown a {
  display: block !important;
  color: var(--ce-text) !important;
  padding: 0.65rem 1rem !important;
  border-radius: 0;
  font-size: 0.9rem !important;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  text-decoration: none;
}

.site-header .dropdown a:hover,
.site-header .dropdown a:focus-visible {
  background: rgba(90, 143, 123, 0.14) !important;
  color: #fff !important;
}

.site-header .dropdown .menu-divider {
  display: block !important;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.brand__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--ce-primary) 0%, var(--ce-accent) 100%);
  box-shadow: 0 4px 14px var(--ce-glow);
}

.brand__mark svg {
  width: 1.15rem;
  height: 1.15rem;
  color: #052e16;
}

.brand__text {
  color: #fff;
}

/* One-shot hint: which menu item you chose (links to page titles like “Today at a Glance”) */
.ce-nav-from-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.55rem 1rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  background: linear-gradient(90deg, rgba(90, 143, 123, 0.22) 0%, rgba(6, 78, 59, 0.35) 100%);
  border-bottom: 1px solid var(--ce-border);
  font-size: 0.82rem;
  color: var(--ce-text-muted, rgba(255, 255, 255, 0.82));
  line-height: 1.4;
  z-index: 40;
}

.ce-nav-from-banner__inner {
  flex: 1;
  min-width: 0;
}

.ce-nav-from-banner__name {
  color: #fff;
  font-weight: 600;
}

.ce-nav-from-banner__dismiss {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ce-nav-from-banner__dismiss:hover,
.ce-nav-from-banner__dismiss:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}

.header-left {
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-left h1 {
  margin: 0;
  font-size: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  position: absolute;
}

/* Hamburger control — visible at all viewport widths */
.menu-icon {
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 11px 10px;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.menu-icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

.menu-icon span {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.header-links-row {
  display: none !important;
}

/* ——— Mobile quick bar (app / tool pages) ——— */
.app-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 95;
  background: linear-gradient(180deg, var(--ce-header-end) 0%, var(--ce-header-start) 100%);
  border-top: 1px solid var(--ce-border);
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: stretch;
  gap: 0.1rem;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.app-bottom-nav.is-visible {
  display: flex;
}

@media (min-width: 768px) {
  .app-bottom-nav.is-visible {
    display: none;
  }
}

body.ce-pad-bottom {
  padding-bottom: calc(3.85rem + env(safe-area-inset-bottom, 0px));
}

.app-bottom-nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  flex: 1;
  max-width: 5.75rem;
  padding: 0.3rem 0.15rem;
  font-size: 0.62rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  text-align: center;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}

.app-bottom-nav__link:hover,
.app-bottom-nav__link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

/* ——— AI chat widget ——— */
.ai-chat-toggle {
  position: fixed;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  right: calc(0.75rem + env(safe-area-inset-right, 0px));
  left: auto;
  z-index: 10050;
  width: 3.25rem;
  height: 3.25rem;
  min-width: 3.25rem;
  min-height: 3.25rem;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1px solid var(--ce-border);
  background: linear-gradient(145deg, var(--ce-primary) 0%, var(--ce-primary-deep) 100%);
  color: #052e16;
  font-weight: 700;
  font-size: clamp(0.8rem, 2.8vw, 1rem);
  line-height: 1;
  letter-spacing: -0.02em;
  cursor: pointer;
  box-shadow: 0 6px 24px var(--ce-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  margin: 0;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}

.ai-chat-toggle:hover {
  filter: brightness(1.06);
}

body.ce-pad-bottom .ai-chat-toggle {
  bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  body.ce-pad-bottom .ai-chat-toggle {
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 380px) {
  .ai-chat-toggle {
    width: 2.875rem;
    height: 2.875rem;
    min-width: 2.875rem;
    min-height: 2.875rem;
    font-size: 0.78rem;
  }
}

.ai-chat-panel {
  position: fixed;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  right: calc(0.75rem + env(safe-area-inset-right, 0px));
  left: auto;
  z-index: 10051;
  width: min(
    calc(100dvw - 1.5rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)),
    400px
  );
  height: min(72vh, 540px);
  max-height: min(72vh, calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 5.5rem));
  background: var(--ce-surface-elevated);
  border: 1px solid var(--ce-border);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-panel.is-open {
  display: flex;
}

body.ce-pad-bottom .ai-chat-panel {
  bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  body.ce-pad-bottom .ai-chat-panel {
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
}

.ai-chat-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: var(--ce-surface);
  border-bottom: 1px solid var(--ce-border);
  font-weight: 600;
  font-size: 0.88rem;
}

.ai-chat-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ce-text);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.ai-chat-panel__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ai-chat-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ai-chat-msg {
  max-width: 92%;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.ai-chat-msg--bot {
  align-self: flex-start;
  background: rgba(90, 143, 123, 0.15);
  border: 1px solid rgba(90, 143, 123, 0.25);
  color: var(--ce-text);
}

.ai-chat-msg--user {
  align-self: flex-end;
  background: var(--ce-surface);
  border: 1px solid var(--ce-border);
}

.ai-chat-panel__hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--ce-text-muted);
  line-height: 1.4;
}

.ai-chat-panel__form {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem;
  border-top: 1px solid var(--ce-border);
  background: var(--ce-surface);
}

.ai-chat-panel__input {
  flex: 1;
  margin: 0 !important;
  padding: 0.55rem 0.65rem !important;
  font-size: 0.88rem !important;
  border-radius: 10px !important;
}

.ai-chat-panel__send {
  width: auto !important;
  margin: 0 !important;
  padding: 0.55rem 0.85rem !important;
  border-radius: 10px !important;
  white-space: nowrap;
}

/* ——— Toast notifications (food search, etc.) ——— */
.food-notification {
  position: fixed;
  top: max(0.85rem, env(safe-area-inset-top, 0px));
  right: max(0.85rem, env(safe-area-inset-right, 0px));
  left: auto;
  max-width: min(22rem, calc(100vw - 1.75rem - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  padding: 0.85rem 1.1rem;
  margin: 0;
  background: var(--ce-surface-elevated);
  color: var(--ce-text);
  border: 1px solid var(--ce-border);
  border-radius: var(--ce-radius);
  box-shadow: var(--ce-shadow);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  z-index: 10100;
  animation: ce-toast-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  -webkit-tap-highlight-color: transparent;
}

.food-notification.notification-success {
  border-left: 4px solid var(--ce-primary);
  background: linear-gradient(
    90deg,
    var(--ce-success-soft) 0%,
    var(--ce-surface-elevated) 12%,
    var(--ce-surface-elevated) 100%
  );
}

.food-notification.notification-error {
  border-left: 4px solid var(--ce-danger);
  background: linear-gradient(
    90deg,
    rgba(196, 92, 92, 0.14) 0%,
    var(--ce-surface-elevated) 14%,
    var(--ce-surface-elevated) 100%
  );
}

.food-notification.notification-info {
  border-left: 4px solid var(--ce-accent);
  background: linear-gradient(
    90deg,
    rgba(122, 158, 146, 0.12) 0%,
    var(--ce-surface-elevated) 12%,
    var(--ce-surface-elevated) 100%
  );
}

@keyframes ce-toast-in {
  from {
    transform: translateX(calc(100% + 1.25rem));
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ——— Auth (login) ——— */
.auth-shell {
  display: grid;
  gap: 0;
  max-width: 1000px;
  margin: clamp(1rem, 3vw, 2rem) auto;
  padding: 0 clamp(0.75rem, 3vw, 1.25rem);
  align-items: stretch;
}

.auth-shell__visual {
  position: relative;
  border-radius: var(--ce-radius);
  overflow: hidden;
  min-height: 200px;
  border: 1px solid var(--ce-border);
  box-shadow: var(--ce-shadow);
}

.auth-shell__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-shell__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(6, 46, 38, 0.92) 0%,
    rgba(6, 30, 26, 0.55) 45%,
    rgba(10, 20, 18, 0.75) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
}

.auth-shell__tagline {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.2;
}

.auth-shell__sub {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.82);
  max-width: 22rem;
  line-height: 1.45;
}

.auth-shell__panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--ce-surface);
  border: 1px solid var(--ce-border);
  border-radius: var(--ce-radius);
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: var(--ce-shadow);
}

.auth-card .eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ce-primary);
  margin: 0 0 0.35rem;
}

.auth-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.auth-card .ce-heading-with-help {
  margin-bottom: 0.65rem;
}

.auth-card .ce-heading-with-help h2 {
  margin: 0;
}

.auth-card .ce-help-panel {
  margin-bottom: 1rem;
}

.auth-lead {
  margin: 0 0 1.25rem;
  color: var(--ce-text-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.trust-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--ce-success-soft);
  color: var(--ce-primary-hover);
  border: 1px solid rgba(61, 220, 132, 0.25);
}

@media (min-width: 880px) {
  .auth-shell {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 1.5rem;
  }

  .auth-shell__visual {
    min-height: 100%;
    min-height: 420px;
  }
}

/* Sign-in photo: desktop only — phones/tablets get the form first, no tall hero to scroll past */
@media (max-width: 879px) {
  .auth-shell__visual {
    display: none !important;
  }

  .auth-shell {
    margin-top: 0.5rem;
    margin-bottom: 1.25rem;
  }

  .auth-shell__panel {
    padding-top: 0;
  }
}

.sign-in-page .sign-in-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0.5rem clamp(0.75rem, 3vw, 1.25rem) 2rem;
}

.login-gate {
  max-width: 520px;
}

.login-gate__card {
  padding: clamp(1.25rem, 4vw, 1.75rem);
}

.login-gate__head h2 {
  font-size: 1.35rem;
}

.login-gate__actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.login-gate__btn {
  text-align: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.login-gate__note {
  margin: 1.15rem 0 0;
  font-size: 0.88rem;
  color: var(--ce-text-muted);
}

.login-gate__note a {
  color: var(--ce-link);
  font-weight: 600;
}

@media (min-width: 480px) {
  .login-gate__actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .login-gate__btn {
    width: auto;
    flex: 1 1 auto;
    min-width: 10rem;
  }
}


/* Signup card uses .container — elevate */
#profileSection.container {
  max-width: 520px;
}

.page-intro {
  margin-bottom: 1.25rem;
}

.page-intro h2 {
  margin-bottom: 0.35rem;
}

.page-intro p {
  margin: 0;
  color: var(--ce-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ——— Dashboard ——— */
.page-head {
  margin-bottom: 1.25rem;
}

.page-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}

.page-head p {
  margin: 0;
  color: var(--ce-text-muted);
  font-size: 0.9rem;
}

/* Heading + (?) — title width is content-only so (?) sits right beside the text, not at row end */
.ce-heading-with-help {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.2rem;
  margin-bottom: 0.45rem;
  min-width: 0;
}

.page-head > .ce-heading-with-help + .ce-help-panel:not([hidden]) {
  margin-top: 0.15rem;
}

.ce-heading-with-help h1,
.ce-heading-with-help h2,
.ce-heading-with-help h3 {
  margin: 0;
  min-width: 0;
  flex: 0 1 auto;
}

.ce-heading-with-help .ce-help-trigger {
  flex-shrink: 0;
}

.ce-panel__head-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.meal-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-top: 2rem;
}

.meal-list-toolbar h3 {
  margin: 0;
  font-size: 1.05rem;
}

.meal-list-toolbar__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.page-head .ce-help-panel {
  margin-top: 0.5rem;
  margin-bottom: 0.35rem;
  max-width: 42rem;
}

.progress-share-block {
  margin-top: 1rem;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--ce-border);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.progress-share-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.2rem;
  min-width: 0;
}

.progress-share-row .ce-help-trigger {
  flex-shrink: 0;
}

/* Text link (not a chunky button) — still driven by progress-share.js */
.progress-share-link {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ce-link);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
  box-shadow: none !important;
  max-width: 100%;
}

.progress-share-link:hover {
  color: var(--ce-primary-hover);
}

.progress-share-link:focus-visible {
  outline: 2px solid var(--ce-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.progress-share-link[aria-disabled='true'],
.progress-share-link.progress-share-link--busy {
  opacity: 0.65;
  pointer-events: none;
  cursor: wait;
  text-decoration: none;
}

.progress-share-block .ce-help-panel {
  margin-top: 0;
  max-width: 42rem;
}

.progress-share-block .ce-help-panel strong {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
}

.progress-share-status {
  flex-basis: 100%;
  width: 100%;
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(180, 220, 200, 0.95);
}

.progress-share-status--error {
  color: #fecaca;
}

.page-head--section {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--ce-border);
}

.page-head--section h2 {
  margin-bottom: 0.35rem;
}

#helpSection .help-section-title:first-of-type {
  margin-top: 0.65rem;
}

.dash-summary {
  background: linear-gradient(145deg, var(--ce-surface-elevated) 0%, rgba(26, 36, 32, 0.95) 100%);
  border: 1px solid var(--ce-border);
  border-radius: var(--ce-radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.5rem;
}

.dash-summary__meta {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ce-border);
}

.dash-summary__meta .dash-user {
  margin: 0;
  font-weight: 600;
  font-size: 1.05rem;
}

.dash-summary__meta .dash-profile {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--ce-text-muted);
}

.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 520px) {
  .dash-stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.dash-stat {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--ce-border);
  border-radius: 10px;
  padding: 0.85rem 0.75rem;
  text-align: center;
}

.dash-stat__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ce-text-muted);
  margin-bottom: 0.35rem;
}

.dash-stat__value {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ce-text);
  line-height: 1.25;
}

.dash-avg-block {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--ce-border);
}

.dash-avg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dash-avg-head label,
.dash-avg-head span {
  margin: 0;
  width: auto;
  display: inline;
  font-size: 0.88rem;
  font-weight: 600;
}

.dash-avg-head select {
  width: auto;
  margin: 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
}

#avgCaloriesDisplay {
  margin: 0.65rem 0 0;
  font-size: 1.05rem !important;
  color: var(--ce-accent) !important;
}

#avgCaloriesDisplay .avg-cal-sub {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ce-text-muted);
}

/* Charts section: Trends & Insights intro + panels */
.charts-section__intro {
  margin-bottom: 0.35rem;
}

.charts-section__heading {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--ce-border);
}

.charts-section__lead {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ce-text-muted);
}

.charts-section__hint {
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--ce-text-muted);
  line-height: 1.45;
}

.charts-section {
  min-width: 0;
}

/* Personalized insights (dashboard) */
.dashboard-insights-card {
  margin: 0 0 1.15rem;
  padding: clamp(0.85rem, 3vw, 1.1rem) clamp(0.9rem, 3.5vw, 1.15rem);
  border-radius: 12px;
  border: 1px solid rgba(20, 184, 166, 0.35);
  background: rgba(20, 184, 166, 0.07);
  max-width: 100%;
}

.dashboard-insights-card__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ce-accent);
  letter-spacing: 0.02em;
}

.dashboard-insights-card__sub {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ce-text-muted);
}

.dashboard-insights-card__sub a {
  color: var(--ce-link);
}

.dashboard-insights-card__summary {
  margin: 0 0 0.65rem;
}

.dashboard-insights-card__summary p {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ce-text);
}

.dashboard-insights-card__summary p:last-child {
  margin-bottom: 0;
}

.dashboard-insights-card__list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--ce-text-muted);
}

.dashboard-insights-card__list li + li {
  margin-top: 0.45rem;
}

@media (min-width: 640px) {
  .dashboard-insights-card__list {
    padding-left: 1.2rem;
  }
}

.dash-chart-panel {
  margin-bottom: 0.5rem;
  border: 1px solid var(--ce-border);
  border-radius: 12px;
  background: var(--ce-surface-elevated);
  overflow: hidden;
}

.dash-chart-panel__chevron {
  display: none;
}

.dash-chart-panel__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--ce-text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dash-chart-panel__toggle .dash-chart-panel__title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dash-chart-panel__toggle:hover {
  background: rgba(255, 255, 255, 0.04);
}

.dash-chart-panel__toggle:focus-visible {
  outline: 2px solid var(--ce-primary);
  outline-offset: -2px;
}

.dash-chart-panel__toggle::after {
  content: '';
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--ce-text-muted);
  border-bottom: 2px solid var(--ce-text-muted);
  transform: rotate(-45deg);
  margin-top: -0.2rem;
  transition: transform 0.2s ease;
}

.dash-chart-panel--open .dash-chart-panel__toggle::after {
  transform: rotate(135deg);
  margin-top: 0.15rem;
}

.dash-chart-panel__body {
  padding: 0 0.65rem 0.85rem;
  border-top: 1px solid var(--ce-border);
}

.dash-chart-panel__body[hidden] {
  display: none !important;
}

.dash-chart-panel__body .chart-container,
.dash-chart-panel__body .pie-chart-container {
  margin-top: 0.65rem;
}

/* Keep chart slots sized when data is sparse so expand + screenshots layout reliably */
.dash-chart-panel__body .chart-canvas-wrap {
  min-height: 200px;
}

.dash-chart-panel__body .pie-chart-container {
  min-height: 220px;
}

/* ——— Account ——— */
.btn-danger-outline {
  background: transparent !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
  margin-top: 0.75rem;
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.12) !important;
}

.account-note {
  font-size: 0.85rem;
  color: var(--ce-text-muted);
  margin-top: 1rem;
  line-height: 1.45;
}

/* ——— Help Center ——— */
.help-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ce-accent);
  margin: 1.75rem 0 0.65rem;
}

.help-card {
  background: var(--ce-surface-elevated);
  border: 1px solid var(--ce-border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.85rem;
}

.help-card h4 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  color: var(--ce-text);
}

.help-card p,
.help-card li {
  color: var(--ce-text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.help-card ul,
.help-card ol {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.help-card li + li {
  margin-top: 0.35rem;
}

.tip-callout {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: var(--ce-success-soft);
  border: 1px solid rgba(61, 220, 132, 0.22);
  color: var(--ce-primary-hover) !important;
  font-size: 0.88rem !important;
  line-height: 1.45;
}

.help-version {
  margin-top: 2rem;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--ce-border);
  border-left: 3px solid var(--ce-primary);
}

.help-version p {
  margin: 0;
  font-size: 0.82rem !important;
  color: var(--ce-text-muted) !important;
  line-height: 1.5;
}

.cat-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-right: 0.45rem;
  vertical-align: middle;
}

/* ——— FAQs page ——— */
.faq-page__intro {
  margin: 0 0 1rem;
  color: var(--ce-text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.faq-page__toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0 0 1.25rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--ce-border);
  background: var(--ce-surface-elevated);
  font-size: 0.88rem;
}

.faq-page__toc a {
  color: var(--ce-accent);
  font-weight: 600;
  text-decoration: none;
}

.faq-page__toc a:hover {
  text-decoration: underline;
}

.faq-page__section .help-section-title:first-of-type {
  margin-top: 0.25rem;
}

.faq-details {
  margin-bottom: 0.5rem;
  border: 1px solid var(--ce-border);
  border-radius: 12px;
  background: var(--ce-surface-elevated);
  overflow: hidden;
}

.faq-details summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ce-text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.faq-details summary::-webkit-details-marker {
  display: none;
}

.faq-details summary::after {
  content: '';
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--ce-text-muted);
  border-bottom: 2px solid var(--ce-text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.faq-details[open] summary::after {
  transform: rotate(135deg);
  margin-top: 0.12rem;
}

.faq-details summary:hover {
  background: rgba(255, 255, 255, 0.04);
}

.faq-details summary:focus-visible {
  outline: 2px solid var(--ce-primary);
  outline-offset: -2px;
}

.faq-details__body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--ce-border);
  color: var(--ce-text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.faq-details__body p {
  margin: 0;
}

.faq-details__body p + p {
  margin-top: 0.65rem;
}

.faq-details__body code {
  font-size: 0.82em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
}

.faq-page__outro {
  margin: 1.75rem 0 0;
  font-size: 0.9rem;
  color: var(--ce-text-muted);
  line-height: 1.55;
}

/* ——— App section (goals home) ——— */
#appSection .section-block {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ce-border);
}

#appSection .section-block:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0.5rem;
}

/* ——— Signup error ——— */
#signupError {
  display: none;
  background: var(--ce-danger);
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: center;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ——— Ring cards polish ——— */
.ring-card {
  border: 1px solid var(--ce-border) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ring-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--ce-accent);
  margin-top: 0.25rem;
  display: block;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--ce-text-muted);
  margin: -0.5rem 0 1rem;
  line-height: 1.45;
}

.small-btn.small-btn--accent {
  background: var(--ce-primary) !important;
  color: #052e16 !important;
  border-color: transparent !important;
  font-weight: 600;
}

.targets-box {
  border: 1px solid var(--ce-border);
}

.targets-box h3 {
  margin-top: 0;
  font-size: 1.05rem;
}

/* ——— Subtle page background ——— */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(122, 158, 146, 0.06), transparent 55%);
  z-index: -1;
}

/* ——— Menu dividers & visibility helpers ——— */
.menu-divider {
  border: none;
  border-top: 1px solid var(--ce-border);
  margin: 0.35rem 0.75rem;
  opacity: 0.85;
}

/* ——— Labels vs inputs: labels are not “fields” ——— */
main.container label,
.auth-card label,
.ce-panel label,
#profileSection label,
#accountSection label {
  display: block !important;
  width: auto !important;
  max-width: none !important;
  margin-top: 0 !important;
  margin-bottom: 0.4rem !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: var(--ce-text-muted) !important;
  line-height: 1.3 !important;
}

main.container label:first-of-type,
.ce-field:first-child label {
  margin-top: 0 !important;
}

.ce-field {
  margin-top: 1.15rem;
}

.ce-field:first-child {
  margin-top: 0;
}

/* ——— Field labels + expandable help — label and (?) stay adjacent (no space-between) ——— */
.ce-label-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.2rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.ce-label-row label,
.ce-label-row .ce-inline-label {
  flex: 0 1 auto;
  min-width: 0;
  margin-top: 0 !important;
}

.ce-label-row .ce-inline-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ce-text);
  line-height: 1.35;
}

/* Space label + (?) row away from fields below */
.ce-field > .ce-label-row {
  margin-bottom: 0.5rem;
}

.ce-help-trigger {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  margin: 0;
  border: 1px solid var(--ce-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ce-accent);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  box-shadow: none !important;
}

.ce-help-trigger:hover,
.ce-help-trigger:focus-visible {
  background: var(--ce-success-soft);
  border-color: var(--ce-primary);
  color: var(--ce-text);
  outline: none;
}

.ce-help-trigger[aria-expanded="true"] {
  background: rgba(90, 143, 123, 0.25);
  border-color: var(--ce-primary);
  color: #fff;
}

.ce-help-trigger__icon {
  display: block;
  width: 14px;
  height: 14px;
}

.ce-help-panel {
  margin: 0.4rem 0 0.85rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ce-text-muted);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--ce-border);
  border-radius: 10px;
  border-left: 3px solid var(--ce-accent);
}

.ce-help-panel[hidden] {
  margin-top: 0;
  margin-bottom: 0;
}

.ce-help-panel p {
  margin: 0;
}

.ce-help-panel p + p {
  margin-top: 0.45rem;
}

.food-search-header .ce-label-row {
  align-items: center;
  justify-content: flex-start;
  gap: 0.2rem;
  margin-bottom: 0.45rem;
}

.food-search-header .ce-label-row label {
  line-height: 1.35;
  flex: 0 1 auto !important;
  max-width: 100%;
}

.food-search-container .food-search-header {
  margin-bottom: 0.65rem;
}

main.container input:not([type="checkbox"]):not([type="radio"]),
main.container select,
main.container textarea,
.auth-card input,
.auth-card select,
.auth-card textarea,
.ce-panel input,
.ce-panel select,
.ce-panel textarea {
  margin-top: 0 !important;
  background: var(--ce-input-bg) !important;
  border: 1px solid var(--ce-border) !important;
  border-radius: 10px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

main.container input:focus,
main.container select:focus,
main.container textarea:focus,
.auth-card input:focus,
.ce-panel input:focus {
  outline: none;
  border-color: var(--ce-primary) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 3px var(--ce-success-soft) !important;
}

button:not(.toggle-btn):not(.expand-btn):not(.small-btn):not(.meal-type-btn):not(.ce-help-trigger) {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.ce-panel__intro {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--ce-text-muted);
  line-height: 1.55;
}

.ce-subhead {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ce-text);
}

.ce-subhead--list {
  margin-top: 1.25rem;
}

.ce-panel__sub {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ce-border);
}

.ce-panel .targets-grid {
  display: grid;
  gap: 0.85rem 1rem;
}

.ce-panel .targets-grid .ce-field,
.inline-grid-3col .ce-field,
.inline-grid-2col .ce-field {
  margin-top: 0;
}

.auth-card .ce-field {
  margin-top: 0.9rem;
}

.auth-card .ce-field:first-of-type {
  margin-top: 0.35rem;
}

.time-period-selector > label,
.chart-header .time-period-selector label,
.pie-chart-header .time-period-selector label {
  display: inline-block !important;
  width: auto !important;
  margin: 0 0.5rem 0 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  color: var(--ce-text-muted) !important;
}

button#loginBtn,
button#saveProfileBtn,
button#saveGoalBtn,
button#saveTargetsBtn,
button#saveAccountBtn {
  color: #101514 !important;
}

/* ——— Elevated panels (goals, targets, summaries) ——— */
.ce-panel {
  background: var(--ce-surface-elevated);
  border: 1px solid var(--ce-border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.22);
}

.ce-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--ce-border);
}

.ce-panel__head h2,
.ce-panel__head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex: 0 1 auto;
  min-width: 0;
}

.summary,
.targets-box {
  background: var(--ce-surface-elevated) !important;
  border: 1px solid var(--ce-border) !important;
  border-radius: 14px !important;
  padding: 1.2rem 1.3rem !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
}

.chart-container,
.pie-chart-container {
  border-radius: 14px !important;
  border-color: var(--ce-border) !important;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.25) !important;
}

/* ——— Chart metric toggles (no emoji; CSS vars) ——— */
.toggle-btn[data-metric="protein"] {
  background: var(--ce-chart-protein) !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="carbs"] {
  background: var(--ce-chart-carbs) !important;
  color: #0f1413 !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="fat"] {
  background: var(--ce-chart-fat) !important;
  color: #1a1510 !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="sugar"] {
  background: var(--ce-chart-sugar) !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="breakfast"] {
  background: var(--ce-chart-breakfast) !important;
  color: #1a1608 !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="lunch"] {
  background: var(--ce-chart-lunch) !important;
  color: #1a1608 !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="dinner"] {
  background: var(--ce-chart-dinner) !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="snack"] {
  background: var(--ce-chart-snack) !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="fruits"] {
  background: var(--ce-chart-fruits) !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="veggies"] {
  background: var(--ce-chart-veggies) !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="wholeGrains"] {
  background: var(--ce-chart-grains) !important;
  color: #14110d !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="leanProteins"] {
  background: var(--ce-chart-proteins) !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="processedFoods"] {
  background: var(--ce-chart-processed) !important;
  color: #14110d !important;
  border-color: transparent !important;
}
.toggle-btn[data-metric="sugaryFoods"] {
  background: var(--ce-chart-sugary) !important;
  border-color: transparent !important;
}

.toggle-btn {
  font-weight: 600 !important;
  letter-spacing: 0.02em;
}

/* ——— Meal rows ——— */
.meal-row {
  border: 1px solid var(--ce-border) !important;
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 12px !important;
  padding: 1rem !important;
}

/* ——— Welcome & legal shell ——— */
.welcome-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.welcome-nav a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
}

.welcome-nav a:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.welcome-nav__cta {
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.welcome-nav__cta:hover {
  background: rgba(255, 255, 255, 0.18);
  text-decoration: none;
}

.welcome-hero__title-row {
  margin-bottom: 0.5rem;
}

.welcome-hero__title-row h1 {
  margin: 0;
}

.welcome-page .welcome-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.welcome-hero {
  display: grid;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 880px) {
  .welcome-hero {
    grid-template-columns: 1.05fr 0.95fr;
  }
}

.welcome-hero__copy h1 {
  font-size: clamp(1.85rem, 4vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin: 0.5rem 0 1rem;
}

.welcome-lead {
  font-size: 1.05rem;
  color: var(--ce-text-muted);
  line-height: 1.6;
  max-width: 36rem;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0 0.75rem;
}

.btn-welcome-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.35rem;
  border-radius: 10px;
  background: var(--ce-primary);
  color: #0f1412 !important;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-welcome-primary:hover {
  background: var(--ce-primary-hover);
}

.btn-welcome-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.35rem;
  border-radius: 10px;
  background: transparent;
  color: var(--ce-text) !important;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--ce-border);
}

.btn-welcome-secondary:hover {
  border-color: var(--ce-primary);
  color: #fff !important;
}

.welcome-footnote {
  font-size: 0.82rem;
  color: var(--ce-text-muted);
  max-width: 32rem;
}

.welcome-hero__visual img {
  width: 100%;
  border-radius: var(--ce-radius);
  border: 1px solid var(--ce-border);
  box-shadow: var(--ce-shadow);
  max-height: 520px;
  object-fit: cover;
}

/* Phones: headline & actions first — no tall hero photo to scroll past */
@media (max-width: 639px) {
  .welcome-page .welcome-main {
    padding: 1rem 1rem 2rem;
  }

  .welcome-hero {
    gap: 0.75rem;
  }

  .welcome-hero__visual {
    display: none;
  }

  .welcome-hero__copy .eyebrow {
    margin-bottom: 0.35rem;
  }

  .welcome-hero__copy h1 {
    margin: 0 0 0.65rem;
    font-size: clamp(1.45rem, 6.2vw, 1.8rem);
    line-height: 1.18;
  }

  .welcome-lead {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .welcome-actions {
    margin: 1rem 0 0.5rem;
  }

  .welcome-footnote {
    font-size: 0.78rem;
  }

  .welcome-features h2 {
    margin-top: 1.5rem;
  }
}

/* Small tablets: keep a short banner, not a full-height photo */
@media (min-width: 640px) and (max-width: 879px) {
  .welcome-page .welcome-main {
    padding: 1.35rem 1.15rem 2.25rem;
  }

  .welcome-hero {
    gap: 1.25rem;
  }

  .welcome-hero__visual img {
    max-height: 200px;
  }

  .welcome-features h2 {
    margin-top: 2rem;
  }
}

.welcome-features h2 {
  font-size: 1.25rem;
  margin: 2.5rem 0 1rem;
}

.welcome-feature-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .welcome-feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.welcome-feature-grid li {
  background: var(--ce-surface);
  border: 1px solid var(--ce-border);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

.welcome-feature-grid h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.welcome-feature-grid p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ce-text-muted);
  line-height: 1.5;
}

.legal-page .container--legal,
.legal-page .container--narrow-doc {
  max-width: 720px;
}

.container--narrow-doc {
  max-width: 520px;
}

.legal-page h1 {
  margin-top: 0;
}

.legal-updated {
  color: var(--ce-text-muted);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.legal-page main ul {
  padding-left: 1.2rem;
  color: var(--ce-text-muted);
  line-height: 1.55;
}

.legal-page main li + li {
  margin-top: 0.35rem;
}

/* Back to top — long pages (legal, tracker, meal log, etc.) */
.ce-back-to-top {
  display: flex;
  justify-content: center;
  padding: 1.75rem 1rem 0.35rem;
  margin: 0;
}

.ce-back-to-top__link {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ce-text-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.ce-back-to-top__link:hover,
.ce-back-to-top__link:focus-visible {
  color: #fff;
  background: rgba(90, 143, 123, 0.18);
  outline: none;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 1.25rem 2rem;
  border-top: 1px solid var(--ce-border);
  background: rgba(0, 0, 0, 0.25);
}

.ce-back-to-top + .site-footer {
  margin-top: 0.65rem;
}

.site-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem 1.25rem;
  text-align: center;
}

.site-footer__brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-footer__copy {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ce-text-muted);
  flex: 0 1 auto;
  line-height: 1.4;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1.15rem;
  flex: 0 1 auto;
}

.site-footer__nav a {
  color: var(--ce-link);
  text-decoration: none;
  font-size: 0.88rem;
}

.site-footer__nav a:hover {
  text-decoration: underline;
}

.site-footer__note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ce-text-muted);
  flex: 0 1 auto;
  line-height: 1.45;
  max-width: 36rem;
}

/* Desktop: one horizontal row — copyright | links | disclaimer */
@media (min-width: 900px) {
  .site-footer__inner {
    flex-wrap: nowrap;
    justify-content: space-between;
    text-align: left;
    gap: 1rem 1.5rem;
  }

  .site-footer__copy {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .site-footer__nav {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
  }

  .site-footer__note {
    flex: 0 1 auto;
    max-width: min(24rem, 34vw);
    text-align: right;
  }
}

/* Narrow phones: tidy vertical stack */
@media (max-width: 479px) {
  .site-footer__inner {
    flex-direction: column;
    gap: 0.75rem;
    padding-inline: 0.5rem;
  }

  .site-footer__nav {
    gap: 0.5rem 0.85rem;
  }

  .site-footer__note {
    max-width: 100%;
  }
}

/* ——— Profile editor & meal presets ——— */
.profile-save-status {
  margin: 0 0 1rem;
  padding: 0.65rem 1rem;
  border-radius: var(--ce-radius);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: var(--ce-text);
  font-size: 0.9rem;
}

.meal-preset-block {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ce-border);
}

.meal-preset-block:first-of-type {
  margin-top: 0.5rem;
  padding-top: 0;
  border-top: none;
}

.meal-preset-block__head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.2rem;
  margin-bottom: 0.65rem;
  min-width: 0;
}

.meal-preset-block__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ce-text);
  flex: 0 1 auto;
  min-width: 0;
}

.meal-preset-block__head .ce-help-trigger {
  flex-shrink: 0;
}

.meal-preset-rows {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.65rem;
}

.meal-preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1rem;
  padding: 0.85rem 1rem;
  background: var(--ce-surface-elevated);
  border: 1px solid var(--ce-border);
  border-radius: var(--ce-radius);
}

.meal-preset-row__fields {
  flex: 1 1 16rem;
  min-width: 0;
}

.meal-preset-row__name {
  margin-bottom: 0.5rem;
}

.meal-preset-row__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ce-text-muted);
  margin-bottom: 0.2rem;
}

.meal-preset-row__nums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.5rem 0.65rem;
}

.meal-preset-row__nums .ce-field {
  margin: 0;
}

.meal-preset-row .btn-remove-preset {
  flex: 0 0 auto;
  align-self: center;
}

.profile-actions-panel .btn-welcome-primary {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

#acctNotes {
  width: 100%;
  min-height: 4.5rem;
  resize: vertical;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--ce-border);
  background: var(--ce-surface);
  color: var(--ce-text);
}

.profile-quick-picks {
  margin-bottom: 1.25rem;
}

.profile-quick-picks__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-start;
}

.profile-quick-pick-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--ce-border);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.profile-quick-pick-chip:hover,
.profile-quick-pick-chip:focus-visible {
  background: rgba(90, 143, 123, 0.22);
  border-color: rgba(90, 143, 123, 0.55);
  outline: none;
}

.profile-quick-picks__empty {
  margin: 0;
}

.brand__mark svg {
  color: #0f1614;
}
