.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background var(--transition), border-color var(--transition), transform 0.15s ease;
  /* Faster taps on mobile (reduces double-tap zoom delay on some browsers) */
  touch-action: manipulation;
}

@media (max-width: 899px) {
  .btn {
    min-height: 44px;
  }
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--accent) 42%, transparent);
  transform: translateY(-1px);
}

/* Light-only theme: no dark overrides. */

@media (prefers-reduced-motion: reduce) {
  .btn--primary:hover {
    transform: none;
  }
}

.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn--secondary:hover {
  background: var(--bg-muted);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn--ghost:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.btn--danger {
  background: var(--coral-soft);
  color: var(--coral);
  border-color: transparent;
}

.card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
  transition: box-shadow var(--transition-slow), transform var(--transition), border-color var(--transition);
}

.card:not(.modal__panel):hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .card:not(.modal__panel):hover {
    transform: none;
  }
}

/* Light-only theme: no dark overrides. */

.card__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 var(--space-md);
  letter-spacing: -0.02em;
}

.field {
  margin-bottom: var(--space-md);
}

.field__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.field__label-row label {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.btn--sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

.security-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.security-list li {
  margin-bottom: var(--space-md);
}

.security-list li:last-child {
  margin-bottom: 0;
}

.security-list strong {
  color: var(--text-primary);
  font-weight: 600;
}

.partner-linked-list {
  margin-bottom: 0.75rem;
}

.partner-linked-list li {
  margin-bottom: 0.25rem;
}

.partner-remove-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.35rem;
}

.partner-remove-row select {
  flex: 1;
  min-width: 10rem;
  max-width: 18rem;
}

.cal-guess-hint {
  margin: var(--space-sm) 0 0;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-secondary);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 111, 94, 0.2);
}

.cal-guess-hint__source {
  font-weight: 700;
  color: var(--accent);
}

.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="date"],
.field input[type="time"],
.field textarea,
.field select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-base);
  transition: border-color var(--transition);
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.meal-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meal-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem;
  align-items: center;
}

.meal-item-row__input {
  width: 100%;
}

.meal-item-row__remove {
  min-width: 2rem;
  padding: 0.2rem 0.45rem;
}

.meal-items-add-btn {
  margin-top: 0.55rem;
}

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

.chip {
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--bg-base);
  font-size: 0.875rem;
  font-weight: 500;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    transform 0.15s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .chip:hover {
    transform: none;
  }
}

.chip.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.chip--healthy.is-selected {
  background: var(--sage-soft);
  border-color: var(--sage);
  color: var(--sage);
}

.chip--okay.is-selected {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: #8b6914;
}

.chip--unhealthy.is-selected {
  background: var(--coral-soft);
  border-color: var(--coral);
  color: var(--coral);
}

.meal-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.meal-log-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.meal-log-week {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.meal-log-week__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.meal-log-day {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.meal-log-day__title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.meal-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition-slow),
    transform var(--transition),
    border-color var(--transition);
}

.meal-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border));
}

@media (prefers-reduced-motion: reduce) {
  .meal-card:hover {
    transform: translateY(-1px);
  }
}

.meal-card__img-wrap {
  aspect-ratio: 16 / 9;
  max-height: 140px;
  background: var(--bg-muted);
  position: relative;
  overflow: hidden;
}

.meal-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.meal-card__body {
  padding: var(--space-md);
  position: relative;
}

.meal-card--has-thumb .meal-card__body {
  padding-right: calc(var(--space-md) + 76px);
}

.meal-card__thumb-btn {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 64px;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  background: var(--bg-muted);
  overflow: hidden;
  cursor: pointer;
}

.meal-card__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.meal-image-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
}

.meal-image-overlay[hidden] {
  display: none !important;
}

.meal-image-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}

.meal-image-overlay__panel {
  position: relative;
  z-index: 1;
  margin: 0;
  width: min(90vw, 760px);
  max-height: 86vh;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}

.meal-image-overlay__img {
  width: 100%;
  height: 100%;
  max-height: 86vh;
  object-fit: contain;
  display: block;
  background: #000;
}

.meal-image-overlay__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.meal-card__title {
  font-weight: 600;
  margin: 0 0 var(--space-xs);
  font-size: 1rem;
}

.meal-card__items {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: -0.15rem 0 var(--space-xs);
  line-height: 1.35;
}

.meal-card__meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.badge--healthy {
  background: var(--sage-soft);
  color: var(--sage);
}

.badge--okay {
  background: var(--amber-soft);
  color: #8b6914;
}

.badge--unhealthy {
  background: var(--coral-soft);
  color: var(--coral);
}

.badge--pending {
  background: var(--bg-muted);
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-secondary);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.bar-row {
  display: grid;
  grid-template-columns: 32px 1fr 48px;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8125rem;
}

.bar-track {
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent), var(--sage));
  transition: width 0.5s ease;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
}

.stat-pill {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  border: 1px solid var(--border);
}

.stat-pill__value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
}

.stat-pill__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.insights-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-secondary);
}

.insights-list li {
  margin-bottom: var(--space-sm);
}

.insights-list li:last-child {
  margin-bottom: 0;
}

.toast {
  position: fixed;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 500;
  padding: var(--space-md) var(--space-lg);
  background: var(--text-primary);
  color: var(--bg-elevated);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  max-width: min(90vw, 400px);
  text-align: center;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
