/* ==========================================================================
   Alimenta Design System — Componentes Editorial Kitchen Craft & Motion
   Princípios: emilkowalski/skills (ease-out, scale 0.97, raios concêntricos)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Header Translúcido & Seletor de Membro
   -------------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  min-height: calc(var(--header-height) + var(--safe-top));
  padding: calc(var(--safe-top) + var(--space-2)) var(--space-4) var(--space-2);
  background-color: var(--bg-glass);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.app-header-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.app-header-title {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 28;
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-subtitle {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.2;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.member-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.member-chip {
  min-height: var(--touch-min);
  padding: 5px 14px 5px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.member-chip:hover {
  border-color: var(--border-strong);
}

.member-chip:active {
  transform: scale(0.97);
}

.member-chip.is-active {
  background-color: var(--brand-primary-soft);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  font-weight: 600;
  box-shadow: none;
}

.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background-color: var(--brand-primary);
  color: var(--brand-on-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.member-avatar--lg {
  width: 40px;
  height: 40px;
  font-size: var(--text-base);
}

/* Status & Banner Offline */
.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background-color: var(--status-warn-soft);
  color: var(--status-warn-text);
  font-size: var(--text-xs);
  font-weight: 600;
}

.offline-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background-color: var(--status-warn);
}

.offline-banner {
  padding: var(--space-2) var(--space-4);
  background-color: var(--status-warn-soft);
  color: var(--status-warn-text);
  border-bottom: 1px solid var(--border-hairline);
  font-size: var(--text-xs);
  font-weight: 500;
  text-align: center;
}

/* --------------------------------------------------------------------------
   2. Barra de Navegação Inferior — Floating Glass Dock (#bottom-nav)
   -------------------------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: calc(var(--app-max-width) - 24px);
  z-index: var(--z-nav);
  min-height: var(--bottom-nav-height);
  padding: 6px;
  border-radius: var(--radius-xl);
  background-color: var(--bg-glass-strong);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-dock), var(--highlight-inset);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 2px;
}

.bottom-nav-item {
  min-height: 48px;
  padding: 5px 4px;
  border-radius: calc(var(--radius-xl) - 6px);
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.1;
  transition: color var(--duration-fast) var(--ease-out),
              background-color var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.bottom-nav-item:active {
  transform: scale(0.95);
}

.bottom-nav-icon {
  width: 40px;
  height: 26px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.bottom-nav-icon svg {
  width: 20px;
  height: 20px;
}

.bottom-nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.bottom-nav-item:hover {
  color: var(--text-primary);
}

.bottom-nav-item.is-active,
.bottom-nav-item[aria-current="page"] {
  color: var(--brand-primary);
  font-weight: 600;
}

.bottom-nav-item.is-active .bottom-nav-icon,
.bottom-nav-item[aria-current="page"] .bottom-nav-icon {
  background-color: var(--brand-primary-soft);
}

/* --------------------------------------------------------------------------
   3. Cards & Hero Editorial (Raios Concêntricos + Whisper Shadows)
   -------------------------------------------------------------------------- */
.card {
  --card-radius: var(--radius-lg);
  --card-pad: 18px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--card-radius);
  padding: var(--card-pad);
  box-shadow: var(--shadow-sm), var(--highlight-inset);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.card--hero {
  position: relative;
  border-color: rgba(47, 111, 78, 0.22);
  box-shadow: var(--shadow-md), var(--highlight-inset);
  background-image: linear-gradient(
    180deg,
    rgba(47, 111, 78, 0.045) 0%,
    rgba(47, 111, 78, 0) 110px
  );
  gap: var(--space-4);
}

[data-theme="dark"] .card--hero {
  border-color: rgba(99, 186, 139, 0.24);
  background-image: linear-gradient(
    180deg,
    rgba(99, 186, 139, 0.07) 0%,
    rgba(99, 186, 139, 0) 110px
  );
}

.card--compact {
  --card-radius: var(--radius-md);
  --card-pad: 14px;
  padding: var(--card-pad);
  gap: var(--space-2);
}

.card--alt {
  background-color: var(--bg-surface-alt);
  box-shadow: none;
}

.card--interactive {
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.card--interactive:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md), var(--highlight-inset);
}

.card--interactive:active {
  transform: scale(0.985);
}

.card--highlight {
  border-color: rgba(47, 111, 78, 0.26);
  background-image: linear-gradient(
    180deg,
    rgba(47, 111, 78, 0.055) 0%,
    rgba(47, 111, 78, 0) 96px
  );
  box-shadow: var(--shadow-md), var(--highlight-inset);
}

[data-theme="dark"] .card--highlight {
  border-color: rgba(99, 186, 139, 0.28);
  background-image: linear-gradient(
    180deg,
    rgba(99, 186, 139, 0.08) 0%,
    rgba(99, 186, 139, 0) 96px
  );
}

/* Status semântico refinado sem borda lateral bruta */
.card--ok {
  border-color: rgba(42, 125, 79, 0.24);
}

.card--warn {
  border-color: rgba(201, 118, 30, 0.34);
  background-image: linear-gradient(90deg, rgba(201, 118, 30, 0.045) 0%, transparent 45%);
}

.card--danger {
  border-color: rgba(191, 67, 50, 0.36);
  background-image: linear-gradient(90deg, rgba(191, 67, 50, 0.055) 0%, transparent 45%);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

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

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-hairline);
}

/* Barra minimalista de progresso do dia */
.day-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.day-progress-track {
  height: 4px;
  width: 100%;
  border-radius: var(--radius-pill);
  background-color: var(--bg-surface-alt);
  overflow: hidden;
}

.day-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: var(--radius-pill);
  background-color: var(--brand-primary);
  transform-origin: left center;
  transition: transform var(--duration-normal) var(--ease-out);
}

/* --------------------------------------------------------------------------
   4. Segmented Control, Chips & Pílulas de Refeição
   -------------------------------------------------------------------------- */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-hairline);
  gap: 4px;
}

.segmented-btn {
  min-height: var(--touch-min);
  padding: 0 var(--space-3);
  border-radius: calc(var(--radius-md) - 4px);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: background-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.segmented-btn:active {
  transform: scale(0.97);
}

.segmented-btn.is-active {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

.chips-row,
.meal-pills {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chips-row::-webkit-scrollbar,
.meal-pills::-webkit-scrollbar {
  display: none;
}

.chip,
.meal-pill {
  min-height: var(--touch-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.chip:hover,
.meal-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.chip:active,
.meal-pill:active {
  transform: scale(0.97);
}

.chip.is-active,
.meal-pill.is-active {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--brand-on-primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.meal-pill-time {
  font-size: var(--text-xs);
  opacity: 0.78;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   5. Badges (Semáforo, Motivo de Compra, Favorito, Tags)
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
  white-space: nowrap;
}

.badge--neutral {
  background-color: var(--bg-surface-alt);
  color: var(--text-secondary);
}

.badge--brand {
  background-color: var(--brand-primary-soft);
  color: var(--brand-primary);
}

.badge--ok {
  background-color: var(--status-ok-soft);
  color: var(--status-ok-text);
}

.badge--warn {
  background-color: var(--status-warn-soft);
  color: var(--status-warn-text);
}

.badge--danger {
  background-color: var(--status-danger-soft);
  color: var(--status-danger-text);
}

.badge--info {
  background-color: var(--status-info-soft);
  color: var(--status-info-text);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: currentColor;
  flex-shrink: 0;
}

/* Selos de motivo na lista de compras */
.reason-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.6875rem;
  font-weight: 600;
}

.reason-tag--cardapio {
  background-color: var(--brand-primary-soft);
  color: var(--brand-primary);
}

.reason-tag--recompra {
  background-color: var(--status-warn-soft);
  color: var(--status-warn-text);
}

.reason-tag--zerado {
  background-color: var(--status-danger-soft);
  color: var(--status-danger-text);
}

.reason-tag--recorrente {
  background-color: var(--status-info-soft);
  color: var(--status-info-text);
}

.reason-tag--manual {
  background-color: var(--bg-surface-alt);
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   6. Botões (Alvos >= 44px · Press Tátil scale(0.97))
   -------------------------------------------------------------------------- */
.btn {
  min-height: var(--touch-min);
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  white-space: nowrap;
  transition: background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background-color: var(--brand-primary);
  color: var(--brand-on-primary);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn--primary:hover:not(:disabled) {
  background-color: var(--brand-primary-hover);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.btn--secondary {
  background-color: var(--bg-surface-alt);
  border-color: var(--border-hairline);
  color: var(--text-primary);
}

.btn--secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background-color: var(--bg-surface);
}

.btn--soft {
  background-color: var(--brand-primary-soft);
  color: var(--brand-primary);
}

.btn--soft:hover:not(:disabled) {
  background-color: var(--brand-primary-ring);
}

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

.btn--ghost:hover:not(:disabled) {
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
}

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

.btn--danger:hover:not(:disabled) {
  background-color: var(--status-danger);
  color: #FFFFFF;
}

.btn--danger-solid {
  background-color: var(--status-danger);
  color: #FFFFFF;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn--quick {
  min-height: var(--touch-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-hairline);
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: 600;
}

.btn--quick:hover:not(:disabled) {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn--sm {
  min-height: var(--touch-min);
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
}

.btn--lg {
  min-height: 50px;
  padding: 0 var(--space-5);
  border-radius: calc(var(--radius-md) - 2px);
  font-size: var(--text-base);
}

.btn--block {
  width: 100%;
}

.btn--icon {
  width: var(--touch-min);
  min-width: var(--touch-min);
  padding: 0;
}

.btn-group,
.quick-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* --------------------------------------------------------------------------
   7. Blocos de Refeição (Sem Card-Ception), Alimentos & Nota Financeira
   -------------------------------------------------------------------------- */
.meal-block {
  padding-block: var(--space-3);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.meal-block:first-child {
  padding-top: 0;
  border-top: 0;
}

.meal-block:last-child {
  padding-bottom: 0;
}

.meal-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.meal-block-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.food-item {
  width: 100%;
  text-align: left;
  min-height: 52px;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-alt);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  transition: border-color var(--duration-fast) var(--ease-out),
              background-color var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.food-item--clickable {
  cursor: pointer;
}

.food-item--clickable:hover {
  border-color: var(--brand-primary-ring);
  background-color: var(--bg-surface);
}

.food-item--clickable:active {
  transform: scale(0.985);
}

.food-item-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.food-item-name {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.food-item-meta {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.food-item-aside {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.food-item-qty {
  font-size: var(--text-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  color: var(--brand-primary);
  white-space: nowrap;
}

.food-item-chevron {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  transition: transform var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.food-item--clickable:hover .food-item-chevron {
  transform: translateX(2px);
  color: var(--brand-primary);
}

.conversion-arrow {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
}

/* Barra/Nota Financeira Discreta */
.cost-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-hairline);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.cost-note-total {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.cost-note-warning {
  color: var(--status-warn-text);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   8. Modal Bottom Sheet Estilo Vaul (#modal-root)
   -------------------------------------------------------------------------- */
.modal-root {
  position: relative;
  z-index: var(--z-backdrop);
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-backdrop);
  background-color: var(--bg-backdrop);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: alimenta-fade-in var(--duration-fast) var(--ease-out) forwards;
}

.sheet-backdrop.is-closing {
  pointer-events: none;
  animation: alimenta-fade-out var(--duration-normal) var(--ease-out) forwards;
}

.sheet {
  position: relative;
  z-index: var(--z-sheet);
  width: 100%;
  max-width: var(--app-max-width);
  max-height: 90dvh;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-hairline);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--highlight-inset);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: var(--safe-bottom);
  will-change: transform, opacity;
  animation: alimenta-sheet-in var(--duration-drawer) var(--ease-drawer) forwards;
}

.sheet-backdrop.is-closing .sheet {
  animation: alimenta-sheet-out var(--duration-normal) var(--ease-drawer) forwards;
}

@media (min-width: 640px) {
  .sheet-backdrop {
    align-items: center;
    padding: var(--space-4);
  }

  .sheet {
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-xl);
    max-height: 85dvh;
    animation: alimenta-sheet-pop-in var(--duration-normal) var(--ease-out) forwards;
  }

  .sheet-backdrop.is-closing .sheet {
    animation: alimenta-sheet-pop-out var(--duration-fast) var(--ease-out) forwards;
  }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-pill);
  background-color: var(--border-strong);
  margin: var(--space-2) auto 0;
  flex-shrink: 0;
  cursor: grab;
  touch-action: none;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-hairline);
  touch-action: pan-x;
}

.sheet-title {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 24;
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.sheet-close {
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  transition: background-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.sheet-close:hover {
  background-color: var(--bg-surface-alt);
  color: var(--text-primary);
}

.sheet-close:active {
  transform: scale(0.94);
}

.sheet-body {
  padding: var(--space-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overscroll-behavior: contain;
}

.sheet-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* --------------------------------------------------------------------------
   9. Slider Proporcional 60fps (.prop-slider-group)
   -------------------------------------------------------------------------- */
.prop-slider-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-hairline);
}

.prop-slider-bar {
  height: 10px;
  width: 100%;
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: flex;
  background-color: var(--border-subtle);
  gap: 2px;
}

.prop-slider-segment {
  height: 100%;
  background-color: var(--brand-primary);
  transition: width 60ms linear;
}

.prop-slider-segment:nth-child(2) {
  background-color: var(--status-info);
}

.prop-slider-segment:nth-child(3) {
  background-color: var(--status-warn);
}

.prop-slider-segment:nth-child(4) {
  background-color: var(--status-ok);
}

.prop-slider-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prop-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.prop-slider-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.prop-slider-values {
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.prop-slider-pct {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* Range input estilizado para toque confortável (alvo >= 44px) */
input[type="range"],
.prop-slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--touch-min);
  background: transparent;
  cursor: pointer;
  margin: 0;
  touch-action: pan-y;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--border-strong);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background-color: var(--brand-primary);
  border: 3px solid var(--bg-surface);
  box-shadow: var(--shadow-sm);
  margin-top: -10px;
  transition: transform var(--duration-press) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.12);
  box-shadow: 0 0 0 6px var(--brand-primary-soft), var(--shadow-sm);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: var(--radius-pill);
  background-color: var(--border-strong);
}

input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background-color: var(--brand-primary);
  border: 3px solid var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   10. Formulários & Controles Táteis (Checkboxes Customizados + Switch)
   -------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.field-hint {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.field-error {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--status-danger-text);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--touch-min);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

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

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-soft);
}

.input-group {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}

.input-suffix {
  min-height: var(--touch-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

/* Linha de checkbox grande (substitutos e lista de compras) */
.check-row {
  width: 100%;
  text-align: left;
  min-height: var(--touch-min);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.check-row:hover {
  border-color: var(--border-strong);
}

.check-row:active {
  transform: scale(0.985);
}

.check-row.is-checked {
  background-color: var(--brand-primary-soft);
  border-color: var(--brand-primary);
}

/* Custom Checkbox tátil com checkmark vetorial */
.check-input {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.75px solid var(--border-strong);
  background-color: var(--bg-surface);
  flex-shrink: 0;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  position: relative;
  transition: background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.check-input::after {
  content: "";
  width: 11px;
  height: 6px;
  border-left: 2.2px solid var(--brand-on-primary);
  border-bottom: 2.2px solid var(--brand-on-primary);
  transform: rotate(-45deg) scale(0.4);
  transform-origin: center;
  opacity: 0;
  margin-top: -2px;
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.check-input:checked {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.check-input:checked::after {
  opacity: 1;
  transform: rotate(-45deg) scale(1);
}

.check-input:active {
  transform: scale(0.92);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-min);
  gap: var(--space-3);
  cursor: pointer;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 48px;
  height: 28px;
  border-radius: var(--radius-pill);
  background-color: var(--border-strong);
  padding: 3px;
  display: inline-flex;
  align-items: center;
  transition: background-color var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.switch-thumb {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  background-color: #FFFFFF;
  box-shadow: var(--shadow-xs);
  transition: transform var(--duration-fast) var(--ease-out);
}

.switch-input:checked + .switch-track {
  background-color: var(--brand-primary);
}

.switch-input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
}

.switch-input:focus-visible + .switch-track {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   11. Listas Agrupadas por Seção (Mercado & Estoque)
   -------------------------------------------------------------------------- */
.section-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.section-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-1) 2px;
}

.section-group-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-group-count {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

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

.list-item {
  min-height: var(--touch-min);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.shopping-item {
  min-height: 56px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: opacity var(--duration-fast) var(--ease-out),
              background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.shopping-item.is-checked {
  opacity: 0.62;
  background-color: var(--bg-surface-alt);
  box-shadow: none;
}

.shopping-item.is-checked .shopping-item-name {
  text-decoration: line-through;
}

.shopping-item-check {
  width: var(--touch-min);
  height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.shopping-item-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.shopping-item-name {
  font-weight: 600;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   12. Toasts Estilo Sonner com Ação "Desfazer" (#toast-root)
   -------------------------------------------------------------------------- */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 22px);
  transform: translateX(-50%);
  width: calc(100% - var(--space-6));
  max-width: calc(var(--app-max-width) - var(--space-6));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-height: 50px;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background-color: var(--text-primary);
  color: var(--text-inverse);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  will-change: transform, opacity;
  animation: alimenta-toast-in var(--duration-normal) var(--ease-out) forwards;
}

.toast.is-leaving {
  pointer-events: none;
  animation: alimenta-toast-out var(--duration-fast) var(--ease-out) forwards;
}

.toast-message {
  font-size: var(--text-sm);
  font-weight: 500;
  flex: 1 1 auto;
}

.toast-action,
.toast-undo {
  min-height: var(--touch-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #8FE3B5;
  flex-shrink: 0;
  transition: background-color var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.toast-action:active,
.toast-undo:active {
  transform: scale(0.96);
}

[data-theme="dark"] .toast-action,
[data-theme="dark"] .toast-undo {
  color: var(--brand-primary);
}

.toast-action:hover,
.toast-undo:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .toast-action:hover,
[data-theme="dark"] .toast-undo:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   13. Animações (Somente transform e opacity · ease-out / ease-drawer)
   -------------------------------------------------------------------------- */
@keyframes alimenta-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes alimenta-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes alimenta-sheet-in {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes alimenta-sheet-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(100%);
  }
}

@keyframes alimenta-sheet-pop-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes alimenta-sheet-pop-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

@keyframes alimenta-toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes alimenta-toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

/* --------------------------------------------------------------------------
   14. Fotografia de Alimentos, Hero Banner, Atalhos, Validades & Detalhe
   -------------------------------------------------------------------------- */
.brand-leaf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Miniaturas fotográficas via Sprite 6x6 (.food-thumb) */
.food-thumb {
  display: inline-block;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background-color: #F7F4EA;
  background-repeat: no-repeat;
  background-size: 600% 600%;
  border: 1px solid rgba(86, 77, 70, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.food-thumb--sheet-1 {
  background-image: url("../assets/food-sprite-1.webp");
}

.food-thumb--sheet-2 {
  background-image: url("../assets/food-sprite-2.webp");
}

.food-thumb--sm {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.food-thumb--md {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.food-thumb--lg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

.food-thumb--hero {
  width: 132px;
  height: 132px;
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}

/* Saudação orgânica na tela Agora */
.greeting-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.greeting-title {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 32;
  font-size: var(--text-2xl);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* Hero Banner da Refeição (inspirado em "Seu plano de hoje") */
.hero-meal-banner {
  position: relative;
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-sm), var(--highlight-inset);
  padding: var(--space-4);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 124px;
  align-items: center;
  gap: var(--space-3);
  overflow: hidden;
}

.hero-meal-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
}

.hero-meal-photo-wrap {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--bg-surface);
  box-shadow: var(--shadow-md);
  background-color: #EFECE1;
  justify-self: end;
}

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

@media (min-width: 460px) {
  .hero-meal-banner {
    grid-template-columns: minmax(0, 1fr) 144px;
    padding: var(--space-5);
  }
  .hero-meal-photo-wrap {
    width: 144px;
    height: 144px;
  }
}

/* Grade de 4 atalhos rápidos */
.quick-tiles-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.quick-tile {
  min-height: 76px;
  padding: var(--space-2) var(--space-1);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-xs), var(--highlight-inset);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-press) var(--ease-out);
}

.quick-tile:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.quick-tile:active {
  transform: scale(0.96);
}

.quick-tile-icon {
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quick-tile-label {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
}

/* Faixas de Alerta da Despensa/Cozinha */
.pantry-alert-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.alert-strip {
  width: 100%;
  text-align: left;
  min-height: var(--touch-min);
  padding: 10px var(--space-3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: transform var(--duration-press) var(--ease-out),
              opacity var(--duration-fast) var(--ease-out);
}

.alert-strip:active {
  transform: scale(0.985);
}

.alert-strip--warn {
  background-color: var(--status-warn-soft);
  color: var(--status-warn-text);
}

.alert-strip--danger {
  background-color: var(--status-danger-soft);
  color: var(--status-danger-text);
}

.alert-strip-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background-color: rgba(255, 255, 255, 0.45);
}

[data-theme="dark"] .alert-strip-icon {
  background-color: rgba(0, 0, 0, 0.25);
}

/* Campo de Busca com Ícone Lupa */
.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  display: inline-flex;
}

.search-bar .input {
  padding-left: 38px;
  background-color: var(--bg-surface-alt);
  border-color: var(--border-hairline);
}

/* Grupos por Status de Validade (Tela 2 da referência) */
.expiry-group {
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.expiry-group-header {
  padding: 10px var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
}

.expiry-group-header--danger {
  background-color: var(--status-danger-soft);
  color: var(--status-danger-text);
}

.expiry-group-header--warn {
  background-color: var(--status-warn-soft);
  color: var(--status-warn-text);
}

.expiry-group-header--ok {
  background-color: var(--status-ok-soft);
  color: var(--status-ok-text);
}

.expiry-group-list {
  display: flex;
  flex-direction: column;
}

.expiry-row {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.expiry-row:first-child {
  border-top: 0;
}

.expiry-row-main {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: transform var(--duration-press) var(--ease-out);
}

.expiry-row-main:active {
  transform: scale(0.985);
}

.expiry-status-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.expiry-status-icon--danger {
  background-color: var(--status-danger);
  color: #FFFFFF;
}

.expiry-status-icon--warn {
  background-color: var(--status-warn-soft);
  color: var(--status-warn-text);
}

.expiry-status-icon--ok {
  background-color: var(--status-ok);
  color: #FFFFFF;
}

/* Detalhe do Alimento no Bottom Sheet (Tela 3 da referência) */
.detail-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-2) 0 var(--space-1);
}

.tip-card {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.tip-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-surface);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
