:root {
  --bg-primary: #FAFAF7;
  --bg-card: #FFFFFF;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --accent: #2D6A4F;
  --accent-light: #D8F3DC;
  --warning: #E76F51;
  --warning-light: #FDDEC0;
  --border: #E8E8E4;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --tab-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
}

#app {
  padding: 16px;
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
  max-width: 500px;
  margin: 0 auto;
}

/* Tab Bar */
#tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  padding: 8px 0;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  transition: color 0.2s;
  min-height: 48px;
  justify-content: center;
}

.tab.active {
  color: var(--accent);
}

.tab.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.tab-icon {
  font-size: 22px;
  line-height: 1;
}

.tab-label {
  font-size: 11px;
}

/* Typography */
h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius);
  border: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: opacity 0.2s, transform 0.1s;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}

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

.btn-secondary {
  background: var(--accent-light);
  color: var(--accent);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-primary);
}

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
  min-height: 36px;
  border-radius: 8px;
}

.btn-danger {
  background: var(--warning-light);
  color: var(--warning);
}

/* Form controls */
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  background: var(--bg-card);
  color: var(--text-primary);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

input[type="date"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Toggle buttons group */
.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-toggle {
  padding: 10px 18px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  min-height: 48px;
  color: var(--text-primary);
  transition: all 0.2s;
}

.btn-toggle.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Macro badges */
.macro-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.macro-protein {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.macro-calories {
  background: #F5F5F0;
  color: var(--text-secondary);
}

.macro-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  gap: 16px;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Day card */
.day-card {
  margin-bottom: 16px;
}

.day-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-left: 4px;
}

/* Meal card */
.meal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 8px;
}

.meal-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.meal-name {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.meal-cost {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.meal-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Summary bar */
.summary-bar {
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.summary-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Shopping list */
.shopping-section {
  margin-bottom: 20px;
}

.shopping-header {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0ec;
  min-height: 48px;
}

.shopping-item.checked {
  opacity: 0.4;
}

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

.shopping-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.shopping-name {
  flex: 1;
  font-size: 15px;
}

.shopping-qty {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.shopping-cost {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 45px;
  text-align: right;
}

.shopping-total {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shopping-total-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.shopping-remaining {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Cooking steps */
.step-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
  min-height: 200px;
}

.step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.step-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.step-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 4px 10px;
  border-radius: 20px;
}

.step-action {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 16px;
}

.step-equipment {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.step-duration {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}

.step-parallel {
  background: #F9F9F5;
  border-radius: 8px;
  padding: 12px;
}

.step-parallel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.step-parallel li {
  font-size: 14px;
  padding: 3px 0;
  list-style: none;
  padding-left: 16px;
  position: relative;
}

.step-parallel li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.step-nav {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.step-nav .btn {
  flex: 1;
  font-size: 18px;
  padding: 16px;
}

.progress-bar-container {
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  margin-bottom: 16px;
  overflow: hidden;
}

.progress-bar {
  background: var(--accent);
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.cooking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.time-remaining {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Feedback */
.category-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.category-btn {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  min-height: 48px;
  color: var(--text-primary);
  transition: all 0.2s;
}

.category-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.feedback-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 8px;
}

.feedback-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.feedback-category {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.feedback-category.bug { background: #FEE2E2; color: #DC2626; }
.feedback-category.missing { background: #FEF3C7; color: #D97706; }
.feedback-category.idea { background: #DBEAFE; color: #2563EB; }
.feedback-category.general { background: #F3F4F6; color: #6B7280; }

.feedback-content {
  font-size: 14px;
  line-height: 1.4;
}

/* Exclusions panel */
.exclusions-toggle {
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  font-family: inherit;
  text-decoration: underline;
}

.exclusions-panel {
  background: #F9F9F5;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

.exclusion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
}

.exclusion-remove {
  background: none;
  border: none;
  color: var(--warning);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  min-height: 32px;
}

/* Ingredient exclude menu */
.exclude-menu {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 8px;
  margin-top: 8px;
}

.exclude-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  border-radius: 6px;
  min-height: 40px;
}

.exclude-menu-item:hover,
.exclude-menu-item:active {
  background: var(--warning-light);
  color: var(--warning);
}

/* Toast messages */
.toast {
  position: fixed;
  bottom: calc(var(--tab-height) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.5s forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

/* Error message */
.error-msg {
  background: var(--warning-light);
  color: var(--warning);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  text-align: center;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
