/* Tiempos de preparación y reparto (tiempoReparto.php) */
.tr, .tr-modal {
  --tr-surface: #ffffff;
  --tr-fondo: #f6f7f9;
  --tr-borde: #e1e4e8;
  --tr-texto: #1f2328;
  --tr-texto-2: #57606a;
  --tr-muted: #8c959f;
  --tr-acento: #2a78d6;
  --tr-acento-suave: #eef5fd;
  --tr-serie: #2a78d6;
  --tr-tarde: #eb6834;
  --tr-bueno: #1a7f37;
  --tr-malo: #cf222e;
  --tr-aviso: #9a6700;
  color: var(--tr-texto);
}
.tr [hidden] { display: none !important; }
.demo, #demo-setting { display: none !important; }
.tr .tr-muted, .tr-modal .tr-muted { color: var(--tr-muted); }

.tr-head { margin-bottom: 12px; }
.tr-head .page-title { margin: 0 0 2px; }
.tr-head p { margin: 0; }
.tr-card { background: var(--tr-surface); border: 1px solid var(--tr-borde); border-radius: 6px; padding: 14px 16px; margin-bottom: 14px; }
.tr-sin-padding { padding: 0; }
.tr-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--tr-borde); }
.tr-card-head h3, .tr-toolbar h3 { margin: 0; font-size: 15px; font-weight: 600; }
.tr-card-head span { font-size: 11px; }

/* Filtros (sistema.css fuerza height:20px !important en .form-control) */
.tr .form-control { height: 32px !important; padding: 4px 10px; }
.tr .input-sm { height: 30px !important; }
.tr-filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.tr-campo { display: flex; flex-direction: column; gap: 4px; }
.tr-campo > label { font-size: 12px; font-weight: 600; color: var(--tr-texto-2); margin: 0; }
.tr-campo > label small { font-weight: 400; color: var(--tr-muted); }
.tr-campo-suc { flex: 1 1 220px; max-width: 300px; }
.tr-campo-meta { width: 120px; }
.tr-atajos { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 2px; margin-top: -4px; }
.tr-atajos .btn-link { padding: 0 6px; }
.tr-filtros .select2-container .select2-selection--single { height: 32px; border-color: #ccc; }
.tr-filtros .select2-container .select2-selection--single .select2-selection__rendered { line-height: 30px; }
.tr-filtros .select2-container .select2-selection--single .select2-selection__arrow { height: 30px; }

.tr-aviso { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 6px; border: 1px solid #d4a72c; background: #fff8c5; margin-bottom: 10px; }
.tr-aviso .fa { margin-top: 3px; }
.tr-aviso.error { border-color: #f5a3a8; background: #ffebe9; color: #82071e; }
.tr-vacio { text-align: center; padding: 40px 16px; color: var(--tr-muted); }
.tr-vacio .fa { font-size: 34px; margin-bottom: 10px; }

/* KPIs */
.tr-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tr-kpi { background: var(--tr-surface); border: 1px solid var(--tr-borde); border-radius: 6px; padding: 10px 14px; }
.tr-kpi .et { font-size: 12px; color: var(--tr-texto-2); }
.tr-kpi .val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tr-kpi .val small { font-size: 12px; font-weight: 400; color: var(--tr-muted); }
.tr-kpi .sub { font-size: 11px; color: var(--tr-muted); }
.tr-kpi.fuerte { border-color: var(--tr-acento); box-shadow: inset 3px 0 0 var(--tr-acento); }
.tr-kpi.alerta .val { color: var(--tr-aviso); }
.tr-kpi.ok .val { color: var(--tr-bueno); }

/* Gráficas de columnas (una serie) */
.tr-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; }
.tr-fig { margin: 0 0 14px; }
.tr-fig figcaption { font-size: 12px; font-weight: 600; color: var(--tr-texto-2); margin-bottom: 8px; }
.tr-cols { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding-top: 16px; border-bottom: 1px solid #c9ced4; }
.tr-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.tr-col .b { width: 100%; max-width: 24px; background: var(--tr-serie); border-radius: 4px 4px 0 0; min-height: 0; }
.tr-col .b.tarde { background: var(--tr-tarde); }
.tr-col .v { font-size: 10px; color: var(--tr-texto-2); font-variant-numeric: tabular-nums; margin-bottom: 2px; }
.tr-col .e { position: absolute; bottom: -18px; font-size: 10px; color: var(--tr-muted); white-space: nowrap; }
.tr-col:hover .b { filter: brightness(1.1); }
.tr-columnas { padding-bottom: 20px; }
.tr-nota { font-size: 11px; color: var(--tr-muted); margin: 26px 0 0; display: flex; align-items: center; gap: 6px; }
.tr-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--tr-serie); }
.tr-key.tarde { background: var(--tr-tarde); }

/* Tablas */
.tr-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--tr-borde); }
.tr-toolbar input[type="search"] { flex: 1 1 220px; max-width: 320px; margin-left: auto; }
.tr-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; font-size: 12px; }
.tr-tabla-wrap { overflow: auto; max-height: 50vh; }
.tr-tabla-alta { max-height: 70vh; }
.tr-tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.tr-tabla th, .tr-tabla td { padding: 7px 10px; border-bottom: 1px solid var(--tr-borde); vertical-align: middle; }
.tr-tabla thead th { background: var(--tr-fondo); font-size: 12px; font-weight: 600; color: var(--tr-texto-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tr-tabla th[data-orden] { cursor: pointer; user-select: none; }
.tr-tabla th[aria-sort="ascending"]::after { content: ' ▲'; font-size: 9px; }
.tr-tabla th[aria-sort="descending"]::after { content: ' ▼'; font-size: 9px; }
.tr-tabla tbody tr:hover td { background: #f8fafc; }
.tr-tabla tr.activo td { background: var(--tr-acento-suave); }
.tr-tabla td small { display: block; color: var(--tr-muted); font-size: 11px; }
.tr-tabla .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-tabla .col-acc { text-align: right; width: 1%; white-space: nowrap; }
.tr-dir { max-width: 260px; }
.tr-sin-datos { text-align: center; padding: 22px !important; }
.tr-link { background: none; border: 0; padding: 0; color: var(--tr-acento); font-weight: 600; text-align: left; }
.tr-link:hover { text-decoration: underline; }
.tr-barra-cel { height: 6px; background: #eceef1; border-radius: 3px; overflow: hidden; width: 90px; margin: 0 0 2px auto; }
.tr-barra-cel > div { height: 100%; background: var(--tr-serie); }

/* Tiempos con semáforo: el color acompaña al número, que va en tinta normal */
.tr-t { display: inline-block; min-width: 34px; padding: 1px 6px; border-radius: 4px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.tr-t.ok { background: #dafbe1; color: #116329; }
.tr-t.medio { background: #fff4d6; color: var(--tr-aviso); }
.tr-t.alto { background: #ffe5e7; color: var(--tr-malo); }
.tr-t.sr { color: var(--tr-muted); font-weight: 400; }
.tr-pct { font-weight: 700; }
.tr-pct.ok { color: var(--tr-bueno); }
.tr-pct.medio { color: var(--tr-aviso); }
.tr-pct.alto { color: var(--tr-malo); }
.tr-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--tr-acento-suave); color: var(--tr-acento); border-radius: 12px; padding: 2px 4px 2px 10px; font-size: 12px; font-weight: 600; }
.tr-chip button { background: none; border: 0; color: inherit; font-size: 15px; line-height: 1; padding: 0 4px; }
.tr-pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--tr-borde); }
.tr-leyenda { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; margin: 0; padding: 0; font-size: 11px; color: var(--tr-texto-2); }
.tr-leyenda li { display: inline-flex; align-items: center; gap: 6px; }

/* Modales */
.tr-modal .modal-content { display: flex; flex-direction: column; max-height: 88vh; }
.tr-modal .modal-body { overflow-y: auto; flex: 1 1 auto; }
.tr-mapa { height: 60vh; min-height: 320px; }
.tr-mapa iframe { width: 100%; height: 100%; border: 0; }

@media (max-width: 991px) {
  .tr-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .tr-campo-suc { flex-basis: 100%; max-width: none; }
  .tr-toolbar input[type="search"] { max-width: none; margin-left: 0; }
}
