:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --panel-soft: #fbfaf7;
  --ink: #172124;
  --muted: #667276;
  --line: #d9dee0;
  --line-strong: #aab4b8;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --amber: #b45309;
  --red: #b42318;
  --green: #137333;
  --shadow: 0 18px 45px rgba(23, 33, 36, 0.11);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(246, 247, 248, 0.96)),
    var(--bg);
}

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

button,
select,
input {
  min-height: 40px;
}

button {
  border: 0;
}

button:not(:disabled) {
  cursor: pointer;
}

button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

button svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 1px 0 rgba(23, 33, 36, 0.04);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.badge,
.count-pill,
.standard-note,
.test-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.studio {
  display: grid;
  grid-template-columns: minmax(380px, 470px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.controls-panel,
.preview-panel {
  min-width: 0;
}

.controls-panel {
  display: grid;
  gap: 14px;
}

.intro-panel,
.control-group,
.legend-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(23, 33, 36, 0.04);
}

.intro-panel {
  padding: 16px;
  border-left: 4px solid var(--teal);
}

.intro-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

.control-group {
  padding: 16px;
}

.group-heading,
.preview-toolbar,
.legend-heading,
.label-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.symbol-fieldset {
  margin: 14px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.symbol-fieldset legend {
  padding: 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

select {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

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

.text-fields {
  margin-top: 14px;
}

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

.segmented label {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-transform: none;
}

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

.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  text-align: center;
}

.segmented input:checked + span {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.segmented input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.inline-help {
  min-height: 38px;
  margin: 10px 0 0;
  padding: 10px 11px;
  border-radius: 7px;
  color: #425054;
  background: #eef7f5;
  font-size: 13px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding-top: 20px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  text-transform: none;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.fiber-rows {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.fiber-row {
  display: grid;
  grid-template-columns: minmax(82px, 0.45fr) minmax(160px, 1fr) 40px;
  gap: 8px;
  align-items: end;
}

.icon-button,
.icon-text-button,
.ghost-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  font-weight: 800;
  transition: transform 120ms ease, background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: #fff;
}

.icon-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-text-button,
.ghost-button,
.secondary-button {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: #fff;
  padding: 0 12px;
}

.primary-button {
  min-width: 190px;
  padding: 0 14px;
  color: #fff;
  background: var(--teal);
}

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

.secondary-button:hover,
.ghost-button:hover,
.icon-text-button:hover,
.icon-button:hover:not(:disabled) {
  border-color: var(--ink);
  background: #f0f3f3;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.test-status {
  border-color: var(--line-strong);
  background: #fff;
}

.test-status.is-pass {
  border-color: rgba(19, 115, 51, 0.35);
  color: var(--green);
  background: #eef8f0;
}

.test-status.is-fail {
  border-color: rgba(180, 35, 24, 0.35);
  color: var(--red);
  background: #fff0ee;
}

.test-details {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.test-details ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

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

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

.preview-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 14px;
}

.preview-toolbar {
  padding: 16px 2px 0;
}

.preview-toolbar h2 {
  font-size: 22px;
}

.preview-stage {
  min-height: 480px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(23, 33, 36, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 33, 36, 0.05) 1px, transparent 1px),
    #eef1f1;
  background-size: 24px 24px;
  box-shadow: var(--shadow);
  overflow: auto;
}

.print-sheet {
  display: grid;
  gap: 14px;
  width: fit-content;
  min-width: min(100%, 430px);
  margin: 0 auto;
}

.print-sheet-1 {
  grid-template-columns: minmax(300px, 430px);
}

.print-sheet-8,
.print-sheet-12 {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  min-width: min(100%, 740px);
}

.care-label {
  width: 100%;
  min-height: 235px;
  padding: 18px;
  border: 1px solid #111;
  border-radius: 2px;
  color: #111;
  background: #fff;
  box-shadow: 0 8px 24px rgba(23, 33, 36, 0.12);
}

.label-topline {
  align-items: flex-start;
  min-height: 24px;
  padding-bottom: 10px;
  border-bottom: 1px solid #c7ccce;
}

.label-kicker,
.label-note {
  color: #202426;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.label-note {
  max-width: 50%;
  overflow-wrap: anywhere;
  text-align: right;
}

.symbol-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(48px, 1fr));
  gap: 7px;
  align-items: center;
  margin: 17px 0 15px;
}

.symbol-item {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-width: 0;
}

.care-symbol-svg {
  width: clamp(48px, 8vw, 63px);
  height: clamp(48px, 8vw, 63px);
  color: #111;
  overflow: visible;
}

.label-copy {
  display: grid;
  gap: 5px;
  color: #111;
  font-size: 14px;
  font-weight: 700;
}

.label-copy p {
  margin: 0;
  overflow-wrap: anywhere;
}

.fiber-copy {
  font-size: 16px;
  font-weight: 850;
}

.origin-copy,
.rn-copy {
  color: #303638;
}

.legend-panel {
  padding: 16px;
}

.legend-heading {
  align-items: flex-start;
}

.legend-note,
.legal-note {
  color: var(--muted);
  font-size: 12px;
}

.legend-note {
  max-width: 420px;
  text-align: right;
}

.legend-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.legend-list li {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.legend-list strong,
.legend-list span {
  display: block;
}

.legend-list strong {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
}

.legend-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.legal-note {
  margin: 0;
}

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

  .preview-panel {
    position: static;
  }

  .legend-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .preview-toolbar,
  .group-heading,
  .legend-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-badges {
    justify-content: flex-start;
  }

  .field-grid,
  .fiber-row,
  .legend-list,
  .print-sheet-8,
  .print-sheet-12 {
    grid-template-columns: 1fr;
  }

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

  .preview-stage {
    min-height: 360px;
    padding: 12px;
  }

  .care-label {
    padding: 14px;
  }

  .symbol-strip {
    gap: 4px;
  }

  .care-symbol-svg {
    width: clamp(43px, 16vw, 58px);
    height: clamp(43px, 16vw, 58px);
  }

  .legend-note {
    max-width: none;
    text-align: left;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .icon-text-button {
    width: 100%;
  }
}
