:root {
  --brand-yellow: #ffc400;
  --brand-black: #111111;
  --page-bg: #f3f4f6;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --text: #111111;
  --text-muted: #5d6670;
  --border: #dddddd;
  --border-soft: #e6e6e6;
  --success: #19733a;
  --danger: #a21c1c;
  --warning-bg: #fff8d6;
  --warning-border: #f0cf40;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-card: 0 7px 24px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  appearance: none;
}

.app-header {
  background: linear-gradient(115deg, #101010 0%, #171717 62%, #232323 100%);
  border-bottom: 4px solid var(--brand-yellow);
  color: #fff;
}

.app-header__inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 118px;
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.app-header__brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-header__logo-frame {
  width: 112px;
  height: 62px;
  flex: 0 0 auto;
  padding: 6px 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.2);
}

.app-header__logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-header__title {
  margin: 0;
  font-size: clamp(24px, 2.6vw, 33px);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -0.3px;
}

.app-header__subtitle {
  margin: 7px 0 0;
  color: #d7d7d7;
  font-size: 14px;
  line-height: 1.35;
}

.app-header__badge {
  padding: 8px 12px;
  border: 1px solid #505050;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.26);
  color: var(--brand-yellow);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.app-main {
  max-width: 1180px;
  margin: 24px auto;
  padding: 0 18px 34px;
}

.label-generator {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.card {
  overflow: hidden;
  border: 1px solid #e1e1e1;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.card__header {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-soft);
}

.card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.form-card__body {
  padding: 18px;
}

.form-field {
  margin-bottom: 16px;
}

.form-field__label-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.form-field__label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 800;
}

.form-field__counter {
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 11px;
}

.form-field__control {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #c9c9c9;
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.form-field__control:focus {
  border-color: #9b7900;
  box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.22);
}

.form-field__control--invalid {
  border-color: #c83232;
  box-shadow: 0 0 0 3px rgba(200, 50, 50, 0.10);
}

.form-field__error {
  min-height: 16px;
  margin-top: 5px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.3;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.form-grid .form-field {
  min-width: 0;
  margin-bottom: 0;
}

.form-card__print-note {
  margin: 2px 0 16px;
  color: #58616a;
  font-size: 12px;
  line-height: 1.4;
}

.form-card__sequence {
  margin: 2px 0 17px;
  padding: 11px 12px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  font-size: 13px;
  line-height: 1.45;
}

.form-card__sequence strong {
  display: block;
  margin-bottom: 3px;
}

.form-card__warning {
  display: none;
  margin: -4px 0 12px;
  padding: 9px 11px;
  border: 1px solid #e7c65c;
  border-radius: 8px;
  background: #fff9e3;
  color: #705600;
  font-size: 12px;
  line-height: 1.4;
}

.form-card__warning--visible {
  display: block;
}

.form-card__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.button {
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button--primary {
  background: var(--brand-yellow);
  color: var(--brand-black);
}

.button--primary:hover:not(:disabled) {
  filter: brightness(0.96);
}

.button--ghost {
  border: 1px solid #cfcfcf;
  background: #fff;
  color: var(--text);
}

.form-card__progress {
  display: none;
  margin-top: 14px;
}

.form-card__progress--visible {
  display: block;
}

.form-card__progress-row {
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 11px;
}

.form-card__progress-bar {
  width: 100%;
}

.form-card__status {
  min-height: 20px;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
}

.form-card__status--ok {
  color: var(--success);
}

.form-card__status--error {
  color: var(--danger);
}

.preview-card__body {
  padding: 18px;
}

.preview-card__toolbar {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preview-card__info {
  color: #555;
  font-size: 13px;
}

.preview-card__canvas-frame {
  min-height: 260px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  border-radius: 14px;
  background: #e7e7e7;
}


.preview-card__canvas {
  width: auto;
  max-width: 100%;
  height: auto;
  display: block;
  background: transparent;
}

.preview-card__note {
  margin: 10px 0 0;
  color: #66717b;
  font-size: 12px;
  line-height: 1.4;
}

.preview-card__alert {
  display: none;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid #e6b6b6;
  border-radius: 8px;
  background: #fff1f1;
  color: #8e1717;
  font-size: 12px;
  font-weight: 700;
}

.preview-card__alert--visible {
  display: block;
}

.app-footer {
  margin: 12px 0 0;
  border-top: 1px solid #2a2a2a;
  background: #070707;
  color: #d9dde1;
}

.app-footer__inner {
  width: min(1110px, calc(100% - 40px));
  min-height: 80px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  font-size: 13px;
  line-height: 1.4;
}

.app-footer__credit {
  margin-left: auto;
  white-space: nowrap;
}

.app-footer__link {
  color: #ff2c8d;
  font-weight: 800;
  text-decoration: none;
}

.app-footer__link:hover,
.app-footer__link:focus-visible {
  text-decoration: underline;
}

@media (max-width: 860px) {
  .app-main {
    margin-top: 16px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .label-generator {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .app-header__inner {
    width: calc(100% - 28px);
    gap: 18px;
  }

  .app-header__brand {
    min-width: 0;
    flex: 1;
  }

  .app-header__logo-frame {
    width: 110px;
    height: 58px;
    flex-basis: 110px;
  }

  .app-header__title {
    font-size: 22px;
  }

  .app-header__subtitle {
    font-size: 14px;
  }

  .app-header__badge {
    display: none;
  }

  .preview-card__body {
    padding: 10px;
  }

  .preview-card__canvas-frame {
    min-height: 0;
    padding: 10px;
  }


  .card {
    border-radius: 12px;
  }
}

@media (max-width: 600px) {
  .app-header__inner {
    width: calc(100% - 24px);
    min-height: auto;
    padding: 14px 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .app-header__logo-frame {
    width: 92px;
    height: 50px;
    flex-basis: 92px;
  }

  .app-header__title {
    font-size: 18px;
  }

  .app-header__subtitle {
    margin-top: 5px;
    font-size: 12px;
  }

  .form-card__body {
    padding: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-grid .form-field {
    margin-bottom: 14px;
  }

  .form-field__control {
    height: 48px;
    font-size: 16px;
  }

  .button {
    width: 100%;
    min-height: 50px;
  }

  .preview-card__toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .preview-card__canvas-frame {
    margin-right: -2px;
    margin-left: -2px;
    border-radius: 10px;
  }

  .preview-card__canvas {
    width: 100%;
    max-width: 100%;
  }

  .app-footer__inner {
    width: calc(100% - 24px);
    min-height: auto;
    padding: 16px 0;
    align-items: center;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    font-size: 12px;
  }

  .app-footer__credit {
    margin-left: 0;
    white-space: normal;
  }
}


/* v2.7.0 — responsividade refinada para tablet e mobile. */
.form-card__status:empty {
  display: none;
}

@media (max-width: 1024px) and (min-width: 861px) {
  .app-header__inner {
    width: calc(100% - 32px);
  }

  .app-main {
    padding-right: 14px;
    padding-left: 14px;
  }

  .label-generator {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 16px;
  }

  .preview-card__body {
    padding: 14px;
  }
}

@media (max-width: 600px) {
  .app-main {
    margin-top: 12px;
    padding: 0 10px 24px;
  }

  .app-header__inner {
    gap: 10px;
  }

  .app-header__brand {
    width: 100%;
  }

  .card__header {
    padding: 13px 14px;
  }

  .preview-card__body {
    padding: 10px;
  }

  .preview-card__toolbar {
    margin-bottom: 10px;
  }

  .preview-card__info {
    font-size: 12px;
    line-height: 1.35;
  }

  .preview-card__note {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .app-header__inner {
    width: calc(100% - 20px);
    padding: 12px 0;
  }

  .app-header__brand {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    text-align: left;
  }

  .app-header__brand > div:last-child {
    min-width: 0;
    flex: 1;
  }

  .app-header__logo-frame {
    width: 72px;
    height: 42px;
    flex: 0 0 72px;
  }

  .app-header__title {
    width: 100%;
    font-size: clamp(10px, 3.3vw, 13px);
    line-height: 1.1;
    white-space: nowrap;
  }

  .app-header__subtitle {
    margin-top: 3px;
    font-size: 9px;
    line-height: 1.2;
  }

  .form-card__body {
    padding: 12px;
  }

  .form-field {
    margin-bottom: 13px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .form-grid .form-field {
    margin-bottom: 13px;
  }

  .preview-card__canvas-frame {
    padding: 6px;
  }
}

@media (max-width: 340px) {
  .app-header__title {
    font-size: 10px;
  }

  .app-main {
    padding-right: 7px;
    padding-left: 7px;
  }
}


/* v2.7.17 — contenção horizontal apenas no mobile.
 * Mantém o desktop no layout original e preserva a correção de overflow
 * somente para telas menores, que era o cenário com problema real.
 */
@media (max-width: 860px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .app-header,
  .app-main,
  .label-generator,
  .card,
  .form-card__body,
  .form-field,
  .form-grid,
  .preview-card,
  .preview-card__body,
  .preview-card__canvas-frame {
    min-width: 0;
    max-width: 100%;
  }

  .form-field__control,
  select.form-field__control,
  input.form-field__control {
    min-width: 0;
    max-width: 100%;
  }

  .preview-card__canvas-frame {
    overflow-x: hidden;
  }

  .app-header__brand > div:last-child {
    min-width: 0;
    overflow: hidden;
  }
}

@media (max-width: 600px) {
  .app-header__title {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-main {
    width: 100%;
    max-width: 100%;
  }

  .label-generator,
  .card,
  .form-card__body,
  .preview-card__body {
    width: 100%;
  }

  .preview-card__canvas {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }
}
