/* PROMA ERP · estilos base (v1). Añadir siempre al final, no borrar. */
:root {
    --bg: #f2f5f9;
    --surface: #ffffff;
    --ink: #1b2430;
    --ink-2: #4b5666;
    --ink-3: #7a8596;
    --line: #dce3ec;
    --line-2: #e8edf3;
    --side: #14202e;
    --side-ink: #cfd9e6;
    --side-ink-2: #8497ae;
    --accent: #1f5f9e;
    --accent-ink: #ffffff;
    --accent-soft: #e4edf8;
    --ok: #2f7a4b;
    --ok-soft: #e7f3eb;
    --warn: #9a5b00;
    --warn-soft: #fbf0dc;
    --err: #a3352b;
    --err-soft: #fbe9e7;
    --radius: 8px;
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Mono", Consolas, "SF Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1:focus { outline: none; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin: 0 0 14px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 10px; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.menu-toggle { display: none; }
.sidebar { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: baseline; gap: 8px; padding: 22px 20px 18px; color: #fff; text-decoration: none !important; }
.brand-mark { font-weight: 800; font-size: 22px; letter-spacing: -0.04em; }
.brand-sub { font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: 0.12em; }
.nav { display: flex; flex-direction: column; padding: 0 10px 16px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--side-ink-2); padding: 16px 10px 6px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 6px; color: var(--side-ink); text-decoration: none !important; }
.nav-item:hover { background: rgba(255,255,255,0.06); }
.nav-item.active { background: rgba(201,154,107,0.18); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-pending .nav-text { color: var(--side-ink-2); }
.nav-tag { font-size: 10px; color: var(--side-ink-2); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 0 6px; white-space: nowrap; }
.sidebar-foot { margin-top: auto; padding: 14px 20px; font-size: 11px; color: var(--side-ink-2); border-top: 1px solid rgba(255,255,255,0.06); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-company { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; color: var(--ink-2); }
.menu-button { display: none; cursor: pointer; font-size: 20px; color: var(--ink-2); }
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }

/* ---------- Cabecera de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-sub { margin: 4px 0 0; color: var(--ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back { display: inline-block; font-size: 13px; margin-bottom: 6px; }
.section-title { margin-top: 28px; }

/* ---------- Tarjetas y KPIs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); text-decoration: none !important; transition: border-color .15s; }
.kpi:hover { border-color: var(--accent); }
.kpi-label { font-size: 12px; color: var(--ink-2); }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-foot { font-size: 12px; color: var(--ink-3); }

.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.module-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.module-group ul { list-style: none; margin: 0; padding: 0; }
.module-group li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-top: 1px solid var(--line-2); }
.module-group li:first-child { border-top: 0; }

.status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.status-disponible { background: var(--ok-soft); color: var(--ok); }
.status-endesarrollo { background: var(--accent-soft); color: var(--accent); }
.status-previsto { background: var(--line-2); color: var(--ink-3); }

.placeholder { max-width: 720px; }
.lead { font-size: 15px; line-height: 1.55; margin-top: 0; }
.muted { color: var(--ink-3); }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #184b7c; border-color: #184b7c; }
.btn-ghost { background: transparent; }

.input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono, .mono { font-family: var(--mono); font-size: 13px; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.input.invalid { border-color: var(--err); }
.validation-message { color: var(--err); font-size: 12px; }

/* ---------- Filtros ---------- */
.filters { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr)) auto; gap: 10px; padding: 12px; margin-bottom: 14px; align-items: center; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg { border: 0; background: var(--surface); padding: 0 12px; height: 32px; font: inherit; cursor: pointer; color: var(--ink-2); }
.seg + .seg { border-left: 1px solid var(--line); }
.seg-on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- Tablas ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-card.narrow { max-width: 720px; }
.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 10px 14px; background: #f7f9fc; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
.grid td { padding: 9px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .strong { font-weight: 500; }
.sortable { cursor: pointer; }
.sortable:hover { color: var(--ink); }
.clickable { cursor: pointer; }
.clickable:hover td { background: #f8fafc; }
.w-code { width: 90px; }
.w-nif { width: 120px; }
.w-state { width: 100px; }
.empty { text-align: center; color: var(--ink-3); padding: 32px !important; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--ink-2); }

.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Ficha ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: span 2; }
.fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 14px; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.f-xs { grid-column: span 2; }
.f-sm { grid-column: span 3; }
.f-md { grid-column: span 4; }
.f-lg { grid-column: span 6; }
.f-full { grid-column: span 12; }
.fields label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; padding-top: 18px; }
.hint { font-size: 12px; font-weight: 400; }
.hint-warn { color: var(--warn); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }

.alert { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-error { background: var(--err-soft); color: var(--err); }
.alert.validation:empty { display: none; }
ul.validation-errors { margin: 0; padding-left: 18px; }

/* ---------- Errores de Blazor ---------- */
#blazor-error-ui { background: var(--err-soft); color: var(--err); bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ---------- Pantallas estrechas ---------- */
@media (max-width: 1100px) {
    .filters { grid-template-columns: 1fr 1fr; }
    .hide-md { display: none; }
}
@media (max-width: 860px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 50; width: 260px; left: -270px; transition: left .2s; }
    .menu-toggle:checked + .app .sidebar { left: 0; }
    .menu-button { display: inline-block; }
    .content { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .fields { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .f-xs { grid-column: span 2; } .f-sm, .f-md, .f-lg, .f-full { grid-column: span 6; }
    .filters { grid-template-columns: 1fr; }
    .hide-sm { display: none; }
    .page-head { flex-direction: column; align-items: flex-start; }
}

/* ===== v2: sesión, usuarios, transportes ===== */
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-user form { margin: 0; }
.user-name { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; color: var(--ink); font-weight: 600; font-size: 13px; text-decoration: none !important; }
.user-role { font-size: 11px; font-weight: 400; color: var(--ink-3); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; height: 40px; }
.head-actions { display: flex; gap: 8px; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(1200px 600px at 80% -10%, #3a3029 0%, var(--side) 60%); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 12px; padding: 32px 30px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.auth-brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 22px; }
.auth-brand .brand-mark { color: var(--ink); }
.auth-card h1 { font-size: 18px; margin-bottom: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 12px; }
.auth-form .btn-block { margin-top: 6px; }
.auth-form .input[readonly] { background: var(--line-2); color: var(--ink-2); }
.auth-link { display: block; text-align: center; margin-top: 12px; font-size: 13px; }
.auth-card p.muted { font-size: 13px; line-height: 1.5; margin: -6px 0 14px; }

.badge-accent { background: var(--accent-soft); color: var(--accent); margin-left: 6px; }
.badge-info { background: #e6eef8; color: #2d5c93; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge:not([class*="badge-"]) { background: var(--line-2); color: var(--ink-3); }
.row-off td { color: var(--ink-3); }
.row-selected td { background: var(--accent-soft) !important; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
.split > .table-card:only-child { grid-column: span 2; }
.side-form { position: sticky; top: 16px; }
.form-actions.inline { position: static; background: none; padding: 12px 0 0; margin-top: 4px; }
.narrow-form { max-width: 460px; }
.filters-inline { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.filters-inline .check, label.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }

.temp-pass { background: var(--accent-soft); border: 1px dashed var(--accent); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.temp-pass code { font-family: var(--mono); font-size: 20px; letter-spacing: 0.08em; color: var(--ink); user-select: all; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1100px) {
    .split { grid-template-columns: 1fr; }
    .split > .table-card:only-child { grid-column: auto; }
    .side-form { position: static; }
}

/* ===== v3: transportes DeCA ===== */
.form-subtitle { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.side-form p.hint { margin: 10px 0 0; }

/* ===== v4: registro, auditoría y procesos ===== */
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.w-date { width: 150px; }
.input-auto { width: auto; min-width: 180px; }
.filters-log { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.filters-log label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.filters-log label.check { flex-direction: row; align-items: center; padding-top: 18px; }
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.chip-acceso { background: #e6eef8; color: #2d5c93; }
.chip-accion { background: var(--accent-soft); color: var(--accent); }
.chip-error, .estado-error { background: var(--err-soft); color: var(--err); }
.estado-correcto { background: var(--ok-soft); color: var(--ok); }
.estado-conavisos { background: var(--warn-soft); color: var(--warn); }
.estado-encurso { background: #e6eef8; color: #2d5c93; }
.row-error td { background: #fdf3f2; }
.row-detail td { background: #f7f9fc; }
td.detalle { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-warn { margin-left: 6px; }

.historial, .accesos { margin-top: 14px; }
.historial-toggle { all: unset; cursor: pointer; display: flex; width: 100%; justify-content: space-between; align-items: center; }
.historial-toggle h2 { margin: 0; }
.historial-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.timeline { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.timeline li { border-left: 2px solid var(--line); padding-left: 12px; }
.tl-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.tl-op { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--line-2); color: var(--ink-2); }
.op-A { background: var(--ok-soft); color: var(--ok); }
.op-B { background: var(--err-soft); color: var(--err); }
.tl-who { font-weight: 600; }
.tl-when { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
table.cambios { border-collapse: collapse; font-size: 13px; }
table.cambios th { text-align: left; font-weight: 500; color: var(--ink-2); padding: 2px 14px 2px 0; white-space: nowrap; }
table.cambios td { padding: 2px 6px; vertical-align: top; }
table.cambios .antes { color: var(--ink-3); text-decoration: line-through; }
table.cambios .flecha { color: var(--ink-3); }
table.cambios .despues { color: var(--ink); font-weight: 500; }
.grid.compact td { padding: 6px 10px; }

dl.datos { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; margin: 0 0 10px; font-size: 13px; }
dl.datos dt { color: var(--ink-3); }
dl.datos dd { margin: 0; }
ol.mensajes { list-style: none; margin: 8px 0 0; padding: 0; max-height: 460px; overflow-y: auto; font-size: 13px; }
ol.mensajes li { padding: 6px 0; border-top: 1px solid var(--line-2); display: flex; gap: 8px; flex-wrap: wrap; }
.msg-nivel { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); height: fit-content; }
.msg-aviso .msg-nivel { background: var(--warn-soft); color: var(--warn); }
.msg-error .msg-nivel { background: var(--err-soft); color: var(--err); }
.proceso-detalle { position: static; }

/* ===== v5 · Pedidos recibidos ===== */
.dropzone { position: relative; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); padding: 30px 20px; text-align: center; margin-bottom: 16px; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone-activa { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-ocupada { opacity: .7; }
.dropzone-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone-input:disabled { cursor: progress; }
.dropzone-texto { display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.dropzone-texto strong { font-size: 15px; }
.dropzone-texto span { font-size: 12px; color: var(--ink-3); }
.resultado-subida { padding: 6px 0; margin-bottom: 16px; }
.resultado { display: flex; gap: 12px; align-items: center; padding: 6px 16px; font-size: 13px; border-left: 3px solid transparent; }
.resultado a { margin-left: auto; }
.res-ok { border-left-color: var(--ok); }
.res-aviso { border-left-color: var(--warn); background: var(--warn-soft); }
.res-error { border-left-color: var(--err); background: var(--err-soft); }

.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--ink-2); padding: 8px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab-on { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tab-n { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 9px; background: var(--line-2); font-size: 11px; font-weight: 600; text-align: center; }
.tab-on .tab-n { background: var(--accent-soft); color: var(--accent); }
.tabs-buscar { margin-left: auto; width: 320px; max-width: 100%; height: 30px; margin-bottom: 4px; }

.rec-pendiente { background: #e6eef8; color: #2d5c93; }
.rec-enrevision { background: var(--warn-soft); color: var(--warn); }
.rec-revisado { background: var(--ok-soft); color: var(--ok); }
.rec-convertido { background: var(--accent-soft); color: var(--accent); }
.rec-descartado { background: var(--line-2); color: var(--ink-3); text-decoration: line-through; }

.recepcion { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.documento { padding: 0; overflow: hidden; position: sticky; top: 12px; }
.doc-tabs { margin: 0; padding: 0 10px; overflow-x: auto; flex-wrap: nowrap; }
.doc-barra { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line-2); }
.visor { display: block; width: 100%; height: calc(100vh - 230px); min-height: 480px; border: 0; background: #edf1f6; }
.visor-vacio { padding: 40px 20px; text-align: center; }
.datos { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; padding: 14px; font-size: 13px; }
.datos dt { color: var(--ink-3); }
.datos dd { margin: 0; overflow-wrap: anywhere; }
.cuerpo { margin: 0; padding: 14px; max-height: calc(100vh - 360px); min-height: 300px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: var(--font); font-size: 13px; border-top: 1px solid var(--line-2); }
.prepedido-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.prepedido-head h2 { margin: 0; font-size: 16px; }
.lineas-wrap { overflow-x: auto; margin-bottom: 8px; }
.lineas { width: 100%; border-collapse: collapse; font-size: 13px; }
.lineas th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.lineas td { padding: 3px 4px; vertical-align: middle; }
.lineas .input { height: 30px; min-width: 90px; }
.lineas .l-n { width: 28px; text-align: right; }
.lineas .l-cant, .lineas .l-cant .input { width: 80px; min-width: 70px; }
.lineas .l-cod, .lineas .l-cod .input { width: 120px; }

.selector-cliente { position: relative; color: var(--ink); font-weight: 400; }
.selector-valor { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 34px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 13px; }
.selector-lista { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px); margin: 0; padding: 4px 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.08); max-height: 280px; overflow-y: auto; font-size: 13px; }
.selector-lista li { padding: 6px 10px; cursor: pointer; display: flex; gap: 8px; }
.selector-lista li.marcado, .selector-lista li:hover { background: var(--accent-soft); }
.selector-vacio { padding: 4px 2px; }

.alert-warn { background: var(--warn-soft); color: var(--warn); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.motivo { flex: 1; min-width: 220px; }
.form-actions.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 1100px) {
    .recepcion { grid-template-columns: 1fr; }
    .documento { position: static; }
    .visor { height: 70vh; }
}

/* ===== v6 · Servicios IA ===== */
.ia-estado { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.ia-estado .kpi:hover { border-color: var(--line); }
.ia-estado .kpi-value { font-size: 24px; }
.barra { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; margin-top: 4px; }
.barra > div { height: 100%; background: var(--accent); }
.card-title { font-size: 14px; font-weight: 600; margin: 0; padding: 14px 16px 10px; }
.table-card + .table-card { margin-top: 16px; }
.ia-ayuda { margin-bottom: 16px; }
.ia-ayuda h2 { font-size: 14px; margin: 0 0 6px; }
.ia-ayuda ol { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.7; }
.btn-ia { border-color: var(--accent); color: var(--accent); }
.ia-confirmar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ia-resultado { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; background: #f8fafc; }
.ia-alta { border-left-color: var(--ok); }
.ia-media { border-left-color: var(--warn); }
.ia-baja { border-left-color: var(--err); }
.ia-avisos { margin: 2px 0; padding-left: 18px; color: var(--warn); }

/* ===== v7 · Tablas auxiliares ===== */
.aux-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.aux-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; color: var(--ink); text-decoration: none !important; transition: border-color .15s; }
.aux-card:hover { border-color: var(--accent); }
.aux-titulo { font-weight: 600; }
.aux-n { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; }
.aux-desc { grid-column: span 2; font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.aux-pendiente { margin-top: 24px; }
.breadcrumb { margin: 0 0 4px; font-size: 12px; color: var(--ink-3); }
.breadcrumb a { color: inherit; }
fieldset.sin-borde { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.sin-borde:disabled .input { background: var(--bg); color: var(--ink-2); }

/* ---------- Torre de control BCK (rutas) ---------- */
.bck-import { margin-bottom: 14px; }
.bck-import .dropzone { margin-bottom: 18px; }
.bck-pegar { width: 100%; height: auto; padding: 8px 10px; resize: vertical; min-height: 110px; font-size: 12px; white-space: pre; }
.bck-import-pie { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.bck-espacio { flex: 1; }
.bck-resultado p { margin: 0 0 8px; }
.bck-estados { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 6px; }
.bck-estado { display: flex; flex-direction: column; min-width: 120px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none !important; font-size: 12px; }
.bck-estado:hover { border-color: var(--accent); }
.bck-estado-n { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bck-e-ok { border-color: var(--ok); background: var(--ok-soft); }
.bck-e-sin_ruta, .bck-e-incompleto, .bck-e-sin_serie { border-color: var(--warn); background: var(--warn-soft); }
.bck-filtros { flex-wrap: wrap; gap: 10px; }
.bck-buscar { flex: 1; min-width: 260px; }
.bck-filtros input[type=number] { width: 110px; min-width: 0; }
.bck-quitar { border: 0; background: none; cursor: pointer; color: inherit; font-weight: 700; padding: 0 0 0 4px; }
.bck-tabla { overflow-x: auto; }
.bck-tabla .grid th, .bck-tabla .grid td { white-space: nowrap; }
.bck-corto { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.bck-detalle { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding: 6px 0; white-space: normal; }
.bck-detalle h3 { margin-bottom: 6px; }
.bck-detalle p { margin: 0 0 6px; }
.bck-dl { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 3px 10px; margin: 0; font-size: 12px; }
.bck-dl dt { color: var(--ink-3); }
.bck-dl dd { margin: 0; word-break: break-word; white-space: normal; }
.bck-fases { display: flex; flex-direction: column; gap: 6px; }
.bck-fase-grupo { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.bck-fase-sec { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; width: 100%; }
.bck-filtros-rutas { grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(140px, 1fr)) auto; }
.bck-campos { margin-bottom: 6px; }
.bck-h2 { margin-top: 18px; }
.bck-fases-edit { margin-top: 14px; }
.bck-fases-cab { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.bck-fases-cab h2 { margin: 0; }
.bck-seccion { margin-top: 14px; }
.bck-seccion h3 { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.bck-puestos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.bck-puesto { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 8px; min-height: 36px; }
.bck-puesto label.check { font-size: 13px; }
.bck-puesto-on { border-color: var(--accent); background: var(--accent-soft); }
.bck-tiempo { width: 80px; height: 26px; padding: 0 6px; font-size: 12px; }
@media (max-width: 1100px) {
    .bck-detalle { grid-template-columns: 1fr; }
    .bck-filtros-rutas { grid-template-columns: 1fr 1fr; }
}

/* ---------- Torre de control BCK · rejillas más compactas (16/10) ---------- */
.bck-tabla .grid { font-size: 12px; }
.bck-tabla .grid th { font-size: 11px; padding: 7px 8px; }
.bck-tabla .grid.compact td { padding: 4px 8px; }
.bck-tabla .grid .mono, .bck-tabla .grid td.mono { font-size: 11.5px; }
.bck-tabla .badge { font-size: 10.5px; padding: 1px 7px; }
.bck-tabla .bck-corto { max-width: 160px; }
.bck-buscar-form { display: flex; gap: 8px; flex: 1; min-width: 260px; align-items: center; }
.bck-buscar-form .input { flex: 1; }
.bck-filtros-rutas .bck-buscar-form { min-width: 0; }

/* ---------- Torre de control · programación de órdenes (16/10) ---------- */
.prg-kpis { margin-bottom: 12px; }
.prg-kpi-boton { text-align: left; font: inherit; cursor: pointer; }
.prg-warn { color: var(--warn); font-weight: 600; }
.prg-bloqueadas { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.prg-filtros { align-items: center; }
.prg-tabla th.prg-chk, .prg-tabla td.prg-chk { width: 28px; }
.prg-desc { min-width: 260px; }
.prg-art { max-width: 340px; }
.prg-pila { width: 64px; height: 26px; padding: 0 6px; font-size: 12px; }
.prg-rama { border: 1px solid var(--line); cursor: pointer; background: var(--surface); color: var(--ink-3); text-decoration: line-through; }
.prg-rama-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); text-decoration: none; }
.prg-rama + .prg-rama { margin-left: 4px; }
.prg-detalle { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; white-space: normal; padding: 4px 0; }
.prg-lineas { background: var(--surface); }
.prg-ruta h3 { margin-bottom: 6px; }
.prg-ruta .bck-fase-grupo { margin-bottom: 8px; }
.prg-sub { margin-top: 10px; }
.prg-pasos { margin: 0; padding-left: 20px; font-size: 12px; line-height: 1.6; }
.prg-previa { margin-top: 14px; }
.prg-previa-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.prg-previa-cab h2 { margin: 0; }
.prg-barra { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
@media (max-width: 1100px) { .prg-detalle { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Torre de control · sinóptico POLCA de una OF */
.sn-kpis { margin-bottom: 14px; }
.sn-kpis .kpi-value.small { font-size: 15px; letter-spacing: 0; }
.kpi-err { border-color: var(--err); }
.kpi-err .kpi-value { color: var(--err); }
.badge-err { background: var(--err-soft); color: var(--err); }
.sn-card { padding: 10px 12px 8px; margin-bottom: 18px; }
.sn-scroll { overflow-x: auto; padding-bottom: 4px; }
.sn { display: block; font-family: var(--font); }
.sn text { fill: var(--ink); }
.sn .sn-mono { font-family: var(--mono); font-weight: 600; }
.sn-carril { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; fill: var(--ink-3) !important; }
.sn-sec { fill: var(--line-2); stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 3; }
.sn-sec-aut { stroke: var(--ok); stroke-dasharray: none; }
.sn-sec-actual { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: none; }
.sn-sec-hecho { fill: var(--ok-soft); stroke: var(--ok); stroke-dasharray: none; opacity: .8; }
.sn-sec-tit { font-size: 12.5px; font-weight: 600; }
.sn-sec-sub { font-size: 11px; fill: var(--ink-2) !important; }
.sn-n { stroke-width: 1; fill: var(--surface); stroke: var(--line); }
.sn-n-tit { font-size: 12px; }
.sn-n-sub { font-size: 11px; fill: var(--ink-2) !important; }
.sn-n-hecho { fill: var(--ok-soft); stroke: var(--ok); }
.sn-n-en_curso { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.6; }
.sn-n-retraso { fill: var(--err-soft); stroke: var(--err); }
.sn-n-pendiente { fill: var(--surface); stroke: var(--line); }
.sn-n-espera { fill: var(--warn-soft); stroke: var(--warn); stroke-dasharray: 4 3; }
.sn-bucle, .sn-union { stroke: var(--ink-3); stroke-width: 1.4; }
.sn-bucle-ok { stroke: var(--ok); }
.sn-bucle-sin { stroke: var(--warn); stroke-dasharray: 5 4; }
.sn-bucle-lleno { stroke: var(--err); stroke-width: 2; }
.sn-bucle-cod { font-size: 11px; font-family: var(--mono); font-weight: 600; fill: var(--ink-2) !important; }
.sn-bucle-txt { font-size: 10.5px; fill: var(--ink-2) !important; }
.sn-txt-warn { fill: var(--warn) !important; }
.sn-txt-err { fill: var(--err) !important; font-weight: 600; }
.sn-leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.sn-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.sn-sep { width: 1px; height: 14px; background: var(--line); }
.sn-l { display: inline-block; width: 14px; height: 10px; border-radius: 3px; border: 1px solid var(--line); }
.sn-l.sn-n-hecho { background: var(--ok-soft); border-color: var(--ok); }
.sn-l.sn-n-en_curso { background: var(--accent-soft); border-color: var(--accent); }
.sn-l.sn-n-retraso { background: var(--err-soft); border-color: var(--err); }
.sn-l.sn-n-pendiente { background: var(--surface); }
.sn-l.sn-n-espera { background: var(--warn-soft); border: 1px dashed var(--warn); }
.sn-l-aut { background: var(--line-2); border-color: var(--ok); }
.sn-l-actual { background: var(--accent-soft); border-color: var(--accent); }
.sn-l-sin { height: 0; width: 18px; border: 0; border-top: 2px dashed var(--warn); border-radius: 0; }

/* ---------------------------------------------------------------- Torre de control · lanzamiento */
.lz-kpis { margin-bottom: 14px; }
.lz-nota { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 8px; }
.lz-carga td, .lz-carga th { text-align: right; }
.lz-carga td:first-child, .lz-carga th:first-child { text-align: left; }
.lz-hoy { color: var(--accent); }
.lz-c-ok { background: var(--ok-soft); color: var(--ok); }
.lz-c-warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.lz-c-err { background: var(--err-soft); color: var(--err); font-weight: 600; }
.lz-mas { display: block; font-size: 10px; font-weight: 600; color: var(--accent); }
.lz-imprimir { margin-left: 10px; font-weight: 600; }
.prg-barra-acciones { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
th.chk, td.chk { width: 28px; text-align: center; }

/* ---------------------------------------------------------------- Hojas de ruta (A4, impresora láser) */
.impresion { background: var(--bg); min-height: 100vh; padding: 16px 0 40px; color: #000; }
.hr-barra { position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; align-items: center; justify-content: center; padding: 10px; background: var(--surface); border-bottom: 1px solid var(--line); margin: -16px 0 16px; font-size: 13px; }
.hr-hoja { width: 210mm; min-height: 297mm; box-sizing: border-box; margin: 0 auto 16px; padding: 12mm 12mm 10mm; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); display: flex; flex-direction: column; font-size: 10.5pt; }
.hr-cab { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid #000; padding-bottom: 6px; }
.hr-marca { font-size: 9pt; text-transform: uppercase; letter-spacing: .08em; }
.hr-num { font-size: 22pt; font-weight: 700; font-family: var(--mono); line-height: 1.15; }
.hr-cod { font-family: var(--mono); font-size: 10pt; }
.hr-desc { font-size: 10pt; max-width: 110mm; }
.hr-cb { text-align: center; }
.hr-cb .cb { fill: #000; display: block; }
.hr-cb-txt { font-family: var(--mono); font-size: 9pt; }
.hr-datos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 12px; margin: 8px 0; padding: 6px 0; border-bottom: 1px solid #000; }
.hr-datos div { display: flex; flex-direction: column; }
.hr-datos span { font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; color: #444; }
.hr-grande { font-size: 18pt; }
.hr-union { border: 2px solid #000; padding: 6px 8px; margin: 6px 0; }
.hr-tit { font-size: 10pt; text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 4px; color: #000; }
.hr-tabla { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.hr-tabla th { text-align: left; font-size: 8pt; text-transform: uppercase; border-bottom: 1.5px solid #000; padding: 3px 4px; }
.hr-tabla td { border-bottom: 1px solid #bbb; padding: 5px 4px; vertical-align: top; }
.hr-tabla .num { text-align: right; }
.hr-sec-ini td { border-top: 1.5px solid #000; }
.hr-ok { width: 12mm; text-align: center; }
.hr-caja { display: inline-block; width: 5mm; height: 5mm; border: 1px solid #000; }
.hr-lineas td { padding: 3px 4px; font-size: 8.5pt; }
.hr-pie { margin-top: auto; padding-top: 6px; border-top: 1px solid #000; display: flex; justify-content: space-between; font-size: 8pt; }
@page { size: A4; margin: 0; }
@media print {
    .no-print { display: none !important; }
    .impresion { background: #fff; padding: 0; }
    .hr-hoja { margin: 0; box-shadow: none; page-break-after: always; break-after: page; }
    .hr-hoja:last-child { page-break-after: auto; break-after: auto; }
}

/* ---------------------------------------------------------------- Menú: Torre de control con color propio */
:root { --torre: #3fa39b; --torre-soft: rgba(63,163,155,0.16); --torre-ink: #bfe6e1; }
.nav-section.nav-torre { color: var(--torre); font-weight: 700; }
.nav-item.nav-torre { color: var(--torre-ink); }
.nav-item.nav-torre:hover { background: var(--torre-soft); }
.nav-item.nav-torre.active { background: var(--torre-soft); color: #fff; box-shadow: inset 3px 0 0 var(--torre); }
.nav-item { justify-content: flex-start; }
.nav-item .nav-tag { margin-left: auto; }
.nav-paso { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; font-weight: 700; background: var(--torre); color: #10302d; }
.nav-pending .nav-paso { background: transparent; color: var(--torre); border: 1px solid var(--torre); }
.nav-fin-torre { margin: 12px 10px 0; border-top: 1px solid rgba(63,163,155,0.35); }
.module-torre { border-color: var(--torre) !important; box-shadow: inset 3px 0 0 var(--torre); }
.module-torre h3 { color: var(--torre); }
.sn-n-auto { stroke-dasharray: 3 2; }

/* ---------------------------------------------------------------- Torre de control · estado de pedido */
.ep-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 14px; }
.ep-kpi { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; display: flex; flex-direction: column; gap: 1px; cursor: pointer; font: inherit; color: var(--ink); }
.ep-kpi span { font-size: 12px; color: var(--ink-2); }
.ep-kpi b { font-size: 22px; font-variant-numeric: tabular-nums; }
.ep-kpi small { font-size: 11px; color: var(--ink-3); }
.ep-kpi:hover { border-color: var(--torre, var(--accent)); }
.ep-kpi.on { border-color: var(--torre, var(--accent)); box-shadow: inset 0 -3px 0 var(--torre, var(--accent)); }
.ep-kpi.warn b { color: var(--warn); } .ep-kpi.err b { color: var(--err); }
.ep-campo { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.input-num { width: 70px; }
.ep-tabla td { vertical-align: middle; }
.ep-dias { display: inline-block; min-width: 42px; padding: 2px 8px; border-radius: 10px; font-weight: 700; font-size: 12px; background: var(--line-2); color: var(--ink-2); text-align: center; }
.ep-dias-warn { background: var(--warn-soft); color: var(--warn); }
.ep-dias-err { background: var(--err-soft); color: var(--err); }
.ep-rec { display: inline-flex; gap: 3px; align-items: center; }
.ep-pt { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; }
.ep-pt-hecho { background: #2f8a57; }
.ep-pt-actual { background: #d98a1c; width: 13px; height: 13px; }
.ep-pt-rama { background: #3f7fd1; }
.ep-est-sin_ruta { background: var(--warn-soft); color: var(--warn); }
.ep-est-no_aplica { background: var(--line-2); color: var(--ink-3); }
.ep-est-por_programar { background: #eef0f8; color: #4b5592; }
.ep-est-por_lanzar { background: #e6eef8; color: #2d5c93; }
.ep-est-en_planta { background: var(--torre-soft, var(--accent-soft)); color: #1f6f69; }
.ep-est-terminada { background: var(--ok-soft); color: var(--ok); }
.ep-riesgo { font-size: 11px; font-weight: 700; color: var(--warn); }
.ep-detalle { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; padding: 6px 4px; }
.ep-detalle h3 { font-size: 13px; margin: 4px 0 8px; }
.ep-feed { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; font-size: 12px; }
.ep-feed li { display: grid; grid-template-columns: 82px 44px 1fr auto; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.ep-feed-ok_auto { color: var(--warn); }
.ep-feed-no_existe, .ep-feed-no_lanzada, .ep-feed-fuera_ruta, .ep-feed-puesto { color: var(--err); }
@media (max-width: 1100px) { .ep-detalle { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Torre de control · sinóptico de planta */
.sp-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.sp-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; display: flex; flex-direction: column; color: var(--ink); text-decoration: none !important; }
.sp-kpi span { font-size: 12px; color: var(--ink-2); }
.sp-kpi b { font-size: 24px; font-variant-numeric: tabular-nums; }
.sp-kpi small { font-size: 11px; color: var(--ink-3); }
.sp-kpi.err { border-color: var(--err); } .sp-kpi.err b { color: var(--err); }
.sp-kpi.warn { border-color: var(--warn); } .sp-kpi.warn b { color: var(--warn); }
.sp-card { padding: 10px 12px; margin-bottom: 16px; }
.sp-scroll { overflow-x: auto; }
.sp { display: block; font-family: var(--font); }
.sp text { fill: var(--ink); }
.sp .svg-b { font-weight: 700; font-family: var(--mono); }
.sp-sec-g { cursor: pointer; }
.sp-sec { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; }
.sp-sec-g:hover .sp-sec { stroke: var(--torre, var(--accent)); }
.sp-sec.sp-sel { stroke: var(--torre, var(--accent)); stroke-width: 2.6; }
.sp-cab { fill: #e9eef0; }
.sp-cab.activa { fill: #d7ecea; } .sp-cab.atasc { fill: #f6d4d0; } .sp-cab.lleno { fill: #fbe3c4; } .sp-cab.vacia { fill: #eef1f2; }
.sp-sec.atasc { stroke: var(--err); stroke-width: 1.8; }
.sp-sec.lleno { stroke: var(--warn); }
.sp-sec.vacia { fill: #fafbfb; }
.sp-tit { font-size: 12.5px; font-weight: 600; }
.sp-num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sp-unid { font-size: 11px; fill: var(--ink-3) !important; }
.sp-sub { font-size: 11px; fill: var(--ink-2) !important; }
.sp-barra-f { fill: var(--line-2); }
.sp-barra.ok { fill: #3f9b6a; } .sp-barra.warn { fill: #e2a12f; } .sp-barra.err { fill: var(--err); }
.sp-chip.ok { fill: #3f9b6a; } .sp-chip.err { fill: var(--err); } .sp-chip.warn { fill: #e2a12f; } .sp-chip.gris { fill: #9aa6aa; } .sp-chip.atasc { fill: #7a1e17; }
.sp-chip-txt { font-size: 10.5px; font-weight: 700; fill: #fff !important; }
.sp-hechas { font-size: 10.5px; fill: var(--ok) !important; font-weight: 600; }
.sp-bucle { stroke: #9aa6aa; stroke-width: 1.6; }
.sp-bucle.ok { stroke: #3f9b6a; } .sp-bucle.sin { stroke: #e2a12f; stroke-dasharray: 5 4; } .sp-bucle.lleno { stroke: var(--err); stroke-width: 2.4; }
.sp-bucle-et { fill: #fff; stroke: #9aa6aa; }
.sp-bucle-et.ok { stroke: #3f9b6a; } .sp-bucle-et.sin { stroke: #e2a12f; } .sp-bucle-et.lleno { fill: var(--err-soft); stroke: var(--err); }
.sp-bucle-txt { font-size: 10.5px; font-weight: 700; font-family: var(--mono); }
.sp-leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.sp-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.sp-l { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.sp-l.ok { background: #3f9b6a; } .sp-l.err { background: var(--err); } .sp-l.warn { background: #e2a12f; } .sp-l.gris { background: #9aa6aa; } .sp-l.atasc { background: #7a1e17; }
.sp-detalle-cab { display: flex; align-items: center; gap: 10px; margin: 6px 0 8px; }
.sp-detalle-cab .section-title { margin: 0; flex: 1; }
.sp-est-puede { background: var(--ok-soft); color: var(--ok); }
.sp-est-sin_tarjeta { background: var(--err-soft); color: var(--err); }
.sp-est-espera_rama { background: var(--warn-soft); color: var(--warn); }
.sp-est-no_autorizada { background: var(--line-2); color: var(--ink-2); }

/* ---------------------------------------------------------------- Sinóptico de OF · versión compacta (colores de estado) */
:root { --sn-hecho: #2f8a57; --sn-auto: #8cc7a6; --sn-actual: #e39a1f; --sn-tarde: #c0392b; --sn-pend: #c9d1d4; }
.sn-avance { display: flex; align-items: center; gap: 12px; margin: 2px 0 10px; font-size: 13px; color: var(--ink-2); }
.sn-avance-txt b { color: var(--ink); font-size: 15px; }
.sn-avance-barra { flex: 1; display: flex; gap: 2px; height: 12px; }
.sn-seg { flex: 1; border-radius: 3px; background: var(--sn-pend); }
.sn-seg-hecho { background: var(--sn-hecho); } .sn-seg-auto { background: var(--sn-auto); } .sn-seg-actual { background: var(--sn-actual); }
.sn-seg-tarde { background: var(--sn-tarde); } .sn-seg-espera { background: repeating-linear-gradient(45deg, var(--sn-actual) 0 4px, #f6dfb4 4px 8px); }
.sn .sn-sec { fill: #fff; stroke: var(--line); stroke-width: 1; stroke-dasharray: none; }
.sn .sn-cab { fill: #eef1f2; }
.sn-t-hecho .sn-sec { stroke: var(--sn-hecho); } .sn-t-hecho .sn-cab { fill: var(--sn-hecho); }
.sn-t-actual .sn-sec { stroke: var(--sn-actual); stroke-width: 1.8; } .sn-t-actual .sn-cab { fill: var(--sn-actual); }
.sn-t-tarde .sn-sec { stroke: var(--sn-tarde); stroke-width: 1.8; } .sn-t-tarde .sn-cab { fill: var(--sn-tarde); }
.sn-t-aut .sn-cab { fill: #d7ecea; }
.sn-t-hecho .sn-sec-tit, .sn-t-hecho .sn-sec-est, .sn-t-actual .sn-sec-tit, .sn-t-actual .sn-sec-est,
.sn-t-tarde .sn-sec-tit, .sn-t-tarde .sn-sec-est { fill: #fff !important; }
.sn .sn-sec-tit { font-size: 11.5px; font-weight: 600; }
.sn .sn-sec-est { font-size: 10.5px; font-weight: 700; fill: var(--ink-2); }
.sn .sn-n { stroke-width: 1; fill: #fff; stroke: var(--sn-pend); stroke-dasharray: none; }
.sn .sn-n-tit { font-size: 11px; }
.sn .sn-n-sub { font-size: 10px; }
.sn-g-hecho .sn-n { fill: var(--sn-hecho); stroke: var(--sn-hecho); }
.sn-g-auto .sn-n { fill: var(--sn-auto); stroke: var(--sn-hecho); stroke-dasharray: 3 2; }
.sn-g-actual .sn-n { fill: #fdf0d9; stroke: var(--sn-actual); stroke-width: 2.2; }
.sn-g-tarde .sn-n { fill: var(--sn-tarde); stroke: var(--sn-tarde); }
.sn-g-espera .sn-n { fill: #fdf0d9; stroke: var(--sn-actual); stroke-dasharray: 4 3; stroke-width: 1.6; }
.sn-g-hecho text, .sn-g-tarde text { fill: #fff !important; }
.sn-g-auto text { fill: #10331f !important; }
.sn-g-pend text { fill: var(--ink-3) !important; }
.sn-g-actual .sn-n-sub, .sn-g-espera .sn-n-sub { fill: #8a5600 !important; font-weight: 600; }
.sn-l.sn-l-hecho { background: var(--sn-hecho); border-color: var(--sn-hecho); }
.sn-l.sn-l-auto { background: var(--sn-auto); border: 1px dashed var(--sn-hecho); }
.sn-l.sn-l-actual { background: #fdf0d9; border: 2px solid var(--sn-actual); }
.sn-l.sn-l-tarde { background: var(--sn-tarde); border-color: var(--sn-tarde); }
.sn-l.sn-l-espera { background: #fdf0d9; border: 1px dashed var(--sn-actual); }
.sn-l.sn-l-pend { background: #fff; border-color: var(--sn-pend); }

/* ---------------------------------------------------------------- Órdenes de fabricación: tabla principal y generaciones */
.of-tabla { margin-bottom: 14px; }
.of-tabla td, .of-tabla th { vertical-align: middle; }
th.of-acc-th { text-align: right; }
td.of-acc { white-space: nowrap; text-align: right; width: 1%; }
td.of-acc .btn { height: 26px; padding: 0 8px; font-size: 12px; margin-left: 2px; }
.of-gen { margin-top: 6px; font-size: 12px; }
.of-gen > summary { cursor: pointer; color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 6px 2px; list-style: revert; }
.of-gen > summary .muted { font-weight: 400; }
.of-gen .card { margin-top: 6px; }
.of-gen table.grid { font-size: 11.5px; }
.of-gen table.grid th, .of-gen table.grid td { padding-top: 3px; padding-bottom: 3px; }
.of-gen .btn-sm { height: 22px; padding: 0 7px; font-size: 11px; }

/* ---------------------------------------------------------------- Torre: lecturas y cierres */
.lc-tabla td { vertical-align: middle; }
.lc-res-ok { background: var(--ok-soft); color: var(--ok); }
.lc-res-ok_auto { background: var(--warn-soft); color: var(--warn); }
.lc-res-repetido { background: var(--line-2); color: var(--ink-3); }
.lc-res-no_existe, .lc-res-no_lanzada, .lc-res-fuera_ruta, .lc-res-puesto { background: var(--err-soft); color: var(--err); }
tr.lc-no_existe td, tr.lc-no_lanzada td, tr.lc-fuera_ruta td, tr.lc-puesto td { background: #fff7f6; }

/* ---------------------------------------------------------------- Torre: corrección de ruta (sinóptico de OF) */
.cr-panel { margin: 16px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; }
.cr-panel > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.cr-panel > summary .muted { font-weight: 400; font-size: 12px; }
.cr-cuerpo { padding: 8px 0 4px; display: flex; flex-direction: column; gap: 10px; }
.cr-fila { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cr-lista { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.cr-lista li { display: flex; align-items: center; gap: 8px; }
.cr-lista li .cr-botones { margin-left: auto; display: inline-flex; gap: 2px; }
.cr-lista li .cr-botones .btn { height: 24px; padding: 0 8px; }
.cr-cerrado { color: var(--ink-3); }
.cr-motivo { flex: 1; min-width: 260px; }
.cr-tit { font-size: 13px; margin: 6px 0 0; }
.cr-hist { font-size: 12px; }

/* ---------------------------------------------------------------- Torre: reprocesos y devoluciones */
.rp-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.rp-detalle { padding: 14px 16px; position: sticky; top: 12px; }
.rp-cab { display: flex; align-items: center; justify-content: space-between; }
.rp-cab h3, .rp-nueva h3 { margin: 0 0 8px; font-size: 15px; }
.rp-detalle h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin: 14px 0 6px; }
.rp-datos { display: grid; grid-template-columns: 140px 1fr; gap: 3px 10px; margin: 0; font-size: 13px; }
.rp-datos dt { color: var(--ink-3); }
.rp-datos dd { margin: 0; }
.rp-fotos { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.rp-fotos figure { margin: 0; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.rp-fotos img { width: 110px; height: 82px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.rp-subir { width: 110px; height: 82px; border: 2px dashed var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; color: var(--ink-2); position: relative; }
.rp-subir input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rp-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; }
.rp-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }
.rp-form .rp-ancho { grid-column: span 2; }
.rp-decision { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; font-size: 13px; }
.rp-decision label { display: flex; gap: 6px; align-items: center; }
.rp-decision select { margin-left: 22px; }
.rp-obs { width: 100%; }
.rp-acciones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.rp-nueva { padding: 14px 16px; margin-bottom: 14px; }
.rp-est-declarado { background: var(--warn-soft); color: var(--warn); }
.rp-est-lanzado { background: var(--ok-soft); color: var(--ok); }
.rp-est-sin_defecto { background: #e6eef8; color: #2d5c93; }
.rp-est-anulado { background: var(--line-2); color: var(--ink-3); }
@media (max-width: 1150px) { .rp-grid { grid-template-columns: 1fr; } .rp-detalle { position: static; } }

/* ---------------------------------------------------------------- Torre: analítica */
.an-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.an-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-direction: column; }
.an-kpi span { font-size: 12px; color: var(--ink-2); }
.an-kpi b { font-size: 28px; font-variant-numeric: tabular-nums; }
.an-kpi small { font-size: 11px; color: var(--ink-3); }
.an-ok { color: var(--ok); } .an-warn { color: var(--warn); } .an-err { color: var(--err); }
.an-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.an-card { padding: 12px 16px; }
.an-card h3 { font-size: 13px; margin: 0 0 10px; }
.an-ancho { grid-column: 1 / -1; }
.an-barras { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 6px; }
.an-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.an-col span { font-size: 10px; color: var(--ink-3); }
.an-par { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; border-bottom: 1px solid var(--line); }
.an-b { width: 40%; max-width: 22px; border-radius: 3px 3px 0 0; display: block; min-height: 1px; }
.an-b-l { background: #9fb7c9; } .an-b-t { background: #2f8f88; } .an-b-p { background: #2f8f88; width: 60%; max-width: 30px; }
.an-ley { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.an-ley i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.an-h { position: relative; display: block; height: 10px; background: var(--line-2); border-radius: 5px; min-width: 120px; }
.an-h-v { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.an-h-v.ok { background: #2f8f88; } .an-h-v.err { background: var(--err); }
.an-h-max { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.an-th-barra { width: 34%; }
.an-fila { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 12px; padding: 3px 0; }
.an-et { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.an-v { font-variant-numeric: tabular-nums; color: var(--ink-2); }
@media (max-width: 1100px) { .an-grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- Hoja de ruta: primer destino, OBS y página 2 */
.hr-destino { border: 3px solid #000; padding: 6px 10px; margin: 6px 0; display: flex; flex-direction: column; }
.hr-destino span { font-size: 8.5pt; text-transform: uppercase; letter-spacing: .06em; }
.hr-destino strong { font-size: 18pt; line-height: 1.2; }
.hr-destino em { font-style: normal; font-size: 10pt; }
.hr-obs { border: 1px solid #000; padding: 4px 8px; margin: 4px 0; font-size: 10pt; }
.hr-obs span { font-size: 8pt; text-transform: uppercase; letter-spacing: .05em; margin-right: 6px; }
.hr-aviso { font-size: 9pt; font-style: italic; margin: 8px 0 4px; }
.hr-fallos td { height: 11mm; border: 1px solid #000; }
.hr-fallos th { border: 1px solid #000; }
.hr-fallos th:nth-child(1) { width: 22%; } .hr-fallos th:nth-child(2) { width: 10%; } .hr-fallos th:nth-child(3) { width: 26%; } .hr-fallos th:nth-child(4) { width: 12%; }
.sr-acum { display: inline-block; width: 50px; height: 6px; background: var(--line-2); border-radius: 3px; vertical-align: middle; margin-right: 6px; position: relative; overflow: hidden; } .sr-acum i { position: absolute; left: 0; top: 0; bottom: 0; background: #e2a12f; }

/* ---------------------------------------------------------------- Lanzamiento: carga por puesto (WIP) y lanzadas hoy */
.lz-carga-cab { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 8px; }
.lz-ley { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lz-l { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-left: 6px; }
.lz-l.en, .lz-wip-barra i.en { background: #2f6f8f; }
.lz-l.llega, .lz-wip-barra i.llega { background: #9fc3d6; }
.lz-l.sel, .lz-wip-barra i.sel { background: #e2a12f; }
.lz-ok { color: var(--ok); font-weight: 700; } .lz-warn { color: var(--warn); font-weight: 700; } .lz-err { color: var(--err); font-weight: 700; }
.lz-wip { padding: 10px 14px; margin-bottom: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 6px 22px; }
.lz-wip-sec h4 { font-size: 12px; margin: 6px 0 4px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.lz-wip-fila { display: grid; grid-template-columns: 150px 1fr 62px; gap: 8px; align-items: center; font-size: 12px; padding: 2px 0; }
.lz-wip-nom { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lz-wip-barra { position: relative; height: 12px; background: var(--line-2); border-radius: 3px; display: flex; overflow: visible; }
.lz-wip-barra i { display: block; height: 100%; }
.lz-wip-barra i:first-child { border-radius: 3px 0 0 3px; }
.lz-wip-barra .lim { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.lz-wip-num { text-align: right; font-variant-numeric: tabular-nums; }
.lz-wip-num small { color: var(--ink-3); font-weight: 400; }
.lz-hoy-panel { padding: 10px 14px; margin: 14px 0; }
.lz-hoy-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lz-hoy-cab h3 { font-size: 13px; margin: 0; }
.lz-hoy-lista { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; }

/* ---------------------------------------------------------------- Sinóptico de planta · por puesto */
.sp-vista { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.sp-oculto { display: none; }
.sp-ley-p { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.sp-ley-p .pp { display: inline-block; width: 14px; height: 12px; min-height: 0; padding: 0; border-radius: 3px; margin-left: 6px; }
.pp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; align-items: start; margin-bottom: 16px; }
.pp-mapa { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.pp-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.pp-sec.atasc { border-color: var(--err); }
.pp-sec h4 { margin: 0 0 6px; font-size: 12.5px; display: flex; gap: 6px; align-items: baseline; }
.pp-sec h4 small { margin-left: auto; color: var(--ink-3); font-weight: 400; }
.pp-puestos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 5px; }
.pp { position: relative; text-align: left; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; min-height: 52px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 1px; }
.pp.n0 { background: #f5f7f7; color: var(--ink-3); }
.pp.n1 { background: #d9eef0; border-color: #a9d3d7; }
.pp.n2 { background: #7fc0c6; border-color: #5aa9b0; }
.pp.n3 { background: #2f8f88; border-color: #237069; color: #fff; }
.pp.sel { outline: 3px solid var(--ink); outline-offset: 1px; }
.pp.atasc { box-shadow: inset 0 0 0 2px var(--err); }
.pp-cod { font-family: var(--mono); font-size: 11px; font-weight: 700; }
.pp-nom { font-size: 10.5px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pp-num { position: absolute; right: 6px; top: 4px; font-weight: 800; font-size: 14px; }
.pp-union { position: absolute; right: 5px; bottom: 3px; font-size: 11px; font-weight: 700; color: #8a5600; background: #fdf0d9; border-radius: 8px; padding: 0 5px; }
.pp-feed { padding: 10px 12px; position: sticky; top: 12px; }
.pp-feed h4 { margin: 0 0 8px; font-size: 12.5px; display: flex; justify-content: space-between; }
.pp-vivo { color: var(--ok); font-weight: 600; font-size: 11px; }
.pp-lec { display: grid; grid-template-columns: 40px 42px 1fr; gap: 6px; font-size: 11.5px; padding: 3px 4px; border-bottom: 1px solid var(--line-2); }
.pp-lec.lc-no_existe, .pp-lec.lc-no_lanzada, .pp-lec.lc-fuera_ruta, .pp-lec.lc-puesto { background: #fff1ef; color: var(--err); }
.pp-lec.lc-ok_auto { color: var(--warn); }
@media (max-width: 1100px) { .pp-grid { grid-template-columns: 1fr; } .pp-feed { position: static; } }
.ep-avance { display: inline-block; width: 90px; height: 8px; background: var(--line-2); border-radius: 4px; position: relative; overflow: hidden; vertical-align: middle; } .ep-avance i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ok); } .ep-lineas-ped { font-size: 12px; margin: 4px 0; }

/* Órdenes: que quepan todas las columnas y los botones sin barra horizontal */
.of-tabla table.grid { width: 100%; }
.of-tabla td, .of-tabla th { padding-left: 6px; padding-right: 6px; }
.of-tabla .of-codid { font-size: 11px; word-break: break-all; min-width: 150px; }
.of-tabla .of-desc { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.of-tabla td.of-paso { min-width: 110px; line-height: 1.25; }
.of-tabla .badge { white-space: nowrap; }
td.of-acc .btn { padding: 0 6px; }

/* Lanzamiento: imprimir hojas al lanzar */
.lz-imp-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-right: 8px; cursor: pointer; white-space: nowrap; }

/* Sinóptico de planta: buscador de OF */
.sp-buscar { display: flex; gap: 8px; align-items: center; margin: 4px 0 10px; }
.sp-buscar .input { flex: 1; max-width: 520px; }
.sp-tabla .of-codid { font-size: 11px; word-break: break-all; }
.sp-tabla .of-desc { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sinóptico de la OF: pedidos que agrupa */
.sn-pedidos tr.sn-ped-ini td { border-top: 2px solid var(--line-2); }
.sn-pedidos td[rowspan] { vertical-align: top; background: #f7f9fc; }
.sp-tabla .ep-avance { width: 60px; }

/* Ficha de ruta (BCK): compacta */
.rf-compacta .card { padding: 12px 14px; }
.rf-compacta .card h2 { font-size: 12px; margin: 0 0 6px; }
.rf-compacta .bck-h2 { margin-top: 10px; }
.rf-compacta .fields { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px 8px; }
.rf-compacta .fields > label { grid-column: span 1; font-size: 11px; gap: 2px; }
.rf-compacta .fields > label.f-sm { grid-column: span 2; }
.rf-compacta .fields > label.f-full { grid-column: 1 / -1; }
.rf-compacta .fields label.check { padding-top: 0; font-size: 12px; }
.rf-compacta .input { height: 28px; padding: 0 7px; font-size: 13px; }
.rf-compacta .hint { font-size: 11px; margin: 6px 0 0; }
.rf-compacta .bck-fases-edit { margin-top: 8px; }
.rf-compacta .bck-seccion { margin-top: 8px; }
.rf-compacta .bck-seccion h3 { font-size: 11px; margin-bottom: 3px; }
.rf-compacta .bck-puestos { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px; }
.rf-compacta .bck-puesto { padding: 2px 6px; min-height: 28px; gap: 4px; }
.rf-compacta .bck-puesto label.check { font-size: 12px; gap: 5px; line-height: 1.15; }
.rf-compacta .bck-tiempo { width: 56px; height: 22px; font-size: 11px; padding: 0 4px; flex-shrink: 0; }
.rf-compacta .bck-puesto label.check { min-width: 0; }

/* Lanzamiento · formato con la lista primero y la carga al lado */
.lz-resumen { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }
.lz-resumen b { font-size: 18px; color: var(--ink); margin-right: 3px; font-variant-numeric: tabular-nums; }
.lz-resumen small { color: var(--ink-3); margin-left: 3px; }
.lz-resumen .lz-r-warn b { color: var(--warn); }
.lz-resumen .lz-r-err b { color: var(--err); }
.lz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 12px; align-items: start; }
.lz-principal { min-width: 0; }
.lz-filtros { margin-bottom: 6px; }
.lz-filtros .bck-buscar-form { flex: 1 1 180px; min-width: 160px; }
.lz-filtros .bck-buscar-form .input { width: 100%; min-width: 0; }
.lz-sel-rapida { display: flex; gap: 8px; margin: 0 0 6px; }
.lz-tabla td, .lz-tabla th { padding-left: 6px; padding-right: 6px; }
.lz-tabla table.grid { width: 100%; }
.lz-tabla .of-codid { font-size: 11px; word-break: break-all; min-width: 140px; }
.lz-tabla .of-desc { max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lz-tabla tr.clickable { cursor: pointer; }
.lz-barra { margin-top: 8px; }
.lz-lateral { position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow: auto; }
.lz-panel { padding: 10px 12px; }
.lz-panel-cab { display: flex; justify-content: space-between; align-items: center; }
.lz-panel-cab h3 { font-size: 13px; margin: 0; }
.lz-todos { font-size: 12px; display: inline-flex; gap: 4px; align-items: center; color: var(--ink-2); cursor: pointer; }
.lz-panel .lz-ley { font-size: 11px; margin: 4px 0 6px; gap: 3px; }
.lz-panel .lz-l { width: 10px; height: 8px; margin-left: 4px; }
.lz-panel-nota { font-size: 11px; color: var(--ink-3); margin: 0 0 4px; }
.lz-panel h4 { font-size: 11px; margin: 8px 0 2px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.lz-panel .lz-wip-fila { grid-template-columns: 118px 1fr 44px; gap: 5px; font-size: 11px; padding: 0; line-height: 1.35; }
.lz-panel .lz-wip-barra { height: 10px; }
.lz-ver-secc { margin-top: 10px; width: 100%; }
details.lz-hoy-panel > summary { list-style: none; cursor: pointer; }
details.lz-hoy-panel > summary::-webkit-details-marker { display: none; }
details.lz-hoy-panel > summary h3::before { content: "▸ "; color: var(--ink-3); }
details.lz-hoy-panel[open] > summary h3::before { content: "▾ "; }
@media (max-width: 1250px) { .lz-layout { grid-template-columns: 1fr; } .lz-lateral { position: static; max-height: none; } }

/* Lanzamiento · ajuste fino */
.lz-filtros { gap: 6px; flex-wrap: wrap; }
.lz-filtros .seg { font-size: 13px; padding: 5px 10px; }
.lz-filtros .input { height: 32px; font-size: 13px; }
.lz-sel-rapida .btn { font-size: 12px; }
.lz-tabla table.grid { table-layout: auto; font-size: 13px; }
.lz-tabla td, .lz-tabla th { padding-top: 5px; padding-bottom: 5px; }
.lz-tabla .of-codid { font-size: 11px; min-width: 120px; max-width: 250px; }
.lz-tabla .of-desc { max-width: 250px; }
.lz-tabla td.of-acc { width: 1%; }
.lz-links { font-size: 11px; }
.lz-links a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); }
.lz-links a:hover { color: var(--accent); }
.lz-barra { padding: 8px 12px; }
.lz-barra .btn { height: 32px; font-size: 13px; }
.lz-panel .lz-wip-nom { font-size: 11px; }
.lz-panel h4 { margin-top: 6px; }
.lz-panel-cab h3 { font-size: 12px; }

/* Líneas bd: tabla compacta */
.ln-tabla table.grid { font-size: 12px; width: 100%; }
.ln-tabla td, .ln-tabla th { padding: 4px 6px; }
.ln-tabla th { font-size: 11px; }
.ln-tabla .bck-corto { max-width: 150px; }
.ln-tabla td.mono.small { font-size: 11px; }
.ln-tabla .badge { font-size: 10px; padding: 1px 6px; }
.ln-obs { margin-left: 3px; }
.ln-aviso { font-size: 12px; margin-bottom: 8px; }

/* Hoja de ruta: puertas con observación destacadas */
.hr-datos span.hr-conobs, .hr-conobs { display: inline-block; letter-spacing: 0; text-transform: none; line-height: 1.2; margin-left: 10px; padding: 1px 8px; border: 2px solid #c0141b; color: #c0141b; font-size: 13pt; font-weight: 800; vertical-align: middle; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.hr-obs { border: 2px solid #c0141b; font-size: 13pt; font-weight: 700; }
.hr-obs span { display: block; color: #c0141b; font-weight: 800; margin-bottom: 2px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.hr-lineas tr.hr-linea-obs td { border-top: 2px solid #000; border-bottom: 2px solid #000; }
.hr-lineas td.hr-obs-cel { font-size: 13pt; font-weight: 800; }

/* Observaciones y ruta */
.obs-edicion { margin: 8px 0 14px; padding: 12px 14px; border-color: var(--accent); }
.obs-edicion h3 { font-size: 13px; margin: 0 0 8px; }
.obs-tabla table.grid { font-size: 12px; width: 100%; }
.obs-alt { font-size: 11px; margin: 1px 3px 1px 0; display: inline-block; }
.obs-acc-anadir { background: var(--ok-soft); color: var(--ok); }
.obs-acc-quitar { background: var(--err-soft); color: var(--err); }
.obs-acc-revisar { background: var(--warn-soft); color: var(--warn); }
.obs-rechazadas { margin-top: 14px; }
.obs-rechazadas summary { cursor: pointer; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.prg-obs { display: inline-block; margin: 2px 4px 0 0; font-size: 10px; }

/* Programación: observaciones a la vista */
tr.prg-con-obs > td:first-child { box-shadow: inset 3px 0 0 #c0141b; }
.prg-obs-txt { margin-top: 3px; font-size: 11px; color: #a31218; background: #fdeeee; border-radius: 4px; padding: 2px 6px; max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.prg-obs-txt b { font-weight: 700; }
tr.prg-linea-obs td { background: #fff6f6; }
td.prg-obs-cel { color: #a31218; font-weight: 700; }
.prg-obs-aviso { color: #a31218; font-weight: 600; }
.prg-solo-obs { color: #a31218; }

/* Estado de pedido: reparto de puertas por estado y pedido parcial */
.ep-reparto { display: inline-flex; width: 120px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--line-2); vertical-align: middle; margin-right: 6px; gap: 1px; }
.ep-reparto i { display: block; height: 100%; }
.ep-rp-sin_ruta { background: #d9a13b; }
.ep-rp-por_programar { background: #a9b0d6; }
.ep-rp-por_lanzar { background: #4f6fb5; }
.ep-rp-en_planta { background: #45a3c9; }
.ep-rp-terminada { background: #2f8a57; }
.ep-parcial { background: #fff4e0; color: #9a5b00; border: 1px solid #e8c48a; margin-left: 3px; }

.ep-leyenda { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 2px 0 8px; font-size: 12px; color: var(--ink-2); }
.ep-leyenda-tit { font-weight: 600; color: var(--ink); margin-right: 2px; }
.ep-ley-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ep-ley-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ep-ley-nota { color: var(--ink-3); }
.ep-pct { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; display: inline-block; min-width: 30px; }
.ep-pct-ok { color: var(--ok); font-weight: 600; }

/* Lanzamiento · propuesta de hoy */
.lz-propuesta { background: #f6f9fd; border: 1px solid #e8d6c2; border-radius: 8px; padding: 8px 12px; margin: 0 0 8px; font-size: 13px; }
.lz-prop-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.lz-prop-cab .btn { margin-left: auto; }
.lz-propuesta summary { cursor: pointer; color: var(--ink-2); margin-top: 4px; }
.lz-prop-fuera { margin: 4px 0 0 18px; padding: 0; font-size: 12px; columns: 2; column-gap: 24px; }
.lz-prop-fuera li { break-inside: avoid; margin: 1px 0; }
@media (max-width: 900px) { .lz-prop-fuera { columns: 1; } }

/* Hoja WIP: reimpresión de una OF en curso con su avance */
.hr-wip { display: inline-block; white-space: nowrap; margin: 2px 0 4px; padding: 2px 8px; border: 2px solid #000; font-size: 10pt; font-weight: 800; letter-spacing: .04em; }
.hr-tabla tr.hr-hecho td { color: #555; }
.hr-tabla tr.hr-actual td { font-weight: 700; border-top: 2px solid #000; border-bottom: 2px solid #000; background: #f2f2f2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.hr-aqui { margin-right: 4px; }
.hr-operario { font-size: 8.5pt; }
.hr-caja-ok, .hr-caja-auto { text-align: center; line-height: 5mm; font-weight: 800; font-size: 9pt; }
.hr-caja-ok { background: #000; color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* ---------------------------------------------------------------- Torre · sinóptico: recomendación IA */
.sp-ia { padding: 12px 14px; margin-bottom: 14px; border-left: 4px solid var(--torre); }
.sp-ia-verde { border-left-color: var(--ok); }
.sp-ia-ambar { border-left-color: #d08a1e; }
.sp-ia-rojo { border-left-color: var(--err); }
.sp-ia-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sp-ia-tit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp-ia-tit strong { font-size: 15px; }
.sp-ia-ico { color: var(--torre); font-size: 16px; }
.sp-ia-salud { font-weight: 600; }
.badge.sp-ia-salud-verde { background: var(--ok-soft); color: var(--ok); }
.badge.sp-ia-salud-ambar { background: var(--warn-soft); color: var(--warn); }
.badge.sp-ia-salud-rojo { background: var(--err-soft); color: var(--err); }
.sp-ia-vacia { margin: 8px 0 0; }
.sp-ia-resumen { margin: 10px 0 8px; font-size: 14px; line-height: 1.45; max-width: 1100px; }
.sp-ia-acciones { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sp-ia-accion { display: grid; grid-template-columns: 58px 1fr; gap: 10px; align-items: start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.sp-ia-prio { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 999px; padding: 3px 0; }
.sp-ia-p1 .sp-ia-prio { background: var(--err); color: #fff; }
.sp-ia-p2 .sp-ia-prio { background: var(--warn-soft); color: var(--warn); }
.sp-ia-p3 .sp-ia-prio { background: var(--line-2); color: var(--ink-2); }
.sp-ia-p1 { border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
.sp-ia-linea { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.sp-ia-tipo { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.sp-ia-sec { font: inherit; font-size: 12px; font-weight: 600; border: 1px solid var(--torre); color: var(--torre); background: transparent; border-radius: 999px; padding: 0 8px; cursor: pointer; }
.sp-ia-sec:hover { background: var(--torre-soft); }
.sp-ia-motivo { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.sp-ia-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.sp-ia-meta > span:first-child { margin-right: 4px; }
.sp-ia-of { font-size: 11px; background: var(--line-2); border-radius: 4px; padding: 1px 6px; color: var(--ink); }
a.sp-ia-of:hover { background: var(--accent-soft); color: var(--accent); }
.sp-ia-datos { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.sp-ia-datos summary { cursor: pointer; }
.sp-ia-datos ul { margin: 6px 0 0 18px; padding: 0; }
.sp-ia-pie { margin: 8px 0 0; font-size: 11px; color: var(--ink-3); }
@media (max-width: 640px) { .sp-ia-accion { grid-template-columns: 1fr; } .sp-ia-prio { justify-self: start; padding: 2px 10px; } }

/* ---------------------------------------------------------------- Torre · dimensionar tarjetas POLCA */
.tp-acciones { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.tp-tabla td { vertical-align: middle; }
.tp-chk { width: 28px; text-align: center; }
.tp-marcada td { background: var(--accent-soft); }
.tp-input { width: 72px; text-align: right; padding: 3px 6px; font-variant-numeric: tabular-nums; }
.tp-distinta { border-color: var(--warn); background: var(--warn-soft); font-weight: 600; }
.tp-lleno { color: var(--err); font-weight: 700; }
.tp-fuente { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; padding: 0 4px; border-radius: 3px; margin-left: 2px; }
.tp-real { background: var(--ok-soft); color: var(--ok); }
.tp-plan { background: var(--line-2); color: var(--ink-2); }
.tp-defecto { background: var(--warn-soft); color: var(--warn); }
.badge.tp-nuevo { background: var(--warn-soft); color: var(--warn); margin-left: 4px; }
.tp-calculo { font-variant-numeric: tabular-nums; }
.tp-nota { margin-top: 8px; }

/* ---------------------------------------------------------------- Torre · sinóptico por puesto: WIP de cada fase */
.pp-wip { display: block; height: 4px; border-radius: 2px; background: rgba(0,0,0,.10); margin-top: auto; overflow: hidden; }
.pp-wip i { display: block; height: 100%; border-radius: 2px; }
.pp-wip.ok i { background: var(--ok); }
.pp-wip.warn i { background: #d08a1e; }
.pp-wip.err i { background: var(--err); }
.pp.n3 .pp-wip { background: rgba(255,255,255,.35); }
.pp-wip-ley { display: inline-flex; gap: 2px; margin-left: 6px; }
.pp-wip-ley i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; }
.pp-wip-ley .ok { background: var(--ok); } .pp-wip-ley .warn { background: #d08a1e; } .pp-wip-ley .err { background: var(--err); }

/* ---------------------------------------------------------------- Torre · sinóptico por sección: detalle por fase */
.sp .sp-fase-sep { stroke: var(--line); stroke-width: 1; }
.sp-fase-g { cursor: pointer; }
.sp .sp-fase-bg { fill: transparent; }
.sp-fase-g:hover .sp-fase-bg { fill: var(--line-2); }
.sp-fase-g.on .sp-fase-bg { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1; }
.sp text.sp-fase-cod { font-family: var(--mono); font-size: 9.5px; font-weight: 700; fill: var(--ink-2); }
.sp text.sp-fase-nom { font-size: 10px; fill: var(--ink-2); }
.sp text.sp-fase-num { font-size: 10.5px; font-weight: 700; fill: var(--ink); font-variant-numeric: tabular-nums; }
.sp-fase-g.atasc text.sp-fase-cod, .sp-fase-g.atasc text.sp-fase-num { fill: #7a1f1a; }
.sp-fase-g.atasc .sp-fase-bg { fill: rgba(163,53,43,.08); }
.sp .sp-fase-wip-f { fill: var(--line-2); }
.sp .sp-fase-wip.ok { fill: var(--ok); }
.sp .sp-fase-wip.warn { fill: #d08a1e; }
.sp .sp-fase-wip.err { fill: var(--err); }
.sp text.sp-fase-mas { font-size: 9.5px; fill: var(--ink-3); font-style: italic; }

/* ---------------------------------------------------------------- Torre · ayuda del método */
.ay-guia { padding: 20px 26px; max-width: 920px; line-height: 1.55; }
.ay-guia h2 { font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 0 0 10px; }
.ay-guia h3 { font-size: 15px; margin: 22px 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--torre, var(--accent)); }
.ay-guia h4 { font-size: 13.5px; margin: 14px 0 4px; color: var(--accent); }
.ay-guia p, .ay-texto p { margin: 0 0 8px; }
.ay-guia ul, .ay-guia ol, .ay-texto ul, .ay-texto ol { margin: 2px 0 10px 20px; padding: 0; }
.ay-guia li, .ay-texto li { margin: 2px 0; }
.ay-guia li.sub, .ay-texto li.sub { list-style: none; margin-left: 16px; }
.ay-guia li.sub.cont, .ay-texto li.sub.cont { margin-left: 0; }
.ay-guia code, .ay-texto code { font-family: var(--mono); font-size: 12px; background: var(--line-2); padding: 0 4px; border-radius: 3px; }
.ay-pie { margin-top: 18px; font-size: 12px; color: var(--ink-3); }
.ay-chat { max-width: 920px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ay-vacio { padding: 14px 16px; }
.ay-vacio-tit { font-weight: 600; margin: 0 0 8px; }
.ay-grupo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.ay-grupo > span { width: 120px; font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.ay-chip { font: inherit; font-size: 13px; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.ay-chip:hover:not(:disabled) { border-color: var(--torre, var(--accent)); background: var(--torre-soft, var(--accent-soft)); }
.ay-pregunta { display: flex; justify-content: flex-end; }
.ay-pregunta span { background: var(--accent); color: var(--accent-ink); border-radius: 14px 14px 4px 14px; padding: 7px 12px; max-width: 80%; white-space: pre-wrap; }
.ay-respuesta { padding: 12px 16px; border-left: 4px solid var(--torre, var(--accent)); line-height: 1.5; }
.ay-pensando { color: var(--ink-3); font-style: italic; }
.ay-casos { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); }
.ay-pantallas, .ay-sigue { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ay-entrada { max-width: 920px; display: flex; gap: 8px; padding: 8px; position: sticky; bottom: 8px; }
.ay-entrada .input { flex: 1; }
.ay-aviso { max-width: 920px; font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
@media (max-width: 640px) { .ay-grupo > span { width: 100%; } .ay-entrada { flex-wrap: wrap; } }

/* ---------------------------------------------------------------- Torre · lanzamiento: carga por fase y día */
.lz-carga-sec td { background: var(--line-2); font-weight: 600; font-size: 12px; padding-top: 5px; padding-bottom: 5px; }
.lz-carga-fase { padding-left: 18px !important; }
.lz-carga-todas { display: inline-flex; gap: 6px; align-items: center; margin: 0 0 6px; font-size: 12.5px; }

/* ---------------------------------------------------------------- Ficha de ruta: puestos agrupados por fase definitiva */
.bck-fases-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.bck-fase { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 8px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.bck-fase-on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.bck-fase-cab { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.bck-fase-nom { color: var(--ink-2); }
.bck-fase-si { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--accent); }
.bck-fase-sub { font-size: 11px; color: var(--ink-3); }
.bck-fase .bck-puesto { min-height: 30px; padding: 3px 6px; }
.bck-fase-duda { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: var(--warn-soft); color: var(--warn); font-size: 10px; font-weight: 700; margin-left: 4px; cursor: help; }
.rf-compacta .bck-fases-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }

/* ---------------------------------------------------------------- Órdenes de fabricación: sin scroll horizontal */
.of-tabla .of-cod-td { width: 40%; }
.of-tabla .of-codid { min-width: 0; }
.of-tabla .of-desc { max-width: none; }
.of-tabla .of-cod-td .of-desc { max-width: 100%; display: block; }
.of-tabla td.of-fechas div { line-height: 1.35; }
.of-tabla td.of-paso { min-width: 90px; }
.of-tabla td.of-acc { width: 1%; white-space: nowrap; }
.of-tabla td.of-acc .btn { display: flex; width: 100%; justify-content: center; margin: 0 0 3px; height: 24px; }
.of-tabla td.of-acc .btn:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- maestro de rutas por ramas (formato nuevo, en verde) */
.mr-verde, tr.mr-verde > td { background: var(--ok-soft) !important; }
tr.mr-verde > td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
.mr-verde-txt { background: var(--ok-soft); color: var(--ok); padding: 0 6px; border-radius: 4px; font-weight: 600; }
.mr-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 9px; background: var(--ok); color: #fff; font-size: 11px; font-weight: 600; font-family: inherit; vertical-align: middle; }
a.mr-tag:hover { color: #fff; opacity: .85; }
.mr-click { cursor: pointer; }
.mr-desc { white-space: normal; max-width: 420px; }
.mr-cab { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-left: 4px solid var(--ok); margin-bottom: 12px; }
.mr-cod { font-size: 15px; margin-bottom: 2px; }
.mr-cab-num { display: flex; gap: 14px; flex-wrap: wrap; white-space: nowrap; }
.mr-cab-num b { font-size: 18px; }
.mr-ramas { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; margin-bottom: 12px; }
.mr-rama-0 { grid-column: 1 / -1; }
.mr-rama-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.mr-rama-n { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; font-weight: 700; font-size: 12px; align-items: center; justify-content: center; }
.mr-pasos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.mr-pasos li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }
.mr-pasos li.mr-sup { border-style: dashed; background: transparent; }
.mr-pasos li.mr-cond { border-color: var(--warn); }
.mr-pasos li.mr-previa { border-color: var(--warn); background: var(--warn-soft); }
.mr-paso-n { min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12px; }
.mr-sup-ico { color: var(--accent); font-size: 14px; }
.mr-sec { font-size: 11px; }
.mr-nota { flex-basis: 100%; padding-left: 38px; }
.mr-analisis { margin-bottom: 12px; }
.mr-analisis-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 8px; }
.mr-analisis-cab h2 { margin: 0; font-size: 15px; }
.mr-n-ok b { color: var(--ok); }
.mr-n-err b, .mr-err { color: #b3261e; }
tr.mr-fila-err > td { background: #fdecea; }
.mr-aviso-ficha { border-left: 4px solid var(--ok); color: var(--ok); }
.hr-sumi { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; border: 1.5px dashed #555; border-radius: 4px; padding: 5px 8px; margin: 6px 0; font-size: 11px; }
.hr-sumi > span:first-child { font-weight: 700; }
/* sinóptico de la ruta (maestro por ramas) */
.mr-sinoptico { margin-bottom: 12px; }
.mr-sin-cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.mr-sin-cab h2 { margin: 0; font-size: 15px; }
.dr-wrap { overflow-x: auto; padding-bottom: 4px; }
.dr { display: block; font-family: inherit; }
.dr text { fill: var(--ink, #24201c); }
.dr-rama { font-size: 11.5px; font-weight: 700; fill: var(--ink-2) !important; }
.dr-flecha { stroke: #666; stroke-width: 1.4; }
.dr-union { fill: none; stroke: #2f7a4b; stroke-width: 1.8; stroke-dasharray: 5 3; }
.dr-n rect:first-of-type { stroke-width: 1.4; }
.dr-sup rect:first-of-type { stroke-dasharray: 5 3; stroke-width: 1.6; }
.dr-cond rect:first-of-type { stroke-dasharray: 4 3; stroke-width: 2; }
.dr-fuera text { fill: #999 !important; }
.dr-previa rect:first-of-type { stroke: #9a5b00; stroke-width: 2; }
.dr-sec { font-size: 9.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; fill: var(--ink-2) !important; }
.dr-num { font-size: 10px; fill: var(--ink-2) !important; font-variant-numeric: tabular-nums; }
.dr-cod { font-size: 13px; font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
.dr-nom { font-size: 11px; }
.dr-tag { font-size: 10px; font-weight: 700; fill: #9a5b00 !important; }
.dr-vuelve { fill: #3d6b99 !important; }
.dr-nota { font-size: 10px; fill: #2f7a4b !important; font-weight: 600; }
.dr-leyenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--ink-2); margin-top: 6px; }
.dr-leyenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.dr-leyenda i.dr-ley-sup { border: 1.6px dashed #1f5f9e; background: #fff; }
.dr-leyenda i.dr-ley-cond { border: 2px dashed #9a5b00; background: #fff; }
/* maestro de rutas: mantenimiento, duplicar y editor con arrastrar y soltar */
.mr-botones { flex-wrap: nowrap; white-space: nowrap; }
.mr-desc { font-family: inherit; white-space: normal; max-width: 460px; }
.mr-filtros { margin-bottom: 10px; }
.mr-filtros input[type=search] { min-width: 280px; }
.mr-cab-der { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.mr-acciones { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.mr-modal { position: fixed; inset: 0; background: rgba(20, 16, 12, .45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.mr-modal-caja { width: min(620px, 100%); display: flex; flex-direction: column; gap: 8px; }
.mr-modal-caja h2 { margin: 0; }
.mr-campo { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; }
.mr-modal-pie { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.ed-cab { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 12px; }
.ed-cab label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.ed-f-cod { min-width: 300px; }
.ed-f-desc { flex: 1 1 320px; }
.ed-f-sm { width: 180px; }
.ed-f-xs { width: 110px; }
.ed-cod { font-size: 15px; color: var(--ink, #24201c); padding: 6px 0; }
.ed-cab-info { flex-basis: 100%; }
.ed { display: grid; grid-template-columns: 270px 1fr; gap: 12px; align-items: start; }
@media (max-width: 1000px) { .ed { grid-template-columns: 1fr; } }
.ed-paleta { position: sticky; top: 10px; max-height: calc(100vh - 40px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.ed-pal-grupo { display: flex; flex-direction: column; gap: 3px; }
.ed-pal-tit { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin-top: 4px; color: var(--ink-2); }
.ed-pal-f1 { font-size: 10px; background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 0 5px; margin-left: 4px; text-transform: none; }
.ed-pal { border: 1px solid var(--line); border-left: 4px solid #999; border-radius: 6px; padding: 3px 7px; font-size: 12px; cursor: grab; user-select: none; display: flex; gap: 6px; align-items: baseline; }
.ed-pal:hover { outline: 2px solid var(--accent-soft); }
.ed-pal-sup { background: #fff; border-style: dashed; border-left: 4px dashed #1f5f9e; }
.ed-ramas { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ed-rama { padding: 10px 12px; border: 1.5px solid var(--line); }
.ed-rama-activa { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ed-rama-cab { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.ed-rama-cab label { display: flex; gap: 5px; align-items: center; }
.ed-rama-nom { width: 210px; font-weight: 600; }
.ed-num { width: 64px; }
.ed-criterio { width: 240px; }
.ed-quitar-rama { margin-left: auto; }
.ed-carril { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; row-gap: 8px; min-height: 64px; }
.ed-hueco { width: 10px; border-radius: 4px; }
.ed-hueco-on { background: var(--accent); width: 14px; }
.ed-paso { position: relative; width: 132px; min-height: 58px; border: 1.5px solid #999; border-left-width: 5px; border-radius: 7px; padding: 4px 7px; font-size: 12px; cursor: grab; user-select: none; display: flex; flex-direction: column; gap: 1px; }
.ed-paso-sup { border-style: dashed; border-left-style: dashed; }
.ed-paso-cond { outline: 2px dashed #9a5b00; outline-offset: 1px; }
.ed-paso-sel { box-shadow: 0 0 0 3px var(--accent); }
.ed-paso-n { position: absolute; top: 3px; right: 6px; font-size: 10px; color: var(--ink-2); }
.ed-paso-nom { font-size: 11px; color: var(--ink-2); }
.ed-paso-tag { font-size: 10px; font-weight: 700; color: #9a5b00; }
.ed-paso-union { font-size: 10px; font-weight: 700; color: var(--ok); }
.ed-final { flex: 1 1 140px; min-width: 140px; margin-left: 10px; border: 1.5px dashed var(--line); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--ink-2); padding: 6px; }
.ed-final.ed-hueco-on { background: var(--accent-soft); border-color: var(--accent); width: auto; color: var(--accent); }
.ed-pie-ramas { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.ed-papelera { flex: 1; border: 1.5px dashed var(--line); border-radius: 7px; padding: 6px 10px; font-size: 12px; color: var(--ink-2); display: flex; align-items: center; }
.ed-papelera-on { border-color: #b3261e; color: #b3261e; background: #fdecea; }
.ed-props { border: 1.5px solid var(--accent); }
.ed-props-cab { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.ed-props-campos { display: flex; flex-wrap: wrap; gap: 10px; }
.ed-props-campos label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--ink-2); width: 190px; }
.ed-props-campos label.ed-props-notas { flex: 1 1 260px; }
.ed-ayuda { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
@media (max-width: 1000px) { .ed-ayuda { grid-template-columns: 1fr; } }
.ed-ayuda h2 { margin: 0 0 6px; font-size: 15px; }
.ed-ayuda p { margin: 0 0 4px; }
/* lanzamiento: periodo, autorización por fecha y capacidad, observaciones y ayuda al lanzamiento */
.lz-fecha { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.lz-fecha .input { height: 32px; font-size: 13px; }
.lz-ayuda { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lz-max { width: 80px; height: 28px; font-size: 13px; }
.lz-obs { background: #fdecea; color: #b3261e; font-weight: 700; margin-top: 2px; }
.lz-cap .badge { white-space: nowrap; }
/* programación: pila general y separación por madera y ancho */
.prg-pilas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 8px; }
.prg-pilas label { display: inline-flex; align-items: center; gap: 6px; }
.prg-sep { display: flex; gap: 4px; margin: 2px 0; }
.prg-sep .chip { font-size: 10.5px; padding: 0 6px; }


/* ---------- Opciones del menú por perfil y usuario (seguridad) ---------- */
.menu-permisos { display: grid; gap: 14px; }
.menu-permisos .card { padding: 12px 14px; }
.mp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.mp-head h2 { margin: 0; }
.menu-permisos .segmented .seg { height: 28px; padding: 0 10px; font-size: 13px; }
.mp-ajustada td { background: var(--accent-soft); }
.menu-permisos td .check { display: inline-flex; align-items: center; gap: 8px; }
.mp-enlace { margin-top: 12px; }

/* ---------- Entrada de pedidos: clasificación, pedido formal, codificador (31/10/2026) ---------- */
.filtros-entrada { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0 0 12px; }
.filtros-entrada label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }
.filtros-entrada .input { min-width: 170px; }
td.clasif .chip, td.clasif .badge { margin: 0 4px 3px 0; }
.clasif-propuesta .chip { opacity: .75; font-style: italic; }
.chip-tipo { background: #e6eef8; color: #2d5c93; }
.tipo-anul { background: var(--err-soft); color: var(--err); }
.tipo-modif { background: var(--warn-soft); color: var(--warn); }
.tipo-reclam { background: var(--err-soft); color: var(--err); }
.tipo-consulta { background: var(--line-2); color: var(--ink-2); }
.clasificacion { margin-bottom: 14px; }
.clasificacion.clasif-propuesta { border-left: 3px solid var(--warn); }
.clasif-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.clasif-head h2 { margin: 0; }
.etiquetas { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.etiquetas .check { display: inline-flex; align-items: center; gap: 6px; }

.ped-borrador { background: #e6eef8; color: #2d5c93; }
.ped-precio { background: var(--warn-soft); color: var(--warn); }
.ped-revisado { background: var(--ok-soft); color: var(--ok); }
.ped-confirmado { background: var(--accent-soft); color: var(--accent); }
.ped-cerrado { background: var(--line-2); color: var(--ink-2); }
.ped-anulado { background: var(--line-2); color: var(--ink-3); text-decoration: line-through; }
.ped-pasos { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 14px; }
.ped-paso { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 12px; background: var(--line-2); color: var(--ink-3); }
.ped-paso.hecho { background: var(--ok-soft); color: var(--ok); }
.ped-paso.actual { background: var(--accent); color: #fff; }
.ped-acciones { margin-left: auto; }
.confirmacion { margin-bottom: 14px; border-left: 3px solid var(--accent); }
.confirmacion .button-row { margin: 8px 0; }
a.btn.disabled { pointer-events: none; opacity: .5; }
.ped-lineas td { vertical-align: top; }
.ped-lineas .input.num { width: 84px; }
.codificador-fila > td { background: var(--accent-soft); }
.codificador { padding: 8px 4px; display: grid; gap: 6px; }
.codificador .fields { margin: 0; }
.codificador label .muted { display: block; margin-top: 2px; }
.cod-resultado { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 6px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.cod-resultado .mono { word-break: break-all; }
@media (max-width: 720px) {
    .ped-acciones { margin-left: 0; width: 100%; }
    .filtros-entrada .input { min-width: 140px; }
}
.ped-comprobado { background: #e8f1ec; color: #2f6b4f; }

/* ======================================================================
   Mesa de trabajo de la entrada (Pedidos recibidos › ficha) · 31/10/2026
   Pantalla de uso diario: ancho completo, documento grande y fijo, cabecera
   compacta, líneas con sitio para leer y acciones siempre visibles.
   ====================================================================== */
.content:has(.mesa) { max-width: none; padding: 12px 18px 16px; }
.mesa { display: flex; flex-direction: column; gap: 10px; }

.mesa-cab { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 38px; }
.mesa-cab .back { font-size: 22px; line-height: 1; text-decoration: none; color: var(--ink-2); padding: 0 4px; }
.mesa-num { font-size: 18px; font-weight: 700; color: var(--ink); }
.mesa-asunto { flex: 1 1 200px; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mesa-modo { margin-left: auto; }
.mesa-modo .seg { height: 30px; font-size: 13px; }

/* Clasificación en una franja */
.clasif-franja { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.clasif-franja.clasif-propuesta { border-left: 4px solid var(--warn); background: linear-gradient(90deg, var(--warn-soft), var(--surface) 40%); }
.clasif-titulo { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.clasif-franja select.input { height: 32px; width: auto; min-width: 150px; max-width: 230px; }
.clasif-franja .clasif-destino { font-weight: 600; }
.clasif-ped { height: 32px; width: 130px; }
.clasif-etiquetas { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.etq { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 14px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.etq:hover { border-color: var(--accent); }
.etq-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.etq-urg.etq-on { background: var(--err-soft); border-color: var(--err); color: var(--err); }
.clasif-mas { flex-basis: 100%; display: flex; gap: 8px; }
.clasif-mas .input { height: 32px; }
.clasif-mas .input:first-child { width: 200px; flex: none; }
.clasif-mas .input:last-child { flex: 1; }
.ok-text { color: var(--ok); }
.err-text { color: var(--err); }

/* Reparto documento / prepedido (botones ◧ ◫ ◨, se recuerda en el navegador) */
.mesa-grid { display: grid; gap: 14px; align-items: start; }
.mesa-eq .mesa-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.mesa-doc .mesa-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.mesa-lin .mesa-grid { grid-template-columns: minmax(0, .7fr) minmax(0, 1.5fr); }

.mesa .documento { position: sticky; top: 8px; height: calc(100vh - 120px); min-height: 520px; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.mesa .doc-tabs { flex: none; }
.mesa .doc-barra { flex: none; padding: 6px 12px; }
.mesa .doc-nombre { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mesa .visor { flex: 1; height: auto; min-height: 0; }
.mesa .doc-correo { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.mesa .cuerpo { max-height: none; flex: 1; font-size: 14px; line-height: 1.45; }

/* Prepedido */
.mesa .prepedido { padding: 14px 16px 0; }
.mesa .prepedido-head { margin-bottom: 10px; }
.prepedido-ia { margin-left: auto; }
.pre-cab { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 10px; }
.pre-cab label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.pre-cab .input { height: 34px; font-size: 14px; text-transform: none; letter-spacing: 0; }
.pc-cliente { grid-column: span 6; }
.pc-ref { grid-column: span 3; }
.pc-fecha { grid-column: span 3; }
.pc-obra { grid-column: span 5; }
.pc-dir { grid-column: span 4; }
.pc-obs { grid-column: span 12; }

/* Textos que crecen con el contenido (Chrome/Edge); en otros, se estiran a mano */
textarea.input.auto { field-sizing: content; min-height: 34px; max-height: 200px; height: auto; resize: vertical; padding: 6px 9px; line-height: 1.35; font-size: 14px; }

.pre-lineas-cab { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.pre-lineas-cab .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.pre-lineas { display: flex; flex-direction: column; gap: 8px; }
.pl {
    display: grid; gap: 4px 10px; align-items: start;
    grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr) 84px 180px 30px;
    grid-template-areas: "n txt txt cant cod x" "n desc obs obs obs obs";
    background: #f9fbfd; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px;
}
.pl:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.pl label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pl label > span { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.pl .input { height: 34px; font-size: 14px; min-width: 0; }
.pl .input.num { text-align: right; font-weight: 600; }
.pl-n { grid-area: n; font-weight: 700; color: var(--ink-3); padding-top: 22px; text-align: right; }
.pl-txt { grid-area: txt; }
.pl-txt textarea { font-weight: 500; }
.pl-cant { grid-area: cant; }
.pl-cod { grid-area: cod; }
.pl-quitar { grid-area: x; padding-top: 18px; }
.pl-desc { grid-area: desc; }
.pl-obs { grid-area: obs; }
.pl-anadir { margin-top: 8px; }

/* Acciones siempre visibles al pie del prepedido */
.pre-acciones { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px -16px 0; padding: 10px 16px 12px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 14px rgba(0,0,0,.05); }
.pre-acciones-der { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pre-acciones .motivo { flex: 1; min-width: 200px; }
.pre-descartar { color: var(--err); }
.pre-msg { flex-basis: 100%; margin: 0; }
.btn-grande { height: 40px; padding: 0 20px; font-size: 15px; font-weight: 600; }

@media (max-width: 1100px) {
    .mesa-eq .mesa-grid, .mesa-doc .mesa-grid, .mesa-lin .mesa-grid { grid-template-columns: minmax(0, 1fr); }
    .mesa .documento { position: static; height: 70vh; }
    .mesa-modo { display: none; }
}
@media (max-width: 720px) {
    .pc-cliente, .pc-ref, .pc-fecha, .pc-obra, .pc-dir { grid-column: span 12; }
    .pl { grid-template-columns: 22px minmax(0, 1fr) 84px; grid-template-areas: "n txt txt" "n cod cant" "n desc desc" "n obs obs" "n x x"; }
    .clasif-franja select.input { min-width: 0; flex: 1 1 140px; }
}

/* Ajustes 31/10 tarde: la zona principal no puede ensancharse más que la ventana (causa del desborde a la derecha) */
.app { grid-template-columns: 236px minmax(0, 1fr); }
.main, .content, .mesa, .mesa-grid > * { min-width: 0; }
.content:has(.mesa) { overflow-x: hidden; }
.mesa-eq .mesa-grid { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
.mesa-doc .mesa-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.mesa-lin .mesa-grid { grid-template-columns: minmax(0, .6fr) minmax(0, 1.4fr); }
.mesa .documento { height: calc(100vh - 150px); min-height: 460px; }
.pl { grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr) 76px 150px 28px; }
.clasif-franja select.input { min-width: 120px; max-width: 200px; }
.cli-parecidos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.cli-parecidos .etq { text-align: left; }

/* ======================================================================
   Mesa de trabajo como aplicación: la página no hace scroll; cada mitad tiene el suyo.
   El documento se queda quieto mientras se recorren las líneas. (31/10 noche)
   ====================================================================== */
.main:has(.mesa) { height: 100vh; overflow: hidden; }
.main:has(.mesa) .content { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; max-width: none; padding: 10px 14px 10px; }
.main:has(.mesa) .content > .mesa { flex: 1; min-height: 0; overflow: hidden; }
.mesa > .mesa-cab, .mesa > .clasif-franja, .mesa > .alert { flex: none; }
.mesa-grid { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
.mesa .documento { position: static; height: auto; min-height: 0; }
.mesa .prepedido { min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
.mesa .prepedido > *, .pre-cab > *, .pl > * { min-width: 0; }
.mesa .input { max-width: 100%; }
.mesa .pre-acciones { margin-top: 16px; }
.clasif-prog { height: 32px; width: 78px; text-transform: uppercase; }
.badge-info { background: #e6eef8; color: #2d5c93; }
@media (max-width: 1100px) {
    .main:has(.mesa) { height: auto; overflow: visible; }
    .main:has(.mesa) .content, .main:has(.mesa) .content > .mesa { overflow: visible; }
    .mesa .prepedido { overflow: visible; }
}

/* Pedido: descifrador y pedido del cliente al lado */
.con-cajon { margin-right: min(44vw, 760px); }
.cajon-doc { position: fixed; top: 0; right: 0; bottom: 0; width: min(43vw, 750px); z-index: 30; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.12); }
.cajon-barra { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.cajon-barra .btn:first-of-type { margin-left: auto; }
.cajon-doc iframe { flex: 1; border: 0; width: 100%; background: #edf1f6; }
.cod-falta { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.cod-historico { display: flex; flex-direction: column; gap: 4px; }
.cod-cand { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.cod-cand:hover { border-color: var(--accent); }
.cod-cand .mono { flex: none; min-width: 170px; color: var(--ink-2); }
.cod-cand-cli { border-left: 3px solid var(--ok); }
.cod-cand.on { background: var(--accent-soft); border-color: var(--accent); }
.ia-conf-alta { background: var(--ok-soft); color: var(--ok); }
.ia-conf-media { background: var(--warn-soft); color: var(--warn); }
.ia-conf-baja { background: var(--err-soft); color: var(--err); }
@media (max-width: 1100px) { .con-cajon { margin-right: 0; } .cajon-doc { width: 100vw; } }
.codid { font-size: 12px; font-weight: 600; color: var(--ink); word-break: break-all; }
.borrar-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.borrar-panel > span { flex: 1 1 320px; }
.mesa-borrar, .borrar-link { color: var(--err); }

/* ======================================================================
   Pedido compacto: título en una línea, cabecera densa y plegable, líneas protagonistas (31/10)
   ====================================================================== */
.content:has(.pedido-pagina) { max-width: none; padding: 12px 18px 24px; }
.pedido-pagina > .alert { padding: 7px 12px; margin-bottom: 8px; font-size: 13px; }
.ped-titulo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ped-titulo .back { font-size: 22px; line-height: 1; text-decoration: none; color: var(--ink-2); }
.ped-titulo-cli { font-size: 17px; font-weight: 700; }
.ped-titulo-meta { flex: 1 1 260px; }
.pedido-pagina .ped-pasos { padding: 6px 10px; margin-bottom: 8px; gap: 6px; }
.pedido-pagina .ped-pasos .btn { height: 32px; padding: 0 12px; font-size: 13px; }
.pedido-pagina .ped-paso { padding: 3px 9px; font-size: 11px; }

.ped-cab { padding: 8px 12px; margin-bottom: 8px; }
.ped-cab.plegada { display: flex; align-items: center; gap: 10px; }
.ped-cab-toggle { border: 0; background: none; font: inherit; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); cursor: pointer; padding: 2px 4px; flex: none; }
.ped-cab:not(.plegada) .ped-cab-toggle { margin-bottom: 4px; }
.ped-cab-resumen { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ped-cab-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px 10px; }
.ped-cab-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); min-width: 0; }
.ped-cab-grid .input { height: 30px; font-size: 13px; padding: 4px 8px; text-transform: none; letter-spacing: 0; }
.ped-cab-grid textarea.input.auto { min-height: 30px; font-size: 13px; padding: 5px 8px; }
.pk-cli { grid-column: span 4; } .pk-dest { grid-column: span 2; } .pk-prog { grid-column: span 1; } .pk-ent { grid-column: span 2; } .pk-ref { grid-column: span 3; }
.pk-fecha { grid-column: span 2; } .pk-obra { grid-column: span 3; } .pk-dir { grid-column: span 3; } .pk-mail { grid-column: span 2; }
.pk-obs { grid-column: span 12; }

/* Líneas más densas */
.pedido-pagina .ped-lineas { font-size: 13px; }
.pedido-pagina .ped-lineas th { padding: 4px; font-size: 11px; }
.pedido-pagina .ped-lineas td { padding: 4px; }
.pedido-pagina .ped-lineas .input { height: 30px; font-size: 13px; }
.pedido-pagina .ped-lineas .input.num { width: 76px; }
.pedido-pagina .ped-lineas td.small { line-height: 1.3; }
.pedido-pagina section.card { padding: 10px 12px; }
.pedido-pagina section.card > h2, .pedido-pagina .clasif-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 1100px) {
    .pk-cli, .pk-ref, .pk-obra, .pk-dir { grid-column: span 6; } .pk-dest, .pk-ent, .pk-fecha, .pk-mail { grid-column: span 3; } .pk-prog { grid-column: span 2; }
}

/* ======================================================================
   Líneas del pedido en dos filas: pedido arriba, codificación (como Gestión) abajo (31/10)
   ====================================================================== */
.pdl-lista { display: flex; flex-direction: column; gap: 6px; }
.pdl { border: 1px solid var(--line-2); border-left: 4px solid var(--line); border-radius: 8px; background: #f9fbfd; padding: 6px 10px 8px; }
.pdl.pdl-ok { border-left-color: var(--ok); }
.pdl.pdl-sinruta { border-left-color: var(--err); }
.pdl.abierta, .pdl:focus-within { background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.pdl label { display: flex; flex-direction: column; gap: 1px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); min-width: 0; }
.pdl .input { height: 28px; font-size: 13px; padding: 2px 6px; text-transform: none; letter-spacing: 0; }
.pdl .input.num { text-align: right; }

.pdl-f1 { display: grid; grid-template-columns: 22px minmax(0, 1fr) 70px 86px 64px 86px auto; gap: 8px; align-items: start; }
.pdl-n { font-weight: 700; color: var(--ink-3); padding-top: 4px; text-align: right; }
.pdl-txt { min-width: 0; }
.pdl-cliente { font-size: 12px; color: var(--ink-2); }
.pdl-desc { font-size: 14px; font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pdl-obs { font-size: 12px; color: var(--ink-3); }
.pdl-imp { padding-top: 16px; text-align: right; font-weight: 600; white-space: nowrap; }
.pdl-acc { display: flex; gap: 2px; padding-top: 12px; }

.pdl-f2 { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; margin: 6px 0 0 30px; padding-top: 6px; border-top: 1px dashed var(--line-2); }
.pc-tipo .input { width: 64px; }
.pc-mod .input { width: 72px; }
.pc-c .input { width: 74px; }
.pc-mad .input { width: 108px; }
.pc-med .input { width: 72px; }
.pc-grueso .input { width: 58px; }
.pc-trab .input { width: 96px; }
.pc-cod .input { width: 150px; }
.pc-descr { flex: 1 1 260px; }
.pc-idx { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-transform: none; text-align: right; }
.pc-idx.fuera { color: var(--warn); font-weight: 700; }
.pdl-codid { flex: 1 1 220px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 4px 8px; min-height: 28px; background: var(--bg); border-radius: 6px; }
.pdl-codid .codid { font-size: 12.5px; }
.pdl-art { font-size: 10.5px; color: var(--ink-3); }
.pdl .codificador { margin: 8px 0 0 30px; padding: 8px; background: var(--accent-soft); border-radius: 6px; }
.pdl-avisos { margin: 4px 0 0 30px; font-size: 12px; }
@media (max-width: 900px) {
    .pdl-f1 { grid-template-columns: 22px minmax(0, 1fr) 70px 86px; }
    .pdl-dto, .pdl-imp { display: none; }
    .pdl-f2 { margin-left: 0; }
}

/* ======================================================================
   31/10 tarde: sin flechitas en los números, medidas más anchas y líneas más separadas
   ====================================================================== */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Pedido: cada línea como una tarjeta separada, con su número destacado */
.pdl-lista { gap: 12px; }
.pdl { padding: 10px 14px 12px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.pdl:nth-child(even) { background: #f8fafc; }
.pdl-n { width: 22px; height: 22px; padding: 0; margin-top: 2px; border-radius: 50%; background: var(--line-2); color: var(--ink-2); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.pdl-f2 { margin-top: 10px; padding-top: 10px; gap: 8px 10px; }
.pc-med .input { width: 84px; }
.pc-grueso .input { width: 64px; }
.pc-mod .input { width: 80px; }
.pc-c .input { width: 80px; }
.pdl .input.num { padding-right: 8px; }

/* Prepedido: más aire entre líneas */
.pre-lineas { gap: 12px; }
.pl { padding: 10px 12px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.05); grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr) 84px 30px; grid-template-areas: "n txt txt cant x" "n desc obs obs obs"; }
.pl:nth-child(even) { background: #f8fafc; }
.pl-n { width: 24px; height: 24px; padding: 0; margin-top: 18px; border-radius: 50%; background: var(--line-2); color: var(--ink-2); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 720px) {
    .pl { grid-template-areas: "n txt txt" "n cant cant" "n desc desc" "n obs obs" "n x x"; grid-template-columns: 26px minmax(0, 1fr) 84px; }
}

/* Bandeja: número de pedido generado · Pedido: lo que pide este cliente */
a.pedido-num { font-size: 14px; padding: 2px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); text-decoration: none; }
a.pedido-num:hover { background: var(--accent); color: #fff; }
.cli-historia { padding: 8px 12px; margin-bottom: 8px; }
.cli-historia.plegada { display: flex; align-items: center; gap: 10px; }
.cli-historia-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; margin-top: 6px; max-height: 320px; overflow: auto; }
.cli-historia-grid .grid td { padding: 3px 6px; font-size: 12.5px; }
@media (max-width: 1100px) { .cli-historia-grid { grid-template-columns: minmax(0, 1fr); } }

/* IA trabajando: aviso fijo abajo, bien visible, con barra de progreso */
.ia-trabajando { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
    width: min(460px, calc(100vw - 32px)); background: var(--surface, #fff); border: 1px solid var(--accent);
    border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 12px 16px; animation: ia-entra .2s ease-out; }
.ia-trab-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ia-trab-cab strong { flex: 1; }
.ia-trab-icono { color: var(--accent); font-size: 18px; display: inline-block; animation: ia-gira 1.6s linear infinite; }
.ia-trab-tiempo { color: var(--muted, #777); }
.ia-trab-barra { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.ia-trab-relleno { height: 100%; border-radius: 4px; transition: width .5s ease;
    background: repeating-linear-gradient(45deg, var(--accent) 0 10px, color-mix(in srgb, var(--accent) 75%, #fff) 10px 20px);
    background-size: 28px 28px; animation: ia-rayas 1s linear infinite; }
.ia-trab-pie { margin-top: 6px; }
.btn-ia.trabajando { position: relative; }
.btn-ia.trabajando::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ia-gira .8s linear infinite; }
@keyframes ia-gira { to { transform: rotate(360deg); } }
@keyframes ia-rayas { to { background-position: 28px 0; } }
@keyframes ia-entra { from { opacity: 0; transform: translate(-50%, 10px); } }
@media (prefers-reduced-motion: reduce) { .ia-trab-icono, .ia-trab-relleno, .btn-ia.trabajando::before { animation: none; } }

/* ===== Líneas del pedido más compactas (01-11) ===== */
.pdl-lista { gap: 8px; container-type: inline-size; }
.pdl { padding: 6px 12px 8px 10px; }
.pdl-f1 { align-items: center; }
/* Texto del pedido en dos renglones: lo que pidió el cliente arriba; descripción y observación en el mismo renglón */
.pdl-txt { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; }
.pdl-cliente { flex-basis: 100%; font-size: 12px; line-height: 1.3; }
.pdl-desc { font-size: 14px; line-height: 1.35; }
.pdl-obs { font-size: 12px; line-height: 1.35; }
.pdl-obs::before { content: "· "; }
.pdl-imp, .pdl-acc { padding-top: 0; }
.pdl-f2 { margin-top: 6px; padding-top: 6px; gap: 4px 6px; }
.pdl-f2 > * { flex: none; }
.pdl-f2 > .pc-tipo { width: 60px; } .pdl-f2 > .pc-mod { width: 196px; } .pdl-f2 > .pc-c { width: 74px; }
.pdl-f2 > .pc-mad { width: 104px; } .pdl-f2 > .pc-med { width: 76px; } .pdl-f2 > .pc-grueso { width: 56px; } .pdl-f2 > .pc-trab { width: 92px; }
.pdl-f2 > .pdl-codid, .pdl-f2 > .pc-descr { flex: 1 1 200px; }
.pdl .pdl-f2 .input { width: 100%; }
.pc-mod { display: flex; flex-direction: column; gap: 1px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); min-width: 0; }
/* El índice de la medida (02, 10…) dentro del propio campo, abajo a la izquierda: no ocupa altura */
.pc-med, .pc-grueso { position: relative; }
.pc-med .pc-idx, .pc-grueso .pc-idx { position: absolute; left: 6px; bottom: 7px; line-height: 1; pointer-events: none; }
/* Cabecera única: solo cuando caben todos los campos en una fila; entonces las líneas no repiten las etiquetas */
.pdl-cab { display: none; }
@container (min-width: 1140px) {
    .pdl-cab { display: flex; margin: 0 0 -4px 44px; padding: 0; border: 0; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); }
    .pdl-cab > .pdl-codid-cab { flex: 1 1 200px; padding-left: 8px; }
    .pdl .pc-tipo .pc-lbl, .pdl .pc-mod .pc-lbl, .pdl .pc-c .pc-lbl, .pdl .pc-mad .pc-lbl, .pdl .pc-med .pc-lbl, .pdl .pc-grueso .pc-lbl, .pdl .pc-trab .pc-lbl {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Desplegable de modelos con búsqueda */
.combo { position: relative; }
.combo .combo-input { padding-right: 22px; text-overflow: ellipsis; }
.combo.fuera .combo-input { border-color: var(--warn); color: var(--warn); }
.combo-flecha { position: absolute; right: 1px; bottom: 1px; height: 26px; width: 20px; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 12px; }
.combo-flecha:disabled { display: none; }
.combo-lista { position: absolute; z-index: 40; top: 100%; left: 0; margin: 2px 0 0; padding: 4px 0; list-style: none; width: 340px; max-height: 300px; overflow: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
    text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; color: var(--ink); }
.combo-lista li { display: flex; gap: 8px; align-items: baseline; padding: 4px 10px; cursor: pointer; }
.combo-lista li .mono { color: var(--accent); min-width: 44px; }
.combo-lista li.on, .combo-lista li:hover { background: var(--accent-soft); }
.combo-lista li.elegido { font-weight: 600; }
.combo-lista li.combo-vacio { cursor: default; color: var(--ink-3); }

/* ===== Pedido: la cabecera queda fija y solo se desplazan las líneas (01-11) ===== */
.pc-idx { display: none; }
.pdl .input.fuera { border-color: var(--warn); color: var(--warn); font-weight: 700; }
@media (min-width: 901px) {
    .main:has(.pedido-pagina) { height: 100vh; overflow: hidden; }
    .main:has(.pedido-pagina) .content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 10px 18px 10px; }
    .pedido-pagina { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
    .pedido-pagina > * { flex: none; }
    .pedido-pagina > .ped-lin { flex: 1 1 0; min-height: 300px; display: flex; flex-direction: column; margin-bottom: 0; padding-bottom: 6px; }
    .ped-lin > .clasif-head { flex: none; }
    .ped-lin > .pdl-lista { flex: 1; min-height: 0; overflow: auto; padding: 0 4px 8px 0; }
    .pdl-cab, .pdl-cab-c { position: sticky; top: 0; z-index: 3; background: var(--surface); padding-top: 2px; padding-bottom: 4px; }
}
.ped-lin .clasif-head { display: flex; align-items: center; gap: 12px; }
.pdl-vista { margin-left: auto; }

/* ===== Vista compacta: una fila por línea ===== */
.pdl-lista.compacta { gap: 0; }
.pdl-lista.compacta > .pdl-cab { display: none !important; }
.compacta .pdl { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding: 2px 6px; min-width: 1380px;
    border-width: 0 0 1px 3px; border-radius: 0; border-bottom-color: var(--line-2); box-shadow: none; background: var(--surface); }
.compacta .pdl:nth-child(even) { background: #f8fafc; }
.compacta .pdl.abierta, .compacta .pdl:focus-within { box-shadow: inset 0 0 0 2px var(--accent-soft); }
.compacta .pdl-f1, .compacta .pdl-f2 { display: contents; }
.compacta .pdl label, .compacta .pc-mod { font-size: 0; gap: 0; }
.compacta .pc-lbl { display: none; }
.compacta .pdl .input { height: 24px; font-size: 12px; padding: 0 4px; border-radius: 4px; }
.compacta .pdl label .input, .compacta .pdl .combo .input { width: 100%; min-width: 0; }
.compacta .pdl select.input { padding-right: 14px; background-position: right 2px center; }
.compacta .combo-flecha { height: 22px; }
.compacta .pdl-n { order: 1; width: 20px; height: 20px; margin: 0; font-size: 10.5px; flex: none; }
.compacta .pdl-txt { order: 2; flex: 1 1 160px; min-width: 120px; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.compacta .pdl-cliente, .compacta .pdl-obs { display: none; }
.compacta .pdl-desc { display: inline; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.compacta .pdl-desc .badge { font-size: 10px; padding: 0 5px; }
.compacta .pdl-cant { order: 3; width: 46px; flex: none; }
.compacta .pdl-f2 > * { order: 4; flex: none; }
.compacta .pdl-f2 > .pc-tipo { width: 50px; } .compacta .pdl-f2 > .pc-mod { width: 120px; } .compacta .pdl-f2 > .pc-c { width: 60px; }
.compacta .pdl-f2 > .pc-mad { width: 90px; } .compacta .pdl-f2 > .pc-med { width: 58px; } .compacta .pdl-f2 > .pc-grueso { width: 44px; }
.compacta .pdl-f2 > .pc-trab { width: 88px; }
.compacta .pdl-f2 > .pc-cod { width: 120px; } .compacta .pdl-f2 > .pc-descr { flex: 1 1 150px; }
.compacta .pdl-f2 > .pdl-codid { width: 68px; flex: none; min-height: 0; padding: 0; background: none; justify-content: center; }
.compacta .pdl-codid .codid, .compacta .pdl-codid .pdl-art { display: none; }
.compacta .pdl-codid .badge { font-size: 10px; padding: 1px 5px; white-space: nowrap; }
.compacta .pdl-codid .muted { display: none; }
.compacta .pdl-precio { order: 5; width: 64px; flex: none; }
.compacta .pdl-dto { display: none; }
.compacta .pdl-imp { order: 6; width: 66px; flex: none; font-size: 12px; }
.compacta .pdl-acc { order: 7; width: 56px; flex: none; justify-content: flex-end; }
.compacta .pdl-acc .btn { height: 22px; padding: 0 6px; font-size: 12px; }
.compacta .pdl-acc .btn[title="Duplicar"] { display: none; }
.compacta .codificador, .compacta .pdl-avisos { order: 8; flex-basis: 100%; margin: 4px 0 6px 24px; }
/* Cabecera de la vista compacta: mismas medidas que la fila */
.pdl-cab-c { display: flex; align-items: center; gap: 4px; padding-left: 9px; padding-right: 6px; min-width: 1380px; border-bottom: 1px solid var(--line);
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); }
.pdl-cab-c > span { flex: none; }
.pdl-cab-c .c-n { width: 20px; } .pdl-cab-c .c-txt { flex: 1 1 160px; min-width: 120px; } .pdl-cab-c .c-cant { width: 46px; text-align: right; }
.pdl-cab-c .c-tipo { width: 50px; } .pdl-cab-c .c-mod { width: 120px; } .pdl-cab-c .c-c { width: 60px; } .pdl-cab-c .c-mad { width: 90px; }
.pdl-cab-c .c-med { width: 58px; text-align: right; } .pdl-cab-c .c-gru { width: 44px; text-align: right; } .pdl-cab-c .c-trab { width: 88px; }
.pdl-cab-c .c-ruta { width: 68px; text-align: center; } .pdl-cab-c .c-precio { width: 64px; text-align: right; } .pdl-cab-c .c-imp { width: 66px; text-align: right; }
.pdl-cab-c .c-acc { width: 56px; }

/* ===== Catálogo de stock (01-11) ===== */
.badge-stock { background: #e3f1e6; color: #1f6b35; font-weight: 700; letter-spacing: .03em; }
.badge-fab { background: var(--line-2); color: var(--ink-3); }
.cat-file { position: relative; cursor: pointer; }
.cat-file input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.cat-file.disabled { opacity: .5; pointer-events: none; }
.cat-resumen { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding: 10px 14px; margin-bottom: 12px; }
.cat-leido { border-color: var(--accent); margin-bottom: 14px; }
.cat-leido h2 { margin: 0 0 4px; font-size: 16px; }
.cat-avisos { margin: 6px 0 10px; padding-left: 18px; font-size: 12.5px; color: var(--warn); }
.cat-leido-pie { margin-top: 10px; align-items: center; justify-content: flex-end; gap: 10px; }
.cat-leido-pie .muted { margin-right: auto; }
.cat-serie { margin-bottom: 12px; padding: 12px 14px; }
.cat-serie-cab { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 8px; }
.cat-foto { flex: none; width: 190px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.cat-foto img { width: 190px; height: 134px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); }
.cat-sinfoto { width: 100%; min-height: 60px; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 6px; color: var(--ink-3); font-size: 12px; }
.cat-serie-datos { flex: 1; min-width: 0; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.cat-serie-titulo { display: flex; align-items: center; gap: 8px; }
.cat-serie-titulo h2 { margin: 0; font-size: 20px; }
.cat-arts td { vertical-align: middle; }
.cat-th-foto { width: 52px; }
.cat-mini { position: relative; width: 52px; }
.cat-mini img { width: 34px; height: 64px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); display: block; }
.cat-mini img.de-serie { opacity: .45; }
.cat-mini-cambiar { position: absolute; right: 0; bottom: 2px; font-size: 12px; opacity: .55; }
.cat-mini-cambiar:hover { opacity: 1; }
.cat-arts tr.cat-pend { background: #fff8ec; }
.cat-modelo { min-width: 230px; }
.cat-modelo .combo { width: 210px; display: inline-block; vertical-align: middle; }
.cat-modelo .input { height: 30px; }
.cat-corr { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; vertical-align: middle; }
.cat-med-txt { white-space: pre-line; line-height: 1.35; }
.cat-medidas { min-width: 280px; height: auto; padding: 4px 6px; font-size: 12px; }
.cat-texto { white-space: pre-wrap; font-size: 12px; line-height: 1.4; background: var(--bg); padding: 10px; border-radius: 6px; max-height: 420px; overflow: auto; }
.cat-muestras { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cat-muestra { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px; }
.cat-muestra img, .cat-muestra .cat-sinfoto { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex: none; }
.cat-muestra-datos { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cat-muestra-datos .input { height: 28px; font-size: 12px; }
@media (max-width: 760px) { .cat-serie-cab { flex-direction: column; } .cat-foto, .cat-foto img { width: 100%; } }
/* Desplegable de modelos con la foto del catálogo */
.combo-lista { width: 420px; }
.combo-lista .combo-mini { width: 16px; height: 30px; flex: none; object-fit: cover; border-radius: 2px; }
.combo-lista li { align-items: center; }
.combo-txt { flex: 1; min-width: 0; }
.combo-cat { display: block; font-size: 11px; color: var(--ink-3); }
/* El aviso del destino propuesto */
.aviso-destino { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.aviso-destino > span { flex: 1 1 300px; }
/* Vista compacta: hueco para ruta + stock */
.compacta .pdl-f2 > .pdl-codid { width: 96px; flex-wrap: wrap; gap: 2px; }
.pdl-cab-c .c-ruta { width: 96px; }
.compacta .pdl, .pdl-cab-c { min-width: 1410px; }

/* Panel ⋯ de la línea: foto pequeña del modelo (catálogo de stock) a la izquierda */
.codificador:has(> .cod-foto) { display: grid; grid-template-columns: 92px minmax(0, 1fr); column-gap: 12px; align-items: start; }
.codificador > .cod-foto { grid-row: 1 / span 20; margin: 0; }
.codificador > :not(.cod-foto) { grid-column: 2; }
.cod-foto img { width: 92px; height: 150px; object-fit: cover; object-position: center top; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); display: block; }
.cod-foto figcaption { font-size: 10.5px; line-height: 1.25; color: var(--ink-3); margin-top: 3px; }

/* ---------- Líneas polimórficas: hoja, block, cerco, tapajuntas, pack, herraje (01/11/2026) ---------- */
.pdl .input.vacio, .pdl select.input.vacio { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.pdl .input.vacio option { color: var(--ink); font-weight: 400; background: var(--surface); }
.pdl.pdl-vacia { border-left-color: var(--warn); }
.pdl.pdl-fam-block, .pdl.pdl-fam-pack { border-left-color: var(--accent); }
.pdl.pdl-hijo { margin: -2px 0 0 34px; border-left-style: dashed; padding-top: 4px; padding-bottom: 6px; background: #f7f9fc; }
.pdl.pdl-hijo .pdl-n { background: transparent; color: var(--accent); font-size: 14px; }
.pdl.pdl-hijo .pdl-desc { font-size: 13px; font-weight: 500; }
.pdl-block-desc { font-size: 11.5px; color: var(--accent); white-space: pre-wrap; flex-basis: 100%; }
.pdl-total { font-size: 10px; color: var(--ink-3); text-transform: none; letter-spacing: 0; font-weight: 500; }
.pdl-impr.off { opacity: .35; text-decoration: line-through; }
.pdl-f2 > .pc-pieza { width: 190px; } .pdl-f2 > .pc-mat { width: 92px; } .pdl-f2 > .pc-jun { width: 96px; }
.pdl-f2 > .pc-reb { width: 74px; } .pdl-f2 > .pc-lar { width: 70px; } .pdl-f2 > .pc-hcod { width: 190px; }
.pdl-f3 { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 6px; margin: 6px 0 0 30px; padding: 6px 8px; border-radius: 6px; background: var(--accent-soft); }
.pdl-f3 > * { flex: none; }
.pdl-f3 > .pc-plant { width: 300px; } .pdl-f3 > .pc-var { width: 118px; } .pdl-f3 > .pc-mad { width: 104px; } .pdl-f3 > .pc-mat { width: 92px; }
.pdl-f3 > .pc-herr { width: 112px; } .pdl-f3 > .pc-mano { width: 66px; } .pdl-f3 > .pc-med { width: 84px; } .pdl-f3 > .pc-grueso { width: 70px; } .pdl-f3 > .pc-trab { width: 96px; }
.pdl .pdl-f3 .input { width: 100%; }
.pdl-block-acc { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; }
.compacta .pdl-f3 { display: none; }
.compacta .pdl.pdl-hijo { margin-left: 24px; }
@media (max-width: 900px) { .pdl.pdl-hijo { margin-left: 12px; } .pdl-f3 { margin-left: 0; } .pdl-f3 > .pc-plant { width: 100%; } }

/* Plantillas de block */
.pla-split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
.pla-lista { padding: 10px; display: flex; flex-direction: column; gap: 3px; max-height: calc(100vh - 220px); overflow: auto; }
.pla-lista-barra { justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pla-grupo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 8px 0 2px; }
.pla-item { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 8px; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 6px 8px; font: inherit; cursor: pointer; }
.pla-item:hover { background: var(--line-2); }
.pla-item.on { background: var(--accent-soft); border-color: var(--accent); }
.pla-item.inactiva { opacity: .55; }
.pla-cod { font-size: 12px; font-weight: 600; }
.pla-nom { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pla-meta { grid-column: 2; font-size: 11px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.pla-ficha { padding: 14px 16px; }
.pla-vacia { display: flex; align-items: center; justify-content: center; min-height: 200px; }
.pla-h3 { font-size: 14px; margin: 16px 0 4px; }
.pla-piezas .input { height: 28px; font-size: 13px; padding: 2px 6px; min-width: 0; width: 100%; }
.pla-piezas td { padding: 4px 4px; }
.pla-piezas .input.num { width: 72px; text-align: right; }
.pla-herraje { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 6px; }
.pla-resumen { margin: 10px 0; padding: 6px 10px; background: var(--bg); border-radius: 6px; }
.pla-pie { align-items: center; margin-top: 10px; }
.pla-hueco { flex: 1; }
.pla-valores .input { height: 28px; font-size: 13px; padding: 2px 6px; }
.pla-valores .pla-v-cod { width: 90px; } .pla-valores .pla-v-orden { width: 70px; } .pla-valores .input.num { width: 90px; text-align: right; }
.pla-valores tr.inactiva td { opacity: .55; }
.pla-ayuda-valores { align-self: end; }
@media (max-width: 1000px) { .pla-split { grid-template-columns: 1fr; } .pla-lista { max-height: none; } }

/* Sugerencias del histórico: pequeñas, son solo una ayuda */
.cod-historico { gap: 2px; max-height: 132px; overflow: auto; }
.cod-historico > .small { font-size: 11px; }
.cod-cand { font-size: 11.5px; padding: 2px 8px; gap: 8px; border-radius: 4px; color: var(--ink-2); }
.cod-cand .mono { min-width: 0; font-size: 10.5px; }
.cod-cand .badge { font-size: 10px; padding: 0 5px; }

/* Cómo se ha codificado el pedido / la línea */
.chip.orig-ia { background: #efe7fb; color: #6b3fb1; }
.chip.orig-auto { background: #e3f1ff; color: #1f5f9e; }
.chip.orig-manual { background: var(--line-2); color: var(--ink-2); }
.chip.orig-mixto { background: #fff3dc; color: #8a5a00; }
.badge.orig-linea { font-size: 10px; font-weight: 600; padding: 0 6px; }
.badge.orig-ia { background: #efe7fb; color: #6b3fb1; }
.badge.orig-ia_cor { background: #efe7fb; color: #6b3fb1; outline: 1px dashed #6b3fb1; }
.badge.orig-auto, .badge.orig-sucodigo { background: #e3f1ff; color: #1f5f9e; }
.badge.orig-auto_cor { background: #e3f1ff; color: #1f5f9e; outline: 1px dashed #1f5f9e; }
.badge.orig-manual { background: var(--line-2); color: var(--ink-2); }

/* ---------- Pedido: cabecera más compacta y líneas bien separadas (01/11/2026, tarde) ---------- */
/* Cabecera en 2 filas: cliente · destino · prog · entrega · su ref. · fechas / obra · dirección · correo · observaciones */
.pedido-pagina .ped-titulo { margin-bottom: 4px; }
.pedido-pagina .ped-pasos { margin-bottom: 6px; }
.ped-cab { padding: 4px 10px 8px; margin-bottom: 6px; }
.ped-cab:not(.plegada) .ped-cab-toggle { margin-bottom: 0; padding: 0 2px; font-size: 10px; }
.ped-cab-grid { grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 4px 8px; }
.ped-cab-grid label { font-size: 9.5px; gap: 1px; letter-spacing: .02em; }
.ped-cab-grid .input, .ped-cab-grid select.input { height: 26px; font-size: 12.5px; padding: 2px 7px; }
.ped-cab-grid textarea.input.auto { min-height: 26px; height: 26px; font-size: 12.5px; padding: 3px 7px; resize: vertical; }
.ped-cab-grid .btn { height: 26px; padding: 0 10px; font-size: 12px; }
.pk-cli { grid-column: span 6; } .pk-dest { grid-column: span 4; } .pk-prog { grid-column: span 2; } .pk-ent { grid-column: span 3; } .pk-ref { grid-column: span 3; }
.pk-fecha { grid-column: span 3; }
.pk-obra { grid-column: span 4; } .pk-dir { grid-column: span 6; } .pk-mail { grid-column: span 4; } .pk-obs { grid-column: span 10; }
@media (max-width: 1300px) {
    .pk-cli { grid-column: span 8; } .pk-dest { grid-column: span 5; } .pk-prog { grid-column: span 3; } .pk-ent, .pk-ref { grid-column: span 4; }
    .pk-fecha { grid-column: span 4; } .pk-obra { grid-column: span 8; } .pk-dir { grid-column: span 8; } .pk-mail { grid-column: span 6; } .pk-obs { grid-column: span 24; }
}
@media (max-width: 800px) { .ped-cab-grid > label { grid-column: span 12 !important; } .ped-cab-grid > .pk-cli, .ped-cab-grid > .pk-obs { grid-column: span 24 !important; } }
.cli-historia { padding: 4px 10px; margin-bottom: 6px; }
.cli-historia .ped-cab-toggle { font-size: 10px; }

/* Líneas: cada una es una tarjeta bien marcada, alternando el fondo, con el número destacado */
.pdl-lista:not(.compacta) { gap: 14px; }
.pdl-lista:not(.compacta) > .pdl:not(.pdl-hijo) {
    border: 1px solid #ccd5e0; border-left-width: 6px; border-radius: 10px;
    box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 3px 8px rgba(60,40,20,.07);
    padding: 10px 14px 12px; background: #fff;
}
.pdl-lista:not(.compacta) > .pdl:not(.pdl-hijo):nth-child(even) { background: #eef3f9; }
.pdl-lista:not(.compacta) > .pdl:not(.pdl-hijo):hover { border-color: #c7b9a6; }
.pdl-lista:not(.compacta) > .pdl.abierta, .pdl-lista:not(.compacta) > .pdl:focus-within { box-shadow: 0 0 0 3px var(--accent-soft), 0 3px 10px rgba(60,40,20,.10); }
.pdl-lista:not(.compacta) > .pdl:not(.pdl-hijo) > .pdl-f1 .pdl-n {
    width: 28px; height: 28px; font-size: 13.5px; font-weight: 800; background: var(--ink); color: #fff;
}
.pdl-lista:not(.compacta) > .pdl.pdl-ok > .pdl-f1 .pdl-n { background: var(--ok); }
.pdl-lista:not(.compacta) > .pdl.pdl-sinruta > .pdl-f1 .pdl-n { background: var(--err); }
.pdl-lista:not(.compacta) > .pdl.pdl-vacia > .pdl-f1 .pdl-n { background: var(--warn); }
.pdl-lista:not(.compacta) .pdl-desc { font-size: 15px; }
.pdl-lista:not(.compacta) .pdl-f2 { border-top: 1px solid #e6ddd0; }
/* las piezas de un block, pegadas a su block y más discretas */
.pdl-lista:not(.compacta) > .pdl.pdl-hijo { margin-top: -10px; border: 1px dashed #ccd5e0; border-left: 3px solid var(--accent); border-radius: 0 0 8px 8px; background: #f8fafc; box-shadow: none; }
.pdl-lista:not(.compacta) > .pdl.pdl-ok:not(.pdl-hijo) { border-left-color: var(--ok); }
.pdl-lista:not(.compacta) > .pdl.pdl-sinruta:not(.pdl-hijo) { border-left-color: var(--err); }
.pdl-lista:not(.compacta) > .pdl.pdl-vacia:not(.pdl-hijo) { border-left-color: var(--warn); }
.pdl-lista:not(.compacta) > .pdl.pdl-fam-block:not(.pdl-hijo):not(.pdl-ok):not(.pdl-sinruta),
.pdl-lista:not(.compacta) > .pdl.pdl-fam-pack:not(.pdl-hijo) { border-left-color: var(--accent); }
.pdl-f2 > .pc-tipo { width: 72px; }

/* Confirmación: valorada o sin valorar */
.impr-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.impr-panel .muted { flex: 1 1 260px; }
.valorado-eleccion { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 10px 0; padding: 8px 10px; background: var(--bg); border-radius: 6px; }
.valorado-eleccion .check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- Pedido: lo de arriba lo más bajo posible para que quepan muchas líneas (02/11/2026) ---------- */
.pedido-pagina .ped-titulo { margin-bottom: 2px; gap: 8px; }
.pedido-pagina .ped-titulo .mesa-num { font-size: 17px; }
.pedido-pagina .ped-titulo-cli { font-size: 15px; }
.ped-hist-btn { margin-left: auto; height: 24px; font-size: 11.5px; padding: 0 8px; }
.ped-hist-btn.on { background: var(--accent-soft); }
/* barra de pasos y acciones en una sola fila: los pasos solo con su número (salvo el actual) */
.pedido-pagina .ped-pasos { flex-wrap: nowrap; padding: 4px 8px; margin-bottom: 4px; gap: 4px; }
.pedido-pagina .ped-paso { padding: 2px 7px; font-size: 10.5px; flex: none; }
.pedido-pagina .ped-paso:not(.actual) .ped-paso-txt { display: none; }
.pedido-pagina .ped-acciones { flex-wrap: nowrap; overflow-x: auto; gap: 4px; scrollbar-width: thin; }
.pedido-pagina .ped-pasos .btn { height: 27px; padding: 0 9px; font-size: 12px; white-space: nowrap; flex: none; }
.pedido-pagina > .alert { padding: 4px 10px; margin-bottom: 4px; font-size: 12.5px; }
/* cabecera: etiqueta a la izquierda del campo (no encima) y «Cabecera» en vertical en el lateral */
.ped-cab:not(.plegada) { display: flex; align-items: stretch; gap: 6px; padding: 4px 8px; margin-bottom: 4px; }
.ped-cab:not(.plegada) .ped-cab-toggle { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9px; padding: 2px 1px; margin: 0; border-right: 0; color: var(--ink-3); }
.ped-cab:not(.plegada) .ped-cab-grid { flex: 1; min-width: 0; gap: 3px 8px; }
.ped-cab.plegada { padding: 3px 10px; margin-bottom: 4px; }
.ped-cab-grid label { flex-direction: row; align-items: center; gap: 5px; white-space: nowrap; font-size: 9.5px; }
.ped-cab-grid label > * { flex: 1 1 auto; min-width: 0; }
.ped-cab-grid .input, .ped-cab-grid select.input, .ped-cab-grid textarea.input.auto { height: 25px; min-height: 25px; font-size: 12.5px; }
.ped-cab-grid .btn { height: 25px; }
.cli-historia { padding: 1px 10px; margin-bottom: 4px; }
.cli-historia.plegada { min-height: 0; }
.cli-historia .ped-cab-toggle, .cli-historia .small { font-size: 10.5px; }
/* cabecera de las líneas: una fila baja con «+ Añadir línea» */
.pedido-pagina section.card.ped-lin { padding: 4px 8px 4px; }
.ped-lin .clasif-head { gap: 8px; margin-bottom: 4px; min-height: 0; }
.ped-lin .clasif-head h2 { margin: 0; font-size: 12px; }
.ped-lin .clasif-head .pl-anadir { margin-left: auto; height: 24px; padding: 0 10px; font-size: 12px; }
.ped-lin .clasif-head .pdl-vista { margin-left: 0; height: 24px; font-size: 12px; }
@media (min-width: 1100px) and (min-height: 600px) {
    .main:has(.pedido-pagina) .content { padding: 6px 14px 6px; }
    .pedido-pagina > .ped-lin { min-height: 360px; }
}
.pedido-pagina section.card.cli-historia { padding: 2px 10px; }
.pedido-pagina section.card.ped-cab:not(.plegada) { padding: 4px 8px; }
.pedido-pagina section.card.ped-cab.plegada { padding: 3px 10px; }
.pdl-lista:not(.compacta) { gap: 8px; }
.pdl-lista:not(.compacta) > .pdl:not(.pdl-hijo) { padding: 6px 10px 7px; }
.pdl-lista:not(.compacta) .pdl-f2 { margin-top: 5px; padding-top: 5px; }

/* ---------- Pedido: término medio en la cabecera (02/11/2026, 2) ----------
   Etiqueta ENCIMA del campo (pequeña y pegada), 2 filas; anchos repartidos para que quepan fechas, correo y cliente. */
.ped-cab-grid { grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px 10px; }
.ped-cab-grid label { flex-direction: column; align-items: stretch; gap: 0; white-space: nowrap; font-size: 9.5px; line-height: 1.25; }
.ped-cab-grid label > * { flex: none; min-width: 0; }
.ped-cab-grid .input, .ped-cab-grid select.input, .ped-cab-grid textarea.input.auto { height: 28px; min-height: 28px; font-size: 13px; padding: 3px 8px; }
.ped-cab-grid textarea.input.auto { resize: vertical; }
.ped-cab-grid .btn { height: 28px; }
.ped-cab-grid input[type="date"] { min-width: 128px; }
/* fila 1: cliente · destino · prog · entrega · su ref. · fecha · entrega sol. — fila 2: obra · dirección · correo · obs. */
.pk-cli { grid-column: span 6; } .pk-dest { grid-column: span 4; } .pk-prog { grid-column: span 2; } .pk-ent { grid-column: span 3; }
.pk-ref { grid-column: span 3; } .pk-fecha { grid-column: span 3; }
.pk-obra { grid-column: span 4; } .pk-dir { grid-column: span 7; } .pk-mail { grid-column: span 5; } .pk-obs { grid-column: span 8; }
@media (max-width: 1500px) {
    /* pantallas medianas (o con zoom de Windows): 3 filas */
    .pk-cli { grid-column: span 9; } .pk-dest { grid-column: span 6; } .pk-prog { grid-column: span 3; } .pk-ent { grid-column: span 6; }
    .pk-ref { grid-column: span 6; } .pk-fecha { grid-column: span 5; } .pk-obra { grid-column: span 8; }
    .pk-dir { grid-column: span 10; } .pk-mail { grid-column: span 7; } .pk-obs { grid-column: span 17; }
}
@media (max-width: 900px) { .ped-cab-grid > label { grid-column: span 12 !important; } .ped-cab-grid > .pk-cli, .ped-cab-grid > .pk-obs, .ped-cab-grid > .pk-dir { grid-column: span 24 !important; } }
.pedido-pagina section.card.ped-cab:not(.plegada) { padding: 5px 10px 7px 8px; }
@media (max-width: 1500px) { .pk-dir { grid-column: span 9; } .pk-mail { grid-column: span 6; } .pk-obs { grid-column: span 9; } }
.ped-cab-grid textarea.input.auto { overflow-y: hidden; line-height: 20px; }

/* =====================================================================================================
   PEDIDO · LÍNEAS — diseño de trabajo diario (02/11/2026). Manda sobre los bloques anteriores.
   Código de colores fijo:
     ESTADO (borde izquierdo + número):  verde codificada · naranja falta algo · rojo sin ruta en la Torre · gris sin codificar
     FAMILIA (el Tipo):                 azul hoja · morado block · verde azulado cerco · ocre tapajuntas · teja pack · gris herraje
     FILAS alternas por línea (el block y sus piezas van del mismo tono): blanco / arena
   ===================================================================================================== */
:root {
    --st-ok: #2f7d4f;       --st-ok-soft: #e4f2e9;
    --st-falta: #c26a00;    --st-falta-soft: #fff0d9;
    --st-sinruta: #c0392b;  --st-sinruta-soft: #fde6e3;
    --st-pend: #9b9188;     --st-pend-soft: #efebe6;
    --fam-hoja: #2a5e9c;       --fam-hoja-soft: #e6eefa;
    --fam-block: #6a3fb0;      --fam-block-soft: #eee6fb;
    --fam-cerco: #1d7a72;      --fam-cerco-soft: #def2ef;
    --fam-tapajuntas: #806c0e; --fam-tapajuntas-soft: #f4eed4;
    --fam-pack: #a24f1b;       --fam-pack-soft: #fbe7da;
    --fam-herraje: #57514b;    --fam-herraje-soft: #ebe8e4;
    --fila-a: #ffffff;
    --fila-b: #efe8de;
    --fila-borde: #d6ccbe;
}

/* ---- cliente en la cabecera: el nombre se recorta, «Cambiar» no se sale de su casilla ---- */
.selector-cliente { min-width: 0; }
.selector-valor { min-width: 0; overflow: hidden; }
.selector-valor > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selector-valor > .btn { flex: none; }
.ped-cab-grid .selector-valor { height: 28px; }

/* ---- leyenda ---- */
.pdl-leyenda { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-left: 8px; font-size: 11px; color: var(--ink-2); }
.pdl-leyenda .ley { display: inline-flex; align-items: center; gap: 4px; }
.pdl-leyenda .ley::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--st-pend); }
.pdl-leyenda .ley-ok::before { background: var(--st-ok); }
.pdl-leyenda .ley-falta::before { background: var(--st-falta); }
.pdl-leyenda .ley-sinruta::before { background: var(--st-sinruta); }
.pdl-leyenda .ley-sep { width: 1px; height: 14px; background: var(--line); }
.pdl-leyenda .fam { padding: 0 6px; border-radius: 4px; font-weight: 600; font-size: 10.5px; line-height: 17px; }
.fam-hoja { background: var(--fam-hoja-soft); color: var(--fam-hoja); }
.fam-block { background: var(--fam-block-soft); color: var(--fam-block); }
.fam-cerco { background: var(--fam-cerco-soft); color: var(--fam-cerco); }
.fam-tapajuntas { background: var(--fam-tapajuntas-soft); color: var(--fam-tapajuntas); }
.fam-pack { background: var(--fam-pack-soft); color: var(--fam-pack); }
.fam-herraje { background: var(--fam-herraje-soft); color: var(--fam-herraje); }
@media (max-width: 1250px) { .pdl-leyenda .fam, .pdl-leyenda .ley-sep { display: none; } }

/* ---- tarjeta de línea (vista normal) ---- */
.pdl-lista:not(.compacta) { gap: 6px; }
.pdl-lista:not(.compacta) > .pdl {
    background: var(--fila-a); border: 1px solid var(--fila-borde); border-left: 6px solid var(--st-pend);
    border-radius: 8px; box-shadow: 0 1px 2px rgba(50, 35, 20, .06); padding: 7px 12px 8px 10px;
}
.pdl-lista:not(.compacta) > .pdl.pdl-g-par { background: var(--fila-b); }
.pdl-lista:not(.compacta) > .pdl:not(.pdl-hijo):nth-child(even) { background: inherit; }   /* anula el alterno anterior */
.pdl-lista:not(.compacta) > .pdl.pdl-g-par:not(.pdl-hijo) { background: var(--fila-b); }
.pdl-lista:not(.compacta) > .pdl.pdl-g-impar:not(.pdl-hijo) { background: var(--fila-a); }
.pdl-lista:not(.compacta) > .pdl:hover { border-color: #bfb2a1; }
.pdl-lista:not(.compacta) > .pdl.abierta, .pdl-lista:not(.compacta) > .pdl:focus-within { box-shadow: 0 0 0 3px rgba(31, 95, 158, .28), 0 2px 8px rgba(20, 32, 46, .10); }
/* estado: borde izquierdo y número */
.pdl.st-ok { border-left-color: var(--st-ok) !important; }
.pdl.st-falta { border-left-color: var(--st-falta) !important; }
.pdl.st-sinruta { border-left-color: var(--st-sinruta) !important; }
.pdl.st-pend { border-left-color: var(--st-pend) !important; }
.pdl-lista:not(.compacta) > .pdl:not(.pdl-hijo) > .pdl-f1 .pdl-n {
    width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800; color: #fff; background: var(--st-pend); margin-top: 1px;
}
.pdl.st-ok > .pdl-f1 .pdl-n { background: var(--st-ok) !important; }
.pdl.st-falta > .pdl-f1 .pdl-n { background: var(--st-falta) !important; }
.pdl.st-sinruta > .pdl-f1 .pdl-n { background: var(--st-sinruta) !important; }
.pdl.st-pend > .pdl-f1 .pdl-n { background: var(--st-pend) !important; }
/* piezas del block: pegadas, mismo tono que su block, sangradas */
.pdl-lista:not(.compacta) > .pdl.pdl-hijo {
    margin: -7px 0 0 40px; border-radius: 0 0 8px 8px; border-top: 1px dashed var(--fila-borde);
    border-left-width: 4px; box-shadow: none; padding: 4px 10px 6px 8px;
}
.pdl-lista:not(.compacta) > .pdl.pdl-hijo .pdl-n { color: var(--fam-block); font-size: 15px; }

/* ---- fila 1: lo que pide el cliente ---- */
.pdl-lista:not(.compacta) .pdl-f1 { grid-template-columns: 30px minmax(0, 1fr) 84px 104px 78px 100px auto; gap: 10px; }
.pdl-lista:not(.compacta) .pdl-cliente { font-size: 12px; color: var(--ink-2); }
.pdl-lista:not(.compacta) .pdl-desc { font-size: 15px; font-weight: 650; color: var(--ink); }
.pdl-lista:not(.compacta) .pdl-hijo .pdl-desc { font-size: 13.5px; font-weight: 550; }
.pdl-lista:not(.compacta) .pdl-obs { font-size: 12px; color: var(--ink-2); }
.pdl .pdl-num .input { height: 30px; font-size: 14px; }
.pdl .pdl-cant .input { font-weight: 700; }
.pdl-imp { font-size: 14px; }

/* ---- fila 2: codificación. Hojas y blocks en REJILLA a todo lo ancho, alineada con la cabecera común ---- */
.pdl-lista:not(.compacta) .pdl-f2 {
    margin: 6px 0 0 40px; padding: 6px 8px; border: 0; border-radius: 6px; background: rgba(60, 40, 20, .045); gap: 6px 8px;
}
.pdl-lista:not(.compacta) .pdl .input { height: 30px; font-size: 13.5px; }
.pdl-lista:not(.compacta) .pdl-f2-hoja {
    display: grid; align-items: end;
    grid-template-columns: 104px minmax(170px, 2fr) repeat(5, minmax(60px, 1fr)) minmax(104px, 1.35fr)
                           minmax(72px, .85fr) minmax(72px, .85fr) minmax(58px, .7fr) minmax(100px, 1.2fr) minmax(230px, 2.6fr);
}
.pdl-lista:not(.compacta) .pdl-f2-hoja > * { width: auto !important; min-width: 0; flex: none; }
.pdl-lista:not(.compacta) .pdl-f2-hoja > .pdl-codid { align-self: stretch; flex-wrap: wrap; background: rgba(255, 255, 255, .7); border: 1px solid var(--line); }
.pdl-lista:not(.compacta) .pdl-f2-pieza { display: flex; flex-wrap: wrap; align-items: flex-end; }
.pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-tipo { width: 104px; }
.pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-pieza { width: 220px; }
.pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-mat, .pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-jun { width: 110px; }
.pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-reb, .pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-lar { width: 84px; }
.pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-mad, .pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-trab { width: 120px; }
.pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-med { width: 84px; } .pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-grueso { width: 70px; }
.pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-hcod { width: 220px; }
.pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-descr, .pdl-lista:not(.compacta) .pdl-f2-pieza > .pdl-codid { flex: 1 1 220px; }
.pdl-lista:not(.compacta) .pdl-f3 { margin-left: 40px; }
/* cabecera común de la rejilla: mismas columnas y mismos márgenes que la fila 2 de las tarjetas */
@container (min-width: 1140px) {
    .pdl-lista:not(.compacta) > .pdl-cab.pdl-f2-hoja {
        display: grid; margin: 0 13px 0 57px; padding: 0 8px 2px; background: none; border-radius: 0;
        font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2);
        position: sticky; top: 0; z-index: 3;
    }
    .pdl-lista:not(.compacta) > .pdl-cab.pdl-f2-hoja > .pdl-codid-cab { padding-left: 8px; }
}
@container (max-width: 1139px) {
    .pdl-lista:not(.compacta) .pdl-f2-hoja { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .pdl-lista:not(.compacta) .pdl-f2-hoja > .pc-mod, .pdl-lista:not(.compacta) .pdl-f2-hoja > .pdl-codid { grid-column: span 2; }
}

/* ---- el Tipo, con el color de su familia ---- */
.pdl .pc-tipo .input { font-weight: 700; }
.pdl-fam-hoja .pc-tipo .input, .pdl-fam-ninguna .pc-tipo .input { background: var(--fam-hoja-soft); color: var(--fam-hoja); border-color: #bcd0ea; }
.pdl-fam-block .pc-tipo .input { background: var(--fam-block-soft); color: var(--fam-block); border-color: #d3c2f0; }
.pdl-fam-cerco .pc-tipo .input { background: var(--fam-cerco-soft); color: var(--fam-cerco); border-color: #b5ddd8; }
.pdl-fam-tapajuntas .pc-tipo .input { background: var(--fam-tapajuntas-soft); color: var(--fam-tapajuntas); border-color: #e2d6a2; }
.pdl-fam-pack .pc-tipo .input { background: var(--fam-pack-soft); color: var(--fam-pack); border-color: #f0c9ae; }
.pdl-fam-herraje .pc-tipo .input { background: var(--fam-herraje-soft); color: var(--fam-herraje); border-color: #d4cec8; }
.pdl .pc-tipo .input option { background: #fff; color: var(--ink); }

/* ---- vista compacta: mismo código de colores y filas alternas bien visibles ---- */
.compacta .pdl { border-left: 5px solid var(--st-pend); background: var(--fila-a); }
.compacta .pdl.pdl-g-par { background: var(--fila-b); }
.compacta .pdl:nth-child(even):not(.pdl-g-par) { background: var(--fila-a); }
.compacta .pdl .pdl-n { color: #fff; background: var(--st-pend); border-radius: 50%; }
.compacta .pdl.st-ok .pdl-n { background: var(--st-ok); }
.compacta .pdl.st-falta .pdl-n { background: var(--st-falta); }
.compacta .pdl.st-sinruta .pdl-n { background: var(--st-sinruta); }
.compacta .pdl.pdl-hijo .pdl-n { background: transparent; color: var(--fam-block); }
.compacta .pdl.pdl-hijo { padding-left: 22px; }

/* ---- campos vacíos que hay que rellenar ---- */
.pdl .input.vacio, .pdl select.input.vacio { border-color: var(--st-falta); background: var(--st-falta-soft); color: var(--st-falta); }
/* ajustes de la rejilla: C1–C5 más estrechas (casi siempre «—»), más sitio para el COD_ID */
.pdl-lista:not(.compacta) .pdl-f2-hoja {
    grid-template-columns: 116px minmax(170px, 2fr) repeat(5, minmax(56px, .8fr)) minmax(104px, 1.3fr)
                           minmax(70px, .8fr) minmax(70px, .8fr) minmax(56px, .65fr) minmax(96px, 1.15fr) minmax(330px, 3.6fr);
}
.pdl-lista:not(.compacta) .pdl-f2-hoja > .pdl-codid { gap: 2px 8px; padding: 3px 8px; }
.pdl-lista:not(.compacta) .pdl-f2-hoja > .pdl-codid .codid { font-size: 11.5px; letter-spacing: -.01em; white-space: nowrap; }
.pdl-lista:not(.compacta) .pdl-f2-pieza > .pc-tipo { width: 132px; }
/* piezas: sin círculo de color, solo la flecha */
.pdl-lista:not(.compacta) > .pdl.pdl-hijo > .pdl-f1 .pdl-n { background: transparent !important; color: var(--fam-block); width: auto; height: auto; font-size: 16px; }
/* cerco / tapajuntas / herraje: sus etiquetas siempre a la vista (la cabecera común es solo de hojas) */
.pdl-f2-pieza .pc-lbl { position: static !important; width: auto !important; height: auto !important; overflow: visible !important; clip: auto !important; }
.pdl-lista:not(.compacta) .pdl-f2-hoja {
    grid-template-columns: 108px minmax(170px, 2.3fr) repeat(5, minmax(52px, .8fr)) minmax(104px, 1.3fr)
                           minmax(70px, .8fr) minmax(70px, .8fr) minmax(56px, .65fr) minmax(96px, 1.15fr) minmax(200px, 3.3fr);
}

/* ---- vista compacta: ajustes finos (02/11/2026) ---- */
.compacta .pdl-f2 > .pc-tipo, .pdl-cab-c .c-tipo { width: 76px; }
.compacta .pdl-f2 > .pc-tipo select.input { font-weight: 600; }
.compacta .pdl-precio, .pdl-cab-c .c-precio { width: 72px; }
.compacta .pdl-imp, .pdl-cab-c .c-imp { width: 80px; }
.compacta .pdl-imp { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: right; padding-right: 6px; }
.compacta .pdl-acc, .pdl-cab-c .c-acc { width: 64px; }
.compacta .pdl, .pdl-cab-c { min-width: 1460px; }
.compacta .pdl.pdl-hijo .pdl-n, .compacta .pdl.pdl-hijo.st-ok .pdl-n, .compacta .pdl.pdl-hijo.st-falta .pdl-n,
.compacta .pdl.pdl-hijo.st-sinruta .pdl-n { background: transparent !important; color: var(--fam-block); font-size: 14px; border-radius: 0; }
.compacta .pdl.pdl-hijo { border-left-style: dotted; }
.compacta ~ .pdl-cab, .compacta > .pdl-cab { display: none; }
.compacta .pdl-f2 > .pc-tipo, .pdl-cab-c .c-tipo { width: 90px; }
.compacta .pdl-f2 > .pc-mod, .pdl-cab-c .c-mod { width: 150px; }
.compacta .pdl-f2 > .pc-c, .pdl-cab-c .c-c { width: 54px; }
.compacta .pdl-acc, .pdl-cab-c .c-acc { width: 112px; gap: 2px; }
.compacta .pdl-acc .btn { padding: 0 5px; }
.compacta .pdl, .pdl-cab-c { min-width: 1520px; }
/* piezas hijas en compacta: caben en una sola fila */
.compacta .pdl-f2-pieza > .pc-pieza { width: 150px; }
.compacta .pdl-f2-pieza > .pc-mat, .compacta .pdl-f2-pieza > .pc-jun { width: 78px; }
.compacta .pdl-f2-pieza > .pc-reb, .compacta .pdl-f2-pieza > .pc-lar { width: 62px; }
.compacta .pdl-f2-pieza > .pc-mad { width: 90px; } .compacta .pdl-f2-pieza > .pc-trab { width: 88px; }
.compacta .pdl-f2-pieza > .pc-med { width: 58px; } .compacta .pdl-f2-pieza > .pc-grueso { width: 44px; }
.compacta .pdl-f2-pieza > .pc-hcod { width: 150px; }
.compacta .pdl-hijo .pdl-txt { flex-basis: 120px; }
.pdl-lista:not(.compacta) .pdl-f2-hoja > .pdl-codid { min-width: 0; overflow: hidden; }
.pdl-lista:not(.compacta) .pdl-f2-hoja > .pdl-codid .codid { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---- entrega flexible (04/11/2026) ---- */
.pk-ent { position: relative; }
.pk-ent-info { display: block; margin-top: 2px; font-size: 11px; font-weight: 500; color: var(--st-ok, #2f7d4f); text-transform: none; letter-spacing: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-ent .pk-aprox { border-color: var(--st-falta, #c26a00); background: #fff6e8; }
.pk-ent .pk-aprox + .pk-ent-info { color: var(--st-falta, #c26a00); }

/* ===== Norma de compacidad (07/11/2026) =====
   Poco aire por defecto: campos y botones de 30 px, tarjetas y tablas con relleno pequeño.
   Las pantallas que necesiten más ancho lo piden en su propia hoja de estilos. */
input.input, select.input { height: 30px; padding: 0 8px; font-size: 13px; }
.btn { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.btn-sm { height: 26px; padding: 0 9px; font-size: 12px; }
.card { padding: 12px 14px; }
.table-card { padding: 0; }
.page-head { margin-bottom: 8px; gap: 12px; }
.page-head h1 { font-size: 20px; }
.page-sub { font-size: 12.5px; }
.grid th { padding: 6px 10px; font-size: 12px; }
.grid td { padding: 5px 10px; }
.grid.compact td { padding: 3px 8px; }
.tabs { margin-bottom: 8px; }
.fields { gap: 6px 10px; }
.fields label { gap: 2px; }
.alert { padding: 7px 12px; }

/* ===== Listas de mucho uso en UNA línea por fila (Pedidos recibidos, Pedidos) — 07/11/2026 =====
   Ancho fijo por columna (colgroup), texto que no cabe con «…» y el completo al pasar el ratón. */
.grid.una-linea { table-layout: fixed; width: 100%; font-size: 12.5px; }
.grid.una-linea th { padding: 5px 8px; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.grid.una-linea td { padding: 3px 8px; height: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; line-height: 1.25; }
.grid.una-linea .chip, .grid.una-linea .badge { font-size: 11px; padding: 1px 7px; line-height: 16px; margin: 0 3px 0 0; vertical-align: middle; white-space: nowrap; }
.grid.una-linea .small { font-size: 11px; }
.grid.una-linea td.mono, .grid.una-linea .mono { font-size: 12px; }
.grid.una-linea .pedido-num { font-size: 12.5px; }
.grid.una-linea a.ent { margin-right: 4px; }
.grid.una-linea tbody tr:nth-child(even) td { background: #f7f9fc; }
.grid.una-linea tbody tr.clickable:hover td { background: var(--accent-soft); }

/* ===== Ficha del pedido: lo máximo para las líneas (07/11/2026) =====
   Título con los pasos y el siguiente paso en UNA fila; barra de botones de 28 px; cabecera en DOS filas. */
.pedido-pagina .ped-titulo { gap: 8px; margin-bottom: 4px; flex-wrap: nowrap; min-width: 0; }
.pedido-pagina .ped-titulo .mesa-num { font-size: 17px; }
.pedido-pagina .ped-titulo-cli { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30%; }
.pedido-pagina .ped-titulo-meta { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-size: 11.5px; }
.pedido-pagina .ped-titulo .ped-pasos-fila { display: inline-flex; gap: 3px; flex: none; margin-left: 6px; }
.pedido-pagina .ped-titulo .ped-paso { padding: 1px 7px; font-size: 10.5px; }
.pedido-pagina .ped-sig-txt { flex: 1 1 120px; min-width: 0; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pedido-pagina .ped-titulo .ped-hist-btn { flex: none; margin-left: auto; height: 24px; }
.pedido-pagina .ped-pasos { padding: 4px 8px; margin-bottom: 4px; }
.pedido-pagina .ped-pasos .ped-acciones { margin-left: 0; width: 100%; gap: 6px 14px; justify-content: flex-start; }
.pedido-pagina .ped-pasos .ped-acciones .ped-grp .btn, .pedido-pagina .ped-pasos .ped-acciones .ped-grp .ped-mas .btn { height: 28px; padding: 0 10px; font-size: 12.5px; }
.pedido-pagina .ped-pasos .ped-fin { margin-left: auto; padding-left: 12px; }

.pedido-pagina .ped-cab { padding: 4px 8px 5px 4px; margin-bottom: 4px; }
.pedido-pagina .pc2 { gap: 3px; }
.pedido-pagina .pc2-fila { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px 6px; align-items: end; }
.pedido-pagina .pc2 label { display: flex; flex-direction: column; gap: 0; min-width: 0; font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.pedido-pagina .pc2 .input, .pedido-pagina .pc2 select.input { height: 26px; min-height: 26px; font-size: 12.5px; padding: 0 6px; text-transform: none; letter-spacing: 0; width: 100%; }
.pedido-pagina .pc2 textarea.input.auto { height: 26px; min-height: 26px; line-height: 18px; padding: 3px 6px; resize: vertical; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pedido-pagina .pc2 textarea.input.auto:focus { white-space: normal; height: auto; min-height: 60px; overflow: auto; position: relative; z-index: 5; }
.pedido-pagina .pc2 input[type="date"] { padding: 0 4px; font-size: 12px; }
.pedido-pagina .pc2 .input.num { text-align: right; padding: 0 4px; }
.pedido-pagina .pc2 .c1 { grid-column: span 1; } .pedido-pagina .pc2 .c2 { grid-column: span 2; } .pedido-pagina .pc2 .c3 { grid-column: span 3; }
.pedido-pagina .pc2 .c4 { grid-column: span 4; } .pedido-pagina .pc2 .c5 { grid-column: span 5; } .pedido-pagina .pc2 .c6 { grid-column: span 6; }
.pedido-pagina .pc2-chks { display: flex; gap: 4px; align-items: center; height: 26px; min-width: 0; overflow: hidden; }
.pedido-pagina .pc2 .pc2-chk { flex-direction: row; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 1px 7px; background: var(--surface); height: 22px; }
.pedido-pagina .pc2 .pc2-chk input { margin: 0; }
/* el selector de cliente, a la misma altura */
.pedido-pagina .pc2 .selector-cliente .input, .pedido-pagina .pc2 .selector-cliente .btn { height: 26px; min-height: 26px; font-size: 12.5px; }
.pedido-pagina .pc2 .selector-cliente .btn { padding: 0 8px; }
.pedido-pagina .cli-historia { padding: 2px 8px; margin-bottom: 4px; }
.pedido-pagina section.card.ped-lin { padding-top: 6px; }
@media (max-width: 1250px) {
    .pedido-pagina .pc2-fila { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .pedido-pagina .pc2 .c5, .pedido-pagina .pc2 .c6 { grid-column: span 6; } .pedido-pagina .pc2 .c4 { grid-column: span 4; }
    .pedido-pagina .ped-titulo { flex-wrap: wrap; }
}
.pedido-pagina .pc2 .selector-valor { height: 26px; font-size: 12.5px; padding: 0 2px 0 8px; text-transform: none; letter-spacing: 0; }
.pedido-pagina .pc2 .selector-valor .btn { height: 22px; min-height: 22px; font-size: 11.5px; }

/* ---- Pedidos: nuevo pedido a mano (08/11/2026) ---- */
.ped-nuevo { padding: 8px 12px; margin-bottom: 8px; border-left: 3px solid var(--accent); }
.ped-nuevo-tit { margin-bottom: 4px; font-size: 13px; }
.ped-nuevo-campos { display: flex; flex-wrap: wrap; align-items: end; gap: 6px 10px; }
.ped-nuevo-campos label { display: flex; flex-direction: column; gap: 1px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); min-width: 140px; }
.ped-nuevo-campos .pn-cli { flex: 1 1 360px; }
.ped-nuevo-campos .input, .ped-nuevo-campos .selector-valor { height: 28px; min-height: 28px; font-size: 13px; text-transform: none; letter-spacing: 0; }
.ped-nuevo-bot { display: flex; gap: 6px; }
.ped-nuevo-bot .btn { height: 28px; }

/* ---- C1–C5 legibles (08/11/2026): más ancho y menos relleno, para que se lea «LPL», «1-V», «F60», «GRO»… ---- */
.pdl-lista:not(.compacta) .pdl-f2-hoja {
    grid-template-columns: 100px minmax(150px, 2fr) repeat(5, minmax(68px, .95fr)) minmax(100px, 1.3fr)
                           minmax(62px, .75fr) minmax(62px, .75fr) minmax(50px, .6fr) minmax(92px, 1.15fr) minmax(180px, 3fr);
}
.pdl .pc-c select.input { padding: 0 1px 0 6px; font-size: 13px; font-weight: 600; letter-spacing: -.01em; text-overflow: clip; }
.pdl .pc-c select.input option { font-weight: 400; }
.compacta .pdl-f2 > .pc-c, .pdl-cab-c .c-c { width: 64px; }
.compacta .pdl .pc-c select.input { padding: 0 0 0 4px; font-size: 12.5px; }

/* ---- Pedido: combinaciones del modelo con COD_ID y ruta (elegir una al entrar a mano) ---- */
.pdl-conruta { height: 22px; padding: 0 7px; font-size: 11.5px; white-space: nowrap; }
.pdl-conruta.on { background: var(--accent-soft); border-color: var(--accent); }
.compacta .pdl-codid .pdl-conruta { font-size: 10px; padding: 0 4px; height: 20px; }
.pdl-conruta-panel { margin: 2px 0 4px; padding: 6px 8px; border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); }
.pdl-conruta-panel .cr-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 4px; font-size: 12.5px; }
.pdl-conruta-panel .cr-filtro { height: 26px; width: 260px; font-size: 12.5px; }
.pdl-conruta-panel .check { font-size: 12px; }
.pdl-conruta-panel .cr-lista { max-height: 240px; overflow: auto; }
.cr-tabla { font-size: 12px; width: 100%; }
.cr-tabla th { position: sticky; top: 0; background: var(--surface); }
.cr-tabla td, .cr-tabla th { padding: 2px 8px; height: 24px; }
.cr-tabla tbody tr { cursor: pointer; }
.cr-tabla tbody tr:hover { background: var(--accent-soft); }
.cr-tabla tbody tr.on { background: var(--accent-soft); font-weight: 600; }
.cr-tabla .badge { font-size: 10px; padding: 0 5px; }
.cr-tabla .cr-cli { white-space: nowrap; max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.cr-tabla .cr-cli > span { margin-right: 6px; }
.cr-mio { background: var(--ok-soft); color: var(--ok); font-weight: 700; border-radius: 4px; padding: 0 5px; }
.cr-otro { color: var(--ink-2); }
.cr-tabla tbody tr.cr-suyo > td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.cr-tabla .cr-ref { color: var(--ink-3, #888); font-style: italic; white-space: nowrap; }
