:root {
  --bg: #0b1510; --panel: #13211a; --panel2: #1a2d23; --panel3: #22392d; --line: #284034; --text: #e8f1ec; --muted: #8fa89a;
  --accent: #3ddc84; --accent-ink: #062b16; --warn: #ffb020; --danger: #ff5d5d; --info: #6cb6ff; --new: #c58cff;
  --r: 12px; --top: 53px;
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; flex: none; }

/* cabecera */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: rgba(11,21,16,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: inset 0 0 0 4px var(--bg), 0 0 0 2px var(--accent); }
.top nav { display: flex; gap: 4px; margin-left: auto; }
.top nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.top nav a.on { background: var(--panel2); color: var(--text); }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; display: grid; gap: 2px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 40; }
.menu-pop > div { padding: 6px 8px; }
.menu-pop a, .menu-pop button { display: block; width: 100%; text-align: left; padding: 8px; border: 0; background: none; border-radius: 6px; color: var(--text); text-decoration: none; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--panel2); }
main { max-width: 980px; margin: 0 auto; padding: 12px 16px 96px; }
body[data-view="ws"] main, body[data-view="capturar"] main { max-width: none; padding: 0; }

/* controles comunes */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; white-space: nowrap; user-select: none; }
.chip.small { font-size: 12px; padding: 3px 9px; cursor: default; }
.chip.sm { font-size: 13px; padding: 4px 10px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.chip.warn { border-color: var(--warn); color: var(--warn); }
.chip.ok { border-color: var(--accent); color: var(--accent); }
.chip.bad { border-color: var(--danger); color: var(--danger); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover:not(:disabled) { background: var(--panel2); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.sm svg { width: 16px; height: 16px; }
.btn.ic { padding: 7px 9px; }
.btn:disabled { opacity: .45; cursor: default; }
.danger-t { color: var(--danger) !important; }
.ibtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.ibtn:hover:not(:disabled) { background: var(--panel2); }
.ibtn:disabled { opacity: .35; cursor: default; }
.ibtn.sm { width: 32px; height: 32px; border-radius: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ellip { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
h2 { font-size: 18px; margin: 14px 0 8px; }
h3 { font-size: 15px; margin: 12px 0 6px; color: var(--muted); font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.field input, label.field select, label.field textarea { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sel { padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); max-width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.slider { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.slider input, .kmini { width: 110px; accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.seg button { border: 0; background: transparent; padding: 7px 11px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--panel3); color: var(--text); font-weight: 600; }
.seg button:disabled { opacity: .4; cursor: default; }
.seg button small { opacity: .7; font-size: 11px; }
.seg button.on.punt { color: var(--accent); }
.seg button.on.other { color: var(--warn); }
.searchbox { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.searchbox > svg { position: absolute; left: 10px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.searchbox input { width: 100%; padding: 9px 12px 9px 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); }
kbd { display: inline-block; padding: 0 5px; margin: 0 1px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; font: 11px/1.6 ui-monospace, monospace; color: var(--text); background: var(--panel); }

/* cámara: pantalla completa bajo la cabecera (móvil) */
.cam { position: fixed; left: 0; right: 0; bottom: 0; top: var(--top); z-index: 5; display: flex; flex-direction: column; background: #000; }
.cam .stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cam .frame { position: relative; }
.cam .frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cam .guide { position: absolute; left: 50%; top: 50%; width: 62%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 2px dashed rgba(255,255,255,.5); border-radius: 50%; pointer-events: none; }
.camTop { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.camTop .chip.small { cursor: pointer; background: rgba(0,0,0,.55); }
.camTop .chips { padding: 0; }
.camMsg { position: absolute; left: 12px; right: 12px; bottom: 10px; text-align: center; font-size: 13px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.camFail { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; color: var(--muted); }
.camFail .btn { font-size: 16px; padding: 14px 18px; }
.btn svg, .rbtn svg { width: 22px; height: 22px; }
.camBar { padding: 6px 12px calc(12px + env(safe-area-inset-bottom)); background: #000; }
.camBar .chips { justify-content: flex-start; }
.camBar .chip { background: #111b16; font-size: 13px; padding: 6px 11px; }
.camBar .chip.on { background: var(--accent); }
.kslider { display: block; width: 100%; margin: 4px 0 0; accent-color: var(--accent); }
.controls { display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: center; justify-items: center; gap: 4px; margin-top: 8px; }
.rbtn { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 58px; padding: 6px 4px; border: 0; background: none; color: var(--text); font-size: 11px; cursor: pointer; }
.rbtn:disabled { opacity: .35; }
.rbtn.on { color: var(--warn); }
.last { position: relative; width: 52px; height: 52px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; background: #111b16; }
.last img { width: 100%; height: 100%; object-fit: cover; }
.last b { position: absolute; right: 2px; bottom: 2px; font-size: 11px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 5px; }
.shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff; background: var(--accent); cursor: pointer; }
.shutter:active { transform: scale(.94); }
.shutter:disabled { background: #333; border-color: #555; }
.shutter.busy { background: var(--muted); }
.flash { animation: flash .25s; }
@keyframes flash { from { filter: brightness(3); } }

/* rejilla de fotos (lateral, hoja del móvil y vista Fotos) */
.pg-head { display: grid; gap: 8px; }
.pg-head .seg { display: flex; }
.pg-head .seg button { flex: 1; padding: 6px 4px; font-size: 13px; }
.pg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pg-item { position: relative; display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #000; border: 2px solid transparent; color: var(--text); text-decoration: none; }
.pg-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-item span { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 5px 3px; font-size: 10.5px; line-height: 1.2; background: linear-gradient(transparent, rgba(0,0,0,.85)); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pg-item .dot { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px rgba(0,0,0,.6); }
.pg-item.st-marcada .dot { background: var(--info); }
.pg-item.st-etiquetada .dot { background: var(--accent); }
.pg-item:hover { border-color: var(--line); }
.pg-item.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pg-end { padding: 10px 0 4px; text-align: center; }
.pg-grid.rich { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.thumb { position: relative; display: block; border-radius: 10px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.thumb .pic { position: relative; aspect-ratio: 3/4; background: #000; }
.thumb .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.thumb .pic .bx { position: absolute; border: 2px solid var(--accent); border-radius: 3px; }
.thumb .pic .bx.other { border-color: var(--warn); }
.thumb .meta { padding: 6px 8px; font-size: 12px; }
.thumb .meta b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.badge { position: absolute; top: 6px; left: 6px; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.7); }
.badge.pendiente, .badge-st.pendiente { color: var(--warn); }
.badge.marcada, .badge-st.marcada { color: var(--info); }
.badge.etiquetada, .badge-st.etiquetada { color: var(--accent); }
.badge-st { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.imgwrap { position: absolute; inset: 0; }
.sheet-photos { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--bg); }
.sp-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.sp-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 12px 0; }
.sp-body .pg-body { flex: 1; overflow: auto; margin-top: 8px; padding-bottom: env(safe-area-inset-bottom); }
.sp-body .pg-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }

/* editor */
.edhost { height: 100%; }
.ed { display: flex; flex-direction: column; }
.ed-bar { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ednav { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.ednav .pos { min-width: 70px; height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font-variant-numeric: tabular-nums; cursor: pointer; }
.ednav .pos:disabled { cursor: default; opacity: 1; }
.ed-stage { position: relative; background: #000; border-radius: var(--r); overflow: hidden; touch-action: none; }
.ed-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.ed-msg { position: absolute; left: 8px; top: 8px; right: 8px; font-size: 13px; text-shadow: 0 1px 3px #000; pointer-events: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toolbar .btn { padding: 7px 11px; }
.toolbar .btn.ic { padding: 7px 8px; }
.ftools { flex-wrap: nowrap; }
.flabel { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; flex: none; }
.fchips { padding: 0; min-width: 0; flex: 0 1 auto; }
.fchips .chip { flex: none; }
.kwrap { flex: none; }
.kwrap[hidden] { display: none; }
.vsep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 2px; }
.rotv { min-width: 38px; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; flex: 1; border: 0; background: none; padding: 11px 10px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-color: var(--accent); font-weight: 600; }
.tdot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; vertical-align: middle; border-radius: 50%; background: var(--line); }
.tdot.ok { background: var(--accent); }
.ws-empty { display: grid; place-items: center; gap: 12px; padding: 60px 20px; text-align: center; color: var(--muted); }

/* panel del fabricante */
.mk { display: grid; gap: 10px; }
.mk-cmp { display: grid; grid-template-columns: 112px 112px 1fr; gap: 10px; align-items: start; }
.mk-cmp figure { margin: 0; display: grid; gap: 3px; }
.mk-cmp figcaption { font-size: 11px; color: var(--muted); text-align: center; }
.mk-crop, .mk-refimg { width: 100%; aspect-ratio: 1; border-radius: 10px; background: #000; display: block; }
.mk-refimg { display: grid; place-items: center; background: #fff; overflow: hidden; border: 2px solid transparent; }
.mk-refimg img { width: 100%; height: 100%; object-fit: contain; }
.mk-ref.preview .mk-refimg { border-color: var(--info); }
.mk-ref.preview figcaption { color: var(--info); }
.mk-sel { display: grid; gap: 6px; align-content: start; min-width: 0; }
.mk-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mk-name b { font-size: 15px; }
.mk-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-conf { justify-self: start; }
.mk-conf button { padding: 5px 10px; font-size: 13px; }
.tag { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.real { color: var(--info); border-color: var(--info); }
.tag.new { color: var(--new); border-color: var(--new); }
.mk-q { display: flex; gap: 8px; }
.mk-q .sel { width: 44%; flex: none; }
.mk-sets { display: flex; overflow-x: auto; scrollbar-width: none; }
.mk-sets button { flex: 1; font-size: 13px; padding: 6px 9px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mcard { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-width: 0; padding: 5px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; text-align: center; font-size: 11px; line-height: 1.25; }
.mcard:hover { border-color: var(--muted); }
.mcard .mimg { position: relative; display: block; }
.mcard img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 6px; display: block; }
.mcard b { margin-top: 3px; font-size: 11.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.mcard .muted { font-size: 10.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mcard.real { border-color: rgba(108,182,255,.55); }
.mcard.new { border-color: rgba(197,140,255,.6); }
.mcard.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.mcard .uses { position: absolute; right: 3px; top: 3px; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 10.5px/17px system-ui; font-style: normal; }
.mk-empty { grid-column: 1 / -1; padding: 16px; border: 1px dashed var(--line); border-radius: 10px; text-align: center; color: var(--muted); }
.mk-empty .row { justify-content: center; }
.mk-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 4px; }
.pager span { padding: 0 6px; font-variant-numeric: tabular-nums; }

/* diálogo de marca nueva */
.dlg { width: min(620px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); }
.dlg::backdrop { background: rgba(0,0,0,.6); }
.dlg form { display: grid; gap: 10px; padding: 14px 16px 16px; }
.dlg header, .dlg footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dlg footer { justify-content: flex-end; }
.dlg-body { display: grid; grid-template-columns: 160px 1fr; gap: 14px; }
.nm-img { margin: 0; display: grid; gap: 4px; text-align: center; }
.nm-img img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #000; border-radius: 10px; }
.nm-fields { display: grid; gap: 10px; align-content: start; }
.nm-hint { color: var(--warn); }
.nm-hint:empty, .nm-err:empty { display: none; }
.nm-err { color: var(--danger); }
.dlg-note { margin: 0; }

/* lugar */
.places { display: grid; gap: 6px; margin-top: 8px; }
.place { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.place.sel { border-color: var(--accent); }

/* subir (portátil) */
.upl { display: grid; gap: 14px; }
.upl h2 { margin-bottom: 0; }
.drop { display: grid; justify-items: center; gap: 8px; padding: 40px 20px; border: 2px dashed var(--line); border-radius: 14px; background: var(--panel); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop svg { width: 40px; height: 40px; color: var(--accent); }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--panel2); }
.upl-sum { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.upl-list { display: grid; gap: 4px; }
.upl-row { display: grid; grid-template-columns: 44px 1fr auto 130px; gap: 12px; align-items: center; padding: 4px 8px 4px 4px; border-radius: 8px; background: var(--panel); }
.upl-row[data-id] { cursor: pointer; }
.upl-row[data-id]:hover { background: var(--panel2); }
.upl-row img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.upl-row .name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.upl-row .st { font-size: 13px; color: var(--muted); text-align: right; }
.upl-row .st.ok { color: var(--accent); }
.upl-row .st.dup { color: var(--info); }
.upl-row .st.err { color: var(--danger); }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 70; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 10px; background: #233a2e; border: 1px solid var(--line); opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }

/* ================================================================== MÓVIL: editor a pantalla completa con pestañas */
.ws-phone { height: calc(100dvh - var(--top)); }
.ed.phone { height: 100%; }
.ed.phone .ed-bar { padding: 6px 10px; }
.ed.phone .tabs { padding: 0 4px; }
.ed.phone .tabs button { padding: 10px 6px; font-size: 14px; }
.ed-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 8px; }
.ed-pane.scroll { display: block; overflow-y: auto; overflow-x: hidden; padding: 10px 12px 16px; overscroll-behavior: contain; }
.ed.phone .ed-stage { flex: 1; min-height: 200px; border-radius: 10px; }
.ed.phone .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.ed.phone .toolbar::-webkit-scrollbar { display: none; }
.ed.phone .toolbar > * { flex: none; }
.ed.phone .toolbar .grow { display: none; }
.ed-save { display: flex; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.ed-save .btn { flex: 1; padding: 11px; }
.ed-save .btn:first-child { flex: .6; }
.ed.phone .cards { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 899px), (hover: none), (pointer: coarse) {
  #toast { bottom: 76px; }
}
@media (max-width: 520px) {
  main { padding: 8px 10px 96px; }
  .top { padding: 6px 10px; gap: 8px; }
  .brand { font-size: 14px; }
  .brand .full { display: none; }
  .top nav a { padding: 6px 9px; font-size: 14px; }
  .top .ibtn { width: 34px; height: 34px; }
  #gps { font-size: 11px; padding: 2px 7px; }
  .grid2 { grid-template-columns: 1fr; }
  .pg-grid.rich { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .mk-cmp { grid-template-columns: 84px 84px minmax(0, 1fr); gap: 8px; }
  .mk-conf { display: flex; width: 100%; }
  .mk-conf button { flex: 1; padding: 5px 2px; font-size: 12px; }
  .mk-acts .btn.sm, .mk-acts .chip.sm { padding: 4px 8px; font-size: 12px; }
  .mk-q .sel { width: 38%; }
  .mk-sets button { flex: none; }
  .dlg { width: 100%; max-width: none; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .dlg-body { grid-template-columns: 1fr; }
  .nm-img { width: 140px; justify-self: center; }
}
@media (max-width: 360px) {
  .mk-cmp { grid-template-columns: 84px 84px; }
  .mk-sel { grid-column: 1 / -1; }
}

/* ================================================================== PORTÁTIL: lateral de miniaturas + foto + panel de etiquetado */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .ws { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100vh - var(--top)); }
  .ws-side { display: flex; flex-direction: column; min-height: 0; padding: 12px 10px 0 12px; border-right: 1px solid var(--line); background: #0e1a14; }
  .ws-side .pg-body { flex: 1; min-height: 0; overflow: auto; margin-top: 10px; padding-right: 2px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .ws-main { min-width: 0; min-height: 0; }
  .ed.desk { display: grid; grid-template-columns: minmax(0, 1fr) clamp(380px, 32vw, 520px); height: 100%; }
  .ed-center { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; padding: 10px 12px 8px; }
  .ed-center .ed-stage { flex: 1; min-height: 0; }
  .ed-panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: #0e1a14; }
  .ed-panel .tabs { padding: 0 8px; }
  .ed-tab { flex: 1; min-height: 0; overflow: auto; padding: 12px 14px 16px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
  .ed-help { line-height: 1.9; }
  .mk-cmp { grid-template-columns: repeat(2, minmax(0, 180px)); }
  .mk-sel { grid-column: 1 / -1; }
  .cards { grid-template-columns: repeat(4, 1fr); }
  .upl { max-width: 860px; margin: 0 auto; }
}
@media (min-width: 900px) and (max-width: 1250px) and (hover: hover) and (pointer: fine) {
  .ws { grid-template-columns: 220px minmax(0, 1fr); }
  .ws-side .pg-grid { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .ed-help { display: none; }
}
.ed.phone .ftools .kt { display: none; }
.ed.phone .ftools .kmini { width: 72px; }
.ed.phone .ftools .chip.sm { padding: 6px 10px; }
