.xonto-content--wide {
  --xonto-content-max: var(--xonto-shell-max);
}

.stamp-app {
  color: #17202e;
  padding-inline: clamp(18px, 3vw, 40px);
}

.stamp-app__intro {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 14px;
}

.stamp-app__intro-copy {
  min-width: 0;
}

.stamp-app__intro h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  line-height: 1.02;
}

.stamp-app__intro p {
  max-width: 780px;
  margin: 8px 0 0;
  color: #526071;
  line-height: 1.42;
}

.stamp-app__intro-logo {
  width: clamp(220px, 26vw, 360px);
  height: auto;
  flex: 0 0 auto;
}

.stamp-app__workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.stamp-app .panel {
  background: #ffffff;
  border: 1px solid #dce4ec;
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(29, 49, 74, 0.09);
}

.stamp-app .controls {
  position: sticky;
  top: calc(var(--xonto-header-height, 72px) + 12px);
  max-height: calc(100dvh - var(--xonto-header-height, 72px) - var(--xonto-footer-min-height, 52px) - 24px);
  overflow: auto;
  padding: 12px;
}

.stamp-app .preview-panel {
  min-width: 0;
  padding: 14px;
}

.stamp-app fieldset {
  border: 1px solid #e1e8ef;
  border-radius: 8px;
  margin: 0 0 10px;
  padding: 10px;
  background: #ffffff;
}

.stamp-app fieldset:last-child {
  margin-bottom: 0;
}

.stamp-app legend {
  padding: 0 8px;
  color: #17202e;
  font-weight: 800;
}

.stamp-app label {
  display: block;
  margin: 8px 0 4px;
  color: #273549;
  font-size: 0.86rem;
  font-weight: 750;
}

.stamp-app input[type="text"],
.stamp-app input[type="email"],
.stamp-app input[type="tel"],
.stamp-app select,
.stamp-app textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #ccd7e2;
  border-radius: 8px;
  padding: 8px 9px;
  background: #ffffff;
  color: #17202e;
  font: inherit;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.stamp-app input:focus,
.stamp-app select:focus,
.stamp-app textarea:focus {
  border-color: #4d6f8c;
  box-shadow: 0 0 0 3px rgba(77, 111, 140, 0.16);
}

.stamp-app button:focus-visible,
.stamp-app .drop-zone:focus-visible {
  outline: 3px solid rgba(47, 128, 255, 0.85);
  outline-offset: 3px;
}

.stamp-app textarea {
  min-height: 58px;
  resize: vertical;
}

.stamp-app input[type="color"] {
  width: 100%;
  min-height: 36px;
  border: 1px solid #ccd7e2;
  border-radius: 8px;
  padding: 5px;
  background: #ffffff;
}

.stamp-app input[type="range"] {
  width: 100%;
  accent-color: #3e70da;
}

.stamp-app input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: #3e70da;
}

.stamp-app .grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

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

.stamp-app .inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: #526071;
  font-size: 0.86rem;
  line-height: 1.35;
}

.stamp-app .contact-break-options {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #e1e8ef;
  border-radius: 8px;
  background: #f7fafb;
}

.stamp-app .contact-break-options[hidden] {
  display: none;
}

.stamp-app .range-value {
  margin-top: 4px;
  color: #627184;
  font-size: 0.82rem;
  text-align: right;
}

.stamp-app .small {
  color: #627184;
  font-size: 0.82rem;
  line-height: 1.4;
}

.stamp-app .logo-status,
.stamp-app .export-status {
  margin-top: 7px;
  color: #526071;
  font-size: 0.82rem;
  line-height: 1.35;
}

.stamp-app .logo-status.is-loaded {
  color: #1f6f45;
  font-weight: 700;
}

.stamp-app .export-status.is-busy {
  color: #2f5fbe;
  font-weight: 800;
}

.stamp-app .export-status.is-success {
  color: #1f6f45;
  font-weight: 800;
}

.stamp-app .export-status.is-unavailable {
  color: #627184;
}

.stamp-app .preset-description {
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid #e1e8ef;
  border-radius: 8px;
  background: #f7fafb;
  color: #526071;
  font-size: 0.84rem;
  line-height: 1.45;
}

.stamp-app .drop-zone {
  padding: 10px;
  border: 2px dashed #b9c8d8;
  border-radius: 8px;
  background: #f7fafb;
  color: #273549;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.stamp-app .drop-zone:hover,
.stamp-app .drop-zone.drag-over,
.stamp-app .drop-zone:focus-visible {
  border-color: #3e70da;
  background: #eef5ff;
  transform: translateY(-1px);
}

.stamp-app .drop-zone strong,
.stamp-app .drop-zone span {
  display: block;
}

.stamp-app .drop-zone span {
  margin-top: 4px;
  color: #627184;
  font-size: 0.9rem;
}

.stamp-app .drop-zone input[type="file"] {
  display: none;
}

.stamp-app .preview-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.stamp-app .preview-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.stamp-app .preview-header span {
  display: inline-block;
  margin-top: 3px;
  color: #627184;
  font-size: 0.9rem;
}

.stamp-app .preview-stage {
  min-height: clamp(330px, calc(100dvh - var(--xonto-header-height, 68px) - var(--xonto-footer-min-height, 52px) - 245px), 500px);
  border: 1px dashed #b9c8d8;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #f5f8fb 25%, transparent 25%),
    linear-gradient(-45deg, #f5f8fb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f5f8fb 75%),
    linear-gradient(-45deg, transparent 75%, #f5f8fb 75%);
  background-position: 0 0, 0 13px, 13px -13px, -13px 0;
  background-size: 26px 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}

.stamp-app #previewCanvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.stamp-app .export-box {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #e1e8ef;
  border-radius: 8px;
  background: #ffffff;
}

.stamp-app .export-box h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.stamp-app .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.stamp-app .button-row--compact {
  margin-top: 8px;
}

.stamp-app button {
  appearance: none;
  border: 1px solid #2f5fbe;
  border-radius: 8px;
  padding: 8px 11px;
  background: #3e70da;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.15;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 7px 16px rgba(62, 112, 218, 0.2);
}

.stamp-app button:hover {
  background: #2f5fbe;
  transform: translateY(-1px);
}

.stamp-app button.secondary {
  border-color: #17202e;
  background: #17202e;
  box-shadow: 0 7px 16px rgba(23, 32, 46, 0.14);
}

.stamp-app .compact-button {
  margin-top: 8px;
  padding: 7px 10px;
  font-size: 0.84rem;
}

.stamp-app .button-row--compact .compact-button {
  margin-top: 0;
}

.stamp-app button[aria-busy="true"] {
  cursor: wait;
  opacity: 0.74;
}

.stamp-app button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.stamp-app button:disabled:hover {
  background: #3e70da;
  transform: none;
}

.stamp-app button.secondary:disabled:hover {
  background: #17202e;
}

.stamp-app button.reset-button:disabled:hover {
  color: #273549;
  border-color: #ccd7e2;
  background: #f7fafb;
}

.stamp-app .reset-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  color: #273549;
  border-color: #ccd7e2;
  background: #f7fafb;
  box-shadow: none;
}

.stamp-app .reset-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.4;
}

.stamp-app .reset-button:hover {
  color: #ffffff;
  border-color: #2f5fbe;
  background: #3e70da;
}

.stamp-app .error {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #f1b7b7;
  border-radius: 8px;
  background: #fff1f1;
  color: #991b1b;
  font-size: 0.9rem;
}

.stamp-app .warning {
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid #f1d08a;
  border-radius: 8px;
  background: #fff8e8;
  color: #7a4f00;
  font-size: 0.86rem;
  line-height: 1.35;
}

.stamp-app .warning[hidden] {
  display: none;
}

.xonto-legal-page {
  max-width: 72ch;
  margin-inline: auto;
  padding-block: 24px 76px;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: normal;
}

.xonto-legal-page__eyebrow {
  margin: 0 0 10px;
  color: var(--xonto-blue);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.xonto-legal-page__meta {
  color: var(--xonto-muted);
  font-size: 0.94rem;
}

.xonto-legal-page h1 {
  margin: 0 0 22px;
  color: var(--xonto-black);
  font-family: var(--xonto-font-headline);
  font-size: 3rem;
  line-height: 1.08;
}

.xonto-legal-page h2 {
  margin: 30px 0 8px;
  color: var(--xonto-black);
  font-family: var(--xonto-font-headline);
  font-size: 1.32rem;
  line-height: 1.2;
}

.xonto-legal-page p,
.xonto-legal-page li {
  margin: 0 0 14px;
  color: var(--xonto-text);
}

.xonto-legal-page a {
  color: var(--xonto-blue);
  font-weight: 650;
  text-underline-offset: 0.18em;
}

@media (max-width: 900px) {
  .stamp-app__workspace {
    grid-template-columns: 1fr;
  }

  .stamp-app .preview-panel {
    order: -1;
  }

  .stamp-app .controls {
    position: static;
    max-height: none;
  }

  .stamp-app .preview-stage {
    min-height: 390px;
  }
}

@media (max-width: 760px) {
  .stamp-app {
    display: flex;
    flex-direction: column;
  }

  .stamp-app__intro,
  .stamp-app .preview-header {
    display: block;
  }

  .stamp-app__intro {
    margin-bottom: 10px;
  }

  .stamp-app__intro h1 {
    font-size: 1.85rem;
  }

  .stamp-app__intro-logo {
    width: min(280px, 82vw);
    margin-top: 12px;
  }

  .stamp-app__workspace {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .stamp-app .preview-panel {
    order: -1;
  }

  body.stamp-has-user-content .stamp-app .preview-panel {
    position: sticky;
    top: var(--xonto-header-height, 62px);
    z-index: 20;
    margin-inline: calc(var(--xonto-page-gutter) * -1);
    border-inline: 0;
    border-radius: 0;
    box-shadow: 0 12px 26px rgba(29, 49, 74, 0.16);
  }

  body.stamp-has-user-content .stamp-app .preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
  }

  body.stamp-has-user-content .stamp-app .preview-header h2 {
    font-size: 1rem;
  }

  body.stamp-has-user-content .stamp-app .preview-header span {
    margin-top: 0;
    font-size: 0.78rem;
  }

  .stamp-app .preview-header button {
    margin-top: 12px;
    width: 100%;
  }

  body.stamp-has-user-content .stamp-app .preview-header button {
    display: none;
  }

  .stamp-app .grid-2,
  .stamp-app .grid-3 {
    grid-template-columns: 1fr;
  }

  .stamp-app .preview-stage {
    min-height: 300px;
    padding: 14px;
  }

  body.stamp-has-user-content .stamp-app .preview-stage {
    height: clamp(150px, 27dvh, 220px);
    min-height: 0;
    padding: 10px;
  }

  body.stamp-has-user-content .stamp-app #previewCanvas {
    width: auto !important;
    max-width: 100%;
    max-height: 100%;
  }

  body.stamp-has-user-content .stamp-app .export-box {
    margin-top: 8px;
    padding: 8px;
  }

  body.stamp-has-user-content .stamp-app .export-box h3,
  body.stamp-has-user-content .stamp-app .export-box p.small {
    display: none;
  }

  body.stamp-has-user-content .stamp-app .export-box .button-row {
    flex-wrap: nowrap;
    margin-top: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  body.stamp-has-user-content .stamp-app .export-box button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.82rem;
    scroll-snap-align: start;
  }

  .stamp-app .button-row button {
    flex: 1 1 140px;
  }

  .xonto-legal-page {
    padding-block: 8px 46px;
  }

  .xonto-legal-page h1 {
    margin-bottom: 18px;
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .stamp-app {
    padding-inline: 0;
  }

  .stamp-app .controls,
  .stamp-app .preview-panel {
    padding: 10px;
  }

  .stamp-app fieldset,
  .stamp-app .export-box {
    padding: 10px;
  }

  .stamp-app .button-row button {
    flex-basis: 100%;
  }

  body.stamp-has-user-content .stamp-app .preview-panel {
    padding: 8px var(--xonto-page-gutter);
  }

  body.stamp-has-user-content .stamp-app .preview-stage {
    height: clamp(132px, 25dvh, 185px);
    padding: 8px;
  }

  body.stamp-has-user-content .stamp-app .button-row button {
    flex-basis: auto;
  }
}
