.qr-editor {
  --editor-ink: #201e24;
  --editor-violet: #523b82;
  --editor-violet-soft: #ece8f6;
  --editor-paper: #fff;
  --editor-line: #ded9d0;
  --editor-muted: #6d6873;
  color: var(--editor-ink);
  padding: 2.5rem 0 5rem;
}

.qr-editor__head,
.qr-editor__workspace {
  width: min(1240px, calc(100% - 2.5rem));
  margin-inline: auto;
}

@media screen and (min-width: 851px) {
  .qr-editor__head, .qr-editor__workspace { width: var(--page-width); }
}

.qr-editor__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.qr-editor__back {
  color: var(--editor-violet);
  font-weight: 700;
  text-decoration: none;
}

.qr-editor__title {
  max-width: 24ch;
  margin: .55rem 0 0;
  font-size: 3.15rem;
  line-height: 1.03;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.qr-editor__intro {
  max-width: 68ch;
  margin: .75rem 0 0;
  color: var(--editor-muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.qr-editor__workspace {
  display: grid;
  grid-template-columns: minmax(330px, 400px) minmax(480px, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: start;
}

.qr-editor__panel {
  border: 1px solid var(--editor-line);
  border-radius: 14px;
  background: #fff;
}

.qr-editor__controls {
  padding: 1.75rem;
}

.qr-editor__preview-panel {
  min-height: 650px;
  padding: 1.5rem;
  border-color: #ded6e9;
  background: #eee9f4;
}

.qr-editor__panel-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  letter-spacing: -.02em;
}

.qr-form {
  display: grid;
  gap: 1.1rem;
}

.qr-field {
  display: grid;
  gap: .42rem;
}

.qr-field > span,
.qr-field > label,
.qr-carton__top label {
  font-size: .84rem;
  font-weight: 700;
}

.qr-field input,
.qr-field textarea,
.qr-field select,
.qr-carton input,
.qr-carton textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #ccc5d3;
  min-height: 48px;
  border-radius: 9px;
  background: #fff;
  color: var(--editor-ink);
  font: inherit;
  padding: .82rem .9rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.qr-field textarea,
.qr-carton textarea {
  min-height: 88px;
  resize: vertical;
}

.qr-field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #61596b 50%), linear-gradient(135deg, #61596b 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.qr-field input:focus,
.qr-field textarea:focus,
.qr-field select:focus,
.qr-carton input:focus,
.qr-carton textarea:focus,
.qr-action:focus-visible,
.qr-segment button:focus-visible,
.qr-remove:focus-visible {
  outline: none;
  border-color: var(--editor-violet);
  box-shadow: 0 0 0 3px rgba(64, 40, 132, .16);
}

.qr-field__hint,
.qr-editor__notice {
  color: var(--editor-muted);
  font-size: .78rem;
  line-height: 1.45;
}
.qr-editor__notice {
  margin: 0;
  padding: .75rem .85rem;
  border: 1px solid #ded6e9;
  border-radius: 9px;
  background: #f5f2f8;
  color: #4f4660;
}

.qr-error {
  min-height: 1.2em;
  color: #aa2434;
  font-size: .8rem;
  font-weight: 700;
}
.qr-error:empty { display: none; }
.qr-field [aria-invalid="true"] { border-color: #a02c40; }
.qr-field input::placeholder, .qr-field textarea::placeholder { color: #706975; }
.qr-form :focus-visible, .qr-fold-toggle:focus-visible, .qr-label__download:focus-visible {
  outline: 2px solid #67488b;
  outline-offset: 3px;
}
.qr-style-options, .qr-batch { border-top: 1px solid var(--editor-line); }
.qr-style-options summary, .qr-batch summary {
  padding-block: .72rem;
  cursor: pointer;
  color: var(--editor-violet);
  font-weight: 650;
}
.qr-style-options[open] .qr-field + .qr-field { margin-top: .75rem; }
.qr-style-options [type="color"] { height: 42px; width: 72px; padding: 4px; cursor: pointer; }
.qr-carton__id { margin: 0; font-size: .9rem; color: #79472e; }
.qr-carton-undo { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.qr-carton-undo button, .qr-fold-toggle {
  border: 0;
  border-radius: 4px;
  padding: 6px 0;
  background: transparent;
  color: var(--editor-violet);
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.qr-carton-undo button:hover, .qr-fold-toggle:hover { text-decoration-thickness: 2px; }
.qr-preview-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem; margin-bottom: 1.15rem; }
.qr-preview-tools .qr-editor__panel-title { margin: 0; }
.qr-fold-toggle { font-size: .82rem; }

.qr-segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .35rem;
  padding: .3rem;
  border-radius: 10px;
  background: #ebe7ef;
}

.qr-segment button {
  border: 0;
  min-height: 40px;
  border-radius: 7px;
  background: transparent;
  color: #5d5664;
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  padding: .6rem .5rem;
  cursor: pointer;
}

.qr-segment button[aria-pressed="true"] {
  background: #fff;
  color: var(--editor-violet);
  box-shadow: 0 1px 5px rgba(38, 28, 58, .1);
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: .4rem;
}

.qr-action {
  min-height: 44px;
  border: 1px solid var(--editor-violet);
  border-radius: 9px;
  background: var(--editor-violet);
  color: #fff;
  font: inherit;
  font-weight: 750;
  padding: .72rem 1rem;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.qr-action--secondary {
  background: transparent;
  color: var(--editor-violet);
}

.qr-action:disabled {
  cursor: not-allowed;
  opacity: .45;
}
.qr-action:not(:disabled):hover { background: #3f2d66; border-color: #3f2d66; }
.qr-action--secondary:not(:disabled):hover { background: #f0ebf6; border-color: #523b82; color: #3f2d66; }
.qr-action:not(:disabled):active { background: #2f214d; border-color: #2f214d; }

.qr-sheet {
  --accent: #402884;
  position: relative;
  box-sizing: border-box;
  width: min(100%, 690px);
  min-height: 610px;
  margin: 0 auto;
  padding: clamp(1.3rem, 4vw, 3rem);
  background: var(--editor-paper);
  color: var(--editor-ink);
  box-shadow: 0 12px 40px rgba(45, 38, 53, .13);
  font-family: "DM Sans", sans-serif;
}

.qr-sheet__brand {
  margin: 0 0 1.2rem;
  color: color-mix(in srgb, var(--accent) 35%, #201e24);
  font-size: .86rem;
  font-weight: 800;
}

.qr-sheet__headline {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2rem, 5.5vw, 4.5rem);
  line-height: .93;
  letter-spacing: -.035em;
  font-family: Georgia, serif;
  font-weight: 400;
}

.qr-sheet__copy {
  max-width: 34ch;
  margin: 1rem 0 1.4rem;
  color: #5c5761;
  font-size: 1rem;
  line-height: 1.45;
}

.qr-sheet__code {
  display: inline-grid;
  place-items: center;
  min-width: 172px;
  min-height: 172px;
  padding: .7rem;
  border: 1px solid #e0dce4;
  border-radius: 16px;
  background: #fff;
}

.qr-sheet__code svg {
  display: block;
  width: 180px;
  height: 180px;
}

.qr-sheet__foot {
  margin-top: 1.1rem;
  font-size: .73rem;
  color: #767078;
}

.qr-tent-face {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: center;
  min-height: 510px;
}

.qr-tent-face--back {
  transform: rotate(180deg);
}

.qr-sheet--tent {
  min-height: 1080px;
  padding: 0 clamp(1.3rem, 4vw, 3rem);
  border-top: 10px solid var(--accent);
  border-bottom: 10px solid var(--accent);
}

.qr-sheet--tent .qr-sheet__headline {
  max-width: 9ch;
}

.qr-fold {
  position: relative;
  height: 1px;
  border-top: 1.5px dashed #8b8490;
  text-align: center;
}

.qr-fold span {
  position: relative;
  top: -.72rem;
  display: inline-block;
  padding: .15rem .65rem;
  background: #fff;
  color: #7b747e;
  font-size: .68rem;
  font-weight: 700;
}

.qr-sheet--payment-tent {
  background: linear-gradient(180deg, #f7f4ec 0 50%, #fff 50% 100%);
}

.qr-preview-stack {
  display: grid;
  gap: 1.5rem;
}

.qr-demo {
  box-sizing: border-box;
  width: min(100%, 690px);
  margin: 0 auto 1rem;
  border: 1px solid #efc674;
  border-radius: 10px;
  background: #fff4d8;
  color: #694c15;
  font-size: .82rem;
  font-weight: 700;
  padding: .7rem .9rem;
}

.qr-batch {
  border-top: 1px solid var(--editor-line);
}

.qr-batch summary {
  color: var(--editor-violet);
  cursor: pointer;
  font-weight: 750;
}

.qr-batch[open] summary {
  margin-bottom: .8rem;
}

.qr-cartons {
  display: grid;
  gap: .8rem;
}

.qr-carton {
  display: grid;
  gap: .65rem;
  border: 1px solid var(--editor-line);
  border-radius: 13px;
  background: #fff;
  padding: .85rem;
}

.qr-carton__top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: .55rem;
}
.qr-carton__top .qr-field:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }

.qr-remove {
  min-height: 40px;
  border: 1px solid #d5ceda;
  border-radius: 7px;
  background: transparent;
  color: #7b5a68;
  font-size: .76rem;
  font-weight: 700;
  padding-inline: .65rem;
  cursor: pointer;
}

.qr-label-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.qr-label {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: .85rem;
  align-items: center;
  min-height: 132px;
  border: 1.5px dashed #8c8491;
  border-radius: 8px;
  padding: .75rem;
  break-inside: avoid;
}

.qr-label svg {
  width: 96px;
  height: 96px;
}

.qr-label h3,
.qr-index h3 {
  margin: 0;
}

.qr-label h3 { font-size: 1rem; }

.qr-label p {
  margin: .28rem 0 0;
  color: #656069;
  font-size: .77rem;
  line-height: 1.35;
}

.qr-label__number {
  color: var(--editor-violet);
  font-size: .72rem;
  font-weight: 800;
}

.qr-label__download {
  margin-top: .55rem;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--editor-violet);
  font: inherit;
  font-size: .72rem;
  font-weight: 750;
  padding: 0 0 .08rem;
  cursor: pointer;
}

.qr-label__download:focus-visible {
  outline: 3px solid rgba(64, 40, 132, .18);
  outline-offset: 3px;
}

.qr-label__exports,
.qr-sheet__export {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .8rem;
  align-items: center;
}

@media screen {
  .qr-label__exports { gap: 4px; margin-top: 4px; }
  .qr-label__exports .qr-label__download { min-width: 40px; margin: 0; }
}

.qr-sheet__export {
  position: absolute;
  right: 1rem;
  bottom: .7rem;
}

.qr-export-status {
  color: #9f2d27;
  font-size: .76rem;
  line-height: 1.35;
}

.qr-index {
  grid-column: 1 / -1;
  margin-top: .8rem;
  border-top: 2px solid var(--editor-ink);
  padding-top: 1rem;
}

.qr-index ul {
  columns: 2;
  margin: .7rem 0 0;
  padding-left: 1.1rem;
  color: #555059;
  font-size: .82rem;
  line-height: 1.55;
}

.qr-empty-preview {
  display: grid;
  min-height: 520px;
  place-items: center;
  text-align: center;
  color: var(--editor-muted);
}

.qr-output-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1.15fr) minmax(210px, 1fr);
  gap: .75rem 1.1rem;
  margin: 0 0 1.25rem;
  padding: 1rem;
  border: 1px solid #d9d1e4;
  border-radius: 10px;
  background: #fbfafd;
}

.qr-output__group { display: grid; align-content: start; gap: .45rem; min-width: 0; }
.qr-output__label { color: #5c526a; font-size: .74rem; font-weight: 750; }
.qr-output__hint { margin: 0; color: #5c526a; font-size: .83rem; line-height: 1.4; }
.qr-output__buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.qr-output-actions .qr-action { width: fit-content; max-width: 100%; min-height: 40px; padding: .62rem .8rem; font-size: .83rem; line-height: 1.25; }
.qr-output-actions .qr-action--secondary { background: #fff; }
.qr-output-actions > .qr-export-status { grid-column: 1 / -1; }
.qr-output-actions > .qr-export-status:empty { display: none; }
.qr-editor[data-mode="cartons"] .qr-output-actions { grid-template-columns: 1fr; }

@media screen {
  .qr-editor__preview-panel { min-height: auto; container: qrpreview / inline-size; }
  .qr-sheet__headline, .qr-sheet__brand, .qr-sheet__copy, .qr-sheet__foot, .qr-label, .qr-index { overflow-wrap: anywhere; }
  .qr-sheet__foot { color: #625c67; }
  .qr-folded-preview .qr-tent-face--back, .qr-folded-preview .qr-fold { display: none; }
  .qr-folded-preview .qr-sheet--tent {
    min-height: auto;
    background: #fffef9;
    border-block-width: 4px;
  }
  .qr-folded-preview .qr-tent-face { min-height: 340px; }
  .qr-label__download { min-height: 40px; }
  .qr-preview-tools h2:focus, .qr-editor__panel-title:focus-visible { outline: 2px solid var(--editor-violet); outline-offset: 4px; }
  .qr-carton, .qr-carton__top, .qr-field, .qr-carton__top > * { min-width: 0; }
  .qr-editor:not([data-mode="cartons"]) .qr-editor__controls {
    position: sticky;
    top: 1rem;
  }
}
@container qrpreview (max-width: 525px) {
  .qr-tent-face { grid-template-columns: 1fr; gap: 1rem; align-content: center; padding-block: 1.3rem; }
  .qr-tent-face .qr-sheet__headline { max-width: 17ch; }
  .qr-sheet__code svg { width: 132px; height: 132px; }
  .qr-sheet__code { min-width: 0; min-height: 0; }
  .qr-label-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .qr-editor__workspace { grid-template-columns: 1fr; }
  .qr-editor:not([data-mode="cartons"]) .qr-editor__controls { position: static; }
  .qr-editor__preview-panel { min-height: 0; }
  .qr-editor__head { grid-template-columns: 1fr; align-items: start; }
  .qr-sheet--payment { grid-template-columns: 1fr; }
  .qr-tent-face { grid-template-columns: 1fr; gap: .5rem; min-height: 460px; }
  .qr-sheet--tent { min-height: 940px; }
  .qr-label-grid { grid-template-columns: 1fr; }
  .qr-editor__title { font-size: 2.3rem; }
  .qr-output-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .qr-editor__head,
  .qr-editor__workspace { width: min(100% - 1.1rem, 1180px); }
  .qr-editor { padding-top: 1.6rem; }
  .qr-editor__head { margin-bottom: 1.5rem; }
  .qr-editor__title { font-size: 2.15rem; line-height: 1.06; }
  .qr-editor__intro { font-size: .98rem; }
  .qr-editor__controls { padding: 1.15rem; }
  .qr-editor__preview-panel { padding: .7rem; }
  .qr-preview-tools { padding: .25rem .25rem 0; }
  .qr-output-actions { grid-template-columns: 1fr; padding: .85rem; margin-bottom: .8rem; }
  .qr-output-actions .qr-action { width: 100%; }
  .qr-output__buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .qr-output__buttons .qr-action { min-width: 0; }
  .qr-label__download, .qr-remove { min-height: 44px; }
  .qr-sheet { min-height: 500px; }
  .qr-sheet__code svg { width: 145px; height: 145px; }
  .qr-remove { grid-column: 2; grid-row: 1; }
}

@media print {
  .qr-preview-tools, .qr-output-actions { display: none !important; }
  @page { size: A4; margin: 10mm; }
  body * { visibility: hidden !important; }
  #editor-root,
  #editor-root *,
  .qr-sheet,
  .qr-sheet * { visibility: visible !important; }
  #editor-root { position: static !important; }
  .qr-editor { padding: 0 !important; }
  .qr-editor__head,
  .qr-editor__controls,
  .qr-editor__panel-title { display: none !important; }
  .qr-editor__workspace { display: block; width: auto; }
  .qr-editor__preview-panel { min-height: 0; border: 0; padding: 0; background: #fff; box-shadow: none; }
  .qr-sheet { width: 100%; min-height: 0; margin: 0; padding: 8mm; box-shadow: none; }
  .qr-preview-stack { display: block; }
  .qr-preview-stack > .qr-sheet { break-after: page; page-break-after: always; }
  .qr-preview-stack > .qr-sheet:last-child { break-after: auto; page-break-after: auto; }
  .qr-sheet--tent {
    display: grid;
    grid-template-rows: 1fr 0 1fr;
    height: 275mm;
    min-height: 0;
    padding: 0 8mm;
    border-block-width: 2mm;
    break-inside: avoid;
  }
  .qr-tent-face { min-height: 0; grid-template-columns: minmax(0, 1fr) auto; gap: 4mm; }
  .qr-sheet__brand, .qr-sheet__headline, .qr-sheet__copy, .qr-sheet__foot, .qr-label { overflow-wrap: anywhere; }
  .qr-sheet--tent .qr-sheet__headline { font-size: 28pt; }
  .qr-sheet--tent .qr-sheet__copy { font-size: 11pt; }
  .qr-sheet:not(.qr-sheet--tent):not(.qr-label-grid) .qr-tent-face { min-height: 240mm; }
  .qr-sheet__code { min-width: 0; min-height: 0; padding: 1mm; }
  .qr-sheet__code svg { width: 65mm; height: 65mm; max-width: none; }
  .qr-demo { display: none; }
  .qr-label__download, .qr-label__exports, .qr-sheet__export, .qr-export-status { display: none !important; }
  .qr-sheet__code { break-inside: avoid; }
  .qr-label-grid { grid-template-columns: repeat(2, 1fr); }
  .qr-label { grid-template-columns: auto minmax(0, 1fr); gap: 2mm; padding: 2mm; }
  .qr-label svg {
    width: max(27mm, calc(var(--qr-modules, 77) * .35mm));
    height: max(27mm, calc(var(--qr-modules, 77) * .35mm));
  }
  .qr-index { break-before: page; }
}
