:root {
  --ink: #171717;
  --muted: #66615b;
  --subtle: #8a8379;
  --paper: #fbf8f2;
  --surface: #ffffff;
  --surface-strong: #f4efe7;
  --line: #ddd5ca;
  --line-strong: #b9aa98;
  --teal: #0f6b66;
  --teal-dark: #084c48;
  --wine: #7d1f3d;
  --amber: #a86f14;
  --green: #1f7a4d;
  --red: #a43c2d;
  --shadow: 0 18px 55px rgba(46, 34, 23, 0.12);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(180deg, #f7f2ea 0%, #fcfbf8 42%, #f3f5f2 100%);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: transparent;
}

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

button {
  cursor: pointer;
}

textarea {
  resize: vertical;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 20;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  transition: top 140ms ease;
}

.skip-link:focus {
  top: 16px;
}

.app-header {
  padding: 34px 24px 18px;
}

.app-header__inner,
.app-shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
}

.app-header__inner {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1,
h2 {
  letter-spacing: 0;
}

h1 {
  max-width: 740px;
  margin-bottom: 0;
  font-size: clamp(2.25rem, 4.8vw, 4.7rem);
  line-height: 0.95;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
  line-height: 1.15;
}

.intro {
  max-width: 780px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.55;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

.button:hover {
  border-color: var(--line-strong);
}

.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(15, 107, 102, 0.22);
  outline-offset: 2px;
}

.button--primary {
  border-color: var(--teal-dark);
  color: #ffffff;
  background: linear-gradient(180deg, var(--teal), var(--teal-dark));
}

.button--quiet {
  background: rgba(255, 255, 255, 0.8);
}

.app-shell {
  padding: 8px 0 48px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(380px, 0.97fr);
  gap: 18px;
  align-items: start;
}

.support-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr) minmax(320px, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border: 1px solid rgba(185, 170, 152, 0.62);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.form-panel,
.preview-panel,
.checklist-panel,
.tests-panel,
.explainer-panel {
  padding: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.is-valid {
  border-color: rgba(31, 122, 77, 0.35);
  color: var(--green);
  background: #eef8f2;
}

.status-pill.is-missing {
  border-color: rgba(164, 60, 45, 0.35);
  color: var(--red);
  background: #fff2ef;
}

.type-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.type-picker legend {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.type-picker label {
  min-width: 0;
}

.type-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-picker span {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.type-picker input:checked + span {
  border-color: rgba(15, 107, 102, 0.32);
  color: var(--teal-dark);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(20, 34, 31, 0.08);
}

.type-picker input:focus-visible + span {
  outline: 3px solid rgba(15, 107, 102, 0.2);
  outline-offset: 2px;
}

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

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

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

.field--split {
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
}

.field--split label {
  display: grid;
  gap: 7px;
}

.field span,
.field--split span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.field small,
.toggle-field small {
  display: block;
  margin-top: 2px;
  color: var(--subtle);
  font-size: 0.8rem;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

input,
select {
  min-height: 42px;
  padding: 0 11px;
}

textarea {
  min-height: 72px;
  padding: 10px 11px;
  line-height: 1.45;
}

input::placeholder,
textarea::placeholder {
  color: #aaa39b;
}

.toggle-field {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-field strong {
  display: block;
  font-size: 0.94rem;
}

.toggle-track {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #ddd6cc;
  box-shadow: inset 0 0 0 1px rgba(23, 23, 23, 0.08);
}

.toggle-track::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(23, 23, 23, 0.22);
  content: "";
  transition: transform 140ms ease;
}

.toggle-field input:checked + .toggle-track {
  background: var(--teal);
}

.toggle-field input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle-field input:focus-visible + .toggle-track {
  outline: 3px solid rgba(15, 107, 102, 0.22);
  outline-offset: 2px;
}

.preview-stage {
  display: grid;
  min-height: 620px;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 23, 23, 0.04) 1px, transparent 1px),
    #f3f1ed;
  background-size: 22px 22px;
}

.label-preview {
  width: min(100%, 4.5in);
  min-height: 6.25in;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0.34in;
  border: 1px solid #25211d;
  color: #17130f;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 244, 237, 0.96)),
    #fffdf8;
  box-shadow: 0 24px 60px rgba(40, 32, 22, 0.22);
}

.label-preview--incomplete {
  border-style: dashed;
}

.label-kicker {
  margin: 0;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.label-preview h2 {
  margin: 2px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 6vw, 3.3rem);
  line-height: 0.98;
  text-align: center;
  overflow-wrap: anywhere;
}

.label-class {
  margin: -4px 0 0;
  color: var(--wine);
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.label-rule {
  width: 100%;
  height: 1px;
  margin: 4px 0 2px;
  background: #29231d;
}

.label-facts,
.label-producer {
  display: grid;
  gap: 6px;
  text-align: center;
}

.label-facts p,
.label-producer p {
  margin: 0;
  line-height: 1.3;
}

.label-facts {
  font-size: 1.02rem;
  font-weight: 850;
}

.label-producer {
  margin-top: auto;
  font-size: 0.9rem;
}

.sulfite-line {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(125, 31, 61, 0.42);
  color: var(--wine);
  font-size: 0.92rem;
  font-weight: 900;
  text-align: center;
  text-transform: none;
}

.government-warning {
  margin: 0;
  padding: 10px 12px;
  border: 2px solid #17130f;
  background: #ffffff;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.38;
}

.is-placeholder {
  color: #8f867b;
}

.panel-note,
.disclaimer {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.panel-note {
  margin-bottom: 14px;
}

.checklist,
.rule-list,
.test-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist {
  display: grid;
  gap: 9px;
}

.check-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.check-marker {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 950;
}

.check-item strong,
.check-item small {
  display: block;
}

.check-item strong {
  font-size: 0.9rem;
}

.check-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.check-item--pass .check-marker {
  color: #ffffff;
  background: var(--green);
}

.check-item--fail .check-marker,
.check-item--notice .check-marker {
  color: #ffffff;
  background: var(--red);
}

.test-summary {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #ffffff;
  font-weight: 950;
}

.test-summary--pass {
  border-color: rgba(31, 122, 77, 0.35);
  color: var(--green);
  background: #eef8f2;
}

.test-summary--fail {
  border-color: rgba(164, 60, 45, 0.35);
  color: var(--red);
  background: #fff2ef;
}

.test-list {
  display: grid;
  gap: 8px;
}

.test-result {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.test-result span {
  font-size: 0.68rem;
  font-weight: 950;
}

.test-result strong {
  font-size: 0.85rem;
  line-height: 1.35;
}

.test-result--pass span {
  color: var(--green);
}

.test-result--fail span {
  color: var(--red);
}

.rule-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.rule-list li {
  position: relative;
  padding-left: 18px;
}

.rule-list li::before {
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--amber);
  content: "";
}

.disclaimer {
  margin-bottom: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.print-sheet {
  display: none;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .app-header__inner,
  .workspace,
  .support-grid {
    grid-template-columns: 1fr;
  }

  .app-header__inner {
    display: grid;
    align-items: start;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .preview-stage {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 24px 16px 14px;
  }

  .app-header__inner,
  .app-shell {
    width: min(100% - 20px, 1220px);
  }

  h1 {
    font-size: 2.35rem;
  }

  .header-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

  .form-panel,
  .preview-panel,
  .checklist-panel,
  .tests-panel,
  .explainer-panel {
    padding: 14px;
  }

  .type-picker,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .preview-stage {
    padding: 10px;
  }

  .label-preview {
    min-height: auto;
    padding: 0.24in;
  }

  .label-preview h2 {
    font-size: 2.05rem;
  }
}
