:root {
  --page-w: 210mm;
  --page-h: 297mm;
  --bg: #f4f5f7;
  --ink: #111111;
  --promo-red: #c41f2d;
  --promo-yellow: #ece319;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--ink); }
.app { display: grid; grid-template-columns: 360px 1fr; min-height: 100vh; }
.panel { background: #fff; padding: 20px; border-right: 1px solid #ddd; overflow: auto; }
.panel h1 { margin: 0 0 16px; font-size: 28px; }
.field-group { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
input, select, button { width: 100%; padding: 12px; font-size: 16px; border: 1px solid #ccc; border-radius: 10px; }
button { background: #111; color: #fff; border: none; font-weight: 700; cursor: pointer; }
button:hover { opacity: .92; }
.hint { font-size: 13px; color: #666; line-height: 1.45; }
.preview-wrap { padding: 28px; overflow: auto; }
.sheet {
  background: #fff;
  box-shadow: 0 10px 35px rgba(0,0,0,.14);
  width: var(--page-w);
  height: var(--page-h);
  margin: 0 auto;
}
.sheet.A5 { width: 148mm; height: 210mm; }
.sheet.A6 { width: 105mm; height: 148mm; }
.sheet.landscape.A4 { width: 297mm; height: 210mm; }
.sheet.landscape.A5 { width: 210mm; height: 148mm; }
.sheet.landscape.A6 { width: 148mm; height: 105mm; }
.label {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 0;
  position: relative;
}
.theme-yellow .label { background: var(--promo-yellow); color: #111; }
.theme-white .label { background: #fff; color: #111; }
.theme-red .label { background: #fff3f3; color: #111; }
.banner {
  width: 100%;
  background: var(--promo-red);
  color: #fff3a0;
  text-align: center;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.topline {
  position: relative;
  width: 100%;
  text-align: center;
}
.brand {
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
}
.description {
  text-align: center;
  line-height: 1.2;
  padding: 0 12mm;
}
.price-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.old-price {
  text-decoration: line-through;
  font-weight: 700;
  opacity: .9;
}
.new-price {
  font-weight: 900;
  line-height: .9;
  letter-spacing: -2px;
}
.footer-text {
  text-align: center;
  min-height: 8mm;
  padding: 0 10mm 8mm;
  font-size: 16px;
}
.percent {
  font-weight: 900;
}
.percent.hidden { display: none; }
.percent.plain { background: transparent; color: #111; border-radius: 0; padding: 0; }
.percent.badge-round,
.percent.badge-square {
  color: #fff;
  background: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26mm;
  min-height: 26mm;
  padding: 2mm 4mm;
}
.percent.badge-round { border-radius: 999px; }
.percent.badge-square { border-radius: 4mm; }
.percent.top-right {
  position: absolute;
  right: 12mm;
  top: 8mm;
}
.percent.under-banner {
  position: static;
  display: inline-flex;
  margin-top: 6mm;
}

/* A4 + presets */
.sheet.A4.portrait.size-rayon .banner { padding: 10mm 0; font-size: 18mm; }
.sheet.A4.portrait.size-rayon .topline { padding-top: 12mm; }
.sheet.A4.portrait.size-rayon .brand { font-size: 26mm; }
.sheet.A4.portrait.size-rayon .description { margin-top: 4mm; font-size: 8mm; }
.sheet.A4.portrait.size-rayon .old-price { font-size: 12mm; margin-bottom: 4mm; }
.sheet.A4.portrait.size-rayon .new-price { font-size: 52mm; }
.sheet.A4.portrait.size-rayon .percent { font-size: 14mm; }

.sheet.A4.portrait.size-tg .banner { padding: 11mm 0; font-size: 20mm; }
.sheet.A4.portrait.size-tg .topline { padding-top: 16mm; }
.sheet.A4.portrait.size-tg .brand { font-size: 32mm; }
.sheet.A4.portrait.size-tg .description { margin-top: 5mm; font-size: 9mm; }
.sheet.A4.portrait.size-tg .old-price { font-size: 14mm; margin-bottom: 5mm; }
.sheet.A4.portrait.size-tg .new-price { font-size: 70mm; }
.sheet.A4.portrait.size-tg .percent { font-size: 16mm; }

.sheet.A4.portrait.size-bac .banner { padding: 12mm 0; font-size: 21mm; }
.sheet.A4.portrait.size-bac .topline { padding-top: 16mm; }
.sheet.A4.portrait.size-bac .brand { font-size: 34mm; }
.sheet.A4.portrait.size-bac .description { margin-top: 5mm; font-size: 9mm; }
.sheet.A4.portrait.size-bac .old-price { font-size: 15mm; margin-bottom: 6mm; }
.sheet.A4.portrait.size-bac .new-price { font-size: 76mm; }
.sheet.A4.portrait.size-bac .percent { font-size: 16mm; }

/* generic fallback for non-A4 */
.sheet:not(.A4) .banner, .sheet.landscape .banner { padding: 7mm 0; font-size: 12mm; }
.sheet:not(.A4) .topline, .sheet.landscape .topline { padding-top: 8mm; }
.sheet:not(.A4) .brand, .sheet.landscape .brand { font-size: 18mm; }
.sheet:not(.A4) .description, .sheet.landscape .description { margin-top: 3mm; font-size: 5.5mm; }
.sheet:not(.A4) .old-price, .sheet.landscape .old-price { font-size: 8mm; margin-bottom: 3mm; }
.sheet:not(.A4) .new-price, .sheet.landscape .new-price { font-size: 40mm; }
.sheet:not(.A4) .percent, .sheet.landscape .percent { font-size: 10mm; }

@media print {
  @page { margin: 0; size: A4 portrait; }
  html, body { width: 100%; height: 100%; background: #fff !important; }
  .no-print { display: none !important; }
}
