:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #2b2420;
  --text-muted: #7a716a;
  --accent: #2f7a4f;
  --accent-soft: #e6f2ea;
  --border: #e7e0d6;
  --veg: #4c9a5b;
  --fruit: #e0733c;
  --seafood: #3577b7;
  --grain: #b58a2e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  padding: 2.5rem 1.5rem 1.5rem;
  text-align: center;
}

.site-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.site-nav a {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.site-nav a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.month-picker {
  margin-bottom: 1.25rem;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

@media (max-width: 560px) {
  .month-grid { grid-template-columns: repeat(4, 1fr); }
}

.month-btn {
  padding: 0.6rem 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.month-btn:hover { border-color: var(--accent); }

.month-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.category-filter {
  margin-bottom: 2rem;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.chart-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 2rem;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.chart-header h2 {
  margin: 0;
}

#itemSelect {
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}

.chart-hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.origin-info {
  margin-top: 1rem;
}

.origin-info:empty {
  display: none;
}

.origin-badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.origin-reason {
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.6;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 320px;
}

.ingredient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.9rem;
}

.ingredient-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ingredient-card:hover {
  border-color: var(--accent);
}

.ingredient-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.ingredient-card.highlight-pulse {
  animation: highlight-pulse 1.1s ease-out 2;
}

@keyframes highlight-pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 122, 79, 0.55); }
  70% { box-shadow: 0 0 0 12px rgba(47, 122, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 122, 79, 0); }
}

.ingredient-card .tag {
  align-self: flex-start;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  color: #fff;
}

.tag.veg { background: var(--veg); }
.tag.fruit { background: var(--fruit); }
.tag.seafood { background: var(--seafood); }
.tag.grain { background: var(--grain); }

.ingredient-card .name {
  font-size: 1.05rem;
  font-weight: 700;
}

.ingredient-card .unit {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.ingredient-card .origin {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.ingredient-card .price {
  margin-top: auto;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}

.disclaimer {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ---- Chatbot widget ---- */

.chat-toggle {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(47, 122, 79, 0.35);
  z-index: 40;
}

.chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5.5rem;
  width: min(360px, calc(100vw - 2.5rem));
  height: min(480px, calc(100vh - 8rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 40;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.chat-panel-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--accent-soft);
  color: var(--text);
  border-bottom-left-radius: 2px;
}

.chat-bubble.typing {
  color: var(--text-muted);
  font-style: italic;
}

.chat-bubble.error {
  background: #fbe4e0;
  color: #9c3b2c;
}

.chat-note {
  align-self: flex-start;
  font-size: 0.76rem;
  color: var(--text-muted);
  padding: 0 0.2rem;
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.chat-input-row input {
  flex: 1;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.chat-input-row button {
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Progress status page ---- */

.overall-progress {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.overall-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.overall-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.overall-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.overall-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.stepper-section {
  margin-bottom: 2rem;
  overflow-x: auto;
}

.stepper {
  display: flex;
  align-items: flex-start;
  min-width: 640px;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
  padding-top: 2.5rem;
}

.step::before {
  content: "";
  position: absolute;
  top: 15px;
  left: -50%;
  width: 100%;
  height: 3px;
  background: var(--border);
  z-index: 0;
}

.step:first-child::before {
  content: none;
}

.step-dot {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: #c7bfb3;
  z-index: 1;
}

.step.done .step-dot { background: var(--accent); }
.step.in-progress .step-dot { background: #e0a13c; }
.step.planned .step-dot { background: #c7bfb3; }

.step.done::before { background: var(--accent); }

.step-name {
  font-size: 0.82rem;
  margin-top: 0.5rem;
  color: var(--text);
  padding: 0 0.4rem;
}

.step-status {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stage-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stage-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.stage-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
}

.stage-badge.done { background: var(--accent); }
.stage-badge.in-progress { background: #e0a13c; }
.stage-badge.planned { background: #9c9488; }

.stage-body .stage-name {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.stage-body .stage-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}
