:root {
  --green-950: #062f1e;
  --green-900: #0a3d27;
  --green-800: #11512f;
  --green-700: #176b3a;
  --green-600: #208246;
  --green-100: #e7f4ea;
  --gold-500: #d9b451;
  --gold-100: #fff3c8;
  --leaf: #65a844;
  --sky: #d9f2ec;
  --mint: #bfe8ca;
  --cream: #fff8df;
  --ink: #17231d;
  --muted: #5c6a62;
  --line: #d8e3dc;
  --surface: #ffffff;
  --surface-soft: #f7fbf8;
  --danger: #b3261e;
  --ok: #217a3f;
  --shadow: 0 22px 55px rgba(6, 47, 30, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 9% 11%, rgba(101, 168, 68, 0.28), transparent 18rem),
    radial-gradient(circle at 88% 9%, rgba(217, 180, 81, 0.20), transparent 20rem),
    radial-gradient(circle at 78% 78%, rgba(32, 130, 70, 0.13), transparent 24rem),
    linear-gradient(135deg, rgba(23, 107, 58, 0.12) 0 25%, transparent 25% 100%),
    linear-gradient(180deg, #f8fcf9 0%, #edf6ef 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(120deg, rgba(17, 81, 47, 0.05) 0 1px, transparent 1px 28px),
    linear-gradient(30deg, rgba(217, 180, 81, 0.08) 0 1px, transparent 1px 36px),
    radial-gradient(circle at 18px 18px, rgba(23, 107, 58, 0.07) 0 2px, transparent 2px 34px);
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(217, 180, 81, 0.20), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(255, 248, 223, 0.24), transparent 13rem),
    linear-gradient(90deg, rgba(6, 47, 30, 0.98), rgba(23, 107, 58, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 16px;
}

.brand-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  padding: 7px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
legend,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 2.4vw, 2.45rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.status-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 250px;
  min-height: 46px;
  gap: 10px;
  padding: 10px 14px;
  color: #12351f;
  font-weight: 800;
  background: #fff;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 1px rgba(17, 81, 47, 0.12),
    0 12px 24px rgba(6, 47, 30, 0.18);
}

.status-dot {
  width: 10px;
  height: 10px;
  background: var(--gold-500);
  border-radius: 999px;
}

.status-card.valid .status-dot {
  background: var(--ok);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(430px, 0.72fr);
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}

.form-panel,
.preview-panel {
  position: relative;
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 253, 250, 0.94)),
    rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 81, 47, 0.12);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel::before,
.preview-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, var(--green-700), var(--gold-500), var(--green-600));
}

.form-panel::after,
.preview-panel::after {
  position: absolute;
  right: -42px;
  top: 42px;
  width: 160px;
  height: 160px;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(135deg, rgba(23, 107, 58, 0.12), transparent 62%),
    radial-gradient(circle, rgba(217, 180, 81, 0.16), transparent 56%);
  border-radius: 999px;
}

.section-title {
  margin-bottom: 14px;
}

.section-title .section-kicker {
  color: var(--green-700);
}

.section-title h2 {
  margin: 0;
  color: var(--green-950);
  font-size: 1.55rem;
}

.section-title.compact {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

form {
  display: grid;
  gap: 12px;
}

.form-health {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(255, 248, 223, 0.92), rgba(231, 244, 234, 0.92)),
    #fff;
  border: 1px solid rgba(23, 107, 58, 0.16);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.health-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--green-950);
}

.health-main span {
  color: var(--green-700);
  font-size: 0.82rem;
  font-weight: 900;
}

.health-main strong {
  font-size: 0.95rem;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  background: rgba(17, 81, 47, 0.12);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green-700), var(--leaf), var(--gold-500));
  border-radius: inherit;
  transition: width 180ms ease;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.health-grid span {
  min-height: 30px;
  padding: 7px 9px;
  color: var(--green-900);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(17, 81, 47, 0.12);
  border-radius: 8px;
}

fieldset {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 12px;
  margin: 0;
  padding: 54px 14px 14px;
  background:
    linear-gradient(135deg, rgba(231, 244, 234, 0.72), rgba(255, 255, 255, 0.90) 54%, rgba(217, 242, 236, 0.72)),
    linear-gradient(90deg, rgba(217, 180, 81, 0.10), transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.responsibility-fieldset {
  grid-template-columns: minmax(150px, 0.38fr) minmax(260px, 1fr);
}

legend {
  position: absolute;
  top: 12px;
  left: 14px;
  width: calc(100% - 28px);
  min-height: 30px;
  margin: 0;
  padding: 5px 10px;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 900;
  background: linear-gradient(90deg, var(--green-900), var(--green-700) 65%, var(--leaf));
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(10, 61, 39, 0.13);
}

.field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.field.full,
.subject-grid,
.check-field {
  grid-column: 1 / -1;
}

label {
  color: var(--green-950);
  font-size: 0.92rem;
  font-weight: 800;
}

.field-label {
  color: var(--green-950);
  font-size: 0.92rem;
  font-weight: 800;
}

input,
select,
output {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  color: var(--ink);
  font: inherit;
  background: #fff;
  border: 1px solid #bdcec3;
  border-radius: 8px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.70);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

select {
  cursor: pointer;
}

select:disabled {
  color: var(--muted);
  cursor: not-allowed;
  background: #eef5f0;
}

input:focus,
select:focus {
  border-color: var(--green-600);
  box-shadow:
    0 0 0 4px rgba(32, 130, 70, 0.14),
    0 8px 18px rgba(10, 61, 39, 0.08);
}

.field.valid input,
.field.valid select {
  border-color: rgba(33, 122, 63, 0.75);
  background: #fbfffc;
}

.field.invalid input,
.field.invalid select {
  border-color: var(--danger);
  background: #fffafa;
}

.field.warning input,
.field.warning select {
  border-color: #d97706;
  background: #fffdf7;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.10);
}

.field-message {
  min-height: 16px;
  margin: 0;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.35;
}

.field.invalid .field-message,
#subjects-message.invalid {
  color: var(--danger);
  font-weight: 700;
}

.field.warning .field-message {
  color: #b45309;
  font-weight: 700;
}

.field.valid .field-message {
  color: var(--ok);
}

.field-message.neutral {
  color: var(--muted);
  font-weight: 500;
}

.check-field {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 10px;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid #bdcec3;
  border-radius: 8px;
  cursor: pointer;
}

.check-field input {
  width: 19px;
  min-height: 19px;
  accent-color: var(--green-700);
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #bdcec3;
  border-radius: 8px;
  cursor: pointer;
}

.radio-row input {
  width: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--green-700);
}

.number-stepper {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #bdcec3;
  border-radius: 8px;
}

.number-stepper input {
  min-height: 40px;
  text-align: center;
  border: 0;
  border-right: 1px solid #d7e4dc;
  border-left: 1px solid #d7e4dc;
  border-radius: 0;
  box-shadow: none;
}

.step-button {
  min-height: 40px;
  padding: 0;
  color: var(--green-900);
  font-size: 1.05rem;
  background: linear-gradient(180deg, #f8fdf9, #e6f4ea);
  border-radius: 0;
  box-shadow: none;
}

.step-button:hover {
  background: linear-gradient(180deg, var(--cream), #e6f4ea);
}

.subject-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

button {
  min-height: 46px;
  padding: 0 18px;
  font: inherit;
  font-weight: 900;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--green-700), var(--green-900) 65%, #042415);
  box-shadow: 0 12px 24px rgba(10, 61, 39, 0.22);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost-button {
  color: var(--green-900);
  background: linear-gradient(180deg, #f4fbf6, #e5f3e9);
  box-shadow: inset 0 0 0 1px rgba(17, 81, 47, 0.15);
}

.preview-panel {
  position: sticky;
  top: 16px;
}

.cutter-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(100%, 12.5cm);
  margin: 0 auto 10px;
  padding: 7px 10px;
  color: var(--green-950);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(231, 244, 234, 0.76));
  border: 1px solid rgba(17, 81, 47, 0.14);
  border-radius: 8px;
}

.cutter-badge span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.cutter-badge strong {
  font-size: 1rem;
  letter-spacing: 0;
}

.catalog-preview {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(180deg, #f6fbf7, #eef7f0);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.catalog-heading,
.catalog-footer {
  width: min(100%, 12.5cm);
  margin: 0 auto;
  color: #111;
  font-family: Arial, sans-serif;
  text-align: center;
  background: transparent;
  border: 0;
}

.catalog-heading {
  padding: 0 8px 3px;
  font-size: 12pt;
  line-height: 1.1;
}

.catalog-footer {
  padding: 0 6px;
  font-size: 9.5pt;
  line-height: 1.25;
}

.catalog-card {
  width: min(100%, 12.5cm);
  margin: 0 auto;
  color: #111;
  background: #fff;
  border: 1px solid #111;
}

.catalog-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

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

  .preview-panel {
    position: static;
  }
}

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

  .app-header,
  .brand-lockup,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .status-card {
    min-width: 0;
  }

  .health-main {
    align-items: flex-start;
    flex-direction: column;
  }

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

  fieldset,
  .responsibility-fieldset,
  .subject-grid {
    grid-template-columns: 1fr;
  }

  .form-panel,
  .preview-panel {
    padding: 18px;
  }

  .catalog-preview {
    overflow-x: hidden;
  }
}
