:root {
  --primary: #ff5722;
  --primary-dark: #e64a19;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background: var(--bg); color: var(--text); padding-bottom: 85px; }

.topbar {
  background: var(--card); padding: 14px 20px; display: flex; justify-content: space-between;
  align-items: center; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.brand h1 { font-size: 1.3rem; font-weight: 800; color: var(--text); }
.badge-online { font-size: 0.78rem; color: var(--green); font-weight: 700; }

.kid-toggle {
  display: flex; align-items: center; gap: 6px; background: #fff3e0; color: #e65100;
  padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
}

.container { max-width: 900px; margin: 16px auto; padding: 0 14px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.card {
  background: var(--card); border-radius: 14px; padding: 16px; margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05); border: 1px solid var(--border);
}
.card h2 { font-size: 1.1rem; margin-bottom: 4px; }
.subtitle { font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.card-header-flex { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }

.alert-box {
  background: #fef2f2; border-left: 4px solid #dc2626; color: #991b1b;
  padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 0.88rem; line-height: 1.4;
}
.hidden { display: none !important; }

.pantry-input-row { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="text"], select {
  flex: 1; min-width: 160px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 0.9rem; outline: none; background: #fff;
}
input[type="text"]:focus { border-color: var(--primary); }

button, .upload-btn {
  border: none; border-radius: 10px; padding: 10px 14px; font-size: 0.86rem;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f3f4f6; color: var(--text); }
.btn-ok { background: #16a34a; color: #fff; }
.btn-skip { background: #fef3c7; color: #92400e; }
.btn-wa { background: #25d366; color: #fff; }
.btn-voice { background: #2563eb; color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 0.8rem; }

.scan-status { font-size: 0.82rem; color: var(--primary); margin-top: 8px; font-weight: 600; }
.tag-container { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  background: #eef2ff; color: #3730a3; padding: 5px 10px; border-radius: 20px;
  font-size: 0.82rem; display: inline-flex; align-items: center; gap: 6px;
}
.tag.perishable { background: #fef3c7; color: #92400e; }
.tag button { background: none; padding: 0; color: inherit; font-size: 0.95rem; }

.filter-bar { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 4px; }
.chip, .chip-ing { background: #f3f4f6; color: var(--text); border-radius: 20px; padding: 6px 14px; white-space: nowrap; }
.chip.active, .chip-ing.active { background: var(--primary); color: #fff; }

.recipe-grid { display: grid; gap: 14px; }
.recipe-card {
  background: var(--card); border-radius: 14px; overflow: hidden; border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.recipe-banner {
  background: linear-gradient(135deg, #ff5722, #ff8a65); color: #fff;
  padding: 16px; display: flex; justify-content: space-between; align-items: center;
}
.recipe-icon { font-size: 1.9rem; }
.match-badge { background: rgba(0,0,0,0.28); padding: 4px 10px; border-radius: 12px; font-size: 0.78rem; }
.recipe-body { padding: 14px 16px; }
.recipe-meta { font-size: 0.78rem; color: var(--primary); font-weight: 700; text-transform: uppercase; margin-bottom: 4px; }
.recipe-title { font-size: 1.08rem; font-weight: 700; margin-bottom: 6px; }
.recipe-ingredients { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }
.batch-pill { background: #ecfdf5; color: #065f46; font-size: 0.8rem; padding: 6px 10px; border-radius: 8px; margin-bottom: 10px; }
.recipe-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.radar-grid { display: grid; gap: 12px; }
.radar-label { display: flex; justify-content: space-between; font-size: 0.88rem; font-weight: 600; margin-bottom: 4px; }
.progress-bar { height: 10px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; transition: width 0.3s ease; }
.progress-fill.protein { background: #ef4444; }
.progress-fill.fiber { background: #16a34a; }
.progress-fill.carb { background: #f59e0b; }

.calendar-day { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.calendar-day h4 { margin-bottom: 8px; color: var(--primary); }
.meal-slot { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 0.88rem; }
.meal-slot span { width: 58px; font-weight: 600; }

.budget-box { text-align: right; background: #ecfdf5; padding: 8px 12px; border-radius: 10px; }
.budget-box span { display: block; font-size: 0.75rem; color: #065f46; }
.budget-box strong { font-size: 1.05rem; color: #047857; }
.export-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.shopping-list { list-style: none; }
.shopping-item {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--border); font-size: 0.9rem;
}

.leftover-box { margin-top: 12px; padding: 12px; background: #fffbeb; border-radius: 10px; border: 1px solid #fde68a; }
.hack-item { padding: 10px; border-left: 3px solid var(--primary); background: #f9fafb; margin-bottom: 8px; border-radius: 6px; font-size: 0.88rem; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex;
  justify-content: center; align-items: center; padding: 14px; z-index: 50;
}
.modal-content {
  background: #fff; width: 100%; max-width: 540px; border-radius: 16px;
  padding: 18px; max-height: 90vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.close-btn { background: #f3f4f6; border-radius: 50%; width: 32px; height: 32px; justify-content: center; }
.batch-banner { background: #ecfdf5; color: #065f46; padding: 8px 12px; border-radius: 8px; font-size: 0.82rem; margin-bottom: 10px; }
.modal-section { font-size: 0.86rem; color: var(--muted); margin-bottom: 12px; }
.live-cook-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.step-indicator { font-size: 0.8rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.step-text { font-size: 1.05rem; font-weight: 600; line-height: 1.5; margin-bottom: 14px; min-height: 60px; }
.timer-display {
  background: #111827; color: #fff; padding: 12px; border-radius: 10px;
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px;
}
#timerClock { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cook-nav { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 0; z-index: 30;
}
.nav-item {
  background: none; flex-direction: column; justify-content: center; gap: 2px;
  font-size: 1.1rem; color: var(--muted); padding: 4px;
}
.nav-item span { font-size: 0.72rem; }
.nav-item.active { color: var(--primary); }
