/* ════════════════════════════════════════════
   Tablero de Producción (copia de prueba) — estilos con prefijo .tb-
   Claro y limpio, pensado para tablet (objetivos táctiles ≥ 44px).
   ════════════════════════════════════════════ */
.tb-root {
  --tb-bg: #f2f5f9; --tb-p1: #fff; --tb-p2: #f7f9fc; --tb-bd: #e0e7f0; --tb-b2: #c3d0e0;
  --tb-tx: #0b1b3a; --tb-m1: #5b6b84; --tb-m2: #8a99b0;
  --tb-ac: #005394; --tb-ac2: #0090e6; --tb-acbg: #e5f0fa; --tb-acline: #b5d3ee; --tb-r: 16px;
  --tb-mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  background: var(--tb-bg); color: var(--tb-tx); font-size: 15px; line-height: 1.4;
  padding: 14px 16px 90px; min-height: 100%;
}
/* Igual que la pantalla clásica: .cp-view es hijo directo de .app (flex:1) y aquí scrollea el contenido */
.tb-root.cp-view { display: block; overflow-y: auto; overflow-x: hidden; min-height: 0; -webkit-overflow-scrolling: touch; }
[data-theme="dark"] .tb-root {
  --tb-bg: #0a1226; --tb-p1: #111b36; --tb-p2: #0e1731; --tb-bd: #22304f; --tb-b2: #33466b;
  --tb-tx: #e8eef8; --tb-m1: #93a5c5; --tb-m2: #667a9c; --tb-ac: #5aa9ec; --tb-ac2: #8fcbff;
  --tb-acbg: #15284a; --tb-acline: #27497c;
}
.tb-root *, .tb-root *::before, .tb-root *::after { box-sizing: border-box; }
.tb-root .mono { font-family: var(--tb-mono); font-variant-numeric: tabular-nums; }
.tb-root :where(button, select, input, textarea) { font: inherit; color: inherit; }
.tb-root button { cursor: pointer; }
.tb-root button:focus-visible, .tb-root select:focus-visible, .tb-root input:focus-visible { outline: 3px solid var(--tb-ac2); outline-offset: 2px; }
.tb-grow { flex: 1; }
.tb-lab { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--tb-m1); }
.tb-sub { display: block; font-size: 12.5px; color: var(--tb-m1); }

.tb-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.tb-banner > span { flex: 1; min-width: 220px; }
.tb-banner.practice { background: var(--tb-acbg); color: var(--tb-ac); border: 1px dashed var(--tb-acline); }
.tb-banner.real { background: #fbf1d6; color: #7a5200; border: 1px solid #eed99a; }
[data-theme="dark"] .tb-banner.real { background: #33280f; color: #f0b13a; border-color: #5c4713; }

.tb-top { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
.tb-brand { font-weight: 700; font-size: 18px; }
.tb-brand small { display: block; font-weight: 500; font-size: 12px; color: var(--tb-m1); }
.tb-day { display: flex; align-items: center; background: var(--tb-p1); border: 1px solid var(--tb-bd); border-radius: 14px; }
.tb-day button { width: 48px; height: 48px; border: 0; background: none; font-size: 20px; color: var(--tb-ac); border-radius: 14px; }
.tb-day b { padding-inline: 6px; min-width: 150px; text-align: center; font-size: 14px; }
.tb-seg { display: flex; background: var(--tb-p1); border: 1px solid var(--tb-bd); border-radius: 14px; padding: 4px; gap: 4px; }
.tb-seg button { border: 0; background: none; padding: 0 18px; height: 44px; border-radius: 10px; font-weight: 600; color: var(--tb-m1); }
.tb-seg button.on { background: var(--tb-ac); color: #fff; }
.tb-clock { font-weight: 600; font-size: 22px; }
.tb-tog { height: 48px; padding-inline: 14px; border: 1px solid var(--tb-bd); background: var(--tb-p1); border-radius: 14px; font-weight: 600; color: var(--tb-ac); }
.tb-floatback { position: fixed; right: 16px; bottom: 16px; z-index: 8000; box-shadow: 0 6px 22px rgba(0,10,42,.25); background: var(--tb-p1, #fff); color: var(--tb-ac, #005394); }

.tb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tb-stat { background: var(--tb-p1); border: 1px solid var(--tb-bd); border-radius: 14px; padding: 10px 14px; }
.tb-stat b { display: block; font: 600 26px var(--tb-mono); line-height: 1.1; }
.tb-stat span { font-size: 12px; color: var(--tb-m1); }
.tb-of { font-size: 15px; color: var(--tb-m1); }

.tb-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.tb-pill { min-height: 44px; padding-inline: 16px; border-radius: 99px; border: 1px solid var(--tb-bd); background: var(--tb-p1); font-weight: 600; color: var(--tb-m1); }
.tb-pill.on { background: var(--tb-ac); border-color: var(--tb-ac); color: #fff; }
.tb-search { margin-left: auto; min-height: 44px; min-width: 240px; border: 1px solid var(--tb-bd); border-radius: 12px; padding-inline: 14px; background: var(--tb-p1); }

.tb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 430px), 1fr)); gap: 14px; }
.tb-card { background: var(--tb-p1); border: 1px solid var(--tb-bd); border-radius: var(--tb-r); padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tb-ch { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-ch h2 { font-size: 17px; margin: 0; }
.tb-code { font: 600 11px var(--tb-mono); color: var(--tb-ac); background: var(--tb-acbg); padding: 3px 8px; border-radius: 8px; }
.tb-chip { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--tb-p2); color: var(--tb-m1); border: 1px solid var(--tb-bd); }
.tb-chip.run { background: var(--tb-ac); color: #fff; border-color: var(--tb-ac); }
.tb-chip.pau { background: repeating-linear-gradient(135deg, var(--tb-acbg) 0 6px, var(--tb-p1) 6px 12px); color: var(--tb-ac); border-color: var(--tb-acline); }

.tb-now { background: var(--tb-p2); border: 1px solid var(--tb-bd); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.tb-now.free { align-items: flex-start; color: var(--tb-m1); }
.tb-lote { display: flex; gap: 12px; align-items: center; }
.tb-sw { width: 10px; align-self: stretch; min-height: 38px; border-radius: 6px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.tb-sw.tall { width: 12px; min-height: 44px; }
.tb-lote h3 { font-size: 20px; line-height: 1.2; margin: 0; }
.tb-lote small { color: var(--tb-m1); font-size: 13px; }
.tb-steps { display: flex; gap: 4px; }
.tb-st { flex: 1; min-width: 0; height: 10px; border-radius: 5px; background: var(--tb-bd); position: relative; overflow: hidden; }
.tb-st.done { background: var(--tb-ac); }
.tb-st.cur { background: var(--tb-acline); }
.tb-st.cur i { position: absolute; inset: 0 auto 0 0; background: var(--tb-ac2); }
.tb-phase { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.tb-phase b { font-size: 16px; }
.tb-meta { display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--tb-m1); }
.tb-meta b { color: var(--tb-tx); }

.tb-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.tb-btn { min-height: 52px; padding-inline: 20px; border-radius: 14px; border: 1.5px solid var(--tb-b2); background: var(--tb-p1); font-weight: 600; font-size: 15px; color: var(--tb-ac); }
.tb-btn.pri { background: var(--tb-ac); border-color: var(--tb-ac); color: #fff; flex: 1; }
.tb-btn.full { width: 100%; }
.tb-btn.big { width: 100%; }
.tb-btn.sm { min-height: 44px; padding-inline: 14px; font-size: 14px; }
.tb-btn:disabled { opacity: .4; cursor: default; }
.tb-btn:active:not(:disabled) { transform: scale(.98); }

.tb-sel { height: 44px; border: 1.5px solid var(--tb-b2); border-radius: 12px; background: var(--tb-p1); padding-inline: 10px; max-width: 100%; font-size: 14px; }
.tb-queue { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.tb-qrow { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--tb-p1); border: 1px solid var(--tb-bd); border-radius: 14px; padding: 8px 8px 8px 10px; }
.tb-qrow .tb-sw { min-height: 56px; }
.tb-nm { font-weight: 600; line-height: 1.2; }
.tb-qrow small { color: var(--tb-m1); font-size: 12px; }
.tb-qrow .tb-sel { height: 40px; width: 100%; max-width: 260px; }
.tb-qctl { display: grid; grid-template-columns: repeat(2, 44px); gap: 6px; }
.tb-ib { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--tb-b2); background: var(--tb-p2); font-size: 16px; color: var(--tb-ac); padding: 0; }
.tb-ib:disabled { opacity: .35; }
.tb-empty { color: var(--tb-m2); font-size: 14px; padding: 6px 2px; }
.tb-add { border: 2px dashed var(--tb-acline); background: var(--tb-acbg); color: var(--tb-ac); min-height: 52px; border-radius: 14px; font-weight: 600; width: 100%; }
.tb-foot { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--tb-m1); }
.tb-foot b { color: var(--tb-tx); }

/* Historial */
.tb-hist { background: var(--tb-p1); border: 1px solid var(--tb-bd); border-radius: var(--tb-r); overflow: hidden; }
.tb-hs { overflow-x: auto; }
.tb-hin { min-width: 1250px; }
.tb-hr { display: grid; grid-template-columns: 200px minmax(0, 1fr) 150px; }
.tb-hr + .tb-hr { border-top: 1px solid var(--tb-bd); }
.tb-hl { padding: 12px 14px; background: var(--tb-p2); border-right: 1px solid var(--tb-bd); position: sticky; left: 0; z-index: 3; }
.tb-hl b { display: block; }
.tb-hl small { color: var(--tb-m1); }
.tb-hrt { padding: 12px 14px; text-align: right; border-left: 1px solid var(--tb-bd); background: var(--tb-p2); position: sticky; right: 0; z-index: 3; }
.tb-hrt b { font: 600 18px var(--tb-mono); display: block; }
.tb-hrt small { color: var(--tb-m1); }
.tb-hh { background: var(--tb-p2); }
.tb-ax { position: relative; height: 30px; border-bottom: 1px solid var(--tb-bd); }
.tb-ax span { position: absolute; top: 7px; transform: translateX(-50%); font-size: 11px; color: var(--tb-m1); }
.tb-trk { position: relative; min-height: 78px; background: linear-gradient(to right, var(--tb-bd) 1px, transparent 1px) 0 0 / calc(100% / var(--hrs, 9)) 100%; }
.tb-blk { position: absolute; top: 12px; bottom: 12px; border-radius: 10px; background: var(--tb-ac); color: #fff; padding: 6px 10px; overflow: hidden; border: 0; text-align: left; min-width: 6px; display: flex; flex-direction: column; justify-content: center; }
.tb-blk b { font-size: 12.5px; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tb-blk span { font-size: 11px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-blk.live { background: linear-gradient(90deg, var(--tb-ac), var(--tb-ac2)); box-shadow: 0 0 0 3px var(--tb-acline); }
.tb-gap { position: absolute; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--tb-m2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; pointer-events: none; }
.tb-nowl { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--tb-tx); opacity: .65; z-index: 2; pointer-events: none; }
.tb-note { font-size: 13px; color: var(--tb-m1); margin: 12px 0 0; }

/* Hojas */
.tb-scrim { position: fixed; inset: 0; background: rgba(5,15,40,.45); z-index: 9000; display: flex; align-items: flex-end; justify-content: center; }
.tb-sheet { background: var(--tb-p1); color: var(--tb-tx); width: min(720px, 100%); max-height: 88vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
.tb-sh { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tb-sh h2 { font-size: 18px; margin: 0; }
.tb-pick { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--tb-p2); border: 1.5px solid var(--tb-bd); border-radius: 14px; padding: 10px 14px; min-height: 60px; }
.tb-pick.ind { margin-left: 22px; width: calc(100% - 22px); }
.tb-pick.on { border-color: var(--tb-ac); background: var(--tb-acbg); }
.tb-check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--tb-b2); display: inline-flex; align-items: center; justify-content: center; flex: none; font-weight: 700; color: #fff; }
.tb-pick.on .tb-check { background: var(--tb-ac); border-color: var(--tb-ac); }
.tb-pick b { display: block; }
.tb-grp { display: flex; flex-direction: column; gap: 6px; }
.tb-picknote { font-size: 13px; color: var(--tb-m1); }
.tb-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tb-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--tb-m1); letter-spacing: .4px; text-transform: uppercase; }
.tb-form label.wide { grid-column: 1 / -1; }
.tb-in { min-height: 48px; border: 1.5px solid var(--tb-b2); border-radius: 12px; padding: 8px 12px; background: var(--tb-p1); font-size: 16px; width: 100%; text-transform: none; font-weight: 500; color: var(--tb-tx); }
.tb-row2 { display: flex; gap: 8px; }
.tb-warn { background: #fbf1d6; color: #7a5200; border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600; }
[data-theme="dark"] .tb-warn { background: #33280f; color: #f0b13a; }
.tb-dg { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.tb-dg div { background: var(--tb-p2); border: 1px solid var(--tb-bd); border-radius: 12px; padding: 8px 12px; }
.tb-dg small { display: block; color: var(--tb-m1); font-size: 12px; }
.tb-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tb-tbl th { font-size: 11px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--tb-m1); text-align: left; padding: 8px; }
.tb-tbl td { padding: 10px 8px; border-top: 1px solid var(--tb-bd); }
.tb-tbl tfoot td { font-weight: 700; }
.tb-notes { background: var(--tb-p2); border: 1px solid var(--tb-bd); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.tb-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--tb-tx); color: var(--tb-bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 9500; max-width: 92vw; }
.tb-toast.on { opacity: 1; }

@media (max-width: 700px) { .tb-form { grid-template-columns: 1fr; } .tb-search { min-width: 0; width: 100%; margin-left: 0; } }
@media (prefers-reduced-motion: reduce) { .tb-root * { transition: none !important; } }

/* Perfiles y fases */
.tb-profile { display: flex; flex-direction: column; gap: 6px; }
.tb-profile .tb-sel { height: 48px; width: 100%; }
.tb-profbox { background: var(--tb-p2); border: 1px solid var(--tb-bd); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.tb-ph { border: 1.5px solid var(--tb-bd); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--tb-p1); }
.tb-ph.run { border-color: var(--tb-ac2); box-shadow: 0 0 0 3px var(--tb-acbg); }
.tb-ph.done { background: var(--tb-p2); }
.tb-ph-h { display: flex; align-items: center; gap: 10px; }
.tb-ph-h .tb-sel, .tb-ph-h .tb-in { height: 48px; }
.tb-ph-n { width: 30px; height: 30px; border-radius: 50%; background: var(--tb-acbg); color: var(--tb-ac); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.tb-ph-min { font-weight: 600; font-size: 15px; white-space: nowrap; }
.tb-ph-min.over { color: #d23b2e; }
.tb-ph-times, .tb-ph-f { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tb-ph-times label, .tb-ph-f label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--tb-m1); letter-spacing: .4px; text-transform: uppercase; }
.tb-ph-f .tb-sel { height: 48px; width: 100%; font-weight: 500; text-transform: none; }

/* Bases del día */
.tb-bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 14px; }
.tb-bcard { background: var(--tb-p1); border: 1px solid var(--tb-bd); border-radius: var(--tb-r); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tb-bh { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tb-bh b, .tb-crow b { display: block; }
.tb-bh small, .tb-crow small { display: block; color: var(--tb-m1); font-size: 12px; }
.tb-bcols { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--tb-bd); padding-top: 10px; }
.tb-crow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--tb-p2); border: 1px solid var(--tb-bd); border-radius: 12px; padding: 8px 10px; }
.tb-chip.st-pend { background: var(--tb-p2); color: var(--tb-m1); }
.tb-chip.st-fila { background: var(--tb-acbg); color: var(--tb-ac); border-color: var(--tb-acline); }
.tb-chip.st-curso, .tb-chip.st-proc { background: var(--tb-ac); color: #fff; border-color: var(--tb-ac); }
.tb-chip.st-listo { background: #e0f2e9; color: #0a6f43; border-color: #b2ddc6; }
.tb-chip.st-canc { text-decoration: line-through; }
[data-theme="dark"] .tb-chip.st-listo { background: #0f2e25; color: #34c98a; border-color: #1c5b45; }

/* Historial: barra y lista */
.tb-hbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tb-tbl.tb-lst { min-width: 880px; }
.tb-tbl.tb-lst td { vertical-align: top; }
.tb-clk { cursor: pointer; }
.tb-clk:hover td { background: var(--tb-acbg); }
.tb-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--tb-p2); border: 1px solid var(--tb-bd); border-radius: 99px; padding: 3px 10px; margin: 0 6px 4px 0; font-size: 13px; }
.tb-tag i { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
@media (max-width: 700px) { .tb-ph-times, .tb-ph-f { grid-template-columns: 1fr; } }

/* Selector de fila: cambio de día */
.tb-pickday { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tb-pickday .tb-in { width: auto; min-width: 160px; }
.tb-pickday .tb-day b { min-width: 170px; }
.tb-pickblk { display: flex; flex-direction: column; gap: 8px; }
.tb-pickhead { padding: 8px 4px 2px; border-top: 1px solid var(--tb-bd); }
.tb-day button:disabled { opacity: .35; }

/* Lotes que cruzan la medianoche y pausas */
.tb-blk > b, .tb-blk > span:not(.tb-ps) { position: relative; z-index: 1; }
.tb-blk .tb-ps { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,.45) 0 4px, transparent 4px 8px); z-index: 0; }
.tb-blk.from { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 4px dashed rgba(255,255,255,.7); }
.tb-blk.to { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 4px dashed rgba(255,255,255,.7); }
.tb-dg small.tb-sub, td small.tb-sub { display: block; }

/* Historial: zoom, varios días y orden */
.tb-hin { width: max-content; min-width: 100%; }
.tb-hr { grid-template-columns: 200px var(--tw, 900px) 150px; }
.tb-trk { background-image: linear-gradient(to right, var(--tb-bd) 1px, transparent 1px); background-repeat: repeat-x; }
.tb-ax { height: auto; border-bottom: 1px solid var(--tb-bd); }
.tb-axd { position: relative; height: 26px; border-bottom: 1px solid var(--tb-bd); }
.tb-axd span { position: absolute; top: 5px; font-size: 12px; font-weight: 700; color: var(--tb-tx); white-space: nowrap; text-transform: capitalize; }
.tb-axh { position: relative; height: 26px; }
.tb-axh span { position: absolute; top: 6px; transform: translateX(-50%); font-size: 11px; color: var(--tb-m1); }
.tb-dsep { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--tb-b2); z-index: 1; pointer-events: none; }
.tb-zoom { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-zlab { font-size: 12px; color: var(--tb-m1); min-width: 62px; text-align: center; }
.tb-sortsel { display: flex; flex-direction: column; gap: 2px; }
.tb-sortsel .tb-sel { height: 44px; min-width: 190px; }
.tb-ord { display: inline-flex; gap: 6px; margin-left: auto; }
.tb-hl .tb-ord { margin: 6px 0 0; }
.tb-ib.sm { width: 36px; height: 36px; font-size: 13px; }
.tb-filters { align-items: flex-end; }

/* Selector de fila: lote visible y buscador */
.tb-loterow { color: var(--tb-ac); }
.tb-sheet input[type="search"].tb-in { width: 100%; }

/* ── Máquinas en filas (presentación 2: fila con línea del día) ── */
.tb-rowbar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 10px; }
.tb-rows { display: flex; flex-direction: column; gap: 10px; }
.tb-row { background: var(--tb-p1); border: 1px solid var(--tb-bd); border-left: 6px solid var(--tb-b2); border-radius: var(--tb-r); min-width: 0; }
.tb-row.run { border-left-color: var(--tb-ac); }
.tb-row.pau { border-left-color: #c79214; }
.tb-row.ld { border-left-color: var(--tb-acline); }
.tb-r { display: grid; grid-template-columns: auto minmax(190px, .9fr) minmax(260px, 2.2fr) auto auto; gap: 10px 16px; align-items: center; padding: 12px 14px; }
.tb-r1 { display: flex; gap: 6px; align-items: center; }
.tb-ord.col { flex-direction: column; margin: 0; gap: 2px; }
.tb-ord.col .tb-ib.sm { height: 21px; width: 36px; font-size: 10px; }
.tb-rn { min-width: 0; }
.tb-rn > b { font-size: 16px; line-height: 1.2; display: block; }
.tb-rmeta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 5px; }
.tb-rlote { margin-top: 7px; }
.tb-rlote b { display: block; font-size: 14px; line-height: 1.2; }
.tb-rlote small { color: var(--tb-m1); font-size: 11.5px; }
.tb-rt { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.tb-muted { color: var(--tb-m1); }
.tb-mini { position: relative; height: 28px; border-radius: 8px; background: var(--tb-p2); border: 1px solid var(--tb-bd); overflow: hidden; background-image: linear-gradient(to right, var(--tb-bd) 1px, transparent 1px); background-size: calc(100% / 12) 100%; }
.tb-mb { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; overflow: hidden; }
.tb-mb.past { background: var(--tb-b2); opacity: .8; }
.tb-mb.cur { background: var(--tb-acline); border: 1px solid var(--tb-ac); }
.tb-mb.cur u { position: absolute; inset: 0 auto 0 0; background: var(--tb-ac); }
.tb-mb.plan { background: var(--tb-p1); border: 2px dashed var(--tb-b2); }
.tb-mnow { position: absolute; top: 0; bottom: 0; width: 2px; background: #d23b2e; z-index: 2; }
.tb-pills { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tb-pills i { font-style: normal; font: 600 11px var(--tb-mono); width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--tb-bd); color: var(--tb-m1); }
.tb-pills i.d { background: var(--tb-ac); color: #fff; }
.tb-pills i.c { background: var(--tb-acbg); color: var(--tb-ac); box-shadow: 0 0 0 2px var(--tb-ac); }
.tb-pills > span { font-size: 13px; margin-left: 6px; }
.tb-pills em { font-style: normal; font-size: 12px; color: var(--tb-m1); }
.tb-qchips { display: flex; gap: 6px; flex-wrap: wrap; }
.tb-qchips > span { display: inline-flex; gap: 6px; align-items: center; background: var(--tb-p2); border: 1px solid var(--tb-bd); border-radius: 99px; padding: 3px 10px; font-size: 12px; }
.tb-qchips small { color: var(--tb-m1); }
.tb-rend { text-align: right; }
.tb-rend b { display: block; font-size: 24px; line-height: 1; font-weight: 600; }
.tb-rend small { font-size: 10.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--tb-m1); }
.tb-racts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tb-racts .tb-btn { min-height: 48px; padding-inline: 16px; }
.tb-rx { border-top: 1px solid var(--tb-bd); background: var(--tb-p2); border-radius: 0 0 var(--tb-r) var(--tb-r); padding: 14px 16px 16px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr) minmax(0, 1fr); gap: 20px; }
.tb-rx > div { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; }
.tb-rx > div > * { max-width: 100%; }
.tb-rx .tb-profile, .tb-rx .tb-queue, .tb-rx .tb-add, .tb-rx .tb-dg, .tb-rx .tb-notes, .tb-plist { width: 100%; }
.tb-rx .tb-queue { margin-top: 0; }
.tb-plist { display: flex; flex-direction: column; gap: 4px; }
.tb-pli { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px; font-size: 13.5px; }
.tb-pli.c { background: var(--tb-acbg); font-weight: 700; }
.tb-pli.d { color: var(--tb-m1); }
.tb-pli.d .tb-ph-n { background: var(--tb-ac); color: #fff; }
.tb-pli .tb-plt, .tb-pli .tb-plm { font-size: 12px; color: var(--tb-m1); white-space: nowrap; }
@media (max-width: 1180px) {
  .tb-r { grid-template-columns: auto 1fr auto; }
  .tb-r > .tb-rt, .tb-r > .tb-racts { grid-column: 1 / -1; }
  .tb-racts { justify-content: stretch; } .tb-racts .tb-btn { flex: 1; }
  .tb-rx { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) { .tb-rx { grid-template-columns: 1fr; } }

/* Historial: tiempo sin fase (máquina cargada, sin fase en marcha) más visible */
.tb-blk .tb-ps { background: repeating-linear-gradient(135deg, rgba(255,255,255,.6) 0 5px, rgba(0,10,42,.22) 5px 10px); border-left: 1px solid rgba(255,255,255,.7); border-right: 1px solid rgba(255,255,255,.7); }
.tb-rx .tb-qrow { grid-template-columns: minmax(0, 1fr) auto; width: 100%; }
.tb-rx .tb-qrow .tb-sel { max-width: 100%; }
.tb-rx .tb-qctl { grid-template-columns: repeat(2, 44px); }

/* ── Lotes fallidos (rojo) ── */
.tb-root { --tb-rd: #c62828; --tb-rdbg: #fdeaea; --tb-rdline: #f1b0b0; }
.tb-root[data-theme="dark"], [data-theme="dark"] .tb-root { --tb-rd: #ff6b6b; --tb-rdbg: #3a1518; --tb-rdline: #7a2a2f; }
.tb-btn.danger { border-color: var(--tb-rdline); color: var(--tb-rd); }
.tb-btn.danger.pri { background: var(--tb-rd); border-color: var(--tb-rd); color: #fff; }
.tb-btn.danger:disabled { opacity: .5; }
.tb-chip.fail { background: var(--tb-rd); color: #fff; border-color: var(--tb-rd); }
.tb-blk.failed { background: var(--tb-rd); }
.tb-blk.failed.live { background: var(--tb-rd); }
.tb-mb.past.failed { background: var(--tb-rd); opacity: .85; }
.tb-tbl.tb-lst tr.tb-failrow td { background: var(--tb-rdbg); color: var(--tb-rd); }
.tb-tbl.tb-lst tr.tb-failrow:hover td { background: var(--tb-rdline); }
.tb-failbox { background: var(--tb-rdbg); border: 1px solid var(--tb-rdline); color: var(--tb-rd); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.tb-failbox b { display: block; margin-bottom: 2px; }
