:root {
  --bg: #f4f6f2;
  --panel: #ffffff;
  --panel-soft: #fbfcf8;
  --ink: #17211d;
  --muted: #65736b;
  --line: #d8ded5;
  --line-strong: #b7c3b8;
  --green: #1f7a4d;
  --green-dark: #135735;
  --gold: #b96f1a;
  --red: #a63d3d;
  --blue: #2f6470;
  --shadow: 0 18px 50px rgba(29, 44, 35, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(244, 246, 242, 0.72)),
    var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 3vw, 36px);
  background: rgba(250, 252, 248, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.topbar h1,
.preview-toolbar h2,
.form-section h2,
.label-sheet h2,
.label-sheet h3 {
  margin: 0;
  line-height: 1.1;
}

.topbar h1 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions,
.test-actions,
.subhead-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button {
  padding: 10px 14px;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--green);
  box-shadow: 0 10px 24px rgba(31, 122, 77, 0.14);
}

.button.primary {
  border-color: var(--green-dark);
  background: var(--green);
  color: #ffffff;
}

.button.secondary {
  border-color: #a8bdad;
  background: #eef6ef;
  color: var(--green-dark);
}

.button.ghost {
  background: transparent;
}

.icon-button {
  width: 100%;
  padding: 9px 10px;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 0.96fr) minmax(430px, 1.04fr);
  gap: clamp(20px, 3vw, 34px);
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 36px);
}

.input-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#labelForm {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 30px rgba(33, 45, 37, 0.06);
  padding: clamp(16px, 2vw, 22px);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 1.08rem;
}

.section-heading p,
.field span,
.choice small,
.row-label small,
.empty-note,
#readyCount,
.label-footer .disclaimer {
  color: var(--muted);
}

.section-heading p {
  margin: 4px 0 0;
  font-size: 0.93rem;
}

.section-number {
  display: inline-grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #b8d3be;
  border-radius: 999px;
  background: #e9f5ec;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

.field span {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.14);
}

.muted {
  opacity: 0.6;
}

.choice-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.choice-group legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.choice input {
  width: auto;
  margin-top: 3px;
  accent-color: var(--green);
}

.choice strong,
.choice small {
  display: block;
}

.choice strong {
  font-size: 0.92rem;
  line-height: 1.25;
}

.choice small {
  margin-top: 5px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.choice:has(input:checked) {
  border-color: var(--green);
  background: #edf7ef;
  box-shadow: inset 0 0 0 1px rgba(31, 122, 77, 0.12);
}

.statement-box {
  margin-top: 14px;
  border-left: 4px solid var(--green);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: #f1f7f1;
  padding: 12px 14px;
  color: var(--green-dark);
  font-weight: 800;
}

.row-header,
.data-row {
  display: grid;
  gap: 10px;
  align-items: center;
}

.row-header {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.three-cols {
  grid-template-columns: minmax(0, 1.5fr) minmax(92px, 0.6fr) minmax(92px, 0.45fr);
}

.four-cols {
  grid-template-columns: minmax(0, 1.3fr) 84px minmax(92px, 0.55fr) 60px;
}

.five-cols {
  grid-template-columns: minmax(0, 1.25fr) 86px minmax(84px, 0.55fr) minmax(70px, 0.45fr) minmax(92px, 0.45fr);
}

.row-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.data-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.locked-row {
  background: #fbfcf8;
}

.row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row-label strong {
  font-size: 0.95rem;
}

.row-label small {
  font-size: 0.76rem;
  text-transform: uppercase;
  font-weight: 800;
}

.limit-chip {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
}

.limit-chip.min {
  background: var(--green);
}

.limit-chip.max {
  background: var(--gold);
}

.unit-cell {
  color: var(--muted);
  font-weight: 900;
}

.subhead-row {
  justify-content: space-between;
  margin: 18px 0 10px;
}

.subhead-row h3 {
  margin: 0;
  font-size: 0.94rem;
  text-transform: uppercase;
  color: var(--muted);
}

.empty-note {
  margin: 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--panel-soft);
}

.checklist,
.test-results {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li,
.test-results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.status-dot {
  display: inline-grid;
  min-width: 56px;
  min-height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.69rem;
  font-weight: 900;
}

li.pass .status-dot,
.test-summary.pass {
  background: var(--green);
}

li.fail .status-dot,
.test-summary.fail {
  background: var(--red);
}

.test-summary {
  display: inline-grid;
  min-height: 42px;
  min-width: 110px;
  place-items: center;
  border-radius: var(--radius);
  background: #e8ece8;
  color: #ffffff;
  font-weight: 900;
}

.preview-pane {
  position: sticky;
  top: 99px;
  align-self: start;
  min-width: 0;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.preview-toolbar h2 {
  font-size: 1.15rem;
}

.label-sheet {
  width: min(100%, 740px);
  margin: 0 auto;
  border: 1px solid #202721;
  border-radius: var(--radius);
  background: #fffdf8;
  color: #111812;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.label-hero {
  padding: clamp(24px, 4vw, 44px);
  border-bottom: 5px solid var(--green);
  background:
    linear-gradient(135deg, rgba(31, 122, 77, 0.12), rgba(47, 100, 112, 0.1)),
    #fffdf8;
}

.label-kind {
  display: inline-block;
  margin: 0 0 12px;
  border: 1px solid rgba(23, 33, 29, 0.25);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.label-sheet h2 {
  max-width: 14ch;
  font-size: clamp(2rem, 4.8vw, 4rem);
  letter-spacing: 0;
}

.net-weight {
  margin: 18px 0 0;
  font-size: 1.1rem;
  font-weight: 900;
}

.label-block {
  padding: 20px clamp(22px, 4vw, 38px);
  border-bottom: 1px solid #d6d6cd;
}

.label-block h3 {
  margin-bottom: 10px;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ga-table {
  width: 100%;
  border-collapse: collapse;
  border-top: 2px solid #111812;
  border-bottom: 2px solid #111812;
  font-size: 1rem;
}

.ga-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.ga-table th,
.ga-table td {
  padding: 10px 0;
  border-bottom: 1px solid #c8c8c0;
  text-align: left;
}

.ga-table tr:last-child th,
.ga-table tr:last-child td {
  border-bottom: 0;
}

.ga-table th {
  font-weight: 900;
}

.ga-table td {
  width: 30%;
  text-align: right;
  font-weight: 900;
}

.label-copy {
  margin: 0;
  white-space: pre-wrap;
}

.label-footer {
  padding: 20px clamp(22px, 4vw, 38px) 24px;
  background: #f5f4ed;
}

.label-footer p {
  margin: 0;
}

.label-footer .disclaimer {
  margin-top: 12px;
  font-size: 0.78rem;
}

.sr-only {
  position: relative;
  display: block;
}

.sr-only > input {
  display: block;
}

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

  .preview-pane {
    position: static;
  }

  .label-sheet {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .topbar-actions .button,
  .preview-toolbar,
  .preview-toolbar .button {
    width: 100%;
  }

  .topbar-actions .button,
  .preview-toolbar .button {
    justify-content: center;
  }

  .workspace {
    padding: 14px;
  }

  .field-grid,
  .choice-group {
    grid-template-columns: 1fr;
  }

  .row-header {
    display: none;
  }

  .data-row,
  .three-cols,
  .four-cols,
  .five-cols {
    grid-template-columns: 1fr;
  }

  .limit-chip {
    width: 76px;
  }

  .preview-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .label-sheet h2 {
    max-width: 100%;
    font-size: clamp(1.8rem, 12vw, 3rem);
  }
}
