/*
 * Component styles for Peppi design-system Custom Elements.
 * All values use design tokens defined in tokens.css.
 * Each block targets the Custom Element's host selector and its internal parts.
 */

/* ---------------------------------------------------------------------------
 * peppi-app-header
 * --------------------------------------------------------------------------- */

peppi-app-header {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background-color: var(--color-brand-primary);
  padding-top: env(safe-area-inset-top, 0px);
  box-shadow: var(--shadow-md);
}

.peppi-app-header__bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 56px;
  padding: 0 var(--space-4);
  max-width: 480px;
  margin: 0 auto;
}

.peppi-app-header__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: var(--font-size-18);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-inverse);
}

/* Peppi brand mark — Home route only (top-left header slot). A CSS mask
 * silhouette of the wordmark asset, filled with --color-text-inverse (the
 * same token the plain text title uses) so a partner-theme override of that
 * token re-tints the mark automatically with no separate logo-swap wiring. */
.peppi-app-header__brand-mark {
  flex: 1 1 auto;
  min-width: 0;
  height: 22px;
  max-width: 120px;
  background-color: var(--color-text-inverse);
  -webkit-mask-image: url('/assets/brand/peppi-wordmark.svg');
  mask-image: url('/assets/brand/peppi-wordmark.svg');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: left center;
  mask-position: left center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Partner logo — Home route only, replaces .peppi-app-header__brand-mark
 * when the signed-in org has a fullLockup/mark logo (PeppiAppHeader.ts's
 * _brandSlotHtml). Unlike the mask above, this is the partner's actual
 * (potentially multi-color) SVG rendered as-is, so it is not tinted via
 * --color-text-inverse — object-fit keeps it from overflowing the fixed
 * header row regardless of the source asset's aspect ratio. */
.peppi-app-header__brand-logo {
  flex: 1 1 auto;
  min-width: 0;
  height: 22px;
  max-width: 120px;
  object-fit: contain;
  object-position: left center;
}

/* "Beta" MVP label (feedback General #2). Translucent-white pill echoing the
 * avatar treatment so it reads as chrome, not content. On Home it hugs the
 * capped brand mark; on text-title routes the flex-growing title pushes it
 * toward the right. */
.peppi-app-header__beta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--border-radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.4);
  background-color: rgba(255, 255, 255, 0.18);
  color: var(--color-text-inverse);
  font-family: var(--font-sans);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
}

.peppi-app-header__context {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
  color: rgba(255, 255, 255, 0.82);
  text-align: right;
}

.peppi-app-header__avatar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--border-radius-pill);
  border: 2px solid rgba(255, 255, 255, 0.35);
  background-color: rgba(13, 46, 92, 0.35);
  color: var(--color-text-inverse);
  font-family: var(--font-sans);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  padding: 0;
}

.peppi-app-header__avatar:hover {
  background-color: rgba(13, 46, 92, 0.5);
}

/* ---------------------------------------------------------------------------
 * peppi-tab-bar
 * --------------------------------------------------------------------------- */

peppi-tab-bar {
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 92px;
  background-color: #EDF4FC;
  border-top: 1px solid rgba(214, 230, 247, 0.95);
  box-shadow: 0 -10px 30px rgba(13, 46, 92, 0.06);
}

/* ---------------------------------------------------------------------------
 * peppi-bottom-sheet
 * --------------------------------------------------------------------------- */

peppi-bottom-sheet {
  display: block;
  position: fixed;
  bottom: 92px; /* above tab bar */
  left: 0;
  right: 0;
  z-index: 200;
  background-color: var(--color-surface-raised);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  box-shadow: var(--shadow-xl);
}

/* ---------------------------------------------------------------------------
 * peppi-window-banner
 * --------------------------------------------------------------------------- */

peppi-window-banner {
  display: block;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-surface-tint);
  border-bottom: 1px solid var(--color-border);
}

/* ---------------------------------------------------------------------------
 * peppi-button
 * --------------------------------------------------------------------------- */

peppi-button {
  display: inline-block;
}

/* ---------------------------------------------------------------------------
 * peppi-card
 * --------------------------------------------------------------------------- */

peppi-card {
  display: block;
  background-color: var(--color-surface-raised);
  border-radius: var(--border-radius-card);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
}

/* ---------------------------------------------------------------------------
 * peppi-priority-alert-card
 * --------------------------------------------------------------------------- */

peppi-priority-alert-card {
  display: block;
  background-color: var(--color-danger-bg);
  border: 1px solid var(--color-danger);
  border-radius: var(--border-radius-card);
  padding: var(--space-3) var(--space-4);
}

/* ---------------------------------------------------------------------------
 * peppi-shield-gauge
 * --------------------------------------------------------------------------- */

peppi-shield-gauge {
  display: block;
  width: 200px;
  height: 200px;
}

peppi-shield-gauge canvas {
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------------------
 * Form inputs
 * --------------------------------------------------------------------------- */

peppi-input,
peppi-checkbox,
peppi-radio,
peppi-slider,
peppi-toggle {
  display: block;
  margin-bottom: var(--space-3);
}

/* ---------------------------------------------------------------------------
 * peppi-avatar
 * --------------------------------------------------------------------------- */

peppi-avatar {
  display: inline-block;
  border-radius: var(--border-radius-pill);
  overflow: hidden;
  width: 40px;
  height: 40px;
  background-color: var(--color-surface-tint);
}

/* ---------------------------------------------------------------------------
 * peppi-badge
 * --------------------------------------------------------------------------- */

peppi-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: var(--border-radius-pill);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-semibold);
  background-color: var(--color-brand-primary);
  color: var(--color-text-inverse);
}

/* ---------------------------------------------------------------------------
 * peppi-spinner
 * --------------------------------------------------------------------------- */

peppi-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
}

/* ---------------------------------------------------------------------------
 * peppi-toast
 * --------------------------------------------------------------------------- */

peppi-toast {
  display: block;
  position: fixed;
  bottom: 80px; /* above tab bar + clearance */
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
 * Shared post-onboarding screen polish
 * --------------------------------------------------------------------------- */

.checkin-drawer,
.insights-container,
.profile-container,
.navigate-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: calc(100dvh - 92px);
  width: 100%;
}

.checkin-drawer .peppi-screen__title,
.insights-screen__title,
.profile-screen__title,
.navigate-screen__title {
  color: #0D2E5C;
  font-family: var(--font-sans);
  font-size: var(--font-size-28);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0;
  line-height: 1.05;
  margin: 0;
}

.checkin-section,
.insights-card,
.profile-section,
.navigate-card {
  background: #FFFFFF;
  border: 1px solid #D6E6F7;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(13, 46, 92, 0.04);
  padding: var(--space-4);
}

.checkin-section__label,
.insights-card__title,
.profile-section__title,
.navigate-section-label {
  color: #0D2E5C;
  font-family: var(--font-sans);
  font-size: var(--font-size-18);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
  margin: 0 0 var(--space-2);
}

.checkin-section__summary,
.checkin-note-saved,
.profile-caregiver-empty,
.profile-info-row__body,
.profile-pa-tile__detail,
.profile-consent-locked__hint,
.profile-account__org,
.insights-archive__empty {
  color: #3A5070;
  font-size: var(--font-size-13);
  line-height: var(--line-height-relaxed);
}

.checkin-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.checkin-chip,
.checkin-btn,
.profile-caregiver-btn,
.profile-save-btn,
.insights-archive-toggle,
.insights-archive__dismiss-btn,
.insights-more-link,
.navigate-action,
.navigate-back {
  align-items: center;
  background: #EDF4FC;
  border: 1px solid #D6E6F7;
  border-radius: 999px;
  color: #0D2E5C;
  cursor: pointer;
  display: inline-flex;
  font-family: var(--font-sans);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-semibold);
  justify-content: center;
  line-height: 1.1;
  min-height: 40px;
  padding: 10px 14px;
  text-decoration: none;
  transition: background var(--motion-fast) var(--easing-standard),
              border-color var(--motion-fast) var(--easing-standard),
              color var(--motion-fast) var(--easing-standard);
}

.checkin-chip.is-selected,
.checkin-chip.is-active,
.checkin-btn--primary,
.profile-save-btn,
.profile-caregiver-btn--submit,
.navigate-action--primary {
  background: #3EC9D6;
  border-color: #3EC9D6;
  color: #0D2E5C;
}

.checkin-btn--primary,
.profile-save-btn,
.navigate-action--primary {
  min-height: 48px;
  width: 100%;
}

.checkin-input,
.checkin-select,
.profile-time-input,
.profile-tz-select,
.profile-caregiver-form__input,
.profile-caregiver-form__select {
  appearance: none;
  background: #FFFFFF;
  border: 1px solid #C7DCF2;
  border-radius: 12px;
  color: #0D2040;
  font-family: var(--font-sans);
  font-size: var(--font-size-15);
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.checkin-select,
.profile-tz-select,
.profile-caregiver-form__select {
  background-image:
    linear-gradient(45deg, transparent 50%, #366EB0 50%),
    linear-gradient(135deg, #366EB0 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
  padding-right: 34px;
}

.checkin-label,
.profile-notif-label,
.profile-consent-label,
.profile-caregiver-form__label {
  color: #0D2E5C;
  display: block;
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}

.checkin-section__kicker {
  color: #7A9EC5;
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.09em;
  line-height: 1;
  margin-bottom: var(--space-2);
  text-transform: uppercase;
}

.checkin-supports-label {
  margin: var(--space-1) 0 calc(var(--space-2) * -1);
}

.checkin-mic-btn {
  align-items: center;
  background: #EDF4FC;
  border: 1px solid #D6E6F7;
  border-radius: 999px;
  color: #0D2E5C;
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  font-size: var(--font-size-18);
  height: 36px;
  justify-content: center;
  line-height: 1;
  width: 36px;
}

.checkin-mic-btn[aria-pressed="true"] {
  background: #3EC9D6;
  border-color: #3EC9D6;
}

.checkin-textarea {
  background: #F5F9FD;
  border: 1px solid #D6E6F7;
  border-radius: 14px;
  color: #0D2040;
  font-family: var(--font-sans);
  font-size: var(--font-size-15);
  line-height: var(--line-height-relaxed);
  min-height: 112px;
  padding: var(--space-3);
  resize: vertical;
  width: 100%;
}

.checkin-note-actions {
  align-items: center;
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
  margin-top: var(--space-3);
}

.checkin-note-actions .checkin-btn {
  width: auto;
}

.checkin-past-meal-card {
  align-items: center;
  background: #FFFFFF;
  border: 1px solid #D6E6F7;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(13, 46, 92, 0.04);
  color: #0D2E5C;
  cursor: pointer;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 72px;
  padding: var(--space-3);
  text-align: left;
  width: 100%;
}

.checkin-card-icon {
  align-items: center;
  background: #3EC9D6;
  border-radius: 999px;
  color: #0D2E5C;
  display: flex;
  font-size: var(--font-size-24);
  font-weight: var(--font-weight-bold);
  height: 44px;
  justify-content: center;
  line-height: 1;
  width: 44px;
}

.checkin-past-meal-card__title {
  color: #0D2040;
  display: block;
  font-size: var(--font-size-16);
  font-weight: var(--font-weight-bold);
  line-height: 1.15;
}

.checkin-past-meal-card__sub {
  color: #7A9EC5;
  display: block;
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-semibold);
  line-height: 1.35;
  margin-top: 4px;
}

.checkin-past-meal-card__chevron {
  color: #7A9EC5;
  font-size: var(--font-size-24);
  font-weight: var(--font-weight-semibold);
}

.checkin-weight-row,
.checkin-fiber-row,
.profile-notif-row,
.profile-consent-row {
  align-items: center;
  display: flex;
  gap: var(--space-2);
}

.checkin-weight-row .checkin-input {
  flex: 1 1 auto;
  min-width: 0;
}

.checkin-inline-error {
  color: #DC2626;
  font-size: var(--font-size-12);
  line-height: var(--line-height-normal);
  margin-top: var(--space-1);
}

.is-hidden {
  display: none !important;
}

.checkin-slider-row {
  align-items: center;
  display: grid;
  gap: var(--space-2);
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.checkin-slider {
  accent-color: #366EB0;
  width: 100%;
}

.checkin-slider-anchor {
  color: #3A5070;
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
}

.checkin-slider-value {
  color: #366EB0;
  margin-left: 4px;
}

.profile-caregiver-form {
  background: #F5F9FD;
  border: 1px solid #D6E6F7;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: var(--space-3);
}

.checkin-actions {
  background: var(--color-surface-page);
  bottom: 92px;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0 calc(var(--space-4) * -1) calc(var(--space-6) * -1);
  padding: var(--space-3) var(--space-4) var(--space-4);
  position: sticky;
}

/* ---------------------------------------------------------------------------
 * Navigate
 * --------------------------------------------------------------------------- */

.navigate-container {
  /* Scoped tints with no global-token equivalent (see peppi-design-tokens.css) —
     kept local to the Eat tab rather than added to the shared token file. */
  --eat-tint-vulnerable-border: #FECACA;
  --eat-tint-vulnerable-text: #B45309;
  padding: var(--space-4) var(--space-4) var(--space-6);
}

.navigate-header {
  align-items: center;
  display: grid;
  gap: var(--space-2);
  grid-template-columns: 88px 1fr 88px;
}

.navigate-topbar {
  align-items: center;
  display: grid;
  gap: var(--space-2);
  grid-template-columns: 74px minmax(0, 1fr) auto;
}

.navigate-title-block {
  min-width: 0;
  text-align: center;
}

.navigate-screen__title {
  font-size: var(--font-size-22);
  text-align: center;
}

.navigate-subtitle {
  color: #3A5070;
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  margin: 4px 0 0;
}

.navigate-status-pill {
  background: #EDF4FC;
  border: 1px solid #D6E6F7;
  border-radius: 999px;
  color: #366EB0;
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  padding: 8px 10px;
  text-transform: uppercase;
  white-space: nowrap;
}

.navigate-back {
  background: transparent;
  border-color: transparent;
  color: #366EB0;
  justify-content: flex-start;
  min-height: 36px;
  padding: 6px 0;
}

/* ---------------------------------------------------------------------------
 * Recommendations section (Lean Guard gauge/timer/banner/rec cards) —
 * UNWIRED from the Eat tab's live render path (Felicia Eat #8, Option A —
 * see NavigateScreen.ts's class doc comment). Kept in the tree for the
 * still-present, just-uncalled render methods that reference these classes.
 * --------------------------------------------------------------------------- */

.navigate-rec-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}
.navigate-rec-header__tag {
  font-size: var(--font-size-10);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  color: var(--color-brand-primary);
}
.navigate-rec-header__title {
  margin: 0;
  font-size: var(--font-size-16);
  font-weight: var(--font-weight-bold);
  color: var(--color-brand-navy);
}
.navigate-rec-header__body {
  margin: 0;
  font-size: var(--font-size-13);
  color: var(--color-text-muted);
  line-height: var(--line-height-normal);
}

.navigate-hero {
  background: #FFFFFF;
  border: 1px solid #D6E6F7;
  border-radius: 22px;
  overflow: hidden;
}

.navigate-hero__inner {
  align-items: center;
  background: linear-gradient(180deg, #F8FBFF 0%, #EDF4FC 100%);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
}

.navigate-state-label {
  color: #7A9EC5;
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.navigate-timer {
  background: #FFFFFF;
  border: 1px solid #D6E6F7;
  border-radius: 14px;
  padding: var(--space-3);
  text-align: center;
  width: 100%;
}

.navigate-timer__label {
  color: #7A9EC5;
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.navigate-timer__value {
  color: #0D2E5C;
  font-size: var(--font-size-20);
  font-weight: var(--font-weight-bold);
  margin-top: 4px;
}

.navigate-timer__sub {
  color: #7A9EC5;
  font-size: var(--font-size-12);
  line-height: var(--line-height-normal);
  margin-top: 4px;
}

.navigate-stat-grid {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.navigate-stat {
  background: #FFFFFF;
  border: 1px solid #D6E6F7;
  border-radius: 14px;
  min-width: 0;
  padding: 12px 8px;
  text-align: center;
}

.navigate-stat__value {
  color: #0D2E5C;
  font-size: var(--font-size-18);
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

.navigate-stat__unit {
  color: #7A9EC5;
  font-size: var(--font-size-12);
  margin-left: 2px;
}

.navigate-stat__label {
  color: #7A9EC5;
  font-size: var(--font-size-10);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  margin-top: 6px;
  text-transform: uppercase;
}

.navigate-banner {
  border-radius: 16px;
  color: #FFFFFF;
  padding: var(--space-4);
}

.navigate-banner--protected {
  background: #0D2E5C;
}

.navigate-banner--vulnerable {
  background: #92400E;
}

.navigate-banner--expired {
  background: #DC2626;
}

.navigate-banner__label {
  color: rgba(255, 255, 255, 0.58);
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.navigate-banner__body {
  font-size: var(--font-size-15);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  margin-top: var(--space-1);
}

.navigate-rec-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.navigate-rec-title {
  color: #0D2040;
  font-size: var(--font-size-16);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
}

.navigate-rec-sub {
  color: #7A9EC5;
  font-size: var(--font-size-12);
  margin-top: 2px;
}

.navigate-macro-grid {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: var(--space-3);
}

.navigate-macro {
  background: #F5F9FD;
  border: 1px solid #D6E6F7;
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
}

.navigate-macro__value {
  color: #0D2E5C;
  font-size: var(--font-size-15);
  font-weight: var(--font-weight-bold);
}

.navigate-macro__label {
  color: #7A9EC5;
  font-size: 9px;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.navigate-leucine {
  align-items: center;
  background: rgba(62, 201, 214, 0.08);
  border: 1px solid rgba(62, 201, 214, 0.24);
  border-radius: 12px;
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
  margin-top: var(--space-3);
  padding: var(--space-3);
}

.navigate-leucine__value {
  color: #23BCCC;
  font-size: var(--font-size-15);
  font-weight: var(--font-weight-bold);
}

.navigate-leucine__sub,
.navigate-leucine__status {
  color: #7A9EC5;
  font-size: var(--font-size-11);
}

.navigate-leucine__status {
  color: #23BCCC;
  flex: 0 0 auto;
  font-weight: var(--font-weight-semibold);
}

/* ---------------------------------------------------------------------------
 * Eat tab — merged food logger (peppi_food_logger_v2 wireframe)
 *
 * The "I just ate" quick-log button (.eat-quick-log) was removed from the
 * Eat tab (Felicia Eat feedback #1 — Home keeps its own); its now-unused
 * rule was removed with it.
 * --------------------------------------------------------------------------- */

.eat-photo-tile {
  align-items: center;
  background: var(--color-brand-navy);
  border: 1.5px solid var(--color-brand-navy);
  border-radius: 16px;
  cursor: not-allowed;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-4);
  text-align: center;
  width: 100%;
}

/* fatsecret_food_search flag on: the tile is a real <button> that opens the
   photo picker/camera instead of the informational, disabled div above. */
.eat-photo-tile--interactive {
  cursor: pointer;
}

.eat-photo-tile--interactive:disabled {
  cursor: wait;
  opacity: 0.85;
}

.eat-photo-error {
  color: var(--color-danger);
  font-family: var(--font-sans);
  font-size: var(--font-size-13);
  margin: 0;
  text-align: center;
}

.eat-photo-error-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-2);
}

.eat-photo-error-action {
  background: #EDF4FC;
  border: 1px solid #D6E6F7;
  border-radius: 999px;
  color: #366EB0;
  cursor: pointer;
  flex: 1 1 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-semibold);
  min-height: 36px;
  padding: 8px 12px;
}

.eat-photo-tile__icon {
  align-items: center;
  background: rgba(62, 201, 214, 0.2);
  border-radius: 999px;
  display: flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.eat-photo-tile__label {
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: var(--font-size-15);
  font-weight: var(--font-weight-bold);
}

.eat-photo-tile__chip {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-semibold);
  padding: 3px 10px;
}

.eat-section-heading {
  color: #0D2E5C;
  font-family: var(--font-sans);
  font-size: var(--font-size-16);
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.eat-saved-meal-card {
  align-items: center;
  background: #FFFFFF;
  border: 1px solid #D6E6F7;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(13, 46, 92, 0.04);
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
}

.eat-saved-meal-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.eat-saved-meal-card__name {
  color: #0D2040;
  display: block;
  font-family: var(--font-sans);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eat-saved-meal-card__serving {
  color: var(--color-brand-navy);
  display: block;
  font-family: var(--font-sans);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-bold);
  margin-top: 2px;
}

.eat-saved-meal-card__badge {
  background: var(--color-signal-protected, #0D9488);
  border-radius: 999px;
  color: var(--color-text-inverse, #FFFFFF);
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-semibold);
  margin-top: 4px;
  padding: 2px 8px;
}

.eat-saved-meal-card__macros {
  color: #7A9EC5;
  font-size: var(--font-size-11);
  margin-top: 2px;
}

.eat-saved-meal-card__action {
  background: #EDF4FC;
  border: 1px solid #D6E6F7;
  border-radius: 999px;
  color: #366EB0;
  cursor: pointer;
  flex: 0 0 auto;
  font-family: var(--font-sans);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-semibold);
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}

.eat-saved-meal-card__action:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.eat-saved-meal-empty {
  color: #7A9EC5;
  font-size: var(--font-size-13);
  font-family: var(--font-sans);
  margin: 0;
}

.eat-saved-meal-error {
  color: #DC2626;
  font-size: var(--font-size-12);
  font-family: var(--font-sans);
  margin: var(--space-1) 0 0;
}

/* UNWIRED (Felicia Eat #8, Option A) — .eat-suggestions-link* styled the
   "What should I eat?" entry point inside the recommendations section,
   which is not rendered by NavigateScreen.ts's live `_render()`. Kept for
   when that section is reintroduced elsewhere. */
.eat-suggestions-link {
  align-items: center;
  background: #FFFFFF;
  border: 1px solid #D6E6F7;
  border-radius: 12px;
  color: #366EB0;
  cursor: pointer;
  display: flex;
  font-family: var(--font-sans);
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
  justify-content: space-between;
  padding: 10px 14px;
  text-decoration: none;
  width: 100%;
}

.eat-suggestions-link__chevron {
  color: #7A9EC5;
  font-size: var(--font-size-16);
}

/* ---------------------------------------------------------------------------
 * Insights
 * --------------------------------------------------------------------------- */

.insights-container {
  padding-bottom: var(--space-5);
}

.insights-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.insights-chart-wrap {
  align-items: center;
  background: #F5F9FD;
  border: 1px solid #E2EEF8;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  min-height: 144px;
  overflow: hidden;
  padding: var(--space-2);
}

.insights-chart-wrap--line {
  min-height: 176px;
}

.insights-chart-wrap--bar {
  min-height: 144px;
}

.insights-canvas {
  height: 100%;
  width: 100%;
}

.insights-tier-legend,
.insights-mpi-direction {
  align-items: center;
  color: #3A5070;
  display: flex;
  flex-wrap: wrap;
  font-size: var(--font-size-12);
  gap: 8px;
  line-height: var(--line-height-normal);
}

.tier-dot {
  border-radius: 999px;
  display: inline-block;
  height: 8px;
  width: 8px;
}

.tier-dot--green { background: #27A760; }
.tier-dot--yellow { background: #EF9F27; }
.tier-dot--red { background: #DC2626; }

.mpi-direction {
  border-radius: 999px;
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-semibold);
  padding: 6px 10px;
}

.mpi-direction--improving {
  background: rgba(39, 167, 96, 0.12);
  color: #1F8F50;
}

.mpi-direction--stable {
  background: #EDF4FC;
  color: #366EB0;
}

.mpi-direction--declining {
  background: rgba(220, 38, 38, 0.1);
  color: #DC2626;
}

.insights-staleness-badge {
  background: #FEF9E7;
  border: 1px solid #FAC775;
  border-radius: 12px;
  color: #8A4B05;
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-semibold);
  padding: 8px 10px;
}

.insights-archive-toggle {
  align-self: flex-start;
  min-height: 36px;
}

.insights-archive-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.insights-archive-list--collapsed {
  display: none;
}

.insights-archive__entry {
  align-items: center;
  background: #F5F9FD;
  border: 1px solid #E2EEF8;
  border-radius: 12px;
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
  padding: var(--space-3);
}

.insights-archive__entry-type {
  color: #0D2E5C;
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-bold);
  text-transform: capitalize;
}

.insights-archive__entry-date {
  color: #7A9EC5;
  font-size: var(--font-size-12);
  margin-top: 2px;
}

.insights-archive__dismiss-btn {
  min-height: 34px;
  padding: 8px 10px;
}

.insights-more-nav,
.profile-tools-nav {
  display: grid;
  gap: var(--space-2);
}

.insights-more-link,
.profile-tools-link {
  background: #EDF4FC;
  border: 1px solid #D6E6F7;
  border-radius: 12px;
  color: #366EB0;
  display: block;
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-semibold);
  padding: 12px;
  text-decoration: none;
}

/* ---------------------------------------------------------------------------
 * Profile
 * --------------------------------------------------------------------------- */

.profile-container {
  padding-bottom: var(--space-5);
}

.profile-hero {
  align-items: center;
  background: linear-gradient(180deg, #071C3E 0%, #0D2E5C 100%);
  border-radius: 22px;
  color: #FFFFFF;
  display: grid;
  gap: var(--space-3);
  grid-template-columns: auto minmax(0, 1fr);
  padding: var(--space-4);
}

.profile-hero__avatar {
  align-items: center;
  background: #3EC9D6;
  border-radius: 999px;
  color: #0D2E5C;
  display: flex;
  flex-shrink: 0;
  font-size: var(--font-size-20);
  font-weight: var(--font-weight-bold);
  height: 64px;
  justify-content: center;
  overflow: hidden;
  width: 64px;
}

.profile-hero__avatar-img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.profile-hero__copy {
  min-width: 0;
}

.profile-section__header-row {
  align-items: center;
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
}

.profile-section__header-row .profile-section__title {
  margin: 0;
}

.profile-section__edit-link {
  flex-shrink: 0;
  margin-top: 0;
}

.profile-hero__title {
  color: #FFFFFF;
  font-size: var(--font-size-22);
  font-weight: var(--font-weight-bold);
  line-height: 1.1;
  margin: 0;
}

.profile-hero__subtitle {
  color: rgba(255, 255, 255, 0.62);
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  margin: 4px 0 0;
}

.profile-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.profile-hero__badge {
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  font-size: var(--font-size-11);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.05em;
  padding: 7px 10px;
  text-transform: uppercase;
}

.profile-hero__badge--connected {
  background: rgba(62, 201, 214, 0.18);
  border-color: rgba(62, 201, 214, 0.34);
  color: #3EC9D6;
}

.profile-hero__member-since {
  color: rgba(255, 255, 255, 0.62);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-semibold);
  margin: var(--space-2) 0 0;
}

.profile-support-details {
  background: #FFFFFF;
  border: 1px solid #D6E6F7;
  border-radius: 16px;
  padding: var(--space-3) var(--space-4);
}

.profile-support-details__summary {
  color: #366EB0;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-semibold);
  list-style: none;
}

.profile-support-details__summary::-webkit-details-marker {
  display: none;
}

.profile-support-details[open] .profile-support-details__summary {
  margin-bottom: var(--space-2);
}

.profile-account-row {
  display: grid;
  gap: var(--space-2);
}

.profile-account__patient {
  color: #0D2040;
  display: block;
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  overflow-wrap: anywhere;
}

.profile-account__org {
  overflow-wrap: anywhere;
}

.profile-menu-card,
.profile-pa-report-card {
  background: #F5F9FD;
  border: 1px solid #E2EEF8;
  border-radius: 14px;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
}

.profile-info-row {
  align-items: center;
  display: grid;
  gap: var(--space-2);
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
}

.profile-info-row__icon {
  background: #D6E6F7;
  border-radius: 999px;
  height: 10px;
  width: 10px;
}

.profile-info-row__title {
  color: #0D2E5C;
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
}

.profile-info-row__body {
  margin-top: 2px;
}

.profile-pa-report-card {
  background: #0D2E5C;
  border-color: #0D2E5C;
  margin-top: var(--space-3);
}

.profile-pa-report-card .profile-info-row__icon {
  background: #3EC9D6;
}

.profile-pa-report-card .profile-info-row__title {
  color: #FFFFFF;
}

.profile-pa-report-card .profile-info-row__body {
  color: rgba(255, 255, 255, 0.58);
}

.profile-pa-report-card__title {
  color: #FFFFFF;
  font-size: var(--font-size-16);
  font-weight: var(--font-weight-bold);
}

.profile-pa-report-card__grid {
  display: grid;
  gap: var(--space-2);
}

.profile-pa-report-card__button {
  background: #3EC9D6;
  border: 0;
  border-radius: 12px;
  color: #0D2E5C;
  cursor: pointer;
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-bold);
  min-height: 44px;
  padding: 10px 14px;
  width: 100%;
}

.profile-voucher-form {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.profile-voucher-input {
  flex: 1 1 auto;
  min-width: 0;
  background: #FFFFFF;
  border: 1px solid #D6E6F7;
  border-radius: var(--border-radius-cta);
  color: #0D2E5C;
  font-family: var(--font-sans);
  font-size: var(--font-size-14);
  min-height: 44px;
  padding: 10px 14px;
}

.profile-voucher-btn,
.profile-data-export-btn,
.profile-data-export-download-btn {
  background: var(--gradient-cta-primary);
  border: 0;
  border-radius: var(--border-radius-cta);
  color: var(--color-text-inverse);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-semibold);
  min-height: 44px;
  padding: 10px 16px;
}

.profile-voucher-btn:disabled,
.profile-data-export-btn:disabled,
.profile-data-export-download-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Premium tiering — locked feature list shown greyed out (feedback General #4). */
.profile-premium-features {
  list-style: none;
  margin: var(--space-2) 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.profile-premium-feature {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  background: #F5F9FD;
  border: 1px solid #D6E6F7;
  border-radius: 12px;
  padding: 10px 14px;
  opacity: 0.6;
}

.profile-premium-feature__label {
  font-family: var(--font-sans);
  font-size: var(--font-size-14);
  color: #0D2E5C;
}

.profile-premium-feature__badge {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: var(--border-radius-pill);
  background: var(--color-brand-primary);
  color: var(--color-text-inverse);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-bold);
}

.profile-premium-upgrade-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-cta-primary);
  border: 0;
  border-radius: var(--border-radius-cta);
  color: var(--color-text-inverse);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-semibold);
  min-height: 44px;
  padding: 10px 16px;
  text-decoration: none;
}

.profile-pa-tile {
  background: #EDF4FC;
  border: 1px solid #D6E6F7;
  border-radius: 12px;
  color: #0D2E5C;
  display: grid;
  gap: 4px;
  padding: var(--space-3);
}

.profile-pa-tile__label {
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-semibold);
}

.profile-persona-group {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-persona-option {
  align-items: center;
  background: #F5F9FD;
  border: 1px solid #D6E6F7;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  gap: var(--space-2);
  justify-items: center;
  padding: var(--space-3);
  text-align: center;
}

.profile-persona-option--selected {
  background: rgba(62, 201, 214, 0.12);
  border-color: #3EC9D6;
}

.profile-persona-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.profile-persona-avatar {
  border-radius: 999px;
  height: 64px;
  width: 64px;
}

.profile-persona-label {
  color: #0D2E5C;
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
}

.profile-notif-row,
.profile-consent-row,
.profile-consent-locked {
  background: #F5F9FD;
  border: 1px solid #E2EEF8;
  border-radius: 12px;
  justify-content: space-between;
  margin-top: var(--space-2);
  padding: 12px;
}

.profile-notif-checkbox,
.profile-consent-checkbox {
  accent-color: #366EB0;
  flex: 0 0 auto;
  height: 22px;
  width: 22px;
}

.profile-time-input {
  flex: 0 0 124px;
  width: 124px;
}

.profile-tz-select {
  flex: 1 1 auto;
  min-width: 0;
}

.profile-notif-actions {
  display: flex;
  flex-direction: row;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* Save shares its row with Cancel (feedback item #7 — was full-width,
   pushing Cancel to its own line below). Scoped to this row only: the
   shared .profile-save-btn class stays full-width everywhere else. */
.profile-notif-actions .profile-save-btn {
  flex: 1 1 0;
  width: auto;
}

.profile-consent-locked {
  align-items: center;
  display: flex;
  gap: var(--space-2);
}

.profile-consent-locked__label {
  color: #0D2E5C;
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
}

.profile-caregiver-list {
  display: grid;
  gap: var(--space-2);
  list-style: none;
}

.profile-caregiver-item {
  background: #F5F9FD;
  border: 1px solid #E2EEF8;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: var(--space-3);
}

.profile-caregiver-email {
  color: #0D2E5C;
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
  overflow-wrap: anywhere;
}

.profile-caregiver-rel {
  color: #7A9EC5;
  font-size: var(--font-size-12);
}

.profile-caregiver-form__actions {
  display: flex;
  gap: var(--space-2);
}

.profile-row-summary {
  display: grid;
  gap: var(--space-2);
}

.profile-row-edit-btn,
.profile-row-cancel-btn {
  align-items: center;
  background: #EDF4FC;
  border: 1px solid #D6E6F7;
  border-radius: 999px;
  color: #0D2E5C;
  cursor: pointer;
  display: inline-flex;
  font-family: var(--font-sans);
  font-size: var(--font-size-13);
  font-weight: var(--font-weight-semibold);
  justify-content: center;
  margin-top: var(--space-2);
  min-height: 36px;
  padding: 8px 14px;
  width: fit-content;
}

.profile-caregiver-form__error {
  color: #DC2626;
  font-size: var(--font-size-12);
}

@media (max-width: 360px) {
  .checkin-section,
  .insights-card,
  .profile-section,
  .navigate-card {
    padding: var(--space-3);
  }

  .profile-persona-group {
    grid-template-columns: 1fr;
  }

  .navigate-header {
    grid-template-columns: 72px 1fr 72px;
  }

  .navigate-topbar {
    grid-template-columns: 1fr auto;
  }

  .navigate-topbar .navigate-back {
    display: none;
  }

  .navigate-title-block {
    text-align: left;
  }

  .navigate-screen__title {
    text-align: left;
  }

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

/* ---------------------------------------------------------------------------
 * Required-field convention
 * Apply .peppi-required to a field's <label> to append a colored asterisk;
 * pair with a .peppi-required-legend note ("* Required") once per form/screen.
 * --------------------------------------------------------------------------- */

.peppi-required::after {
  content: ' *';
  color: var(--color-danger, #DC2626);
}

.peppi-required-legend {
  font-family: var(--font-sans);
  font-size: var(--font-size-12);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.peppi-required-legend::before {
  content: '* ';
  color: var(--color-danger, #DC2626);
}

/* ---------------------------------------------------------------------------
 * FatSecret Platform API attribution
 * The anchor inside is the published Attribution Snippet and must not be
 * modified (no class, no attributes), so it is styled by descendant selector
 * from the wrapper .peppi-fatsecret-attribution. See util/fatsecretAttribution.ts.
 * --------------------------------------------------------------------------- */

.peppi-fatsecret-attribution {
  margin-top: var(--space-3);
}

.peppi-fatsecret-attribution a {
  font-family: var(--font-sans);
  font-size: var(--font-size-12);
  color: var(--color-text-secondary);
  text-decoration: underline;
  line-height: 1.4;
}

.peppi-fatsecret-attribution--on-dark a {
  color: var(--color-text-inverse, #FFFFFF);
  opacity: 0.85;
}
