* { box-sizing: border-box; }

:root {
  --page: #eef1f4;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --slate-900: #172033;
  --slate-800: #27364a;
  --slate-700: #415469;
  --slate-600: #566a7e;
  --slate-500: #718094;
  --slate-300: #cbd3dc;
  --slate-200: #dce2e8;
  --slate-100: #eef2f5;
  --blue: #2e5f93;
  --green: #15803d;
  --red: #b42318;
  --shadow: 0 8px 20px rgba(23, 32, 51, .08);
}

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--page);
  color: var(--slate-900);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

.app-shell {
  width: min(1500px, calc(100% - 24px));
  margin: 12px auto;
  border: 1px solid var(--slate-300);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.brand-header {
  min-height: 118px;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 104px;
  gap: 16px;
  align-items: center;
  padding: 10px 28px;
  background: #fff;
  border-bottom: 1px solid var(--slate-300);
}

.brand-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  justify-self: center;
  border-radius: 50%;
}

.brand-copy {
  text-align: center;
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  color: var(--slate-900);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.75rem, 3.6vw, 3.35rem);
  font-weight: 600;
  letter-spacing: .045em;
  text-transform: uppercase;
  line-height: 1.04;
}

.brand-copy p { display: none; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  padding: 20px 22px;
  background: var(--surface-soft);
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(23, 32, 51, .07);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 20px;
  background: var(--slate-700);
  color: #fff;
}

.panel-title h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sub-title { margin-top: 4px; }

.panel-body { padding: 20px; }

.field { margin-bottom: 20px; }
.field.compact { margin-bottom: 2px; }

.field > label,
.label-text,
fieldset legend {
  display: block;
  margin-bottom: 8px;
  color: var(--slate-800);
  font-size: .9rem;
  font-weight: 750;
  letter-spacing: .025em;
  text-transform: uppercase;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--slate-300);
  border-radius: 7px;
  background: #fff;
  color: var(--slate-900);
  padding: 10px 13px;
}

input:focus, select:focus, button:focus-visible {
  outline: 3px solid rgba(46, 95, 147, .2);
  outline-offset: 2px;
  border-color: var(--blue);
}

.inline-control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.button {
  min-height: 46px;
  border: 1px solid var(--slate-300);
  border-radius: 7px;
  background: #fff;
  color: var(--slate-800);
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}

.button:hover {
  background: var(--slate-100);
  border-color: var(--slate-500);
}

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

.button-slate {
  background: var(--slate-700);
  color: #fff;
  border-color: var(--slate-700);
}

.button-slate:hover {
  background: var(--slate-800);
  border-color: var(--slate-800);
}

.field-status,
.help-text {
  margin: 8px 0 0;
  color: var(--slate-600);
  font-size: .88rem;
}

.field-status.valid { color: var(--green); font-weight: 650; }
.field-status.invalid { color: var(--red); font-weight: 650; }

.price-row {
  display: grid;
  grid-template-columns: minmax(0, 330px) auto;
  align-items: center;
  gap: 22px;
}

.price-input {
  display: grid;
  grid-template-columns: 42px 1fr;
  border: 1px solid var(--slate-300);
  border-radius: 7px;
  overflow: hidden;
}

.price-input:focus-within {
  outline: 3px solid rgba(46, 95, 147, .2);
  border-color: var(--blue);
}

.price-input .currency {
  display: grid;
  place-items: center;
  background: var(--slate-100);
  border-right: 1px solid var(--slate-300);
}

.price-input input {
  border: 0;
  border-radius: 0;
  outline: 0;
}

.check-row {
  display: inline-flex !important;
  align-items: center;
  gap: 9px;
  margin: 0 !important;
  color: var(--slate-900) !important;
  font-size: .95rem !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

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

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr .85fr;
  gap: 18px;
  align-items: end;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 46px;
  align-items: center;
}

.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.radio-row input { accent-color: var(--blue); }

.option-grid .field { margin: 0; }

.action-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.preview-intro {
  margin: 0 0 16px;
  color: var(--slate-600);
}

.barcode-stage {
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(23, 32, 51, .11);
  overflow: auto;
}

.barcode-stage svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.empty-state {
  display: grid;
  gap: 6px;
  color: var(--slate-500);
  text-align: center;
}

.empty-state strong { color: var(--slate-700); }

.about-box {
  margin-top: 28px;
  padding: 18px;
  border: 1px solid #cfd9e5;
  border-radius: 10px;
  background: #f6f9fc;
  color: var(--slate-800);
}

.about-box h3 {
  margin: 0 0 8px;
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.about-box p { margin: 7px 0; line-height: 1.5; }
.small-note { color: var(--slate-600); font-size: .88rem; }

.app-footer {
  display: grid;
  grid-template-columns: auto 1px 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 62px;
  padding: 0 38px;
  border-top: 1px solid var(--slate-300);
  background: #fff;
  color: var(--slate-600);
  font-size: .85rem;
}

.footer-divider {
  width: 1px;
  height: 22px;
  background: var(--slate-300);
}

.version { justify-self: end; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .brand-header { grid-template-columns: 84px 1fr 84px; padding-inline: 16px; }
  .brand-logo { width: 72px; height: 72px; }
  .barcode-stage { min-height: 390px; }
}

@media (max-width: 760px) {
  .app-shell { width: 100%; margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .brand-header {
    grid-template-columns: 58px 1fr 58px;
    gap: 8px;
    min-height: 86px;
    padding: 8px;
  }
  .brand-logo { width: 52px; height: 52px; }
  .brand-copy h1 { font-size: clamp(1.3rem, 6vw, 2.2rem); letter-spacing: .02em; }
  .brand-copy p { margin-top: 8px; font-size: .7rem; letter-spacing: .12em; }
  .workspace { padding: 12px; }
  .inline-control, .price-row, .option-grid, .action-grid { grid-template-columns: 1fr; }
  .price-row { gap: 12px; }
  .radio-row { min-height: auto; }
  .barcode-stage { min-height: 330px; padding: 12px; }
  .app-footer {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 16px 20px;
  }
  .footer-divider { display: none; }
  .version { justify-self: start; }
}

@media print {
  body { background: #fff; }
  body * { visibility: hidden !important; }
  #barcodeStage, #barcodeStage * { visibility: visible !important; }
  #barcodeStage {
    position: absolute;
    inset: 0;
    min-height: 0;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
}
