:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --primary: #e8804a;
  --primary-dark: #cf6a37;
  --text: #3a2f28;
  --muted: #8a7b70;
  --border: #ece3d8;
  --spring: #9bc26c;
  --summer: #4ba3c3;
  --autumn: #d98e3f;
  --winter: #7a8fc2;
  --allyear: #a68bbf;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 72px;
}

.topbar {
  position: sticky;
  top: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  padding: 10px 12px;
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.week-label {
  font-weight: 700;
  font-size: 16px;
  min-width: 180px;
  text-align: center;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--primary);
  padding: 4px 10px;
  cursor: pointer;
}

.content {
  flex: 1;
  padding: 14px;
}

.tab-panel[hidden] { display: none; }

.primary-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 14px;
}
.primary-btn:active { background: var(--primary-dark); }

.secondary-btn {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--primary);
  border-radius: 12px;
  background: transparent;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.day-card.is-today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }

.day-header { display: flex; align-items: center; margin-bottom: 8px; }

.day-badge { text-align: left; display: flex; align-items: baseline; gap: 8px; }
.day-badge .dow { font-size: 12px; color: var(--muted); }
.day-badge .date { font-size: 18px; font-weight: 700; }

.day-slots { display: flex; flex-direction: column; gap: 8px; }
.day-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}
.day-slot:first-child { border-top: none; padding-top: 0; }

.slot-label {
  flex-shrink: 0;
  width: 36px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.slot-content { flex: 1; min-width: 0; }
.day-recipe-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.day-recipe-name.empty { color: var(--muted); font-weight: 400; }
.day-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f2ece2;
  color: var(--muted);
}
.course-tag { background: #eee2f2; color: #8a5fa8; font-weight: 700; }
.season-tag.春 { background: color-mix(in srgb, var(--spring) 20%, white); color: var(--spring); }
.season-tag.夏 { background: color-mix(in srgb, var(--summer) 20%, white); color: var(--summer); }
.season-tag.秋 { background: color-mix(in srgb, var(--autumn) 20%, white); color: var(--autumn); }
.season-tag.冬 { background: color-mix(in srgb, var(--winter) 20%, white); color: var(--winter); }
.season-tag.通年 { background: color-mix(in srgb, var(--allyear) 20%, white); color: var(--allyear); }

.day-slot button {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.recipe-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.recipe-filters select, .recipe-filters input,
.shopping-list input[type="search"], #pickerSearch {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
}
.recipe-filters select { flex: 0 0 auto; }
.recipe-filters input { flex: 1; min-width: 0; }

.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
}
.recipe-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.recipe-card-name { font-weight: 700; font-size: 15px; }
.recipe-card-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.shopping-intro {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.shopping-section { margin-bottom: 16px; }
.shopping-section h3 {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px 2px;
}
.shopping-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.shopping-item input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; }
.shopping-item .item-name { flex: 1; font-size: 14px; }
.shopping-item.checked .item-name { text-decoration: line-through; color: var(--muted); }
.shopping-item .item-qty { font-size: 13px; color: var(--muted); }
.empty-state { color: var(--muted); font-size: 14px; text-align: center; padding: 30px 10px; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  max-width: 480px;
  margin: 0 auto;
}
.nav-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.nav-btn .nav-icon { font-size: 20px; }
.nav-btn.active { color: var(--primary-dark); font-weight: 700; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-end;
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  max-height: 85vh;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-body {
  padding: 14px 16px;
  overflow-y: auto;
}

.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; }
.form input, .form select, .form textarea {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
.checkbox-label input { width: 18px; height: 18px; }

.detail-section { margin-bottom: 14px; }
.detail-section h3 { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.detail-ingredient { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.detail-step { font-size: 14px; margin-bottom: 6px; }
.detail-memo { font-size: 13px; color: var(--muted); background: #f6efe6; padding: 10px; border-radius: 10px; }
.detail-actions { display: flex; gap: 8px; margin-top: 10px; }
.detail-actions button { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.danger-btn { color: #c0392b !important; border-color: #f0c9c2 !important; }
