/* Disenador de Etiquetas ZPL (v2.33.0). Todo con prefijo zd- / lbd-. */

.lbd-page { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1 1 auto; }
.lbd-head {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px;
}
.lbd-head .field { margin: 0; }
.lbd-head .lbd-name { min-width: 240px; flex: 1 1 260px; }
.lbd-head .lbd-sp { min-width: 220px; flex: 1 1 240px; }
.lbd-head .lbd-state { width: 130px; }
.lbd-head input, .lbd-head select { width: 100%; }
.lbd-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.lbd-pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #eef2ff; color: #3730a3; white-space: nowrap; }
.lbd-pill.dirty { background: #fef3c7; color: #92400e; }
.lbd-pill.new { background: #dcfce7; color: #166534; }
.lbd-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: #64748b; padding: 0 4px; }
.lbd-meta b { color: #334155; font-weight: 600; }
.lbd-warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.lbd-warn ul { margin: 4px 0 0 18px; padding: 0; }
.lbd-ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.lbd-denied { background: #fff; border: 1px solid #fecaca; border-radius: 12px; padding: 28px; text-align: center; color: #991b1b; }
.lbd-editor { flex: 1 1 auto; min-height: 640px; height: calc(100vh - 230px); }

/* Lista de etiquetas */
.lbd-modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 1200; padding: 16px; }
.lbd-dialog { background: #fff; border-radius: 14px; width: min(980px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 25px 60px rgba(15, 23, 42, .3); }
.lbd-dialog.sm { width: min(520px, 100%); }
.lbd-dialog header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #e2e8f0; }
.lbd-dialog header h3 { margin: 0; font-size: 16px; }
.lbd-dialog .lbd-dbody { padding: 14px 18px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.lbd-dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #e2e8f0; }
.lbd-search { width: 100%; }
.lbd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lbd-table th { text-align: left; font-weight: 600; color: #475569; background: #f8fafc; position: sticky; top: 0; padding: 7px 8px; border-bottom: 1px solid #e2e8f0; }
.lbd-table td { padding: 7px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.lbd-table tr.pick { cursor: pointer; }
.lbd-table tr.pick:hover td { background: #eff6ff; }
.lbd-table tr.current td { background: #dbeafe; }
.lbd-table small { color: #64748b; display: block; }
.lbd-state-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: #94a3b8; }
.lbd-state-dot.s1 { background: #16a34a; }
.lbd-state-dot.s2 { background: #f59e0b; }
.lbd-state-dot.s3 { background: #dc2626; }
.lbd-sizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.lbd-size { border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px; background: #fff; cursor: pointer; text-align: center; font-size: 13px; }
.lbd-size.on { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 2px rgba(37, 99, 235, .15); }
.lbd-size b { display: block; font-size: 14px; }
.lbd-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lbd-textarea { width: 100%; min-height: 220px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; }

/* ---------- Editor ---------- */
.zd-root {
    display: flex; flex-direction: column; border: 1px solid #cbd5e1; border-radius: 12px; overflow: hidden;
    background: #f8fafc; outline: none; font-family: "Segoe UI", Arial, sans-serif; color: #0f172a;
}
.zd-root:focus-visible { box-shadow: 0 0 0 2px rgba(37, 99, 235, .35); }
.zd-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.zd-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 8px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.zd-tgroup { display: flex; gap: 2px; padding-right: 6px; margin-right: 4px; border-right: 1px solid #e2e8f0; }
.zd-tgroup:last-child, .zd-tright { border-right: 0; }
.zd-tright { margin-left: auto; }
.zd-tbtn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 32px; height: 32px; padding: 0 7px;
    border: 1px solid transparent; border-radius: 8px; background: transparent; color: #334155; cursor: pointer; font-size: 12px;
}
.zd-tbtn:hover:not(:disabled) { background: #f1f5f9; border-color: #e2e8f0; }
.zd-tbtn.on { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.zd-tbtn:disabled { opacity: .35; cursor: default; }
.zd-zoom { min-width: 54px; font-variant-numeric: tabular-nums; font-weight: 600; }
.zd-wide span { white-space: nowrap; }

.zd-body { display: flex; flex: 1 1 auto; min-height: 0; }
.zd-palette { display: flex; flex-direction: column; gap: 3px; padding: 8px 6px; background: #fff; border-right: 1px solid #e2e8f0; overflow: auto; }
.zd-pgroup { display: flex; flex-direction: column; position: relative; }
.zd-pbtn {
    width: 40px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 9px;
    border: 1px solid transparent; background: transparent; color: #334155; cursor: pointer;
}
.zd-pbtn .zd-ico { width: 21px; height: 21px; }
.zd-pbtn:hover { background: #f1f5f9; }
.zd-pbtn.on { background: #2563eb; color: #fff; box-shadow: 0 3px 10px rgba(37, 99, 235, .35); }
.zd-bcsel { width: 40px; height: 16px; font-size: 10px; padding: 0; border: 0; background: #f1f5f9; border-radius: 4px; color: #475569; cursor: pointer; margin-top: -2px; }

.zd-canvas-wrap { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; background: #e7ebf0; }
.zd-canvas { display: block; touch-action: none; }
.zd-inline {
    position: absolute; z-index: 5; font: 14px Consolas, "Cascadia Mono", monospace; padding: 6px 8px; border: 2px solid #2563eb;
    border-radius: 6px; background: #fff; box-shadow: 0 8px 24px rgba(15, 23, 42, .25); resize: both; outline: none;
}

.zd-side { width: 330px; flex: 0 0 330px; display: flex; flex-direction: column; background: #fff; border-left: 1px solid #e2e8f0; min-height: 0; }
.zd-tabs { display: flex; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.zd-tab { flex: 1 1 auto; padding: 9px 4px; border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; font-size: 12px; color: #475569; font-weight: 600; }
.zd-tab:hover { color: #0f172a; }
.zd-tab.on { color: #1d4ed8; border-bottom-color: #2563eb; background: #fff; }
.zd-panel { flex: 1 1 auto; overflow: auto; padding: 10px 12px 18px; }
.zd-section { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #f1f5f9; }
.zd-section:last-child { border-bottom: 0; }
.zd-section h4 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.zd-subsection { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 8px; background: #f8fafc; border: 1px solid #f1f5f9; }
.zd-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.zd-flabel { font-size: 11px; font-weight: 600; color: #475569; }
.zd-field input[type=text], .zd-field input[type=number], .zd-field select, .zd-field textarea, .zd-datawrap input {
    width: 100%; box-sizing: border-box; padding: 5px 7px; border: 1px solid #cbd5e1; border-radius: 7px; font-size: 13px; background: #fff; color: #0f172a;
}
.zd-field input:focus, .zd-field select:focus, .zd-field textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, .15); }
.zd-field input[type=range] { width: 100%; }
.zd-hint { font-size: 11px; color: #94a3b8; }
.zd-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.zd-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.zd-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #334155; cursor: pointer; }
.zd-note { margin: 0; font-size: 12px; color: #64748b; line-height: 1.4; }
.zd-warn { font-size: 12px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 7px; padding: 6px 8px; }
.zd-datawrap { display: flex; gap: 4px; align-items: flex-start; }
.zd-datawrap .zd-data { flex: 1 1 auto; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; padding: 5px 7px; border: 1px solid #cbd5e1; border-radius: 7px; min-width: 0; }
textarea.zd-data { resize: vertical; }
.zd-varins { width: 98px; flex: 0 0 98px; font-size: 11px; padding: 5px 2px; border: 1px solid #c7d2fe; border-radius: 7px; background: #eef2ff; color: #3730a3; cursor: pointer; }
.zd-code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; resize: vertical; }
.zd-zpl { min-height: 360px; white-space: pre; }
.zd-btn { padding: 5px 10px; border-radius: 7px; border: 1px solid #cbd5e1; background: #fff; color: #334155; font-size: 12px; cursor: pointer; }
.zd-btn:hover:not(:disabled) { background: #f1f5f9; }
.zd-btn:disabled { opacity: .45; cursor: default; }
.zd-btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.zd-btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.zd-btn-sm { padding: 2px 7px; font-size: 11px; margin-left: auto; }
.zd-empty { color: #475569; font-size: 13px; }
.zd-empty p { margin: 6px 0; }
.zd-empty ul { margin: 6px 0 0 16px; padding: 0; color: #64748b; font-size: 12px; line-height: 1.5; }

.zd-layers { display: flex; flex-direction: column; gap: 2px; }
.zd-layer { display: flex; align-items: center; gap: 7px; padding: 5px 6px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; }
.zd-layer:hover { background: #f8fafc; }
.zd-layer.on { background: #eff6ff; border-color: #bfdbfe; }
.zd-layer-ico { color: #64748b; display: flex; }
.zd-layer-name { flex: 1 1 auto; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zd-layer-name small { display: block; color: #94a3b8; font-family: Consolas, monospace; font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.zd-mini { border: 0; background: transparent; color: #94a3b8; cursor: pointer; padding: 2px; border-radius: 5px; display: flex; }
.zd-mini:hover { color: #0f172a; background: #e2e8f0; }
.zd-mini .zd-ico { width: 15px; height: 15px; }

.zd-vars { display: flex; flex-direction: column; gap: 6px; }
.zd-var { border: 1px solid #e2e8f0; border-radius: 9px; padding: 7px 8px; background: #fff; cursor: grab; display: flex; flex-direction: column; gap: 5px; }
.zd-var:hover { border-color: #a5b4fc; }
.zd-var-head { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.zd-var-head code { font-size: 12px; font-weight: 700; color: #3730a3; background: #eef2ff; padding: 1px 6px; border-radius: 5px; }
.zd-badge { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: #f1f5f9; color: #475569; }
.zd-badge.ok { background: #dcfce7; color: #166534; }
.zd-badge.warn { background: #ffedd5; color: #9a3412; }
.zd-badge.muted { color: #94a3b8; }

.zd-status { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 5px 10px; font-size: 11px; color: #64748b; background: #fff; border-top: 1px solid #e2e8f0; }
.zd-status-sel { color: #1d4ed8; font-weight: 600; }
.zd-status-pos { font-variant-numeric: tabular-nums; min-width: 110px; }
.zd-status-hint { margin-left: auto; color: #94a3b8; }

@media (max-width: 1100px) {
    .zd-side { width: 280px; flex-basis: 280px; }
    .zd-status-hint { display: none; }
}
@media (max-width: 760px) {
    .zd-body { flex-direction: column; }
    .zd-palette { flex-direction: row; border-right: 0; border-bottom: 1px solid #e2e8f0; overflow-x: auto; }
    .zd-canvas-wrap { min-height: 420px; }
    .zd-side { width: auto; flex-basis: auto; border-left: 0; border-top: 1px solid #e2e8f0; max-height: 60vh; }
    .lbd-editor { height: auto; }
}
