:root {
    color-scheme: light;
    --canvas: #f1f4f6;
    --surface: #ffffff;
    --surface-muted: #f7f9fa;
    --ink: #17212b;
    --ink-soft: #40505f;
    --muted: #687785;
    --line: #d9e1e7;
    --line-strong: #c7d1d9;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #edf4ff;
    --success: #14804a;
    --success-soft: #eaf7f0;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --shadow: 0 12px 32px rgba(23, 33, 43, 0.08);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-width: 320px;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

.app-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 28px 0 44px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 2px 22px;
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 14px;
}

.brand-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
}

.app-header h1 {
    margin: 0;
    color: var(--ink);
    font-size: 1.62rem;
    line-height: 1.1;
    letter-spacing: 0;
}

.app-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.header-tools {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: 8px;
}

.header-tool-btn {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    color: var(--ink-soft);
    box-shadow: 0 3px 12px rgba(23, 33, 43, 0.04);
    font-size: 0.78rem;
    font-weight: 750;
}

.header-tool-btn:hover {
    border-color: var(--line-strong);
    background: var(--surface-muted);
    color: var(--ink);
}

.header-tool-btn svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.format-badge {
    display: grid;
    grid-template-columns: 20px auto;
    align-items: center;
    column-gap: 9px;
    min-width: 150px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: 0 3px 12px rgba(23, 33, 43, 0.04);
}

.format-badge svg {
    width: 20px;
    height: 20px;
    grid-row: 1 / 3;
    color: var(--primary);
}

.format-badge span {
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 750;
    line-height: 1.1;
}

.format-badge small {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.1;
}

.menu-telas {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 20px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #e8edf1;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    min-height: 58px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-soft);
    text-align: left;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.62);
    color: var(--ink);
}

.tab-btn.active {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 2px 8px rgba(23, 33, 43, 0.06);
}

.tab-icon {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-muted);
    color: var(--muted);
}

.tab-icon svg {
    width: 19px;
    height: 19px;
}

.tab-btn.active .tab-icon {
    border-color: #c9dafb;
    background: var(--primary-soft);
    color: var(--primary);
}

.tab-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.tab-copy strong {
    overflow: hidden;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-copy small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.71rem;
    font-weight: 600;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-btn.active .tab-copy small {
    color: var(--primary);
}

.tela {
    display: none;
}

.tela.active {
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(360px, 0.94fr);
    align-items: stretch;
    gap: 20px;
}

.editor-panel,
.preview-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.editor-panel {
    display: flex;
    min-height: 470px;
    flex-direction: column;
    padding: 24px;
}

.section-header {
    margin-bottom: 20px;
}

.section-kicker,
.preview-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.section-header h2 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.25;
    letter-spacing: 0;
}

.form-field {
    min-width: 0;
}

.form-field + .form-field {
    margin-top: 16px;
}

label {
    display: block;
    margin: 0 0 7px;
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 750;
}

textarea,
input[type="number"],
select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

textarea:hover,
input[type="number"]:hover,
select:hover {
    border-color: #9eacb7;
}

textarea:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

textarea {
    min-height: 236px;
    resize: vertical;
    padding: 13px 14px;
    font-size: 0.9rem;
    line-height: 1.55;
}

textarea.code-input {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.82rem;
}

textarea::placeholder,
input::placeholder {
    color: #94a0ab;
}

input[type="number"],
select {
    height: 43px;
    padding: 0 11px;
    font-size: 0.88rem;
}

.labelary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.labelary-grid .form-field + .form-field {
    margin-top: 0;
}

.quantity-field {
    max-width: 220px;
}

.quantity-control {
    display: grid;
    grid-template-columns: 42px minmax(70px, 1fr) 42px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
}

.quantity-control:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.quantity-control button {
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    border: 0;
    background: var(--surface-muted);
    color: var(--ink-soft);
}

.quantity-control button:hover {
    background: #e8edf1;
    color: var(--ink);
}

.quantity-control button:first-child {
    border-right: 1px solid var(--line);
}

.quantity-control button:last-child {
    border-left: 1px solid var(--line);
}

.quantity-control button svg {
    width: 17px;
    height: 17px;
}

.quantity-control input[type="number"] {
    height: 42px;
    padding: 0 6px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    text-align: center;
    appearance: textfield;
}

.quantity-control input::-webkit-inner-spin-button,
.quantity-control input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto;
    gap: 9px;
    margin-top: auto;
    padding-top: 22px;
}

.actions button {
    display: inline-flex;
    min-width: 0;
    height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 750;
    white-space: nowrap;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.actions button svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

#tela-labelary .actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    border-color: var(--line-strong) !important;
    background: var(--surface);
    color: var(--ink);
}

.btn-secondary:hover {
    border-color: #9eacb7 !important;
    background: var(--surface-muted);
}

.btn-ghost {
    border-color: var(--line) !important;
    background: var(--surface-muted);
    color: var(--muted);
}

.btn-ghost:hover {
    background: #e8edf1;
    color: var(--ink);
}

.preview-panel {
    display: flex;
    min-height: 470px;
    flex-direction: column;
    overflow: hidden;
}

.preview-header {
    display: flex;
    min-height: 77px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--line);
}

.preview-header h3 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.25;
    letter-spacing: 0;
}

.preview-meta {
    flex: 0 0 auto;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
}

.preview-stage,
.labelary-preview {
    display: flex;
    min-height: 390px;
    flex: 1;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 26px;
    background: #e8edf0;
}

.labelary-preview {
    min-height: 0;
    height: clamp(390px, calc(100vh - 360px), 660px);
    max-height: clamp(390px, calc(100vh - 360px), 660px);
    flex: 0 0 auto;
    align-items: flex-start;
    justify-content: center;
    overscroll-behavior: contain;
}

#tela-labelary .preview-panel {
    min-height: 0;
    align-self: start;
}

.preview-sheet {
    display: grid;
    width: min(100%, 520px);
    aspect-ratio: 80 / 25;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid #c9d1d7;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(23, 33, 43, 0.16);
}

.visual-label {
    display: flex;
    min-width: 0;
    min-height: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 8px 10px;
    border-right: 1px dashed #bfc8cf;
    color: #111827;
    text-align: center;
}

.visual-label:last-child {
    border-right: 0;
}

.visual-product {
    flex-direction: column;
    justify-content: flex-start;
}

.visual-product .visual-barcode {
    display: block;
    width: min(92%, 190px);
    height: 42px;
    margin: 0 auto 4px;
}

.visual-code {
    width: 100%;
    overflow: hidden;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visual-description {
    display: -webkit-box;
    width: 100%;
    margin: 4px 0;
    overflow: hidden;
    color: #4b5563;
    font-size: 0.56rem;
    line-height: 1.15;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.visual-sku {
    width: 100%;
    overflow: hidden;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visual-free-text {
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #778592;
    font-size: 0.78rem;
    font-weight: 700;
}

.preview-empty svg {
    width: 28px;
    height: 28px;
}

.empty-label {
    color: #a1acb5;
}

.empty-label svg {
    width: 24px;
    height: 24px;
}

.zpl-preview-image {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, 500px);
    max-height: none;
    border: 1px solid #c9d1d7;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(23, 33, 43, 0.16);
    object-fit: contain;
}

.zpl-preview-image.zoom-manual {
    max-width: none;
}

.zpl-preview-toolbar {
    display: flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-muted);
}

.zpl-preview-toolbar button {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #ffffff;
    color: var(--ink-soft);
}

.zpl-preview-toolbar button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.zpl-preview-toolbar button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.zpl-preview-toolbar svg {
    width: 17px;
    height: 17px;
}

.zpl-preview-toolbar span {
    min-width: 116px;
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
}

#status {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 14px;
    padding: 11px 13px;
    border: 1px solid #f2c6c2;
    border-radius: 6px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 700;
}

#status::before {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

#status[data-type="success"] {
    border-color: #b9dfc9;
    background: var(--success-soft);
    color: var(--success);
}

#status[data-type="loading"] {
    border-color: #c9dafb;
    background: var(--primary-soft);
    color: var(--primary);
}

.guia-configuracao {
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.guia-configuracao summary {
    display: flex;
    min-height: 60px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 18px;
    cursor: pointer;
    list-style: none;
}

.guia-configuracao summary::-webkit-details-marker {
    display: none;
}

.summary-title,
.summary-action {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.summary-title {
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 750;
}

.summary-title svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.summary-action {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
}

.summary-action svg {
    width: 16px;
    height: 16px;
    transition: transform 160ms ease;
}

.guia-configuracao[open] .summary-action svg {
    transform: rotate(180deg);
}

.guide-content {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1.1fr);
    gap: 24px;
    padding: 20px;
    border-top: 1px solid var(--line);
}

.img-manual {
    display: block;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.check-list h3 {
    margin: 0 0 14px;
    font-size: 1rem;
}

.check-list ul {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.check-list li {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.check-list li svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: var(--success);
}

.equipment-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 18px 0 0;
    padding: 12px;
    border: 1px solid #c9dafb;
    border-radius: 6px;
    background: var(--primary-soft);
    color: var(--ink-soft);
    font-size: 0.8rem;
    line-height: 1.45;
}

.equipment-note svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: var(--primary);
}

.modo-preview-zpl .guia-configuracao {
    display: none;
}

.seo-overview {
    margin-top: 20px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink-soft);
}

.seo-overview h2 {
    max-width: 760px;
    margin: 6px 0 10px;
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    letter-spacing: 0;
}

.seo-overview p {
    max-width: 900px;
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.65;
}

.seo-overview p + p {
    margin-top: 8px;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
    padding: 18px 2px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-brand img {
    width: 24px;
    height: 24px;
}

.footer-brand span {
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 800;
}

.footer-brand small {
    padding-left: 8px;
    border-left: 1px solid var(--line-strong);
    font-size: 0.7rem;
}

.app-footer nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-footer nav button {
    padding: 6px 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
}

.app-footer nav button:hover {
    background: var(--surface);
    color: var(--primary);
}

.app-dialog {
    width: min(640px, calc(100% - 28px));
    max-height: min(760px, calc(100vh - 40px));
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 70px rgba(23, 33, 43, 0.28);
}

.app-dialog::backdrop {
    background: rgba(23, 33, 43, 0.56);
}

.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
    margin: 0;
    font-size: 1.18rem;
    letter-spacing: 0;
}

.icon-btn {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-muted);
    color: var(--muted);
}

.icon-btn:hover {
    background: #e8edf1;
    color: var(--ink);
}

.icon-btn svg {
    width: 17px;
    height: 17px;
}

.dialog-footer {
    display: flex;
    min-height: 66px;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    padding: 11px 22px;
    border-top: 1px solid var(--line);
    background: var(--surface-muted);
}

.compact-btn,
.btn-danger-ghost {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 750;
}

.compact-btn.btn-primary {
    border: 1px solid var(--primary);
}

.compact-btn.btn-secondary {
    border: 1px solid var(--line-strong);
}

.btn-danger-ghost {
    margin-right: auto;
    border: 1px solid #f2c6c2;
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-danger-ghost:hover {
    background: #fee4e1;
}

.btn-danger-ghost:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.btn-danger-ghost svg {
    width: 16px;
    height: 16px;
}

.history-list {
    display: grid;
    max-height: min(540px, calc(100vh - 190px));
    gap: 9px;
    overflow-y: auto;
    padding: 16px 22px;
}

.history-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
}

.history-item-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 6px;
    background: var(--primary-soft);
    color: var(--primary);
}

.history-item-icon svg {
    width: 19px;
    height: 19px;
}

.history-item-content {
    min-width: 0;
}

.history-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.history-type,
.history-date {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 700;
}

.history-date {
    flex: 0 0 auto;
}

.history-item h3 {
    overflow: hidden;
    margin: 4px 0 3px;
    font-size: 0.88rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item p {
    overflow: hidden;
    margin: 0;
    color: var(--muted);
    font-size: 0.73rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
}

.history-use {
    min-height: 32px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 0.7rem;
    font-weight: 750;
}

.history-use:hover {
    border-color: #9eacb7;
    background: var(--surface-muted);
}

.history-remove {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
}

.history-remove:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.history-remove svg {
    width: 15px;
    height: 15px;
}

.history-empty {
    display: flex;
    min-height: 230px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--muted);
    text-align: center;
}

.history-empty svg {
    width: 30px;
    height: 30px;
    color: var(--primary);
}

.history-empty strong {
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.history-empty span {
    font-size: 0.75rem;
}

.legal-content {
    max-height: min(540px, calc(100vh - 190px));
    overflow-y: auto;
    padding: 20px 22px;
    color: var(--ink-soft);
}

.legal-content h3 {
    margin: 20px 0 7px;
    color: var(--ink);
    font-size: 0.9rem;
}

.legal-content h3:first-of-type {
    margin-top: 18px;
}

.legal-content p {
    margin: 0 0 10px;
    font-size: 0.82rem;
    line-height: 1.65;
}

#print-area {
    display: none;
}

/* =======================================================
   REGRAS DE IMPRESSÃO
   ======================================================= */
@media print {
    .no-print, .guia-configuracao {
        display: none !important;
    }

    body {
        padding: 0;
        margin: 0;
        background: white;
    }

    @page {
        size: 80mm 25mm;
        margin: 0;
    }

    #print-area {
        display: block !important;
        width: 80mm;
        margin: 0;
        padding: 0;
    }

    .etiqueta-linha {
        display: flex;
        justify-content: space-between; /* Distribui as etiquetas com espaço no meio */
        width: 80mm;
        height: 25mm;
        page-break-after: always;
        break-after: page;
        page-break-inside: avoid;
        break-inside: avoid;
        overflow: hidden;
    }

    .etiqueta-linha:last-child {
        page-break-after: auto;
        break-after: auto;
    }

    .etiqueta-individual {
        width: 39mm; /* Trava em 39mm (deixa 2mm de GAP no meio do papel 80mm) */
        height: 25mm;
        box-sizing: border-box;
        padding: 1.5mm;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        text-align: center;
        overflow: hidden;
    }

    /* Tela 1: Etiqueta de produto */
    .etiqueta-conteudo {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
    }

    .barcode {
        display: block !important;
        width: 33mm !important; /* Limite firme para não estourar */
        height: 9mm !important;
        margin: 0 auto 1mm auto !important;
    }

    .txt-codigo {
        width: 100%;
        font-size: 7.5pt;
        font-weight: bold;
        line-height: 1;
        margin: 0;
        text-align: center;
    }

    .txt-desc {
        display: block !important;
        width: 36mm; /* Limite de contenção do texto */
        font-size: 5.5pt;
        line-height: 1.1;
        margin: 1mm auto;
        max-height: 6mm;
        overflow: hidden;
        white-space: normal;
        word-wrap: break-word; /* Força a quebra de linha em vez de passar pro lado */
        text-align: center;
    }

    .txt-sku {
        width: 100%;
        font-size: 6.5pt;
        font-weight: bold;
        line-height: 1;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-align: center;
    }

    /* Tela 2: Texto Livre */
    .etiqueta-texto-livre {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .txt-livre {
        width: 36mm;
        font-size: 11pt;
        font-weight: 800;
        line-height: 1.2;
        white-space: pre-wrap;
        word-wrap: break-word;
        text-align: center;
    }
}

@media (max-width: 940px) {
    .tela.active {
        grid-template-columns: 1fr;
    }

    .editor-panel,
    .preview-panel {
        min-height: auto;
    }

    .preview-stage,
    .labelary-preview {
        min-height: 320px;
    }
}

@media (max-width: 680px) {
    .app-shell {
        width: min(100% - 24px, 1180px);
        padding-top: 18px;
    }

    .app-header {
        align-items: flex-start;
    }

    .header-tools {
        flex-wrap: wrap;
    }

    .brand-logo {
        width: 46px;
        height: 46px;
    }

    .app-header h1 {
        font-size: 1.35rem;
    }

    .format-badge {
        min-width: 138px;
    }

    .menu-telas {
        display: flex;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
    }

    .tab-btn {
        min-width: 166px;
        flex: 1 0 166px;
    }

    .editor-panel {
        padding: 20px;
    }

    .labelary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #tela-labelary .actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #tela-labelary .actions .btn-ghost {
        grid-column: auto;
    }

    .actions .btn-ghost {
        grid-column: 1 / -1;
    }

    .guide-content {
        grid-template-columns: 1fr;
    }

    .app-footer {
        align-items: flex-start;
    }
}

@media (max-width: 460px) {
    .app-header {
        flex-direction: column;
        gap: 14px;
    }

    .header-tools {
        display: grid;
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .header-tool-btn {
        width: 100%;
    }

    .format-badge {
        grid-column: 1 / -1;
        width: 100%;
    }

    .editor-panel {
        padding: 18px;
    }

    .preview-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }

    .preview-stage,
    .labelary-preview {
        min-height: 260px;
        padding: 16px;
    }

    .visual-label {
        padding: 6px;
    }

    .visual-product .visual-barcode {
        height: 32px;
    }

    .visual-code {
        font-size: 0.58rem;
    }

    .visual-description,
    .visual-sku {
        font-size: 0.48rem;
    }

    .actions {
        grid-template-columns: 1fr;
    }

    .actions .btn-ghost {
        grid-column: auto;
    }

    .app-footer {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .app-footer nav {
        justify-content: flex-start;
    }

    .dialog-header,
    .history-list,
    .legal-content {
        padding-right: 16px;
        padding-left: 16px;
    }

    .dialog-footer {
        align-items: stretch;
        flex-direction: column-reverse;
        padding: 12px 16px;
    }

    .dialog-footer .compact-btn,
    .btn-danger-ghost {
        width: 100%;
        margin-right: 0;
    }

    .history-item {
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .history-item-icon {
        width: 32px;
        height: 32px;
    }
}
