:root {
  --bg: #fff7ed;
  --card-bg: #ffffff;
  --accent: #f97316;
  --accent-dark: #ea580c;
  --accent-soft: #fed7aa;
  --text-main: #333333;
  --text-muted: #666666;
  --border: #e5e5e5;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

/* Header */

.page-header {
  margin-bottom: 16px;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.4rem;
  color: var(--accent-dark);
}

.page-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Card */

.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  padding: 12px 14px 14px;
}

.card-title {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--text-main);
  border-left: 4px solid var(--accent);
  padding-left: 8px;
}

.card-body {
  font-size: 0.9rem;
}

/* Fields */

.field {
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.field input,
.field select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.25);
}

/* Inline fields */

.inline-fields {
  display: flex;
  gap: 10px;
}

.inline-fields > div {
  flex: 1;
}

.with-unit {
  display: flex;
  align-items: center;
  gap: 6px;
}

.with-unit input {
  flex: 1;
}

.unit-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Ingredients cards */

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

.ingredient-card {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  background: #fffbf7;
}

.ingredient-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

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

.ingredient-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ingredient-row .field {
  flex: 1;
  margin-bottom: 0;
}

.ingredient-row .field-amount {
  max-width: 120px;
}

.ingredient-row .field-unit {
  max-width: 130px;
}

/* Buttons */

button {
  font-family: inherit;
}

.btn-primary,
.btn-secondary,
.btn-outline {
  border-radius: 999px;
  border: none;
  padding: 9px 14px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid var(--accent-soft);
}

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

.btn-outline {
  background: #ffffff;
  color: var(--accent-dark);
  border: 1px solid var(--accent-soft);
}

.btn-outline:hover {
  background: #fff7ed;
}

.btn-danger {
  background: transparent;
  color: #b91c1c;
  border: none;
  font-size: 0.8rem;
  padding: 4px 6px;
}

.btn-danger:hover {
  text-decoration: underline;
}

.full {
  width: 100%;
}

/* Actions */

.actions {
  padding-top: 4px;
}

/* Result */

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  gap: 8px;
}

.result-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-main);
}

.result-servings {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-table-wrapper {
  overflow-x: auto;
  margin-bottom: 10px;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.result-table th,
.result-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
}

.result-table th {
  background: #fff2e1;
  font-weight: 600;
}

.result-table td:nth-child(1) {
  width: 30%;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(55, 65, 81, 0.95);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* Responsive */

@media (max-width: 600px) {
  .page {
    padding: 12px;
  }

  .page-header h1 {
    font-size: 1.3rem;
  }

  .inline-fields {
    flex-direction: column;
  }

  .ingredient-row {
    flex-direction: column;
  }

  .ingredient-row .field-amount,
  .ingredient-row .field-unit {
    max-width: 100%;
  }

  .result-table th,
  .result-table td {
    font-size: 0.8rem;
  }
}
