:root {
  --ink: #1f2933;
  --muted: #667085;
  --line: #e5e7eb;
  --paper: #ffffff;
  --wash: #f6f3ee;
  --herb: #2f6f4e;
  --herb-dark: #24583e;
  --tomato: #b84a3a;
  --tomato-soft: #fff1ed;
  --mint: #eaf6ef;
  --gold: #f8c55a;
  --gold-soft: #fff7df;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--wash);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(248, 197, 90, 0.24), transparent 30rem),
    linear-gradient(180deg, #fbf8f2 0%, #f3efe7 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(47, 111, 78, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 111, 78, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
}

a,
button,
label,
input {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 1060px);
  margin: 0 auto;
  padding: 0 1rem;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(31, 41, 51, 0.08);
  background: rgba(255, 252, 246, 0.92);
  backdrop-filter: blur(18px);
}

.app-nav__inner {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark__icon {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(47, 111, 78, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #eaf6ef);
  color: var(--herb);
  box-shadow: 0 8px 22px rgba(47, 111, 78, 0.12);
}

.brand-mark__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
}

.nav-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 0.75rem;
  color: #4b5563;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: #ffffff;
  color: var(--herb);
  outline: none;
}

.nav-link--active {
  background: var(--herb);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(47, 111, 78, 0.2);
}

.nav-link--danger {
  color: var(--tomato);
}

.page-main {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--herb);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.75rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.page-subtitle {
  max-width: 42rem;
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.card,
.recipe-card,
.auth-card,
.history-card {
  border: 1px solid rgba(31, 41, 51, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 45px rgba(31, 41, 51, 0.08);
}

.surface-pad {
  padding: clamp(1rem, 4vw, 1.5rem);
}

.button-primary,
.button-secondary {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button-primary {
  background: var(--herb);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(47, 111, 78, 0.22);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--herb-dark);
  outline: none;
  transform: translateY(-1px);
}

.button-secondary {
  border: 1px solid rgba(47, 111, 78, 0.2);
  background: #ffffff;
  color: var(--herb);
}

.alert {
  border-radius: 8px;
  padding: 0.9rem 1rem;
  font-size: 0.925rem;
  line-height: 1.5;
}

.alert--error {
  border: 1px solid rgba(184, 74, 58, 0.2);
  background: var(--tomato-soft);
  color: #913628;
}

.alert--success {
  border: 1px solid rgba(47, 111, 78, 0.18);
  background: var(--mint);
  color: var(--herb-dark);
}

.credit-pill {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 1rem;
  border: 1px solid rgba(47, 111, 78, 0.14);
  border-radius: 8px;
  padding: 0.625rem 0.8rem;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.9rem;
}

.credit-pill strong {
  color: var(--ink);
}

.credit-pill--inline {
  margin: 0;
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 16rem;
  border: 2px dashed rgba(47, 111, 78, 0.28);
  border-radius: 8px;
  padding: clamp(1.25rem, 6vw, 2.5rem);
  background:
    linear-gradient(135deg, rgba(234, 246, 239, 0.9), rgba(255, 247, 223, 0.72)),
    #ffffff;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.upload-zone:hover,
.upload-zone:focus-within {
  border-color: var(--herb);
  box-shadow: 0 18px 32px rgba(47, 111, 78, 0.13);
  transform: translateY(-1px);
}

.upload-zone__icon {
  display: grid;
  width: 4.25rem;
  height: 4.25rem;
  place-items: center;
  margin: 0 auto 1rem;
  border-radius: 8px;
  background: #ffffff;
  color: var(--herb);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 78, 0.12), 0 10px 22px rgba(31, 41, 51, 0.08);
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.section-note {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ingredient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
}

.ingredient-card {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  border: 1px solid rgba(31, 41, 51, 0.08);
  border-radius: 8px;
  padding: 0.85rem;
  background: #fbfdfb;
}

.ingredient-card__name {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
}

.ingredient-card__quantity {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.recipe-stack {
  display: grid;
  gap: 1rem;
}

.recipe-card {
  overflow: hidden;
}

.recipe-card__header {
  border-bottom: 1px solid rgba(31, 41, 51, 0.08);
  padding: 1rem 1rem 0.85rem;
  background: linear-gradient(135deg, rgba(234, 246, 239, 0.9), rgba(255, 255, 255, 0.94));
}

.recipe-card__title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.25;
}

.recipe-card__body {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.chip-list,
.history-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip,
.history-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.2;
}

.chip--matched,
.history-chip--ingredient {
  background: var(--mint);
  color: var(--herb-dark);
}

.chip--missing {
  background: var(--tomato-soft);
  color: #9a3c2f;
}

.history-chip--recipe {
  background: var(--gold-soft);
  color: #78520c;
}

.step-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.step-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  color: #374151;
  font-size: 0.95rem;
  line-height: 1.5;
  counter-increment: steps;
}

.step-list li::before {
  display: grid;
  width: 1.6rem;
  height: 1.6rem;
  place-items: center;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #78520c;
  content: counter(steps);
  font-size: 0.78rem;
  font-weight: 900;
}

.history-list {
  display: grid;
  gap: 1rem;
}

.history-card {
  overflow: hidden;
}

.history-card__image {
  width: 100%;
  height: clamp(11rem, 34vw, 15rem);
  object-fit: cover;
}

.history-card__body {
  display: grid;
  gap: 0.95rem;
  padding: 1rem;
}

.history-card__date {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.package-button {
  display: grid;
  gap: 0.35rem;
  min-height: 7.5rem;
  place-items: center;
  border: 1px solid rgba(47, 111, 78, 0.16);
  border-radius: 8px;
  padding: 1rem;
  background: #ffffff;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.package-button:hover,
.package-button:focus-visible {
  border-color: var(--herb);
  outline: none;
  box-shadow: 0 16px 30px rgba(47, 111, 78, 0.14);
  transform: translateY(-1px);
}

.package-button strong {
  color: var(--herb);
  font-size: 1.45rem;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
}

.auth-wrap {
  width: min(100%, 26rem);
}

.auth-brand {
  margin-bottom: 1rem;
  text-align: center;
}

.auth-brand h1 {
  margin: 0;
  font-size: 2.25rem;
  line-height: 1.05;
}

.auth-brand p {
  margin: 0.6rem 0 0;
  color: var(--muted);
}

.auth-card {
  padding: clamp(1rem, 5vw, 1.5rem);
}

.form-field {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.form-field label {
  color: #344054;
  font-size: 0.9rem;
  font-weight: 800;
}

.input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #ffffff;
  padding: 0.75rem 0.85rem;
  color: var(--ink);
  font-size: 1rem;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input:focus {
  border-color: var(--herb);
  box-shadow: 0 0 0 4px rgba(47, 111, 78, 0.12);
}

.auth-switch {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.auth-switch a,
.text-link {
  color: var(--herb);
  font-weight: 800;
  text-decoration: none;
}

.auth-switch a:hover,
.text-link:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0 0.9rem;
  }

  .app-nav__inner {
    min-height: auto;
    flex-wrap: wrap;
    padding: 0.65rem 0;
  }

  .brand-mark {
    width: 100%;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .nav-link {
    flex: 1 1 auto;
    padding-inline: 0.5rem;
  }

  .page-main {
    padding-top: 1rem;
  }

  .page-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .upload-zone {
    min-height: 13rem;
  }

  .package-grid {
    grid-template-columns: 1fr;
  }
}
