:root {
  --brand: #7a1f1f; --brand-2: #9c2a2a; --bg: #f4f1ec; --card: #fff; --ink: #1d1b19; --muted: #6f6a64; --line: #e3ddd5;
  --ok: #1f7a3d; --ok-bg: #e5f4ea; --warn: #8a5a00; --warn-bg: #fff3d6; --err: #b3261e; --err-bg: #fde7e5; --info-bg: #e8f0fb; --info: #1f4f8a;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171514; --card: #22201e; --ink: #f1ede8; --muted: #a9a29a; --line: #3a3633;
    --ok-bg: #18301f; --warn-bg: #3a2e12; --err-bg: #3d1b18; --info-bg: #1a2638; --ok: #6fd391; --warn: #f0c060; --err: #ff8a80; --info: #8ab4f8;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; -webkit-tap-highlight-color: transparent; }
a { color: var(--brand-2); }
h2 { margin: .2em 0 .5em; font-size: 1.4rem; } h3 { margin: .4em 0; font-size: 1.1rem; }
h3.warn { color: var(--warn); } h3.error { color: var(--err); }
small { display: block; color: var(--muted); font-size: .8rem; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.empty { color: var(--muted); text-align: center; padding: 1.5rem; }

#topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--brand); color: #fff; }
#topbar .brand { flex: 1; font-size: 1.05rem; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 1.5rem; cursor: pointer; padding: 0 4px; }
.net { font-size: .82rem; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.15); cursor: pointer; white-space: nowrap; }
.net.ok { background: #2e7d4f; } .net.pend { background: #b07a00; } .net.off { background: #444; }
#drawer { position: fixed; top: 52px; left: 0; bottom: 0; width: 270px; background: var(--card); z-index: 19; box-shadow: var(--shadow); padding: 8px 0; overflow: auto; }
#drawer a { display: block; padding: 12px 20px; color: var(--ink); text-decoration: none; }
#drawer a:hover { background: var(--bg); }
#drawer .who { padding: 12px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font: inherit; cursor: pointer; text-decoration: none; min-height: 42px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--err); border-color: var(--err); }
.btn.big { min-height: 56px; font-size: 1.15rem; padding: 10px 18px; }
.btn.tiny { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; }
.input { width: 100%; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 10px 12px; font: inherit; min-height: 44px; }
.input:focus { outline: 2px solid var(--brand-2); outline-offset: 0; }
.input.big { font-size: 1.25rem; min-height: 56px; }
.input.num { text-align: center; font-size: 1.6rem; font-weight: 700; }
label { display: block; font-size: .9rem; color: var(--muted); }
label .input { margin-top: 4px; color: var(--ink); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); padding: 6px 0; }
label.check.sub { padding-left: 26px; }
label.check input { width: 20px; height: 20px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.row.end { justify-content: flex-end; margin: 0; }
.grow { flex: 1; min-width: 180px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form > * { margin-bottom: 12px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.actions.col { flex-direction: column; align-items: stretch; }
.dim { opacity: .5; }
fieldset { border: 1px solid var(--line); border-radius: 10px; max-height: 300px; overflow: auto; }
.centro-bod { border-bottom: 1px solid var(--line); padding: 4px 0; }

.panel, .card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }
.page-head .row { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.centro h3 { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .85rem; letter-spacing: .04em; margin-top: 18px; }
.card.bodega { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.card.bodega.activa { outline: 2px solid var(--brand-2); }
.kpis .kpi { text-decoration: none; color: var(--ink); text-align: center; margin: 0; }
.kpi b { font-size: 2rem; display: block; } .kpi.hot b { color: var(--err); }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--line); color: var(--ink); }
.badge.abierto { background: var(--info-bg); color: var(--info); } .badge.reconteo { background: var(--warn-bg); color: var(--warn); }
.badge.cerrado { background: var(--warn-bg); color: var(--warn); } .badge.aprobado { background: var(--ok-bg); color: var(--ok); }
.badge.anulado { background: var(--err-bg); color: var(--err); }
.badge.inc-etiqueta_errada, .badge.inc-codigo_desconocido { background: var(--err-bg); color: var(--err); }
.badge.inc-fuera_de_bodega, .badge.inc-cantidad_atipica { background: var(--warn-bg); color: var(--warn); }
.alert { padding: 10px 14px; border-radius: 10px; margin: 8px 0; font-size: .95rem; }
.alert.warn { background: var(--warn-bg); color: var(--warn); } .alert.info { background: var(--info-bg); color: var(--info); }
.alert.err { background: var(--err-bg); color: var(--err); }

.tbl { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl.click tbody tr { cursor: pointer; } .tbl.click tbody tr:hover { background: var(--bg); }
.tbl tr.anulada td { opacity: .45; text-decoration: line-through; }
.tbl td.neg { color: var(--err); font-weight: 600; } .tbl td.pos { color: var(--ok); font-weight: 600; }
.tbl .thumb { width: 52px; } .tbl .thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; } .dot.ok { background: var(--ok); } .dot.pend { background: #d49b00; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: 8px; font: inherit; color: var(--muted); cursor: pointer; }
.tab.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

/* Conteo */
.count-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.count-head h2 { margin: 0 0 4px; }
.count-stats { display: flex; gap: 16px; } .count-stats div { text-align: center; } .count-stats b { font-size: 1.5rem; }
.scanbar { display: flex; gap: 8px; margin-bottom: 14px; position: sticky; top: 56px; z-index: 5; background: var(--bg); padding: 4px 0; }
.scanbar .input { flex: 1; }
.prod-card { display: grid; grid-template-columns: 180px 1fr; gap: 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 18px; border: 2px solid var(--brand-2); }
.prod-card.warn { border-color: #d49b00; }
.prod-img { width: 180px; height: 180px; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.prod-img img { width: 100%; height: 100%; object-fit: cover; }
.noimg { font-size: 3rem; opacity: .5; }
.prod-name { font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.prod-meta { margin: 6px 0; font-size: 1rem; } .um { background: var(--brand); color: #fff; padding: 3px 12px; border-radius: 6px; font-weight: 700; font-size: 1.1rem; }
.qty { grid-column: 1 / -1; }
.qty-row { display: grid; grid-template-columns: 70px 1fr 70px; gap: 8px; margin-top: 4px; }
.seg { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; } .seg label { display: flex; gap: 6px; align-items: center; color: var(--ink); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--card); border-radius: 16px; padding: 20px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; }
.modal-card.wide { max-width: 760px; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; margin-top: 8px; }
.pick-list.short { max-height: 240px; }
.pick { display: flex; gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 8px 10px; font: inherit; cursor: pointer; }
.pick img, .pick .noimg { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; font-size: 1.6rem; display: flex; align-items: center; justify-content: center; flex: none; }
.check-list { max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; }
.cam { width: 100%; min-height: 240px; background: #000; border-radius: 10px; overflow: hidden; }
.preview { display: block; max-width: 120px; margin: 6px 0; border-radius: 6px; }

#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 520px); }
.toast { background: #333; color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); font-size: .95rem; width: 100%; }
.toast.ok { background: var(--ok); color: #fff; } .toast.error { background: #b3261e; } .toast.warn { background: #8a5a00; }

.login { max-width: 380px; margin: 8vh auto; text-align: center; }
.login .panel { text-align: left; } .login .form > *, .login form > * { margin-bottom: 12px; } .login .btn { width: 100%; }
.login-logo { width: 72px; height: 72px; }

.labels-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.qty-s { width: 80px; min-height: 36px; padding: 4px 8px; }
.label-preview { background: repeating-conic-gradient(var(--line) 0% 25%, transparent 0% 50%) 50% / 16px 16px; padding: 16px; border-radius: 10px; display: flex; justify-content: center; overflow: hidden; }
.label-preview > div { box-shadow: 0 0 0 1px #999; background: #fff; overflow: hidden; }

@media (max-width: 760px) {
  .prod-card { grid-template-columns: 96px 1fr; gap: 12px; padding: 12px; } .prod-img { width: 96px; height: 96px; }
  .prod-name { font-size: 1.3rem; }
  .two, .labels-layout { grid-template-columns: 1fr; }
  .tbl th, .tbl td { padding: 8px; }
  .scanbar { top: 52px; }
}

/* Administración de usuarios e historial */
.roles-info { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 14px; }
.role-card { text-align: left; border: 1px solid var(--line); cursor: pointer; font: inherit; color: var(--ink); position: relative; margin: 0; }
.role-card.on { outline: 2px solid var(--brand-2); }
.role-card .count { position: absolute; top: 12px; right: 14px; font-size: 1.4rem; font-weight: 700; color: var(--brand-2); }
.role-card b { display: block; padding-right: 36px; }
.badge.rol-admin { background: var(--brand); color: #fff; } .badge.rol-operativo { background: var(--info-bg); color: var(--info); }
.badge.rol-admin_sede { background: var(--warn-bg); color: var(--warn); } .badge.rol-contador { background: var(--ok-bg); color: var(--ok); }
.tbl tr.locked { cursor: default; } .tbl tr.locked td:first-child { opacity: .75; }
.antes { color: var(--muted); text-decoration: line-through; }
legend { padding: 0 6px; color: var(--muted); font-size: .9rem; }

/* Espacios dentro de la bodega */
.zonas { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -4px 0 14px; }
.zonas.mini { margin: 6px 0 0; gap: 4px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: 8px 16px; font: inherit; cursor: pointer; min-height: 40px; }
.zonas.mini .chip { padding: 2px 10px; min-height: 28px; font-size: .8rem; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip.off { opacity: .45; text-decoration: line-through; }
.chip.add { border-style: dashed; color: var(--muted); }

/* Análisis */
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kpi b.up { color: var(--ok); } .kpi b.down { color: var(--err); }
.kpis .kpi b { font-size: 1.5rem; }
.export-bar .row { margin: 8px 0 0; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; position: relative; padding: 3px 0; border-radius: 6px; outline: none; }
.bar-row:hover, .bar-row:focus { background: var(--bg); }
.bar-label { font-size: .85rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; display: block; }
.bar-fill { display: block; height: 100%; background: var(--brand-2); border-radius: 0 4px 4px 0; }
.bar-value { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-tip { display: none; position: absolute; left: 34%; bottom: calc(100% + 4px); z-index: 5; background: var(--ink); color: var(--card);
  padding: 6px 10px; border-radius: 8px; font-size: .8rem; box-shadow: var(--shadow); white-space: nowrap; pointer-events: none; }
.bar-tip b { display: block; font-size: .95rem; } .bar-tip small { color: inherit; opacity: .8; }
.bar-row:hover .bar-tip, .bar-row:focus .bar-tip { display: block; }
.badge.abc-A { background: var(--brand); color: #fff; } .badge.abc-B { background: var(--warn-bg); color: var(--warn); } .badge.abc-C { background: var(--line); }
.scroll-x { overflow-x: auto; } .scroll-x .tbl { min-width: 640px; }
.warn-txt { color: var(--warn); }
@media (max-width: 760px) { .two-cols { grid-template-columns: 1fr; } }

/* ---------------- Producción */
:root { --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300;
  --grid: #e1e0d9; --axis: #c3c2b7; --tick: #898781; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300;
    --grid: #2c2c2a; --axis: #383835; }
}
.badge.rol-admin { background: var(--brand); color: #fff; } .badge.rol-admin_produccion { background: var(--info-bg); color: var(--info); }
.badge.rol-lider { background: var(--warn-bg); color: var(--warn); } .badge.rol-operario { background: var(--ok-bg); color: var(--ok); }
.badge.nuevo { background: var(--info-bg); color: var(--info); font-size: .68rem; padding: 1px 7px; vertical-align: middle; margin-left: 4px; }
.badge.borrador { background: var(--warn-bg); color: var(--warn); }
.badge.en_gestion { background: var(--info-bg); color: var(--info); } .badge.abierta { background: var(--err-bg); color: var(--err); }
.badge.cerrada { background: var(--ok-bg); color: var(--ok); }
.proc-card { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.proc-card h3 { margin: 0; } .proc-card .stats { display: flex; gap: 14px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.reg-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.reg-item:hover { background: var(--bg); } .reg-item:last-child { border-bottom: 0; }
.reg-item .main { flex: 1; min-width: 0; } .reg-item .main b { display: block; }
.reg-item .rend { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }

/* Editor de registro */
.editor > * { min-width: 0; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.result-panel { position: sticky; top: 68px; }
.sec h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--brand-2); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; }
.in-unit { position: relative; } .in-unit .input { padding-right: 46px; }
.in-unit .u { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
label .in-unit .input { margin-top: 0; }
label .in-unit { margin-top: 4px; }
.input.fuera { border-color: var(--err); background: var(--err-bg); }
.input.auto::placeholder { color: var(--info); opacity: 1; }
.ayuda { font-size: .78rem; color: var(--muted); margin-top: 3px; }
.etapa { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.etapa-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.etapa-head b { font-size: 1.02rem; } .etapa-head .muted { font-size: .85rem; }
.etapa-times { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 100px; gap: 10px; align-items: end; }
.time-in { display: flex; gap: 6px; margin-top: 4px; } .time-in .input { flex: 1; min-width: 0; margin-top: 0; }
.ops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.ops .chip { min-height: 34px; padding: 4px 12px; font-size: .9rem; }
.pt-line { display: grid; grid-template-columns: minmax(0, 2fr) 110px 120px 44px; gap: 8px; align-items: end; margin-bottom: 8px; }
.pt-line.sin-paq { grid-template-columns: minmax(0, 2fr) 140px 44px; }
.temps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.temp { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.temp.fuera { background: var(--err-bg); color: var(--err); border-color: var(--err); }
.temp button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 2px; font-size: 1rem; }
.temp-add { width: 110px; min-height: 38px; padding: 4px 10px; }
.sens { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.sens-item { display: flex; justify-content: space-between; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 6px 6px 12px; }
.seg2 { display: flex; } .seg2 button { border: 1px solid var(--line); background: var(--card); color: var(--muted); padding: 6px 10px; font: inherit; font-size: .85rem; cursor: pointer; min-height: 36px; }
.seg2 button:first-child { border-radius: 8px 0 0 8px; } .seg2 button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.seg2 button.on.c { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); font-weight: 600; }
.seg2 button.on.nc { background: var(--err-bg); color: var(--err); border-color: var(--err); font-weight: 600; }
.big-num { font-size: 2.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.res-row { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.res-row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.res-row.sub span:first-child { padding-left: 12px; color: var(--muted); }
.al { display: flex; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: .88rem; margin-top: 6px; }
.al.error { background: var(--err-bg); color: var(--err); } .al.alerta { background: var(--warn-bg); color: var(--warn); }
.al .ic { font-weight: 800; flex: none; }
.status-ok { color: var(--ok); } .status-warn { color: var(--warn); } .status-bad { color: var(--err); }
.ro .input, .ro select, .ro textarea { pointer-events: none; background: var(--bg); }
.ro .no-ro { display: none !important; }
.save-state { font-size: .8rem; color: var(--muted); }

/* Tablero */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 14px; }
.filters label { min-width: 150px; flex: 1; max-width: 240px; } .filters .input { min-height: 40px; padding: 6px 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.tile .lbl { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tile .val { font-size: 1.8rem; font-weight: 700; margin: 4px 0 2px; }
.tile .delta { font-size: .85rem; color: var(--muted); }
.delta.up { color: var(--ok); } .delta.down { color: var(--err); }
.chart { position: relative; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; }
.chart .gl { stroke: var(--grid); stroke-width: 1; } .chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--tick); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .ref, .spark .ref { stroke: var(--tick); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .cross { stroke: var(--tick); stroke-width: 1; }
.chart .dot { stroke: var(--card); stroke-width: 2; }
.chart-tip { position: absolute; z-index: 10; background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 8px; padding: 8px 10px; font-size: .82rem; pointer-events: none; min-width: 150px; }
.chart-tip i, .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.legend i.dashed { height: 2px; border-radius: 0; vertical-align: 3px; }
.rank-pos { font-weight: 800; color: var(--muted); width: 28px; }
.rank-1 .rank-pos, .rank-2 .rank-pos, .rank-3 .rank-pos { color: var(--brand-2); }
.idx { font-weight: 700; font-variant-numeric: tabular-nums; }
.alert-card { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.alert-card .ic { font-size: 1.3rem; line-height: 1.2; }
.gestion { margin-top: 8px; font-size: .88rem; background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.hint { font-size: .85rem; color: var(--muted); margin: -4px 0 12px; }
.json-edit { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; min-height: 50vh; white-space: pre; }
#drawer .count { float: right; background: var(--err); color: #fff; border-radius: 99px; padding: 0 8px; font-size: .78rem; font-weight: 700; }
#drawer .sep { border-top: 1px solid var(--line); margin: 6px 0; }
@media (max-width: 900px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .result-panel { position: static; }
}
@media (max-width: 720px) { .etapa-times { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .etapa-times { grid-template-columns: 1fr; }
  .pt-line, .pt-line.sin-paq { grid-template-columns: 1fr 1fr 44px; } .pt-line > label:first-child { grid-column: 1 / -1; }
  .tile .val { font-size: 1.45rem; }
  .filters label { max-width: none; min-width: 45%; }
}

/* Fotos de etiqueta y firma */
.fotos { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.foto { position: relative; display: flex; flex-direction: column; gap: 2px; }
.foto img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.foto button { position: absolute; top: 4px; right: 4px; min-height: 28px; padding: 2px 8px; background: var(--card); }
.firma-cv { width: 100%; height: 220px; border: 2px dashed var(--muted); border-radius: 10px; background: #fff; touch-action: none; display: block; }
.firma-img { max-width: 260px; max-height: 110px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
