/* ─────────────────────────────────────────────────────────────
   Nutri Assist — Wise-style design tokens (2026-04-18 redesign)
   Spec: docs/superpowers/specs/2026-04-18-wise-redesign-design.md
   ───────────────────────────────────────────────────────────── */
:root {
  /* accent palette */
  --accent: #9FE870;
  --accent-ink: #163300;
  --accent-soft: #D7F2C4;
  --brand-dark: #163300;
  --coral: #FF6B4A;
  --sun: #FFD64A;
  --sky: #5BC0EB;
  --pink: #FF9BC9;

  /* surfaces */
  --bg: #FAFBF7;
  --surface: #FFFFFF;
  --surface-alt: #F2F3EE;
  --ink: #0E1A10;
  --ink-soft: #4E5A52;
  --ink-muted: #8A948D;
  --border: rgba(15,26,16,0.07);

  /* chat */
  --chat-bubble: #F0F1EB;
  --chat-bubble-ink: #0E1A10;

  /* typography */
  --font-display: 'Inter Tight', 'Inter', -apple-system, system-ui, sans-serif;
  --font-body: 'Inter', -apple-system, system-ui, sans-serif;

  /* legacy token shims — existing CSS references below still work.
     These will be removed in Task 10 after every screen is migrated. */
  --accent2: var(--sun);
  --bg2: var(--surface-alt);
  --card: var(--surface);
  --text: var(--ink);
  --muted: var(--ink-soft);
  --danger: var(--coral);
  --pill-bg: var(--surface-alt);
  /* permanent — not a legacy token, kept as convenience alias for env(safe-area-inset-bottom) */
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; }

/* ===== APP LAYOUT ===== */
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  max-width: 100%;
}

/* ===== APP HEADER ===== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-shrink: 0;
  z-index: 10;
}

.app-header .logo {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: -0.3px;
}

/* ===== APP BODY ===== */
.app-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0; /* critical for flex children to shrink */
}

/* ===== SECTIONS ===== */
.section {
  display: none;
  height: 100%;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.section.active {
  display: flex;
}

/* Chat section: input bar must stay at bottom */
#sectionChat {
  overflow: hidden;
}

#sectionChat .chat-header {
  flex-shrink: 0;
}

#sectionChat .chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== LOGIN ===== */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
  background: var(--bg);
}

.login-logo {
  font-size: 64px;
  margin-bottom: 12px;
  line-height: 1;
}

.login-title {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 32px;
  letter-spacing: -0.5px;
}

.login-form {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== INPUT FIELD ===== */
.input-field {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.input-field::placeholder {
  color: var(--muted);
}

.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 230, 160, 0.12);
}

.input-field option {
  background: var(--surface);
  color: var(--text);
}

/* ===== ERROR MESSAGE ===== */
.error-msg {
  display: none;
  color: var(--danger);
  font-size: 13px;
  padding: 8px 10px;
  background: rgba(229, 115, 115, 0.1);
  border: 1px solid rgba(229, 115, 115, 0.25);
  border-radius: 8px;
}

.error-msg.visible {
  display: block;
}

.forgot-password {
  display: block;
  text-align: center;
  margin-top: 12px;
  color: #888;
  font-size: 13px;
  text-decoration: none;
}

.forgot-password:hover {
  color: #aaa;
  text-decoration: underline;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-primary:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-secondary:active {
  transform: scale(0.98);
  background: var(--card);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 20px;
  background: rgba(229, 115, 115, 0.15);
  color: var(--danger);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid rgba(229, 115, 115, 0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn-danger:active {
  transform: scale(0.98);
  opacity: 0.85;
}

.btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== QUIZ ===== */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quiz-container {
  padding: 20px 16px 32px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.quiz-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.quiz-back-btn:active {
  color: var(--text);
  border-color: var(--muted);
}

.progress-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  flex: 1;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}

.progress-dot.done {
  background: var(--muted);
}

.progress-dot.active {
  background: var(--accent);
  transform: scale(1.35);
}

.quiz-card {
  animation: fadeSlideIn 0.3s ease forwards;
}

.quiz-title {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.quiz-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.plan-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.plan-option-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}

.plan-option-card:active {
  border-color: var(--accent);
}

.plan-option-title {
  font-size: 14px;
  font-weight: 500;
}

.plan-option-macros {
  font-size: 12px;
  color: var(--muted);
}

.recipe-source-chip {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.recipe-source-chip.source-plan {
  background: rgba(200, 230, 160, 0.15);
  color: var(--accent);
}

.recipe-source-chip.source-user {
  background: rgba(240, 208, 128, 0.15);
  color: var(--accent2);
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  min-height: 72px;
  width: 100%;
  text-align: left;
}

.quiz-option:active {
  transform: scale(0.99);
}

.quiz-option.selected,
.quiz-option.active {
  border-color: var(--accent);
  background: rgba(200, 230, 160, 0.08);
}

.quiz-option .emoji {
  font-size: 28px;
  flex-shrink: 0;
  width: 36px;
  text-align: center;
}

.quiz-option .label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

.quiz-option .sublabel {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

.meal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.meal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
}

.meal-btn .emoji {
  font-size: 24px;
}

.meal-btn.selected {
  border-color: var(--accent);
  background: rgba(200, 230, 160, 0.08);
  color: var(--accent);
}

.meal-btn:disabled,
.meal-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.fridge-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  padding: 13px 14px;
  outline: none;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 16px;
}

.fridge-textarea::placeholder {
  color: var(--muted);
}

.fridge-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 230, 160, 0.12);
}

.no-plan-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 20px;
}

.no-plan-card .emoji {
  font-size: 40px;
  margin-bottom: 10px;
}

.no-plan-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ===== CHAT ===== */
.chat-header {
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.chip:hover,
.chip.active {
  border-color: var(--accent);
  color: var(--accent);
}

.quick-reply-group {
  margin: 8px 0;
}

.quick-reply-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.quick-reply-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-reply-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--pill-bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.quick-reply-chip:hover {
  border-color: var(--accent);
}

.quick-reply-chip.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(76, 175, 80, 0.1);
}

.quick-reply-chip.dimmed {
  opacity: 0.4;
  pointer-events: none;
}

.quick-reply-chip.default {
  border-color: var(--accent);
  border-style: dashed;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.send-btn:active {
  transform: scale(0.92);
}

.send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== RECIPES ===== */
.recipes-container {
  padding: 16px 16px 32px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.recipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.recipe-card:active {
  transform: scale(0.99);
  border-color: var(--accent);
}

.recipe-type-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.recipe-type-chip.almoco {
  background: rgba(200, 230, 160, 0.15);
  color: var(--accent);
}

.recipe-type-chip.cafe {
  background: rgba(240, 208, 128, 0.15);
  color: var(--accent2);
}

.recipe-type-chip.lanche {
  background: rgba(147, 197, 253, 0.15);
  color: #93c5fd;
}

.recipe-type-chip.jantar {
  background: rgba(196, 181, 253, 0.15);
  color: #c4b5fd;
}

.recipe-type-chip.pre-treino {
  background: rgba(251, 191, 146, 0.15);
  color: #fbbf92;
}

.recipe-type-chip.ceia {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
}

.macros {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty-state .emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 15px;
  line-height: 1.5;
}

/* ===== PROFILE ===== */
.profile-container {
  padding: 24px 16px 48px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* ===== MODALS ===== */
@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===== CONFIRM ACTIONS ===== */
#confirmDialog.active {
  z-index: 200;
}

/* ===== ANALYTICS ===== */

/* Chart container */
.chart-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.chart-container canvas {
  max-height: 200px;
}

/* Meal timeline */
.meal-timeline {
  margin-top: 16px;
}

.meal-timeline-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 10px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.timeline-dot.cafe { background: var(--accent2); }
.timeline-dot.almoco { background: var(--accent); }
.timeline-dot.lanche { background: #93c5fd; }
.timeline-dot.jantar { background: #c4b5fd; }

.timeline-info {
  flex: 1;
  min-width: 0;
}

.timeline-meal-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.timeline-meal-title {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.timeline-kcal {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.timeline-btns { display: flex; gap: 4px; }
.timeline-btn { background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 4px; opacity: 0.5; transition: opacity 0.2s; }
.timeline-btn:hover { opacity: 1; }
.timeline-macros { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Summary cards */
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.summary-card .summary-title {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.summary-item {
  text-align: center;
  flex: 1;
}

.summary-item .value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.summary-item .label {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.summary-item .value.calories { color: var(--accent); }
.summary-item .value.protein { color: #81c784; }
.summary-item .value.carbs-val { color: #81d4fa; }
.summary-item .value.fat-val { color: #f0d080; }

/* Macro toggle buttons (month view) */
.macro-toggle {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}

.macro-toggle-btn {
  padding: 5px 12px;
  border-radius: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.macro-toggle-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(200, 230, 160, 0.1);
}

/* Log Meal Modal */
.log-meal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Empty state for analytics */
.analytics-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.analytics-empty .emoji {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.analytics-empty p {
  font-size: 15px;
  line-height: 1.5;
}

/* ===== DESKTOP ===== */
@media (min-width: 768px) {
  .app {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    width: 480px;
  }

  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: 20px;
    margin-bottom: 0;
    max-height: 85vh;
  }
}

/* Nutri Virtual */
.nv-consultation { display: flex; flex-direction: column; height: calc(100vh - 120px); }
.nv-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--surface); }
.nv-checklist { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--surface); }
.nv-badge { padding: 3px 8px; border-radius: 10px; font-size: 11px; }
.nv-badge-done { background: #1b3a1b; color: #4CAF50; }
.nv-badge-pending { background: var(--surface); color: var(--muted); }
.nv-messages { flex: 1; overflow-y: auto; padding: 16px; }
.nv-msg { display: flex; gap: 8px; margin-bottom: 14px; }
.nv-msg-user { justify-content: flex-end; }
.nv-msg-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.nv-msg-agent .nv-msg-avatar { background: var(--accent); }
.nv-msg-user .nv-msg-avatar { background: var(--surface); order: 1; }
.nv-msg-bubble { padding: 10px 14px; border-radius: 12px; font-size: 14px; max-width: 80%; line-height: 1.4; }
.nv-msg-agent .nv-msg-bubble { background: #1a2a1a; border-top-left-radius: 4px; }
.nv-msg-user .nv-msg-bubble { background: #1a1a2a; border-top-right-radius: 4px; }
.nv-interim { padding: 0 16px; font-size: 13px; color: var(--muted); font-style: italic; min-height: 20px; }
.nv-controls { text-align: center; padding: 16px; }
.nv-mic-btn { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); font-size: 28px; cursor: pointer; transition: all 0.2s; }
.nv-mic-btn-small { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); font-size: 18px; cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
.nv-mic-btn.nv-mic-active, .nv-mic-btn-small.nv-mic-active { background: #e53935; border-color: #e53935; box-shadow: 0 0 20px rgba(229,57,53,0.3); animation: nv-pulse 1.5s infinite; }
.nv-mic-label { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: center; }
.nv-audio-level { width: 120px; height: 6px; background: var(--surface); border-radius: 3px; margin: 0 auto 12px; overflow: hidden; }
.nv-audio-bar { height: 100%; background: #4CAF50; border-radius: 3px; width: 0%; transition: width 0.05s; }
@keyframes nv-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ===== SPINNER ===== */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== PLAN SUMMARY CHIPS ===== */
.plan-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.plan-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}
.plan-details {
  margin-top: 8px;
}
.plan-details summary {
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
}
.plan-details summary::before {
  content: '▸ ';
}
.plan-details[open] summary::before {
  content: '▾ ';
}


/* ─────────────────────────────────────────────────────────────
   App shell + tab bar (Task 3)
   ───────────────────────────────────────────────────────────── */
.app {
  position: relative;
  min-height: 100vh;
  background: var(--bg);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 14px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.app-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--ink);
}
.app-header .logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-dark);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-body { padding-bottom: 110px; }
.section { display: none; }
.section.active { display: block; }

/* Floating tab bar (replaces the emoji bottom-nav) */
.tabbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(15,26,16,0.12), 0 2px 6px rgba(15,26,16,0.06);
  padding: 6px;
  display: flex;
  gap: 4px;
  z-index: 40;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.tabbar button {
  flex: 1;
  border: none;
  cursor: pointer;
  padding: 10px 6px;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.1px;
  font-family: inherit;
  transition: all 180ms ease;
}
.tabbar button.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.tabbar button svg { display: block; }

/* Hide tab bar when chat is active (chat has its own header back-button) */
.app.chat-active .tabbar { display: none; }

/* ─────────────────────────────────────────────────────────────
   Login screen (Task 4)
   ───────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  background: var(--bg);
  padding: 72px 22px 40px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.login-wrap .blob-1 { position: absolute; right: -50px; top: 40px; width: 180px; height: 180px; border-radius: 999px; background: var(--accent); opacity: 0.35; filter: blur(2px); }
.login-wrap .blob-2 { position: absolute; right: 40px; top: 120px; width: 50px; height: 50px; border-radius: 999px; background: var(--coral); opacity: 0.9; }
.login-wrap .blob-3 { position: absolute; left: -30px; top: 200px; width: 70px; height: 70px; border-radius: 999px; background: var(--sun); opacity: 0.7; }

.login-wrap .logo-row { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; margin-bottom: 64px; }
.login-wrap .logo-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-dark); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.login-wrap .logo-text { font-family: var(--font-display); font-size: 17px; font-weight: 800; color: var(--ink); letter-spacing: -0.4px; }

.login-wrap .hero { position: relative; z-index: 2; margin-bottom: 32px; }
.mega-title { font-family: var(--font-display); font-size: 40px; font-weight: 800; line-height: 0.98; letter-spacing: -1.8px; color: var(--ink); }
.mega-title .highlight { background: var(--accent); padding: 0 10px 2px; border-radius: 10px; color: var(--accent-ink); display: inline-block; transform: rotate(-1.5deg); }
.subcopy { color: var(--ink-soft); font-size: 14px; margin-top: 14px; line-height: 1.4; max-width: 280px; }

.login-wrap .form { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 10px; }
.field label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; color: var(--ink-muted); text-transform: uppercase; margin: 0 0 6px 4px; }
.field input {
  width: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease;
  box-sizing: border-box;
}
.field input:focus { border-color: var(--brand-dark); }
.field.pw { position: relative; }
.field.pw .eye { position: absolute; right: 8px; top: 29px; width: 36px; height: 36px; border: none; background: transparent; color: var(--ink-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; }

.link-btn { background: transparent; border: none; cursor: pointer; color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; font-family: inherit; padding: 6px 4px; }

.btn-primary {
  width: 100%;
  padding: 18px;
  background: var(--brand-dark);
  color: #fff;
  border: none;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -0.2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(15,26,16,0.14), 0 2px 4px rgba(15,26,16,0.06);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.login-wrap .error-msg { color: var(--coral); font-size: 13px; min-height: 18px; }
.login-wrap .error-msg.visible { margin-top: 4px; }

/* ─────────────────────────────────────────────────────────────
   Home screen (Task 5)
   ───────────────────────────────────────────────────────────── */
.home-wrap { padding: 16px 20px 140px; }

.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.home-top .greet { display: flex; align-items: center; gap: 10px; }
.home-top .avatar {
  width: 36px; height: 36px; border-radius: 999px;
  background: var(--coral); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
}
.home-top .greet-text .label {
  font-size: 11px; color: var(--ink-muted); letter-spacing: 0.2px;
  text-transform: uppercase; font-weight: 600;
}
.home-top .greet-text .name {
  font-size: 15px; font-weight: 700; color: var(--ink); margin-top: -1px;
}
.home-top .bell {
  width: 40px; height: 40px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); cursor: pointer; position: relative;
}
.home-top .bell .dot {
  position: absolute; top: 9px; right: 10px;
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--coral); border: 2px solid var(--surface);
}

.home-hero { margin: 10px 0 22px; }
.home-hero .title {
  font-family: var(--font-display);
  font-size: 42px; font-weight: 800; line-height: 1.02;
  letter-spacing: -1.8px; color: var(--ink);
}
.home-hero .title .highlight {
  background: var(--accent); padding: 0 10px 2px;
  border-radius: 10px; color: var(--accent-ink);
  display: inline-block; transform: rotate(-1deg);
}
.home-hero .sub { color: var(--ink-soft); font-size: 15px; margin-top: 10px; line-height: 1.4; }

.home-search {
  width: 100%;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 22px; padding: 10px 10px 10px 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(15,26,16,0.06), 0 1px 3px rgba(15,26,16,0.04);
  font-family: inherit;
  transition: border-color 150ms ease;
}
.home-search:focus-within { border-color: var(--brand-dark); }
.home-search .sparkle {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.home-search-input {
  flex: 1;
  border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 15px; color: var(--ink);
  padding: 6px 0; resize: none; max-height: 120px; line-height: 1.3;
}
.home-search-input::placeholder { color: var(--ink-muted); }
.home-search-send {
  width: 36px; height: 36px; border-radius: 999px; border: none;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: opacity 150ms ease;
}
.home-search-send:disabled { opacity: 0.4; cursor: not-allowed; }

.sugg-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 14px;
}
.sugg {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 14px;
  display: flex; align-items: center; gap: 10px;
  text-align: left; cursor: pointer;
  font-family: inherit; color: var(--ink);
}
.sugg .ic {
  width: 28px; height: 28px; border-radius: 8px;
  color: var(--accent-ink); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sugg .label { font-size: 13px; font-weight: 600; line-height: 1.2; }

.section-label {
  font-size: 11px; letter-spacing: 0.3px; color: var(--ink-muted);
  font-weight: 700; text-transform: uppercase;
}

.today-card {
  background: var(--brand-dark);
  border-radius: 24px; padding: 20px; color: #fff;
  position: relative; overflow: hidden;
}
.today-card .blob-a { position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 999px; background: var(--accent); opacity: 0.18; }
.today-card .blob-b { position: absolute; right: 30px; top: 40px; width: 50px; height: 50px; border-radius: 999px; background: var(--accent); opacity: 0.35; }
.today-card .row1 { position: relative; display: flex; justify-content: space-between; align-items: flex-start; }
.today-card .kcal-label { font-size: 12px; opacity: 0.7; font-weight: 500; letter-spacing: 0.2px; }
.today-card .kcal-value { font-family: var(--font-display); font-size: 38px; font-weight: 800; line-height: 1; letter-spacing: -1.2px; margin-top: 4px; }
.today-card .kcal-value .goal { font-size: 16px; opacity: 0.6; font-weight: 500; }
.today-card .badge { background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: 999px; letter-spacing: 0.2px; font-family: var(--font-display); }
.today-card .bar-wrap { margin-top: 14px; height: 8px; border-radius: 999px; background: rgba(255,255,255,0.12); overflow: hidden; position: relative; }
.today-card .bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.today-card .macros { display: flex; gap: 16px; margin-top: 16px; position: relative; }
.today-card .macro { flex: 1; }
.today-card .macro .m-label { font-size: 10px; opacity: 0.7; letter-spacing: 0.2px; font-weight: 500; text-transform: uppercase; }
.today-card .macro .m-value { font-family: var(--font-display); font-size: 16px; font-weight: 700; margin-top: 2px; }
.today-card .macro .m-goal { font-size: 11px; opacity: 0.55; font-weight: 500; }
.today-card .macro .m-bar { height: 3px; border-radius: 999px; background: rgba(255,255,255,0.12); margin-top: 6px; }
.today-card .macro .m-bar > span { display: block; height: 100%; border-radius: 999px; }

.plan-card {
  background: var(--surface); border-radius: 22px; padding: 16px;
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}
.plan-card .plan-ic {
  width: 54px; height: 54px; border-radius: 16px;
  background: var(--accent-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.plan-card .plan-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -0.2px; }
.plan-card .plan-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.plan-card .plan-arrow { color: var(--ink-soft); display: flex; align-items: center; }

/* No-plan empty state (reskinned) */
.no-plan-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; padding: 28px 22px; text-align: center;
  margin-top: 20px;
}
.no-plan-card .ic-wrap {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--accent-soft); color: var(--brand-dark);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.no-plan-card .title {
  font-family: var(--font-display); font-size: 22px; font-weight: 800;
  letter-spacing: -0.6px; color: var(--ink); margin-bottom: 6px;
}
.no-plan-card .desc { font-size: 14px; color: var(--ink-soft); line-height: 1.4; margin-bottom: 16px; }

/* ─────────────────────────────────────────────────────────────
   Chat screen (Task 6)
   ───────────────────────────────────────────────────────────── */
#sectionChat {
  display: none;
  background: var(--bg);
}
#sectionChat.active {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: 25;
}

.chat-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 12px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.chat-header .round-btn {
  width: 36px; height: 36px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink); padding: 0;
}
.chat-header .who { flex: 1; display: flex; align-items: center; gap: 10px; }
.chat-header .who-avatar {
  position: relative;
  width: 38px; height: 38px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
}
.chat-header .who-avatar .online {
  position: absolute; bottom: -1px; right: -1px;
  width: 12px; height: 12px; border-radius: 999px;
  background: #30D158; border: 2px solid var(--bg);
}
.chat-header .who-name {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.2px;
}
.chat-header .who-sub { font-size: 11px; color: var(--ink-muted); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 130px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-messages .day-stamp {
  align-self: center; font-size: 11px; color: var(--ink-muted);
  margin: 2px 0 10px; font-weight: 500;
}

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  font-size: 15px; line-height: 1.35;
  word-wrap: break-word;
}
.bubble.ai { background: var(--chat-bubble); color: var(--chat-bubble-ink); border-radius: 20px 20px 20px 6px; align-self: flex-start; }
.bubble.user { background: var(--accent); color: var(--accent-ink); border-radius: 20px 20px 6px 20px; align-self: flex-end; }

/* Typing indicator */
.typing {
  background: var(--chat-bubble); border-radius: 20px 20px 20px 6px;
  padding: 12px 14px;
  display: inline-flex; gap: 4px; align-items: center;
  align-self: flex-start;
}

/* "Preparando a receita…" state — shown while AI streams the recipe tag block */
.bubble.ai.preparing {
  display: inline-flex; align-items: center; gap: 8px;
  font-style: italic; color: var(--ink-soft);
}
.bubble.ai.preparing .prep-label { font-style: italic; }
.bubble.ai.preparing .prep-dots {
  display: inline-flex; gap: 3px; align-items: center;
}
.bubble.ai.preparing .prep-dots span {
  width: 5px; height: 5px; border-radius: 999px;
  background: var(--ink-muted);
  animation: typingDot 1.2s infinite;
}
.bubble.ai.preparing .prep-dots span:nth-child(2) { animation-delay: 0.15s; }
.bubble.ai.preparing .prep-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}
.typing span {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--ink-muted); animation: typingDot 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

/* Recipe bubble (inline in chat) */
.recipe-bubble {
  max-width: 86%; width: 86%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 22px 22px 22px 6px;
  overflow: hidden;
  align-self: flex-start;
  /* overflow: hidden sets min-height: 0 on flex item; without flex-shrink: 0
     the bubble gets crushed to ~0 when the chat content overflows the viewport. */
  flex-shrink: 0;
}
.recipe-bubble .hero { height: 100px; background: var(--accent); position: relative; overflow: hidden; }
.recipe-bubble .hero .b1 { position: absolute; left: -20px; top: -20px; width: 100px; height: 100px; border-radius: 999px; background: var(--sun); opacity: 0.8; }
.recipe-bubble .hero .b2 { position: absolute; right: 40px; bottom: -30px; width: 80px; height: 80px; border-radius: 999px; background: var(--coral); }
.recipe-bubble .hero .b3 { position: absolute; right: -15px; top: 20px; width: 60px; height: 60px; border-radius: 999px; background: var(--brand-dark); opacity: 0.85; }
.recipe-bubble .match-pill {
  position: absolute; top: 10px; left: 12px;
  background: var(--brand-dark); color: var(--accent);
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
  padding: 4px 8px; border-radius: 999px;
  font-family: var(--font-display);
}
.recipe-bubble .body { padding: 14px; }
.recipe-bubble .meta { display: flex; align-items: center; gap: 6px; color: var(--ink-muted); font-size: 11px; font-weight: 600; letter-spacing: 0.2px; text-transform: uppercase; }
.recipe-bubble .title { font-family: var(--font-display); font-size: 19px; font-weight: 800; color: var(--ink); letter-spacing: -0.4px; line-height: 1.15; margin-top: 4px; }
.recipe-bubble .ings { margin-top: 10px; }
.recipe-bubble .ings .ing { font-size: 13px; color: var(--ink-soft); line-height: 1.6; display: flex; gap: 8px; align-items: center; }
.recipe-bubble .ings .dot { width: 4px; height: 4px; border-radius: 999px; background: var(--accent); flex-shrink: 0; }
.recipe-bubble .macro-row {
  display: flex; gap: 6px; margin-top: 12px;
  padding: 10px 12px; background: var(--surface-alt); border-radius: 12px;
}
.recipe-bubble .macro-row .cell { flex: 1; text-align: center; }
.recipe-bubble .macro-row .cell .k { font-size: 10px; color: var(--ink-muted); font-weight: 600; letter-spacing: 0.2px; }
.recipe-bubble .macro-row .cell .v { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -0.2px; margin-top: 1px; }
.recipe-bubble .macro-row .sep { width: 1px; background: var(--border); }
.recipe-bubble .actions { display: flex; gap: 8px; margin-top: 12px; }
.recipe-bubble .actions .btn-register { flex: 1; background: var(--brand-dark); color: #fff; border: none; border-radius: 14px; padding: 12px 14px; font-size: 13px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; font-family: inherit; }
.recipe-bubble .actions .btn-save { background: var(--surface-alt); color: var(--ink); border: none; border-radius: 14px; padding: 12px 14px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; font-family: inherit; }

.recipe-bubble .btn-prep-toggle {
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--accent-soft); color: var(--brand-dark);
  border: none; border-radius: 14px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700; letter-spacing: -0.1px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  transition: background 150ms ease, transform 100ms ease;
}
.recipe-bubble .btn-prep-toggle:hover { background: #C6EAA8; }
.recipe-bubble .btn-prep-toggle:active { transform: scale(0.98); }
.recipe-bubble .btn-prep-toggle .chev {
  display: flex; align-items: center;
  transition: transform 200ms ease;
  transform: rotate(90deg); /* arrowRight → down */
}
.recipe-bubble .btn-prep-toggle[aria-expanded="true"] .chev {
  transform: rotate(-90deg); /* arrowRight → up */
}
.recipe-bubble .prep-steps {
  margin: 12px 4px 0;
  padding: 0 0 0 22px;
  list-style: decimal;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}
.recipe-bubble .prep-steps li { margin-bottom: 8px; padding-left: 4px; }
.recipe-bubble .prep-steps li:last-child { margin-bottom: 0; }
.recipe-bubble .prep-steps li::marker {
  color: var(--brand-dark);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
}
.recipe-bubble .prep-steps[hidden] { display: none; }

/* Composer (floating pill) */
.composer-wrap {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 14px);
  pointer-events: none;
  z-index: 30;
}
.composer-fade {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 100px; pointer-events: none; z-index: 29;
  background: linear-gradient(to bottom, transparent, var(--bg) 55%);
}
.composer {
  pointer-events: auto;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 28px;
  padding: 6px 6px 6px 16px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 12px 30px rgba(15,26,16,0.1), 0 2px 6px rgba(15,26,16,0.05);
}
.composer .plus-btn {
  width: 32px; height: 32px; border-radius: 999px; border: none;
  background: var(--surface-alt); color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.composer textarea {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--ink);
  padding: 8px 0; resize: none; max-height: 120px;
}
.composer textarea::placeholder { color: var(--ink-muted); }
.composer .send-btn {
  width: 36px; height: 36px; border-radius: 999px; border: none;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.composer .send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─────────────────────────────────────────────────────────────
   Progresso screen (Task 7)
   ───────────────────────────────────────────────────────────── */
.analytics-wrap { padding: 16px 20px 140px; }

.huge-title {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 800; line-height: 1;
  letter-spacing: -1.5px; color: var(--ink);
}

.period-chips {
  display: flex; gap: 8px; margin-top: 20px; overflow-x: auto;
}
.period-chips button {
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  font-family: var(--font-display);
  cursor: pointer;
}
.period-chips button.active {
  background: var(--brand-dark); color: var(--accent);
  border-color: var(--brand-dark);
}

.card {
  background: var(--surface); border-radius: 22px;
  border: 1px solid var(--border); overflow: hidden;
  padding: 20px;
}

.today-ring-card {
  background: var(--brand-dark); border-radius: 24px;
  padding: 20px; color: #fff;
}
.today-ring-card .label { font-size: 11px; letter-spacing: 0.3px; opacity: 0.65; font-weight: 700; text-transform: uppercase; }
.today-ring-card .ring-row { display: flex; gap: 16px; margin-top: 14px; align-items: center; }
.today-ring-card .ring {
  position: relative; width: 100px; height: 100px; flex-shrink: 0;
}
.today-ring-card .ring svg { transform: rotate(-90deg); }
.today-ring-card .ring .ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.today-ring-card .ring .ring-value { font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.today-ring-card .ring .ring-sub { font-size: 9px; opacity: 0.6; margin-top: -2px; }
.today-ring-card .macro-list { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.today-ring-card .macro-list .macro-row { }
.today-ring-card .macro-list .mr-label-row { display: flex; justify-content: space-between; font-size: 11px; }
.today-ring-card .macro-list .mr-label-row .k { opacity: 0.75; }
.today-ring-card .macro-list .mr-label-row .v { font-weight: 600; }
.today-ring-card .macro-list .mr-bar { height: 5px; background: rgba(255,255,255,0.1); border-radius: 999px; margin-top: 4px; }
.today-ring-card .macro-list .mr-bar > span { display: block; height: 100%; border-radius: 999px; }

.week-chart-card { margin-top: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; }
.week-chart-card .legend { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.week-chart-card .legend .legend-items { display: flex; gap: 10px; font-size: 11px; color: var(--ink-soft); }
.week-chart-card .legend .legend-items .dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 4px; vertical-align: middle; }

/* ─────────────────────────────────────────────────────────────
   Receitas screen (Task 8)
   ───────────────────────────────────────────────────────────── */
.recipes-wrap { padding: 16px 0 140px; }
.recipes-wrap .head { padding: 0 20px; }

.filter-chips {
  margin-top: 20px; padding: 0 20px;
  display: flex; gap: 8px; overflow-x: auto;
}
.filter-chips .chip {
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  font-family: var(--font-display);
  cursor: pointer;
}
.filter-chips .chip.active {
  background: var(--brand-dark); color: var(--accent);
  border-color: var(--brand-dark);
}

.recipe-list { margin-top: 20px; padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
.recipe-card {
  background: var(--surface); border-radius: 20px;
  border: 1px solid var(--border);
  padding: 14px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
}
.recipe-card .thumb {
  width: 64px; height: 64px; border-radius: 16px;
  flex-shrink: 0; position: relative; overflow: hidden;
}
.recipe-card .thumb .dec-a { position: absolute; right: -10px; bottom: -10px; width: 40px; height: 40px; border-radius: 999px; background: var(--brand-dark); opacity: 0.25; }
.recipe-card .thumb .dec-b { position: absolute; left: 8px; top: 8px; width: 12px; height: 12px; border-radius: 999px; background: var(--surface); opacity: 0.7; }
.recipe-card .info { flex: 1; min-width: 0; }
.recipe-card .info .tag-row { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.recipe-card .info .source-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px;
  font-family: var(--font-display);
}
.recipe-card .info .source-tag.plano { background: var(--accent-soft); color: var(--brand-dark); }
.recipe-card .info .source-tag.salva { background: var(--surface-alt); color: var(--ink-soft); }
.recipe-card .info .meal-tag { font-size: 11px; color: var(--ink-muted); }
.recipe-card .info .title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -0.2px; line-height: 1.2; }
.recipe-card .info .kcal { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.recipe-card .arrow { color: var(--ink-soft); display: flex; align-items: center; }

/* ─────────────────────────────────────────────────────────────
   Perfil screen (Task 9)
   ───────────────────────────────────────────────────────────── */
.profile-wrap { padding: 16px 20px 140px; }

.profile-hero {
  margin-top: 22px;
  background: var(--accent); border-radius: 24px;
  padding: 20px; position: relative; overflow: hidden;
}
.profile-hero .deco { position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 999px; background: var(--brand-dark); opacity: 0.12; }
.profile-hero .hero-row { position: relative; display: flex; align-items: center; gap: 14px; }
.profile-hero .avatar {
  width: 62px; height: 62px; border-radius: 999px;
  background: var(--coral); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  border: 3px solid var(--accent-soft);
}
.profile-hero .user-name { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--accent-ink); letter-spacing: -0.4px; }
.profile-hero .user-email { font-size: 12px; color: var(--accent-ink); opacity: 0.7; margin-top: 2px; }

.profile-section { margin-top: 24px; }
.profile-section .section-label { margin: 0 4px 10px; }
.profile-section .card {
  padding: 0;
  border-radius: 22px;
  overflow: hidden;
}
.profile-section .card > .row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.profile-section .card > .row:last-child { border-bottom: none; }
.profile-section .card > .row .left { font-size: 14px; color: var(--ink); }
.profile-section .card > .row .right { font-size: 14px; color: var(--ink-soft); font-weight: 600; }

.nutri-row {
  display: flex; align-items: center; gap: 12px; padding: 16px;
}
.nutri-row .n-avatar {
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--sky); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
}
.nutri-row .n-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.nutri-row .n-meta { font-size: 12px; color: var(--ink-muted); }
.nutri-row .n-arrow { color: var(--ink-soft); display: flex; align-items: center; }

.chips-group { padding: 16px; }
.chips-group .chips-label {
  font-size: 11px; letter-spacing: 0.2px; color: var(--ink-muted);
  font-weight: 600; text-transform: uppercase; margin-bottom: 8px;
}
.chips-group + .chips-group { padding-top: 0; }
.profile-wrap .chip, .chips-row .chip {
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface-alt); color: var(--ink);
  border: none;
  cursor: default;
  font-size: 12px; font-weight: 600;
  font-family: var(--font-display);
  display: inline-flex; align-items: center; gap: 4px;
}
.profile-wrap .chip:hover, .chips-row .chip:hover { border-color: transparent; background: var(--surface-alt); }
.profile-wrap .chip.alert, .chips-row .chip.alert { background: #FEE4DE; color: #8A2E16; }
.profile-wrap .chip.warn, .chips-row .chip.warn { background: #FFF3D6; color: #6A4A00; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ─────────────────────────────────────────────────────────────
   Modal/toast/confirm reskin (Task 10)
   Tokens-only overrides; HTML structure in app.html stays.
   ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,26,16,0.5);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 24px;
  padding: 20px;
  max-width: 420px; width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  font-family: var(--font-body);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal-header h3 {
  font-family: var(--font-display); font-size: 20px; font-weight: 800;
  letter-spacing: -0.3px; color: var(--ink); margin: 0;
}
.modal-close {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--surface-alt); color: var(--ink);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; padding: 0;
}
.input-field {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.input-field:focus { border-color: var(--brand-dark); }
.field-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
  color: var(--ink-muted); text-transform: uppercase;
  display: block; margin-bottom: 6px;
}
.btn-secondary {
  padding: 14px 18px; background: var(--surface-alt); color: var(--ink);
  border: none; border-radius: 14px;
  font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
}
.confirm-actions {
  display: flex; gap: 8px; margin-top: 16px;
}
.confirm-actions button { flex: 1; }

.portion-selector { display: flex; gap: 6px; margin-bottom: 12px; }
.portion-btn {
  flex: 1; padding: 10px; background: var(--surface-alt); color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  cursor: pointer;
}
.portion-btn.active { background: var(--brand-dark); color: var(--accent); border-color: var(--brand-dark); }

.log-macro-preview { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.macro-pill {
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-alt); color: var(--ink);
  font-size: 12px; font-weight: 600; font-family: var(--font-display);
}
.macro-pill.protein { background: rgba(91,192,235,0.15); color: #0F5A79; }
.macro-pill.carb { background: rgba(255,214,74,0.2); color: #6A4A00; }
.macro-pill.fat { background: rgba(255,107,74,0.15); color: #8A2E16; }
.macro-pill.kcal { background: var(--accent-soft); color: var(--brand-dark); }

.toast-container {
  position: fixed; top: 20px; left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; z-index: 200;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 600;
  opacity: 0; transform: translateY(-10px);
  transition: all 200ms ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--coral); }
.toast.success { background: var(--brand-dark); color: var(--accent); }
