* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7f5;
  color: #333;
  min-height: 100vh;
}

header {
  background: #2e7d32;
  color: #fff;
  padding: 16px 20px;
  text-align: center;
}

header h1 {
  font-size: 1.3rem;
  font-weight: 700;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

/* タブナビ */
.tab-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: #c8e6c9;
  color: #2e7d32;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.tab-btn.active {
  background: #2e7d32;
  color: #fff;
}

/* タブコンテンツ */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* フォームカード */
.form-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-card h3 {
  font-size: 0.95rem;
  color: #555;
  margin: 12px 0 8px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.form-row label {
  font-size: 0.85rem;
  color: #555;
  font-weight: 600;
}

.form-row input,
.form-row select {
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  width: 100%;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: #2e7d32;
}

/* 食材行 */
.ingredient-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.ingredient-row .ing-select {
  flex: 2;
  min-width: 120px;
}

.ingredient-row .ing-amount {
  flex: 1;
  min-width: 80px;
}

.ingredient-row .ing-remove {
  padding: 9px 12px;
  background: #f44336;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* ボタン */
.btn-primary {
  width: 100%;
  padding: 11px;
  background: #2e7d32;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #1b5e20;
}

.btn-secondary {
  padding: 8px 14px;
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #c8e6c9;
}

/* リスト */
h2 {
  font-size: 1rem;
  color: #2e7d32;
  margin-bottom: 10px;
  border-left: 4px solid #2e7d32;
  padding-left: 8px;
}

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

.empty-msg {
  color: #999;
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

/* 食材カード */
.ingredient-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.ingredient-card .ing-info {
  flex: 1;
}

.ingredient-card .ing-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.ingredient-card .ing-detail {
  font-size: 0.82rem;
  color: #666;
  margin-top: 2px;
}

.btn-delete {
  background: none;
  border: none;
  color: #e53935;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.btn-delete:hover {
  background: #ffebee;
}

/* メニューカード */
.menu-card {
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.menu-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.menu-card .menu-name {
  font-weight: 700;
  font-size: 1rem;
}

.menu-card .menu-price {
  font-size: 0.85rem;
  color: #555;
  margin-top: 2px;
}

.cost-rate-badge {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.cost-rate-badge.ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.cost-rate-badge.warning {
  background: #fff8e1;
  color: #f57f17;
}

.cost-rate-badge.danger {
  background: #ffebee;
  color: #c62828;
}

.menu-ing-list {
  font-size: 0.82rem;
  color: #666;
  margin-top: 6px;
  list-style: none;
  padding: 0;
}

.menu-ing-list li {
  padding: 2px 0;
}

.menu-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
  font-size: 0.88rem;
  color: #555;
}

/* スマホ対応 */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.1rem;
  }

  .ingredient-row {
    flex-direction: column;
    gap: 6px;
  }

  .ingredient-row .ing-select,
  .ingredient-row .ing-amount {
    width: 100%;
  }

  .ingredient-row .ing-remove {
    width: 100%;
  }
}
