:root {
  --bg: #f4f1e8;
  --card: #fffdf8;
  --text: #1f2937;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --line: #d6d3d1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, #dcebe7 0, transparent 40%),
    radial-gradient(circle at 80% 10%, #f8ead7 0, transparent 35%),
    var(--bg);
  min-height: 100vh;
}

.container {
  width: min(1080px, 94vw);
  margin: 24px auto;
  display: grid;
  gap: 16px;
}

.hero {
  padding: 18px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, #184e4a 0%, #276c66 100%);
  color: #f9fafb;
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.hero p {
  margin: 0;
  opacity: 0.92;
}

.station-badge {
  margin-top: 10px;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 600;
}

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

.row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

label {
  font-size: 14px;
  font-weight: 600;
}

input, select, button {
  font: inherit;
}

input, select {
  border: 1px solid #bcb8b1;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

select.tone-1 { background: #e6efe9; }
select.tone-2 { background: #fde8e8; }
select.tone-3 { background: #e8f0ff; }
select.tone-4 { background: #ececec; }
select.tone-5 { background: #fddede; }

.station-badge.tone-1 { background: rgba(22, 101, 52, 0.25); }
.station-badge.tone-2 { background: rgba(220, 38, 38, 0.22); }
.station-badge.tone-3 { background: rgba(37, 99, 235, 0.26); }
.station-badge.tone-4 { background: rgba(75, 85, 99, 0.28); }
.station-badge.tone-5 { background: rgba(185, 28, 28, 0.3); }

.btn-primary, .btn-secondary {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  padding: 10px 14px;
  transition: transform 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: #e6efed;
  color: #134e4a;
}

.btn-primary:hover, .btn-secondary:hover {
  transform: translateY(-1px);
}

.hint {
  color: #6b7280;
  margin-top: -2px;
}

.ingredient-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.ingredient-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ingredient-name {
  font-weight: 600;
}

.ingredient-range {
  color: #6b7280;
  font-size: 12px;
}

.ingredient-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ingredient-input-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qty-input {
  width: 100px;
}

.unit {
  color: #9ca3af;
  font-size: 7px;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.btn-row-confirm,
.btn-row-edit {
  border: 1px solid #bcb8b1;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.btn-row-confirm:disabled,
.btn-row-edit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ingredient-row.confirmed {
  opacity: 0.55;
  transform: scale(0.7);
  transform-origin: left center;
}

.ingredient-row.confirmed .ingredient-name {
  font-size: 13px;
}

.warning {
  color: var(--warn);
  margin: 4px 0;
}

.result-message {
  margin: 10px 0 6px;
  color: #0f766e;
  font-weight: 600;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  font-size: 14px;
}

th {
  background: #f3f4f6;
}

.need-purchase {
  color: #b91c1c;
  font-weight: 700;
}

.anomaly-list {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 720px) {
  .hero h1 {
    font-size: 22px;
  }

  .ingredient-row {
    flex-direction: column;
    align-items: stretch;
  }

  .qty-input {
    width: 100%;
  }

  .row-actions {
    width: 100%;
  }

  .btn-row-confirm,
  .btn-row-edit {
    flex: 1;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

.kitchen-page {
  background:
    radial-gradient(circle at 20% 0%, #ffe1e1 0, transparent 40%),
    radial-gradient(circle at 80% 10%, #ffd4d4 0, transparent 35%),
    #fff5f5;
}

.kitchen-page .card h2 {
  font-size: 14.5px;
  margin: 0;
}

.kitchen-page label {
  font-size: 11px;
}

.kitchen-page input {
  font-size: 12px;
}

.kitchen-page #lossSearch {
  font-size: 16px;
}

.kitchen-page .hint {
  font-size: 11px;
}

.kitchen-page .ingredient-name {
  font-size: 12px;
}

.hero-red {
  background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 100%);
}

.card-red {
  border-color: #fecaca;
  background: #fffafa;
}

.btn-red {
  background: #b91c1c;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}

.loss-search-result {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.loss-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #f3d3d3;
  border-radius: 8px;
  padding: 8px;
}

.pot-sales-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lock-btn {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.2;
}

.locked-card {
  opacity: 0.78;
  transform: scale(0.8);
  transform-origin: left top;
  width: 100%;
  margin-bottom: 0;
}

.lock-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
}

input.default-zero {
  color: #9ca3af;
}

input.touched {
  color: #111827;
}

@media (max-width: 720px) {
  .lock-toolbar {
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }
}

.kitchen-loss-row {
  padding: 6px 8px;
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.kitchen-loss-meta .ingredient-name {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
}

.kitchen-loss-controls {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 6px;
}

.kitchen-mini-wrap {
  gap: 4px;
}

.kitchen-mini-input {
  width: 58px;
  min-width: 58px;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 7px;
}

.kitchen-mini-remove {
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  line-height: 1;
  font-size: 14px;
}
