:root {
  --bg: #edf2f7;
  --surface: #ffffff;
  --surface-strong: #f7f9fc;
  --border: #d7e0ea;
  --text: #16212b;
  --muted: #64748a;
  --accent: #1f6feb;
  --success: #17825f;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  min-height: 100vh;
}

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

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
  padding: 28px 30px;
  border-radius: 26px;
  background: linear-gradient(135deg, #162432 0%, #213548 58%, #2b4a61 100%);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #d8e8ff;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3.4vw, 3.2rem);
  line-height: 1;
  max-width: 15ch;
  color: #f4f8fc;
}

.hero__text,
.panel__header p,
.ingredients-box__header p,
.table-wrap__header p {
  line-height: 1.55;
}

.hero__text {
  color: #bfd2e3;
  max-width: 60ch;
}

.panel__header p,
.ingredients-box__header p,
.table-wrap__header p,
.table-filter span {
  color: var(--muted);
}

.hero__stats {
  display: grid;
  gap: 12px;
}

.stat-card,
.panel,
.summary-box,
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-card {
  border-radius: 18px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(216, 232, 255, 0.15);
  box-shadow: none;
}

.stat-card span,
.result-card span {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.stat-card span,
.stat-card strong {
  color: #f4f8fc;
}

.stat-card strong,
.result-card strong {
  font-size: 1.4rem;
}

.layout {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 24px;
}

.panel {
  border-radius: 22px;
  padding: 24px;
}

.panel__header {
  margin-bottom: 22px;
}

.panel__header p {
  margin: 10px 0 0;
}

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

.field-grid--metrics {
  margin-top: 18px;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.94rem;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 13px 14px;
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid rgba(31, 111, 235, 0.14);
  border-color: rgba(31, 111, 235, 0.48);
}

.ingredients-box {
  margin-top: 22px;
  padding: 20px;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.ingredients-box__header,
.actions,
.table-wrap__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ingredients-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.ingredient-row {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr auto;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

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

.primary-button {
  border: none;
  background: linear-gradient(135deg, var(--accent) 0%, #408cff 100%);
  color: white;
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(31, 111, 235, 0.18);
}

.secondary-button,
.ghost-button {
  color: var(--text);
  background: #f5f8fb;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
}

.ghost-button {
  padding: 12px 16px;
}

.icon-button {
  width: 48px;
  border: none;
  border-radius: 12px;
  background: #203447;
  color: white;
  font-size: 1rem;
  font-weight: 700;
}

.actions {
  margin-top: 22px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.result-cards,
.summary-grid {
  display: grid;
  gap: 14px;
}

.result-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-card {
  border-radius: 18px;
  padding: 20px;
}

.result-card small {
  display: block;
  color: var(--muted);
  margin-top: 10px;
}

.accent-orange {
  background: linear-gradient(180deg, #fff8ec 0%, #fff2dc 100%);
}

.accent-green {
  background: linear-gradient(180deg, #eefbf5 0%, #e1f4ec 100%);
}

.accent-blue {
  background: linear-gradient(180deg, #eef4ff 0%, #e0eaff 100%);
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.summary-box {
  border-radius: 18px;
  padding: 18px;
}

.summary-box dl {
  margin: 18px 0 0;
  display: grid;
  gap: 14px;
}

.summary-box dt {
  color: var(--muted);
  margin-bottom: 6px;
}

.summary-box dd {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.table-wrap {
  margin-top: 24px;
}

.table-filter {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.table-filter span {
  font-size: 0.9rem;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #e8eef5;
}

th {
  color: #57677a;
  font-size: 0.86rem;
  background: #f6f8fb;
  font-weight: 700;
}

tbody tr {
  cursor: pointer;
  transition: background 0.14s ease;
}

tbody tr:hover {
  background: #f4f8ff;
}

tbody tr.is-active {
  background: #eaf2ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

@media (max-width: 1080px) {
  .hero,
  .layout,
  .result-cards,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

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

  .hero,
  .panel {
    padding: 18px;
    border-radius: 20px;
  }

  .field-grid,
  .ingredient-row {
    grid-template-columns: 1fr;
  }

  .ingredients-box__header,
  .table-wrap__header {
    align-items: flex-start;
    flex-direction: column;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    border: 1px solid var(--border);
    border-radius: 18px;
    margin-bottom: 12px;
    background: #fff;
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
  }
}
