/* ==========================================================
   SUMAJ YAPAY — Administración de contratos y pedidos
   Estilos del tablero (maqueta "Traza"), encapsulados bajo .tzr
   para no chocar con el resto del sistema.
   ========================================================== */
.tzr{--surface-000:#f5f3ee;--surface-100:#ffffff;--surface-200:#edeae3;--line:#d9d4c9;--ink:#1a2129;--ink-muted:#59626b;--brand:#0f3d5c;--brand-ink:#ffffff;--accent:#b85a24;--stage-pending:#7d858d;--stage-material:#c48a1c;--stage-production:#1d66a8;--stage-approval:#8e3fa0;--stage-rejected:#9b1c47;--stage-transit:#0d7f80;--stage-bl:#c2410c;--stage-paid:#2e7a34;--stage-pending-bg:#eceef0;--stage-material-bg:#f8ecd2;--stage-production-bg:#e1ecf7;--stage-approval-bg:#f3e5f6;--stage-rejected-bg:#fbe3ea;--stage-transit-bg:#dcf0ef;--stage-bl-bg:#fbe5d9;--stage-paid-bg:#e2f1e2;--danger:#b42318;--danger-bg:#fde8e6;--ok:#2e7a34;--chart-real:#1d66a8;--chart-plan:#6aa5e0;--shadow-row:0 1px 2px rgba(26,33,41,0.06);--shadow-open:0 6px 20px rgba(26,33,41,0.10);--space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-6:24px;--space-8:32px;--radius-sm:4px;--radius-md:8px;--radius-lg:12px;--radius-pill:999px;--font-sans:"IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;--font-mono:"IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;}
.tzr{background:var(--surface-000);color:var(--ink);font-family:var(--font-sans);container-type:inline-size;container-name:tzr}
.tzr .tz-tabs{position:sticky;top:var(--tz-stick,0px);z-index:30}
.tzr input,.tzr select,.tzr textarea{text-transform:none}
.tzr input[type="text"]{text-transform:none}
.tzr .tz-loading{padding:32px;color:var(--ink-muted);font-size:14px}
@media (prefers-reduced-motion: reduce){.tzr *{transition:none!important}}
.tzr .tz, .tzr .tz * { box-sizing: border-box; }
.tzr .tz { font-family: var(--font-sans); color: var(--ink); font-size: 14px; line-height: 20px; }
.tzr .tz .num { font-family: var(--font-mono); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tzr .tz .muted { color: var(--ink-muted); }
.tzr .tz .lbl { font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }

/* ---------- StageBadge ---------- */
.tzr .tz-badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 3px 10px 3px 8px; border-radius: var(--radius-pill); font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.tzr .tz-badge i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tzr .tz-st-no-iniciado { --st: var(--stage-pending); --st-bg: var(--stage-pending-bg); }
.tzr .tz-st-mp-comprometida { --st: var(--stage-material); --st-bg: var(--stage-material-bg); }
.tzr .tz-st-produccion { --st: var(--stage-production); --st-bg: var(--stage-production-bg); }
.tzr .tz-st-aprobacion { --st: var(--stage-approval); --st-bg: var(--stage-approval-bg); }
.tzr .tz-st-rechazado { --st: var(--stage-rejected); --st-bg: var(--stage-rejected-bg); }
.tzr .tz-st-transito { --st: var(--stage-transit); --st-bg: var(--stage-transit-bg); }
.tzr .tz-st-bl-por-cobrar { --st: var(--stage-bl); --st-bg: var(--stage-bl-bg); }
.tzr .tz-st-cobrado { --st: var(--stage-paid); --st-bg: var(--stage-paid-bg); }
.tzr .tz-badge { background: var(--st-bg); }
.tzr .tz-badge i { background: var(--st); }

/* ---------- ProgressBar ---------- */
.tzr .tz-prog { display: flex; align-items: center; gap: var(--space-2); min-width: 120px; }
.tzr .tz-prog .track { flex: 1; height: 8px; border-radius: var(--radius-sm); background: var(--surface-200); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.tzr .tz-prog .fill { height: 100%; background: var(--stage-production); border-radius: var(--radius-sm); }
.tzr .tz-prog.done .fill { background: var(--stage-paid); }
.tzr .tz-prog .pct { font-family: var(--font-mono); font-size: 12px; font-weight: 600; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.tzr .tz-prog.sm .track { height: 6px; }

/* ---------- Delay tag ---------- */
.tzr .tz-delay { display: inline-block; padding: 1px 6px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 11px; font-weight: 600; background: var(--danger-bg); color: var(--danger); white-space: nowrap; }
.tzr .tz-ontime { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--ok); white-space: nowrap; }

/* ---------- StageSummary ---------- */
.tzr .tz-summary { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--space-2); }
.tzr .tz-tile { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 6px; padding: var(--space-3) var(--space-4); background: var(--surface-100); border: 1px solid var(--line); border-top: 4px solid var(--st); border-radius: var(--radius-md); min-width: 0; }
.tzr .tz-tile:hover { background: var(--surface-200); }
.tzr .tz-tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tzr .tz-tile[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--st); }
.tzr .tz-tile .step { font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); }
.tzr .tz-tile .name { font-size: 13px; line-height: 16px; font-weight: 600; min-height: 32px; }
.tzr .tz-tile .count { font-family: var(--font-mono); font-size: 28px; line-height: 32px; font-weight: 600; }
.tzr .tz-tile .amt { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }

/* ---------- OrderRow ---------- */
.tzr .tz-order { background: var(--surface-100); border: 1px solid var(--line); border-left: 4px solid var(--st); border-radius: var(--radius-md); box-shadow: var(--shadow-row); }
.tzr .tz-order + .tz-order { margin-top: var(--space-2); }
.tzr .tz-order.open { box-shadow: var(--shadow-open); }
.tzr .tz-order .head { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 20px 1.3fr 0.95fr 1.3fr 0.8fr 1.05fr 1.4fr 132px; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
.tzr .tz-order .head:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: var(--radius-md); }
.tzr .tz-order .chev { width: 16px; height: 16px; transition: transform .15s; color: var(--ink-muted); }
.tzr .tz-order.open .chev { transform: rotate(90deg); }
.tzr .tz-order .c-id b { display: block; font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.tzr .tz-order .c-id span, .tzr .tz-order .c-sub { font-size: 12px; line-height: 16px; color: var(--ink-muted); display: block; }
.tzr .tz-order .c-amt { font-family: var(--font-mono); font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.tzr .tz-order .c-key { font-size: 12px; line-height: 16px; }
.tzr .tz-order .c-badge { justify-self: end; }
.tzr .tz-order .cell-ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.tzr .tz-order .body { display: none; border-top: 1px solid var(--line); background: var(--surface-200); padding: var(--space-4); border-radius: 0 0 var(--radius-md) 0; }
.tzr .tz-order.open .body { display: grid; grid-template-columns: 1.7fr 1fr; gap: var(--space-4); }
.tzr .tz-panel { background: var(--surface-100); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); min-width: 0; }
.tzr .tz-panel h3 { margin: 0 0 var(--space-3); font-size: 15px; line-height: 20px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.tzr .tz-panel.wide { grid-column: 1 / -1; }
.tzr .tz-panel.wide .tz-facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.tzr .tz-items { width: 100%; border-collapse: collapse; }
.tzr .tz-items th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); padding: 6px var(--space-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tzr .tz-items td { padding: var(--space-2); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tzr .tz-items tr:last-child td { border-bottom: 0; }
.tzr .tz-items .r { text-align: right; }
.tzr .tz-items td.num, .tzr .tz-items td .num { white-space: nowrap; }

.tzr .tz-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); margin: 0; }
.tzr .tz-facts div { min-width: 0; }
.tzr .tz-facts dt { font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 2px; }
.tzr .tz-facts dd { margin: 0; font-size: 13px; line-height: 18px; overflow-wrap: anywhere; }
.tzr .tz-facts dd.num { font-family: var(--font-mono); }

/* ---------- DateTimeline ---------- */
.tzr .tz-tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tzr .tz-tl li { display: grid; grid-template-columns: 18px 1fr auto auto auto; gap: var(--space-2) var(--space-3); align-items: center; padding: 7px 0; position: relative; }
.tzr .tz-tl li::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tzr .tz-tl li:first-child::before { top: 50%; }
.tzr .tz-tl li:last-child::before { bottom: 50%; }
.tzr .tz-tl .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface-100); position: relative; z-index: 1; margin-left: 3px; }
.tzr .tz-tl li.done .dot { background: var(--stage-paid); border-color: var(--stage-paid); }
.tzr .tz-tl li.late .dot { background: var(--surface-100); border-color: var(--danger); }
.tzr .tz-tl li.now .dot { border-color: var(--stage-production); box-shadow: 0 0 0 3px var(--stage-production-bg); }
.tzr .tz-tl .ms { font-size: 13px; line-height: 18px; font-weight: 500; }
.tzr .tz-tl .d { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.tzr .tz-tl .d small { display: block; font-family: var(--font-sans); font-size: 11px; line-height: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.tzr .tz-tl .v { min-width: 64px; text-align: right; }
.tzr .tz-tl-head { display: grid; grid-template-columns: 18px 1fr auto auto auto; gap: var(--space-3); }

/* ---------- Tablero (pantalla completa) ---------- */
.tzr .tz-app { background: var(--surface-000); padding: var(--space-6) var(--space-8) var(--space-8); min-height: 100%; }
.tzr .tz-top { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.tzr .tz-top h1 { margin: 0; font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -.02em; }
.tzr .tz-top .sub { color: var(--ink-muted); font-size: 13px; }
.tzr .tz-tools { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.tzr .tz-input { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface-100); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 12px; width: 280px; }
.tzr .tz-input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.tzr .tz-btn { all: unset; cursor: pointer; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface-100); color: var(--ink); }
.tzr .tz-btn:hover { background: var(--surface-200); }
.tzr .tz-btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tzr .tz-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tzr .tz-group { margin-top: var(--space-6); }
.tzr .tz-group-h { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.tzr .tz-group-h h2 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; }
.tzr .tz-group-h .bar { width: 4px; height: 20px; border-radius: 2px; background: var(--st); }
.tzr .tz-group-h .meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.tzr .tz-colh { display: grid; grid-template-columns: 20px 1.3fr 0.95fr 1.3fr 0.8fr 1.05fr 1.4fr 132px; gap: var(--space-3); padding: 0 var(--space-4) 6px calc(var(--space-4) + 4px); }
.tzr .tz-colh span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.tzr .tz-colh .r { text-align: right; }
.tzr .tz-empty { padding: var(--space-4); color: var(--ink-muted); font-size: 13px; border: 1px dashed var(--line); border-radius: var(--radius-md); }

/* ---------- Vista Materia prima ---------- */
.tzr .tz-order .head.mp, .tzr .tz-colh.mp { grid-template-columns: 20px 1.25fr 1.4fr 1.05fr 1.05fr 0.75fr 0.8fr 0.8fr 1.15fr; }
.tzr .tz-order .head.mp .c-sub .tz-badge { padding: 0 8px 0 6px; font-size: 11px; vertical-align: middle; }
.tzr .tz-order.open .body.one { grid-template-columns: 1fr; }
.tzr .tz-summary.mp { grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); }
.tzr .tz-tile.tz-total { cursor: default; border-top-color: var(--danger); }
.tzr .tz-tile.tz-total:hover { background: var(--surface-100); }

/* ---------- Pestañas de la plataforma ---------- */
.tzr .tz-shell { background: var(--surface-000); min-height: 100%; }
.tzr .tz-tabs { display: flex; align-items: stretch; gap: var(--space-1); padding: 0 var(--space-8); background: var(--brand); }
.tzr .tz-brand { font-weight: 600; font-size: 16px; color: var(--brand-ink); padding: 12px var(--space-6) 12px 0; letter-spacing: -.01em; }
.tzr .tz-tabs [role=tab] { all: unset; cursor: pointer; padding: 12px var(--space-4); font-size: 14px; font-weight: 600; color: var(--brand-ink); opacity: .78; border-bottom: 3px solid transparent; }
.tzr .tz-tabs [role=tab]:hover { opacity: 1; }
.tzr .tz-tabs [role=tab][aria-selected="true"] { opacity: 1; border-bottom-color: var(--accent); }
.tzr .tz-tabs [role=tab]:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: -4px; }

/* ---------- Estadísticas ---------- */
.tzr .tz-filters { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); align-items: flex-end; padding: var(--space-3) var(--space-4); background: var(--surface-100); border: 1px solid var(--line); border-radius: var(--radius-md); margin-bottom: var(--space-4); }
.tzr .tz-filters.in { background: var(--surface-200); }
.tzr .tz-field { display: flex; flex-direction: column; gap: 4px; }
.tzr .tz-select { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface-100); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 6px 28px 6px 10px; min-width: 150px; }
.tzr .tz-select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.tzr .tz-seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-100); }
.tzr .tz-seg button { all: unset; cursor: pointer; font-size: 13px; font-weight: 500; padding: 6px 12px; color: var(--ink-muted); }
.tzr .tz-seg button + button { border-left: 1px solid var(--line); }
.tzr .tz-seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.tzr .tz-seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.tzr .tz-panel h3 .tz-seg button { font-size: 12px; padding: 4px 10px; }
.tzr .tz-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-2); }
.tzr .tz-kpi { display: flex; flex-direction: column; gap: 4px; padding: var(--space-3) var(--space-4); background: var(--surface-100); border: 1px solid var(--line); border-radius: var(--radius-md); min-width: 0; }
.tzr .tz-kpi[data-drill] { cursor: pointer; }
.tzr .tz-kpi[data-drill]:hover { background: var(--surface-200); }
.tzr .tz-kpi[data-drill]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tzr .tz-kpi .v { font-family: var(--font-mono); font-size: 22px; line-height: 28px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tzr .tz-kpi .s { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.tzr .tz-trend { font-size: 11px; font-weight: 600; }
.tzr .tz-trend.up { color: var(--ok); }
.tzr .tz-trend.down { color: var(--danger); }
.tzr .tz-cpanel { margin-top: var(--space-4); }
.tzr .tz-cwrap { position: relative; }
.tzr .tz-chart { width: 100%; height: auto; display: block; overflow: visible; }
.tzr .tz-chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tzr .tz-chart .grid.base { stroke: var(--ink-muted); }
.tzr .tz-chart .ax { fill: var(--ink-muted); font-family: var(--font-mono); font-size: 11px; }
.tzr .tz-chart .b-real { fill: var(--chart-real); }
.tzr .tz-chart .b-plan { fill: var(--chart-plan); }
.tzr .tz-chart .hit { fill: transparent; cursor: pointer; }
.tzr .tz-chart .hit:hover { fill: var(--ink); fill-opacity: .05; }
.tzr .tz-legend { display: inline-flex; gap: var(--space-4); font-size: 12px; font-weight: 500; color: var(--ink); }
.tzr .tz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tzr .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 6px; }
.tzr .tz-legend .sw { margin-right: 0; }
.tzr .sw.real { background: var(--chart-real); }
.tzr .sw.plan { background: var(--chart-plan); }
.tzr .tz-two { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); }
.tzr .tz-pivwrap { overflow: auto; max-height: 560px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.tzr .tz-pivot { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.tzr .tz-pivot th, .tzr .tz-pivot td { padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tzr .tz-pivot thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-200); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); padding: 8px 10px; text-align: right; }
.tzr .tz-pivot th.rh { position: sticky; left: 0; z-index: 1; background: var(--surface-100); text-align: left; font-weight: 600; padding: 6px 12px; min-width: 200px; border-right: 1px solid var(--line); }
.tzr .tz-pivot thead th.rh { z-index: 3; background: var(--surface-200); text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink); }
.tzr .tz-pivot td { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tzr .tz-pivot td button { all: unset; cursor: pointer; display: block; padding: 6px 10px; width: 100%; box-sizing: border-box; }
.tzr .tz-pivot td button:hover { text-decoration: underline; }
.tzr .tz-pivot td button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.tzr .tz-pivot td.zero { color: var(--ink-muted); padding: 6px 10px; }
.tzr .tz-pivot .tot { font-weight: 600; background: var(--surface-200); }
.tzr .tz-pivot th.tot { color: var(--ink); }
.tzr .tz-pivot tfoot th, .tzr .tz-pivot tfoot td { position: sticky; bottom: 0; background: var(--surface-200); font-weight: 600; border-top: 2px solid var(--line); }
.tzr .tz-pivot tfoot th.rh { background: var(--surface-200); }
.tzr .tz-pivot td.grand { background: var(--brand); color: var(--brand-ink); }
.tzr .tz-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface-100); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-open); padding: 10px 12px; font-size: 12px; line-height: 18px; min-width: 200px; }
.tzr .tz-tip b { display: block; font-size: 13px; margin-bottom: 4px; }
.tzr .tz-tip .num { float: right; margin-left: 16px; font-weight: 600; }
.tzr .tz-drawer { position: fixed; inset: 0; z-index: 40; }
.tzr .tz-drawer[hidden] { display: none; }
.tzr .tz-scrim { position: absolute; inset: 0; background: rgba(10, 14, 18, .45); }
.tzr .tz-dpanel { position: absolute; top: 0; right: 0; bottom: 0; width: min(1040px, 92vw); background: var(--surface-000); border-left: 1px solid var(--line); box-shadow: var(--shadow-open); padding: var(--space-6); overflow: auto; display: flex; flex-direction: column; gap: var(--space-4); }
.tzr .tz-dpanel header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); }
.tzr .tz-dpanel h2 { margin: 2px 0 0; font-size: 20px; line-height: 26px; font-weight: 600; }
.tzr .tz-dsum { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.tzr .tz-dsum div { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; background: var(--surface-100); border: 1px solid var(--line); border-radius: var(--radius-md); min-width: 130px; }
.tzr .tz-dsum b { font-family: var(--font-mono); font-size: 18px; font-weight: 600; }
.tzr .tz-dscroll { background: var(--surface-100); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0 var(--space-2); overflow-x: auto; }

/* ---------- Espera de aprobación ---------- */
.tzr .tz-wait { height: 6px; margin: 4px 0 2px; border-radius: var(--radius-sm); background: var(--surface-200); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; max-width: 220px; }
.tzr .tz-wait i { display: block; height: 100%; background: var(--stage-approval); border-radius: var(--radius-sm); }
.tzr .tz-wait.over i { background: var(--danger); }
.tzr .tz-tl li.skip .dot { border-style: dashed; }
.tzr .tz-disp { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: var(--radius-sm); font-size: 11px; line-height: 16px; font-weight: 600; background: var(--stage-rejected-bg); color: var(--ink); white-space: nowrap; }
.tzr .tz-disp.pend { background: var(--danger-bg); color: var(--danger); }
.tzr .tz-tl li.rej .dot { background: var(--stage-rejected); border-color: var(--stage-rejected); }
.tzr .tz-summary .tz-tile { padding: var(--space-3); }
.tzr .tz-summary .tz-tile .name { font-size: 12px; }

/* ---------- Planificación ---------- */
.tzr .tz-kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tzr .tz-kpi .v.neg { color: var(--danger); }
.tzr .tz-checks { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.tzr .tz-checks label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tzr .tz-checks input { accent-color: var(--brand); }
.tzr .tz-rmchips { flex-basis: 100%; }
.tzr .tz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tzr .tz-chip { all: unset; cursor: pointer; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface-100); color: var(--ink); }
.tzr .tz-chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tzr .tz-chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tzr .tz-rm { margin-top: var(--space-4); border-left: 4px solid var(--stage-paid); }
.tzr .tz-rm-falta { border-left-color: var(--danger); }
.tzr .tz-rm-bajo { border-left-color: var(--stage-material); }
.tzr .tz-rmh { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-3); }
.tzr .tz-rmh h3 { margin: 2px 0 0; font-size: 17px; line-height: 22px; font-weight: 600; }
.tzr .tz-rmmeta { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.tzr .tz-rmmeta > span { display: flex; flex-direction: column; gap: 2px; }
.tzr .tz-rmmeta b { font-size: 14px; font-weight: 600; }
.tzr .tz-rmmeta .negt { color: var(--danger); }
.tzr .tz-status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap; color: var(--ink); }
.tzr .tz-status.ok { background: var(--stage-paid-bg); }
.tzr .tz-status.warn { background: var(--stage-material-bg); }
.tzr .tz-status.bad { background: var(--danger-bg); color: var(--danger); }
.tzr .tz-spark .zero { stroke: var(--ink-muted); stroke-width: 1; }
.tzr .tz-spark .safe { stroke: var(--stage-material); stroke-width: 1; stroke-dasharray: 3 3; }
.tzr .tz-spark .ln { fill: none; stroke: var(--chart-real); stroke-width: 2; stroke-linejoin: round; }
.tzr .tz-spark .ln.neg { stroke: var(--danger); }
.tzr .tz-spark .end { fill: var(--chart-real); stroke: var(--surface-100); stroke-width: 1.5; }
.tzr .tz-spark .end.neg { fill: var(--danger); }
.tzr .tz-pivwrap.flat { max-height: none; }
.tzr .tz-fc thead th small { display: block; font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.tzr .tz-fc td { padding: 6px 10px; }
.tzr .tz-fc td.in button, .tzr .tz-fc td.in { color: var(--ok); }
.tzr .tz-fc td.out button, .tzr .tz-fc td.out { color: var(--ink); }
.tzr .tz-fc td.soft button { font-style: italic; }
.tzr .tz-fc td button { padding: 0; }
.tzr .tz-fc tr.ini td { color: var(--ink-muted); }
.tzr .tz-fc tr.fin th, .tzr .tz-fc tr.fin td { font-weight: 700; border-top: 2px solid var(--line); background: var(--surface-200); }
.tzr .tz-fc td.neg { color: var(--danger) !important; background: var(--danger-bg) !important; }
.tzr .tz-fc td.low { color: var(--ink); background: var(--stage-material-bg) !important; }
.tzr .tz-fc tr.sug td.sugv { color: var(--brand); font-weight: 600; }
.tzr .tz-fc tr.fin th.rh { background: var(--surface-200); }

/* ---------- Fechas clave y edición ---------- */
.tzr .c-dates { display: flex; flex-direction: column; gap: 1px; font-size: 12px; line-height: 16px; min-width: 0; }
.tzr .kd { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.tzr .kd i { font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); width: 36px; flex: none; }
.tzr .kd b { font-size: 12px; font-weight: 600; }
.tzr .kd .est { font-size: 12px; color: var(--ink-muted); }
.tzr .kd small { font-size: 11px; color: var(--ink-muted); }
.tzr .tz-bodybar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.tzr .tz-order.editing .body { display: block; }
.tzr .tz-editor { display: flex; flex-direction: column; gap: var(--space-3); }
.tzr .tz-edbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; position: sticky; top: 44px; z-index: 5; background: var(--surface-200); padding: 4px 0; }
.tzr .tz-edact { display: flex; gap: var(--space-2); }
.tzr .tz-edgrid { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--space-4); }
.tzr .tz-ederr { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); font-size: 13px; }
.tzr .tz-ederr ul { margin: 6px 0 0; padding-left: 18px; }
.tzr .tz-in { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface-100); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 5px 8px; width: 100%; min-width: 0; box-sizing: border-box; }
.tzr .tz-in.r { text-align: right; font-family: var(--font-mono); }
.tzr .tz-in[type=date] { font-family: var(--font-mono); font-size: 12px; }
.tzr .tz-in:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.tzr .tz-edtab td { padding: 4px; }
.tzr .tz-edtab td:first-child { min-width: 220px; }
.tzr .tz-edrow { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: var(--space-2); align-items: center; padding: 3px 0; font-size: 13px; }
.tzr .tz-edrow.tz-edhead { padding-bottom: 0; }
.tzr .tz-edfields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); }
.tzr .tz-edf { display: flex; flex-direction: column; gap: 4px; }
.tzr .tz-toast { margin: var(--space-2) var(--space-4) 0; padding: 8px 12px; border-radius: var(--radius-md); background: var(--stage-paid-bg); color: var(--ink); font-size: 13px; font-weight: 600; border: 1px solid var(--stage-paid); }
.tzr .tz-toast.fixed { position: fixed; right: 24px; bottom: 24px; z-index: 60; margin: 0; }
.tzr .tz-edgrid { grid-template-columns: 1.8fr 1fr; }
.tzr .tz-edtab td:nth-child(4) .tz-in { min-width: 104px; }
.tzr .tz-edtab td:nth-child(2) .tz-in, .tzr .tz-edtab td:nth-child(3) .tz-in, .tzr .tz-edtab td:nth-child(5) .tz-in, .tzr .tz-edtab td:nth-child(6) .tz-in { min-width: 76px; }


/* ==========================================================
   Ajustes de integración en el ERP y pantallas medianas.
   El ancho se mide sobre el tablero (container query), no sobre
   la ventana: el menú lateral del sistema ya ocupa ~250 px.
   ========================================================== */
/* Pestañas fijas al desplazar (el scroll lo lleva .content del sistema) */
.tzr .tz-tabs{box-shadow:0 2px 6px rgba(26,33,41,.12)}
.tzr .tz-edbar{top:calc(var(--tz-stick,0px) + 46px)}
.tzr .tz-input{flex:0 1 280px;width:auto;min-width:160px}
.tzr .tz-top > div:first-child{min-width:0}
.tzr .tz-tools{flex-wrap:nowrap}
.tzr .tz-tools .tz-btn{white-space:nowrap}

/* Tarjetas de etapa: número y monto siempre alineados abajo */
.tzr .tz-tile .name{flex:1;min-height:0}
.tzr .tz-tile .count,.tzr .tz-tile .amt{flex:none}

/* Fila del pedido: la columna de fechas tiene ancho fijo (sus textos no se cortan) */
.tzr .tz-order .head,.tzr .tz-colh{grid-template-columns:20px minmax(0,1.3fr) minmax(0,.95fr) minmax(0,1.3fr) minmax(92px,.8fr) 150px minmax(0,1.4fr) 136px}
.tzr .tz-order .head.mp,.tzr .tz-colh.mp{grid-template-columns:20px minmax(0,1.25fr) minmax(0,1.4fr) minmax(0,1.05fr) 150px minmax(64px,.75fr) minmax(64px,.8fr) minmax(64px,.8fr) minmax(120px,1.15fr)}
.tzr .tz-order .c-key{min-width:0}
.tzr .tz-order .c-key .tz-prog{min-width:0}
.tzr .c-dates{overflow:hidden}
/* Contrato y producto: hasta dos líneas en vez de cortar con "…" */
.tzr .tz-order .c-id,.tzr .tz-order .c-prod{min-width:0}
.tzr .tz-order .c-id b,.tzr .tz-order .c-prod .c-main{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;line-height:17px}
.tzr .tz-order .c-id > span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tzr .c-dest-alt{display:none;font-style:normal}

/* Detalle desplegado: más aire para la línea de fechas */
.tzr .tz-order.open .body{grid-template-columns:minmax(0,1.35fr) minmax(400px,1fr)}
.tzr .tz-order.open .body.one{grid-template-columns:1fr}
.tzr .tz-panel .tz-items{min-width:0}
.tzr .tz-tl .ms{min-width:0}

/* Editor */
.tzr .tz-in[type=date]{min-width:132px}
.tzr .tz-edrow{grid-template-columns:minmax(110px,1.2fr) minmax(132px,1fr) minmax(132px,1fr)}
.tzr .tz-eddates{display:grid;grid-template-columns:1fr;column-gap:32px}
.tzr .tz-eddates > .tz-edrow.tz-edhead + .tz-edrow.tz-edhead{display:none}
.tzr .tz-edtab select.tz-in{min-width:220px}
.tzr .tz-dpanel .tz-edtab td:first-child{min-width:0}

/* ---- Hasta ~1300 px de tablero (pantallas de 1366 / 1440) ---- */
@container tzr (max-width: 1300px){
  .tzr .tz-edgrid{grid-template-columns:1fr}
  .tzr .tz-eddates{grid-template-columns:1fr 1fr}
  .tzr .tz-eddates > .tz-edrow.tz-edhead + .tz-edrow.tz-edhead{display:grid}
}
@container tzr (max-width: 1200px){
  .tzr .tz-app{padding:20px 20px 28px}
  .tzr .tz-tabs{padding:0 20px}
  .tzr .tz-brand{padding-right:16px}
  .tzr .tz-summary{gap:6px}
  .tzr .tz-summary .tz-tile{padding:10px}
  .tzr .tz-tile .count{font-size:24px;line-height:28px}
  /* El destino pasa debajo del cliente y su columna se oculta */
  .tzr .tz-order .head,.tzr .tz-colh{grid-template-columns:20px minmax(0,1.45fr) minmax(0,1.35fr) minmax(88px,.75fr) 150px minmax(0,1.45fr) 132px;gap:10px}
  .tzr .tz-order .head .c-dest,.tzr .tz-colh .h-dest{display:none}
  .tzr .c-dest-alt{display:inline}
  .tzr .tz-colh{padding-left:calc(var(--space-4) + 4px)}
  .tzr .tz-order .head.mp,.tzr .tz-colh.mp{grid-template-columns:20px minmax(0,1.2fr) minmax(0,1.3fr) minmax(0,1fr) 150px minmax(60px,.7fr) minmax(60px,.75fr) minmax(60px,.75fr) minmax(104px,1fr);gap:10px}
  .tzr .tz-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@container tzr (max-width: 1060px){
  .tzr .tz-order.open .body{grid-template-columns:1fr}
  .tzr .tz-panel.wide .tz-facts{grid-template-columns:repeat(3,minmax(0,1fr))}
  .tzr .tz-two{grid-template-columns:1fr}
  .tzr .tz-edfields{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@container tzr (max-width: 940px){
  .tzr .tz-eddates{grid-template-columns:1fr}
  .tzr .tz-eddates > .tz-edrow.tz-edhead + .tz-edrow.tz-edhead{display:none}
}
@container tzr (max-width: 900px){
  .tzr .tz-summary{grid-template-columns:repeat(4,minmax(0,1fr))}
  .tzr .tz-summary.mp{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tzr .tz-kpis,.tzr .tz-kpis.four{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tzr .tz-panel.wide .tz-facts,.tzr .tz-edfields{grid-template-columns:repeat(2,minmax(0,1fr))}
  /* Las filas mantienen sus columnas y se desplazan de lado dentro de su grupo */
  .tzr .tz-group-b{overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:4px}
  .tzr .tz-group-b > .tz-order,.tzr .tz-group-b > .tz-colh{min-width:840px}
  .tzr .tz-tabs{overflow-x:auto}
  .tzr .tz-tabs [role=tab]{white-space:nowrap}
}
/* Montos de las tarjetas en una sola línea */
.tzr .tz-summary .tz-tile .amt{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@container tzr (max-width: 1060px){
  .tzr .tz-summary .tz-tile .amt{font-size:11px;letter-spacing:-.02em}
  .tzr .tz-summary .tz-tile .count{font-size:22px;line-height:26px}
}

/* Etapas desplegables (acordeón) */
.tzr .tz-group{margin-top:10px}
.tzr .tz-group + .tz-group{margin-top:10px}
.tzr button.tz-group-h{all:unset;box-sizing:border-box;cursor:pointer;width:100%;display:flex;align-items:center;gap:var(--space-3);margin:0;padding:12px var(--space-4);background:var(--surface-100);border:1px solid var(--line);border-radius:var(--radius-md);box-shadow:var(--shadow-row)}
.tzr button.tz-group-h:hover{background:var(--surface-200)}
.tzr button.tz-group-h:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
.tzr .tz-group-h .chev{width:16px;height:16px;flex:none;color:var(--ink-muted);transition:transform .15s}
.tzr .tz-group.open > .tz-group-h .chev{transform:rotate(90deg)}
.tzr .tz-group-h .meta{margin-left:auto;white-space:nowrap}
.tzr .tz-group-b{display:none;padding-top:var(--space-3)}
.tzr .tz-group.open > .tz-group-b{display:block}
.tzr .tz-group.open{margin-bottom:var(--space-4)}
