:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #63716b;
  --line: #d7dfda;
  --paper: #fbfcfb;
  --panel: #ffffff;
  --topbar: rgba(255, 255, 255, 0.88);
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --soft: #eef5f1;
  --hero-wash: rgba(217, 242, 229, 0.84);
  --page-wash: rgba(251, 252, 251, 0.96);
  --table-head: #f4f8f6;
  --brand-start: #f7fbf8;
  --brand-end: #e7f5ee;
  --pill-warning: #fff1d9;
  --pill-danger: #ffe5e5;
  --mint: #d9f2e5;
  --green: #1f7a4c;
  --red: #ad2f2f;
  --amber: #a45f16;
  --teal: #0d6f78;
  --shadow: 0 14px 30px rgba(23, 33, 29, 0.08);
}

body.dark {
  color-scheme: dark;
  --ink: #eef7f1;
  --muted: #a9b8b0;
  --line: #344940;
  --paper: #101815;
  --panel: #16211d;
  --topbar: rgba(16, 24, 21, 0.9);
  --surface: rgba(22, 33, 29, 0.94);
  --surface-strong: #1c2a25;
  --soft: #263932;
  --hero-wash: rgba(15, 35, 28, 0.88);
  --page-wash: rgba(16, 24, 21, 0.98);
  --table-head: #20312b;
  --brand-start: #1c2a25;
  --brand-end: #213d31;
  --pill-warning: rgba(230, 161, 77, 0.18);
  --pill-danger: rgba(240, 114, 114, 0.18);
  --mint: #244d3a;
  --green: #46b879;
  --red: #f07272;
  --amber: #e6a14d;
  --teal: #53c8d0;
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--hero-wash), var(--page-wash) 42%),
    url("https://images.unsplash.com/photo-1514933651103-005eec06c04b?auto=format&fit=crop&w=1800&q=80");
  background-attachment: fixed;
  background-size: cover;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #fff;
  background: var(--green);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(31, 122, 76, 0.18);
}

button.secondary,
.topbar-actions button {
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.75rem;
  color: var(--ink);
  background: var(--surface-strong);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1rem, 4vw, 2.5rem);
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.topbar h1,
.hero-band h2,
.panel h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.brand-line {
  max-width: 44rem;
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.layout {
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
  gap: 1rem;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 1rem clamp(1rem, 4vw, 2.5rem) 2rem;
}

.sidebar {
  position: sticky;
  top: 1rem;
  align-self: start;
  display: grid;
  gap: 0.45rem;
  padding: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-card {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
}

.brand-card strong {
  font-size: 1.05rem;
}

.brand-card span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.nav-item {
  justify-content: start;
  width: 100%;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: var(--green);
}

.content {
  min-width: 0;
}

.hero-band,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(16rem, 0.9fr);
  gap: 1rem;
  align-items: center;
  min-height: 16rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  overflow: hidden;
}

.hero-band h2 {
  max-width: 16ch;
  font-size: clamp(2rem, 5vw, 4.5rem);
  line-height: 0.96;
}

.lede {
  max-width: 48rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

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

.metric,
.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface-strong);
}

.metric strong {
  display: block;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
}

.metric span,
.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.grid.two,
.split {
  grid-template-columns: minmax(20rem, 0.72fr) minmax(0, 1.28fr);
}

.split {
  display: grid;
  gap: 1rem;
}

.panel {
  padding: clamp(1rem, 2vw, 1.35rem);
}

.form-panel {
  display: grid;
  gap: 0.9rem;
  align-self: start;
}

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

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

.section-title p {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.section-title span {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.stack {
  display: grid;
  gap: 0.75rem;
}

.notice {
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  color: var(--muted);
  background: var(--surface-strong);
  line-height: 1.55;
}

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

.integration-card {
  display: grid;
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: var(--surface-strong);
}

.integration-card h3,
.integration-card p {
  margin: 0;
}

.integration-card p,
.integration-card li {
  color: var(--muted);
  line-height: 1.5;
}

.integration-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.integration-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.table {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.45fr 0.85fr 0.75fr 0.65fr 0.65fr 0.8fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
}

.table-row.header {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--table-head);
}

.table-row:last-child {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  color: var(--green);
  background: var(--mint);
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.warning {
  color: var(--amber);
  background: var(--pill-warning);
}

.pill.danger {
  color: var(--red);
  background: var(--pill-danger);
}

.item-card {
  display: grid;
  gap: 0.5rem;
}

.item-card h3,
.item-card p {
  margin: 0;
}

.item-card p {
  color: var(--muted);
  line-height: 1.5;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ingredient-rows {
  display: grid;
  gap: 0.6rem;
}

.ingredient-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7rem 2.5rem;
  gap: 0.55rem;
  align-items: end;
}

.icon-button {
  height: 2.85rem;
  padding: 0;
  color: var(--red);
  background: var(--pill-danger);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 1rem;
  color: var(--muted);
  background: var(--surface);
}

.count-row {
  display: grid;
  grid-template-columns: 1fr 8rem 8rem 8rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.count-row:last-child {
  border-bottom: 0;
}

@media (max-width: 920px) {
  body {
    background-attachment: scroll;
  }

  .topbar,
  .layout,
  .hero-band,
  .split,
  .grid.two {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .layout {
    padding-top: 0.75rem;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    min-height: 3rem;
    justify-content: center;
    text-align: center;
  }

  .table-row,
  .count-row,
  .integration-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 580px) {
  .topbar-actions,
  .fields,
  .hero-metrics,
  .sidebar,
  .ingredient-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    display: grid;
  }
}
