:root {
  color-scheme: light;
  --bg: #f6efe5;
  --bg-accent: #efe2d0;
  --panel: rgba(255, 250, 244, 0.88);
  --panel-strong: #fff8f0;
  --text: #21312b;
  --muted: #61736d;
  --line: rgba(33, 49, 43, 0.12);
  --primary: #bc5f35;
  --primary-strong: #8d4020;
  --accent: #2d6a4f;
  --danger: #9c2f2f;
  --shadow: 0 24px 60px rgba(61, 46, 33, 0.12);
  font-family: "Avenir Next", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(188, 95, 53, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(45, 106, 79, 0.16), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background-color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 248, 240, 0.92), rgba(247, 236, 223, 0.82));
  box-shadow: var(--shadow);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1,
.panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.hero-copy {
  max-width: 52ch;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.summary-grid,
.content-grid,
.recommendation-grid,
.button-row {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 22px 0;
}

.summary-card,
.panel {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.summary-card {
  padding: 18px 20px;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.8rem;
  font-family: Georgia, "Times New Roman", serif;
}

.content-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
  align-items: start;
}

.panel {
  padding: 24px;
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.inventory-toolbar {
  margin-bottom: 18px;
}

.search-field {
  display: grid;
  gap: 8px;
  max-width: 420px;
  font-weight: 600;
}

.search-field span {
  color: var(--muted);
}

.table-wrapper {
  overflow-x: auto;
}

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

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.stack-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  padding: 11px 18px;
  font-weight: 700;
}

.primary-button {
  color: #fffdf8;
  background: var(--primary);
}

.secondary-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.74);
}

.ghost-button {
  color: var(--accent);
  background: rgba(45, 106, 79, 0.12);
}

.danger-button {
  color: #fff5f5;
  background: var(--danger);
}

.button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.recommendation-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.recommendation-card {
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  background: var(--panel-strong);
}

.recommendation-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.recipe-meta {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.recipe-meta strong {
  color: var(--text);
}

.hint-text,
.empty-state {
  color: var(--muted);
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100% - 32px));
  padding: 14px 18px;
  border-radius: 16px;
  color: #fffaf3;
  background: rgba(33, 49, 43, 0.88);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 20px;
  }

  .hero,
  .panel,
  .summary-card {
    border-radius: 20px;
  }

  th,
  td {
    padding: 12px 8px;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .action-group {
    min-width: 220px;
  }
}
