:root {
  --bg: #f1eeee;
  --primary: #2b8336;
  --deep: #193743;
  --accent: #f28f1a;
  --earth: #30170d;
  --white: #ffffff;
  --danger: #b42318;
  --muted: #597279;
  --stroke: rgba(25, 55, 67, 0.12);
  --glass: rgba(255, 255, 255, 0.68);
  --shadow: 0 20px 50px rgba(25, 55, 67, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: var(--deep);
  background:
    radial-gradient(circle at 8% 16%, rgba(255, 255, 255, 0.95) 0%, transparent 28%),
    radial-gradient(circle at 94% 8%, rgba(43, 131, 54, 0.18) 0%, transparent 34%),
    radial-gradient(circle at 82% 88%, rgba(242, 143, 26, 0.14) 0%, transparent 32%),
    linear-gradient(145deg, #f7f5f5 0%, #f1eeee 52%, #ece9e9 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 24px;
  align-items: center;
  border-radius: 26px;
  padding: 28px;
  margin-bottom: 24px;
  overflow: hidden;
}

.glass {
  background:
    linear-gradient(130deg, rgba(25, 55, 67, 0.72), rgba(36, 72, 84, 0.58) 45%, rgba(72, 101, 110, 0.45)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(43, 131, 54, 0.14), transparent 36%, rgba(242, 143, 26, 0.12));
  pointer-events: none;
}

.hero-copy,
.logo-frame,
.hero-actions {
  position: relative;
  z-index: 2;
}

.hero-eyebrow {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9edd0;
  font-weight: 800;
}

.hero-eyebrow::before {
  content: "";
  width: 20px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
}

h1 {
  margin: 10px 0 10px;
  color: #f4f8f9;
  line-height: 1.08;
  font-size: clamp(1.8rem, 3.1vw, 2.5rem);
  max-width: 18ch;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
  max-width: 62ch;
}

.hero .subtitle {
  color: #d7e4e8;
}

.hero-pills {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-block;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.14);
  color: #f1f7f8;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.hero-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.65;
  pointer-events: none;
}

.orb-a {
  width: 210px;
  height: 210px;
  top: -80px;
  right: 36%;
  background: radial-gradient(circle, rgba(43, 131, 54, 0.34), rgba(43, 131, 54, 0));
}

.orb-b {
  width: 180px;
  height: 180px;
  bottom: -74px;
  right: -18px;
  background: radial-gradient(circle, rgba(242, 143, 26, 0.3), rgba(242, 143, 26, 0));
}

.logo-frame {
  justify-self: end;
  width: min(100%, 420px);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(241, 238, 238, 0.62));
  box-shadow: 0 16px 32px rgba(25, 55, 67, 0.2);
  padding: 16px 20px;
}

.logo {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 10px 18px rgba(25, 55, 67, 0.22));
}

.logo-dashboard {
  max-width: 280px;
}

.hero-actions {
  justify-self: end;
  display: grid;
  gap: 14px;
  justify-items: end;
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

.panel {
  background: rgba(255, 255, 255, 0.88);
  border-radius: 20px;
  border: 1px solid var(--stroke);
  box-shadow: 0 12px 28px rgba(25, 55, 67, 0.1);
  padding: 20px;
  overflow: hidden;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  margin: 12px 0 6px;
  color: #274953;
}

input:not([type="checkbox"]):not([type="radio"]),
select {
  width: 100%;
  max-width: 100%;
  border: 1px solid #c5d0d3;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 0.95rem;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus {
  outline: none;
  border-color: rgba(43, 131, 54, 0.55);
  box-shadow: 0 0 0 4px rgba(43, 131, 54, 0.13);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.row-2 > * {
  min-width: 0;
}

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

.ingredient-item {
  border: 1px solid #d6dfdf;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(160deg, #ffffff, #f8fbfa);
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, transform 0.22s ease;
}

.ingredient-item:focus-within {
  border-color: rgba(43, 131, 54, 0.45);
  box-shadow: 0 0 0 3px rgba(43, 131, 54, 0.12);
}

.ingredient-item.is-active {
  border-color: rgba(43, 131, 54, 0.58);
  background: linear-gradient(155deg, rgba(43, 131, 54, 0.08), rgba(255, 255, 255, 0.98));
  box-shadow: 0 12px 24px rgba(43, 131, 54, 0.14);
}

.ingredient-item.is-active .ingredient-head strong {
  color: #1f5f2a;
}

.ingredient-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ingredient-head strong {
  flex: 1 1 auto;
  min-width: 0;
}

.ingredient-status {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  margin-right: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1f5f2a;
  background: rgba(43, 131, 54, 0.14);
  border: 1px solid rgba(43, 131, 54, 0.28);
}

.ingredient-item.is-active .ingredient-status {
  display: inline-flex;
}

.switch {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex-direction: row;
  gap: 8px;
  width: auto;
  max-width: 100%;
  margin: 0;
  color: #274953;
}

.switch input[type="checkbox"] {
  margin-top: 0;
  flex: 0 0 auto;
}

.switch span {
  display: inline-block;
  flex: 0 1 auto;
  min-width: 0;
  white-space: normal;
  line-height: 1.2;
}

.ingredient-head .switch-inline {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
  margin-left: 0;
  white-space: nowrap;
}

.ingredient-head .switch-inline span {
  white-space: nowrap;
  line-height: 1.1;
}

.ingredient-item .switch-wrap {
  display: flex;
  align-items: flex-start;
  width: 100%;
}

.ingredient-item .switch-wrap input[type="checkbox"] {
  margin-top: 2px;
}

.ingredient-item .switch-wrap span {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.25;
}

.hidden {
  display: none;
}

.btn {
  margin-top: 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(120deg, var(--primary), #256f2e);
  color: #fff;
  padding: 12px 15px;
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(43, 131, 54, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(43, 131, 54, 0.32);
}

.btn.secondary {
  margin: 0;
  background: linear-gradient(120deg, var(--deep), #224b5a);
  box-shadow: 0 10px 20px rgba(25, 55, 67, 0.27);
  text-decoration: none;
}

#saveBtn {
  margin-top: 24px;
}

.kpi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.kpi .card {
  position: relative;
  border-radius: 14px;
  padding: 13px;
  background: linear-gradient(145deg, #f8fbfb, #f1f6f5);
  border: 1px solid #d7e1e0;
  box-shadow: 0 10px 22px rgba(25, 55, 67, 0.08);
  overflow: hidden;
}

.kpi .card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0.85;
}

.kpi .label {
  font-size: 0.81rem;
  color: #4f666e;
}

.kpi .value {
  font-size: 1.15rem;
  color: var(--earth);
  font-weight: 800;
  margin-top: 6px;
}

.tag {
  display: inline-block;
  margin-top: 8px;
  background: #e7f5e9;
  color: #205d27;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.alert {
  margin-top: 12px;
  color: var(--danger);
  font-size: 0.9rem;
}

.success {
  margin-top: 12px;
  color: #1f7a2c;
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid #dbe5e5;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 720px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #e8eeee;
  text-align: left;
}

th {
  color: #476169;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #f8fbfb;
}

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

  .logo-frame,
  .hero-actions {
    justify-self: start;
  }

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

@media (max-width: 768px) {
  .container {
    padding: 14px;
  }

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

  h1 {
    max-width: 100%;
    font-size: clamp(1.45rem, 6.4vw, 1.95rem);
  }

  .subtitle {
    font-size: 0.95rem;
  }

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

  .panel {
    padding: 14px;
    border-radius: 16px;
  }

  .kpi {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow: visible;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .logo {
    max-width: 240px;
  }

  .hero-actions {
    justify-items: stretch;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .ingredient-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .ingredient-status {
    margin: 0;
  }

  .ingredient-head .switch-inline {
    margin-left: 0;
    white-space: nowrap;
  }

  .ingredient-head .switch-inline span {
    white-space: nowrap;
  }

  .ingredient-item .switch-wrap {
    width: 100%;
  }

  .ingredient-item .switch-wrap span {
    line-height: 1.25;
  }
}

@media (max-width: 420px) {
  .hero-pills {
    gap: 6px;
  }

  .pill {
    font-size: 0.74rem;
    padding: 6px 9px;
  }

  .logo {
    max-width: 210px;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select {
    font-size: 16px;
  }

  .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .panel {
    padding: 12px;
  }
}
