:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --ink: #17191c;
  --muted: #5d6673;
  --line: #d9dee7;
  --line-strong: #111318;
  --brand: #0f5b67;
  --brand-dark: #0a3d46;
  --danger: #c62828;
  --warning: #f3b327;
  --success: #127a4c;
  --focus: #2f7df6;
  --shadow: 0 18px 44px rgba(23, 25, 28, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef3f6 0%, #f8f9fb 38%, #f4f6f8 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 125, 246, 0.3);
  outline-offset: 2px;
}

.app-header,
.workspace,
.app-footer {
  width: min(1480px, calc(100% - 40px));
  margin-inline: auto;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 0 22px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 4.1rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.lede {
  max-width: 820px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.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;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

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

.button.primary {
  background: var(--brand);
  color: #fff;
}

.button.primary:hover {
  background: var(--brand-dark);
}

.button.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.button.secondary:hover {
  border-color: #aeb7c5;
  background: #f7fafb;
}

.full-width {
  width: 100%;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel,
.control-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.control-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.panel-heading,
.preview-topline,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading {
  align-items: start;
}

.control-form {
  display: grid;
  gap: 16px;
}

.field-set {
  display: grid;
  gap: 12px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.field-set legend {
  padding: 0 7px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 850;
}

.field,
.field span {
  display: grid;
  gap: 6px;
}

.field span {
  color: #313844;
  font-size: 0.78rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd3df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

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

textarea {
  min-height: 86px;
  resize: vertical;
  padding: 10px 11px;
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.type-option {
  position: relative;
  display: grid;
  min-height: 92px;
  align-content: start;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.type-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.type-option strong {
  font-size: 0.92rem;
}

.type-option small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.32;
}

.type-option:has(input:checked) {
  border-color: var(--brand);
  background: #f0f8f9;
  box-shadow: 0 0 0 3px rgba(15, 91, 103, 0.1);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  border-radius: 8px;
  background: #edf1f5;
  padding: 5px;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented span {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: #4b5563;
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented input:checked + span {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(23, 25, 28, 0.12);
}

.dimension-grid,
.sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sheet-grid {
  grid-template-columns: repeat(4, 1fr);
}

.statement-card,
.self-test-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.badge,
.test-summary,
.size-readout {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef5f6;
  color: var(--brand-dark);
  font-size: 0.75rem;
  font-weight: 850;
  white-space: nowrap;
}

.statement-list {
  display: grid;
  gap: 10px;
}

.statement-group {
  display: grid;
  gap: 6px;
  border-left: 3px solid var(--brand);
  padding-left: 10px;
}

.statement-group h3 {
  margin: 0;
}

.statement-group ul,
.test-results {
  margin: 0;
  padding-left: 18px;
}

.statement-group li {
  color: #2e3540;
  font-size: 0.84rem;
  line-height: 1.38;
}

.test-summary.pass {
  background: #e9f8f0;
  color: var(--success);
}

.test-summary.fail {
  background: #fff0ee;
  color: var(--danger);
}

.test-results {
  display: grid;
  gap: 5px;
  max-height: 190px;
  overflow: auto;
  color: #3c4652;
  font-size: 0.8rem;
}

.test-results li.pass {
  color: var(--success);
}

.test-results li.fail {
  color: var(--danger);
}

.preview-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.preview-topline {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
}

.preview-stage {
  display: grid;
  min-height: 560px;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(27, 32, 38, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(27, 32, 38, 0.05) 1px, transparent 1px),
    #eef2f5;
  background-size: 24px 24px;
}

.preview-mount {
  display: grid;
  place-items: center;
}

.warning-label {
  --label-width: 2in;
  --label-height: 2in;
  --label-font: 7px;
  --icon-size: 0.34in;
  display: flex;
  width: var(--label-width);
  height: var(--label-height);
  flex-direction: column;
  gap: 0.035in;
  overflow: hidden;
  border: 1.8px solid #111;
  background: #fff;
  color: #050505;
  font-family: Arial, Helvetica, sans-serif;
  font-size: var(--label-font);
  line-height: 1.13;
  letter-spacing: 0;
  text-align: left;
}

.preview-stage .warning-label {
  box-shadow: var(--shadow);
  transform: scale(1.55);
  transform-origin: center;
}

.warning-label.round {
  border-radius: 50%;
  padding: 0.09in 0.14in 0.08in;
}

.warning-label.rect {
  border-radius: 0.06in;
  padding: 0.1in 0.11in;
}

.warning-label.compact {
  gap: 0.024in;
}

.label-header {
  display: grid;
  gap: 0.012in;
  text-align: center;
}

.label-brand {
  overflow: hidden;
  color: #111;
  font-size: calc(var(--label-font) * 0.9);
  font-weight: 700;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.warning-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.025in;
}

.warning-mark {
  width: calc(var(--label-font) * 2.2);
  min-width: calc(var(--label-font) * 2.2);
  height: calc(var(--label-font) * 2);
}

.warning-title {
  font-size: calc(var(--label-font) * 1.6);
  font-weight: 900;
  line-height: 0.95;
}

.hazard-line {
  font-size: calc(var(--label-font) * 0.95);
  font-weight: 800;
}

.pictogram-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-items: center;
  gap: 0.025in;
  margin-top: 0;
}

.pictogram {
  width: var(--icon-size);
  height: var(--icon-size);
}

.label-divider {
  height: 1px;
  min-height: 1px;
  background: #111;
}

.primary-rules {
  display: grid;
  gap: 0.01in;
  font-size: calc(var(--label-font) * 1.02);
  font-weight: 900;
  text-align: center;
}

.primary-rules div {
  overflow-wrap: anywhere;
}

.instruction-block {
  display: grid;
  min-height: 0;
  gap: 0.012in;
}

.instruction-heading {
  font-size: calc(var(--label-font) * 0.86);
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.instruction-copy {
  margin: 0;
  font-size: calc(var(--label-font) * 0.9);
  line-height: 1.03;
  text-align: center;
  overflow-wrap: anywhere;
}

.label-footer {
  margin-top: auto;
  border-top: 1px solid #111;
  padding-top: 0.014in;
  font-size: calc(var(--label-font) * 0.78);
  font-weight: 700;
  text-align: center;
}

.label-net {
  white-space: nowrap;
}

.info-panel,
.sheet-panel {
  padding: 16px;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.guide-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.86rem;
}

.guide-grid strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.sheet-panel {
  display: grid;
  gap: 12px;
}

.sheet-preview {
  --sheet-cols: 3;
  --sheet-gap: 0.18in;
  display: grid;
  grid-template-columns: repeat(var(--sheet-cols), var(--label-width));
  gap: var(--sheet-gap);
  align-content: start;
  justify-content: start;
  max-width: 100%;
  max-height: 620px;
  overflow: auto;
  border: 1px solid #cbd3df;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.sheet-preview .warning-label {
  box-shadow: none;
}

.print-area {
  display: none;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 0 34px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

  .app-header {
    align-items: start;
    flex-direction: column;
  }

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

  .preview-stage {
    min-height: 440px;
  }
}

@media (max-width: 720px) {
  .app-header,
  .workspace,
  .app-footer {
    width: min(100% - 24px, 1480px);
  }

  h1 {
    font-size: 2.35rem;
  }

  .option-grid,
  .dimension-grid,
  .sheet-grid,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    padding: 14px;
  }

  .preview-stage .warning-label {
    transform: scale(1.18);
  }

  .panel-heading,
  .preview-topline,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}
