/* =========================================================
   PCP v4 — capa de layout IDÉNTICA a maqueta-pcp.html
   Mapea los componentes reales (.top .dv .bn .kpi-b .seg table…)
   a los componentes de la maqueta (.pcp-header .pcp-chip .pcp-bn …).
   Se carga DESPUÉS de pcp_v3.css / pcp_kpi_bubbles.css / pcp-themes.css.
   ========================================================= */

/* 1. Lienzo */
html body { background-color: var(--pcp-bg) !important; color: var(--pcp-text); font-family: 'Inter', system-ui, -apple-system, sans-serif; font-size: 13px; line-height: 1.35; }
html { background-color: var(--pcp-bg) !important; }
body .m {
  background: transparent !important;
  --bg: var(--pcp-bg); --ink: var(--pcp-text); --mut: var(--pcp-text-muted);
  --line: var(--pcp-border); --card: var(--pcp-surface); --sh: none;
  --okbg: var(--pcp-ok-soft); --ok: var(--pcp-ok-ink);
}
body .wrap { padding: 14px 24px 80px !important; gap: 12px !important; }
body #wa-float-btn, body #wa-float-tooltip { display: none !important; }

/* 2. Header anclado oscuro (pcp-header) */
body .top {
  background: var(--pcp-header-bg) !important;
  color: var(--pcp-header-ink) !important;
  border-bottom: 1px solid var(--pcp-header-border) !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  height: 52px !important; padding: 0 24px !important; gap: 10px !important;
}
body .top .brand { color: var(--pcp-header-ink); font-weight: 700; letter-spacing: .06em; font-size: 14px; margin-right: 6px; }
body .top .brand span { color: inherit; opacity: .6; font-weight: 500; }
body .top a.nav { color: var(--pcp-header-ink) !important; opacity: .7; font-size: 12px; padding: 6px 8px; border-radius: var(--pcp-radius-btn); background: none; }
body .top a.nav:hover { opacity: 1; background: var(--pcp-header-btn-bg) !important; }
body .top .pill {
  background: none !important; color: var(--pcp-header-ink) !important; opacity: .85;
  font-size: 11px; font-weight: 600; padding: 0; margin-right: 6px;
  display: inline-flex; align-items: center; gap: 6px; border-radius: 0;
}
body .top .pill::before { margin: 0 !important; width: 7px; height: 7px; background: var(--pcp-ok) !important; animation: none !important; }
body .top .pill.busy::before { background: var(--pcp-warn) !important; }
body .top .btn, body .top .btn.g, body .top select {
  background: var(--pcp-header-btn-bg) !important;
  color: var(--pcp-header-btn-ink) !important;
  border: 1px solid var(--pcp-header-btn-border) !important;
  border-radius: var(--pcp-radius-btn) !important;
  box-shadow: none !important; backdrop-filter: none !important;
  padding: 6px 11px; font-size: 12px; font-family: inherit; font-weight: 400; cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 100ms ease;
}
body .top .btn:hover, body .top .btn.g:hover { border-color: var(--pcp-header-ink) !important; transform: none !important; }
body .top .btn:active { transform: scale(.97) !important; }
body .top .btn.g.on { background: var(--pcp-accent) !important; color: var(--pcp-accent-ink) !important; border-color: var(--pcp-accent) !important; }
body .top #btn_ref {
  background: var(--pcp-primary-btn) !important; color: var(--pcp-primary-btn-ink) !important;
  border: 1px solid transparent !important; font-weight: 600;
}
body .top #btn_ref:hover { filter: brightness(1.07); border-color: transparent !important; }
body .top #drc:not(:empty) {
  margin-left: 4px; padding: 0 5px; border-radius: 99px; font-size: 10px; font-weight: 700;
  background: var(--pcp-accent); color: var(--pcp-accent-ink);
}
body .top .vw { gap: 6px; }
body .top .vw .btn { padding: 6px 9px; }
body .top .pcp-theme-sw { margin-left: 8px; }
body .top .pcp-theme-sw button { border-radius: 0; }

/* 3. Barra de divisiones (pcp-divbar + pcp-chip) */
body .wrap > div:first-child { display: flex; align-items: flex-start; gap: 8px; }
body .wrap > div:first-child > #divs { flex: 1; min-width: 0; }
body .wrap > div:first-child > .hintbar { display: none; }
body #divs {
  display: flex !important; flex-wrap: wrap !important; gap: 8px !important;
  overflow: visible !important; align-items: center;
}
body .dv {
  --mnR: transparent; --mnS: transparent;
  flex: 0 0 auto !important; max-width: none !important; width: auto !important;
  display: inline-flex !important; align-items: center; gap: 7px;
  padding: 6px 11px !important; font: 600 12px/1.35 inherit !important; font-family: inherit !important;
  background: var(--pcp-chip-bg) !important;
  border: 1px solid var(--pcp-chip-border) !important;
  border-radius: var(--pcp-radius-btn) !important;
  color: var(--pcp-chip-ink) !important;
  box-shadow: none !important; backdrop-filter: none !important;
  cursor: pointer; user-select: none; animation: none !important; transform: none !important;
  transition: background-color 150ms ease, border-color 150ms ease !important;
}
body .dv:hover { border-color: var(--pcp-text) !important; color: var(--pcp-chip-ink) !important; transform: none !important; box-shadow: none !important; }
body .dv:active { transform: scale(.97) !important; }
body .dv.on {
  background: var(--pcp-chip-active-bg) !important; color: var(--pcp-chip-active-ink) !important;
  border-color: var(--pcp-chip-active-bg) !important;
}
body .dv .dot {
  width: 7px !important; height: 7px !important; flex: none; border-radius: 50%;
  background: var(--cc, var(--pcp-text-muted)) !important; border: 0 !important;
  opacity: .85; box-shadow: none !important; animation: none !important;
}
body .dv.on .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.35) !important; background: var(--cc, var(--pcp-text-muted)) !important; border: 0 !important; }
body .dv .nm { font-weight: 600; max-width: none; overflow: visible; text-overflow: clip; }
body .dv i {
  font-style: normal; font-size: 10.5px !important; font-weight: 700; padding: 1px 6px !important; min-width: 22px; text-align: center;
  background: var(--pcp-chip-badge-bg) !important; color: var(--pcp-chip-badge-ink) !important;
  border-radius: var(--pcp-radius-btn) !important; box-shadow: none !important;
}
body .dv.on i { background: var(--pcp-chip-badge-active-bg) !important; color: var(--pcp-chip-badge-active-ink) !important; }
body .dv::after { display: none !important; }
body .dtools {
  margin: 0 0 0 auto !important; display: inline-flex; align-items: center; gap: 6px; flex: none;
}
body .dtools a {
  background: none !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important;
  color: var(--pcp-text-muted) !important; font-size: 12px; font-weight: 600; padding: 4px 6px;
  text-decoration: underline dotted; cursor: pointer; transform: none !important;
}
body .dtools a:hover { color: var(--pcp-text) !important; background: none !important; }
.pcp-help {
  position: relative; width: 22px; height: 22px; border-radius: 50%; padding: 0;
  border: 1px solid var(--pcp-border); background: var(--pcp-surface); color: var(--pcp-text-muted);
  font: 700 11px/1 inherit; font-family: inherit; cursor: help;
  display: inline-flex; align-items: center; justify-content: center;
}
.pcp-help:hover, .pcp-help:focus { color: var(--pcp-text); border-color: var(--pcp-text); outline: 0; }
.pcp-help .tip {
  display: none; position: absolute; right: 0; top: 28px; width: 240px;
  background: var(--pcp-header-bg); color: var(--pcp-header-ink);
  font-size: 11px; font-weight: 500; line-height: 1.4; padding: 8px 10px; text-align: left;
  border-radius: var(--pcp-radius-card); box-shadow: 0 6px 18px rgba(0,0,0,.18); z-index: 60;
}
.pcp-help:hover .tip, .pcp-help:focus .tip { display: block; }

/* 4. Buscador + 8 KPI (pcp-kpi-row) */
.pcp-kpi-row { display: flex; align-items: stretch; gap: 8px; min-height: 54px; }
.pcp-kpi-row > #kpi_wrap { flex: 1; min-width: 0; }
.kpi-wrap.has-more::after { display: none !important; }
body .pcp-search {
  position: relative; display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  width: 11rem; padding: 0 10px;
  border: 1.5px solid color-mix(in srgb, var(--pcp-accent) 55%, var(--pcp-border));
  background: color-mix(in srgb, var(--pcp-accent) 6%, var(--pcp-surface));
  border-radius: var(--pcp-radius-card);
  transition: width 300ms cubic-bezier(.22,1,.36,1), box-shadow 160ms ease, border-color 160ms ease;
}
body .pcp-search:focus-within, body .pcp-search.has-value { width: 16.5rem; }
body .pcp-search:focus-within { border: 1.5px solid var(--pcp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pcp-accent) 18%, transparent); }
body .pcp-search .ico { display: inline-flex; color: var(--pcp-accent); flex: none; }
body .pcp-search .ico svg { width: 15px; height: 15px; }
body .pcp-search input#q {
  flex: 1 1 auto !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important;
  border: 0 !important; outline: 0 !important; background: transparent !important; box-shadow: none !important;
  padding: 0 !important; font-size: 12px !important; color: var(--pcp-text); font-family: inherit;
}
body .pcp-search kbd {
  font: 600 10px/1 ui-monospace, monospace; color: var(--pcp-text-muted);
  border: 1px solid var(--pcp-border); border-radius: 3px; padding: 2px 4px; background: var(--pcp-surface-subtle);
}
body .pcp-search:focus-within kbd, body .pcp-search.has-value kbd { display: none; }
body .pcp-search .clr { display: none; border: 0; background: none; color: var(--pcp-text-muted); font-size: 14px; cursor: pointer; padding: 0 2px; line-height: 1; }
body .pcp-search.has-value .clr { display: inline; }

body .kpi-row {
  display: grid !important; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px;
  overflow: visible !important; padding: 0 !important; height: 100%;
}
body .kpi-b {
  --tone: var(--pcp-info);
  min-width: 0 !important; max-width: none !important; flex: none;
  background: var(--pcp-surface) !important;
  border: 1px solid var(--pcp-border) !important;
  border-top: 3px solid var(--tone) !important;
  border-radius: var(--pcp-radius-card) !important;
  box-shadow: none !important;
  padding: 6px 10px !important; gap: 0 !important;
  display: flex; flex-direction: column; justify-content: center; cursor: pointer;
  transition: transform 120ms ease, border-color 160ms ease !important;
}
body .kpi-b.dn { --tone: var(--pcp-danger); }
body .kpi-b.wn { --tone: var(--pcp-warn); }
body .kpi-b.ok { --tone: var(--pcp-ok); }
body .kpi-b:hover { border-color: var(--pcp-text) !important; border-top-color: var(--tone) !important; box-shadow: none !important; }
body .kpi-b:active { transform: scale(.97); }
body .kpi-b .kl {
  font-size: 9px !important; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--pcp-text-muted) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body .kpi-b .kv {
  font-size: 16px !important; font-weight: 800 !important; line-height: 1.15; margin-top: 2px; letter-spacing: 0;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
body .kpi-b.dn .kv { color: var(--pcp-danger-ink) !important; }
body .kpi-b.wn .kv { color: var(--pcp-warn-ink) !important; }
body .kpi-b.ok .kv { color: var(--pcp-ok-ink) !important; }
body .kpi-b:not(.dn):not(.wn):not(.ok) .kv { color: var(--pcp-text) !important; }
body .kpi-b .kv small { font-size: 10px; font-weight: 600; color: var(--pcp-text-muted); margin-left: 3px; }
body .kpi-b .ks {
  font-size: 10px !important; color: var(--pcp-text-muted) !important;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body .kpi-b .ks.pcp-dup { display: none; }

/* 5. Cuellos de botella (pcp-sec-title + pcp-bn-grid + pcp-bn) */
body .bnh {
  font-size: 11px !important; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--pcp-text-muted) !important; margin: 2px 0 -6px !important;
}
body .bnh .mu { font-weight: 500; text-transform: none; letter-spacing: 0; opacity: .8; }
/* Toggle on/off de etapas */
body .pcp-stage-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer; user-select: none; margin-left: auto;
  flex-shrink: 0; padding: 0; border: none !important;
  background: transparent !important; box-shadow: none !important;
  font: inherit; text-transform: none; letter-spacing: 0;
  animation: none !important; border-radius: 0 !important;
  overflow: visible !important;
}
body .pcp-stage-toggle:hover { transform: none !important; color: inherit !important; }
body .pcp-toggle-input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
body .pcp-toggle-track {
  position: relative; width: 34px; height: 20px; flex-shrink: 0;
  background: #c9ccd2; border-radius: 99px;
  transition: background .3s ease;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,.12), inset -1px -1px 2px rgba(255,255,255,.6);
}
body .pcp-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  transition: transform .32s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 1px 4px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.06);
}
body .pcp-toggle-input:checked + .pcp-toggle-track {
  background: #2e7d32;
  box-shadow: inset 1px 1px 3px rgba(0,40,0,.25), inset -1px -1px 2px rgba(255,255,255,.5);
}
body .pcp-toggle-input:checked + .pcp-toggle-track::after {
  transform: translateX(14px);
}
body .pcp-toggle-txt {
  font-size: 10px; font-weight: 700; color: #8a8f9a;
  text-transform: uppercase; letter-spacing: .4px;
  transition: color .3s; white-space: nowrap;
}
body .pcp-toggle-input:checked ~ .pcp-toggle-txt {
  color: #2e7d32;
}
/* Ocultar reglas viejas de #bn_all que interferían */
body #bn_all::before { display: none !important; }
body #bn_all.on { background: transparent !important; }
body #bn, body .bns {
  display: flex !important; flex-wrap: wrap !important; gap: 6px !important; overflow: visible !important;
}
body .bn {
  position: relative; flex: 1 1 190px !important; min-width: 0 !important; max-width: none !important; width: auto !important;
  display: flex !important; align-items: center; gap: 8px;
  padding: 7px 10px 9px !important; text-align: left;
  background-color: var(--pcp-surface) !important; background-image: none !important;
  border: 1px solid var(--pcp-border) !important; border-left-width: 1px !important;
  border-radius: var(--pcp-radius-card) !important;
  box-shadow: none !important; color: var(--pcp-text) !important;
  cursor: pointer; overflow: hidden; transform: none !important;
  font-family: inherit; transition: border-color 140ms ease !important;
}
body .bn:hover { border-color: var(--pcp-text) !important; transform: none !important; box-shadow: none !important; }
body .bn.bn.on { border-color: var(--pcp-text) !important; box-shadow: inset 0 0 0 1px var(--pcp-text) !important; outline: none !important; }
body .bn .bt { flex: 1; font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--pcp-text) !important; text-align: left; }
body .bn .bm { display: flex; align-items: baseline; gap: 8px; font-size: 11px; color: var(--pcp-text-muted) !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
body .bn .bm b { font-weight: 600; color: inherit; }
body .bn .bm .bo { font-size: 11px; color: var(--pcp-text-muted); }
body .bn .bm .bd { font-size: 11px; font-weight: 700; color: var(--pcp-text-muted); }
body .bn[data-sev="high"] .bm .bd { color: var(--pcp-danger-ink); }
body .bn .bb {
  position: absolute !important; left: 0; right: 0; bottom: 0; top: auto !important;
  height: 3px !important; margin: 0 !important; border-radius: 0 !important; background: transparent !important; overflow: hidden;
}
body .bn .bb span { display: block; height: 100%; border-radius: 0 !important; background: var(--pcp-border) !important; }
body .bn[data-sev="high"] .bb span { background: var(--pcp-danger) !important; }
body .bn[data-sev="mid"] .bb span { background: var(--pcp-warn) !important; }
body .bn[data-sev="low"] .bb span { background: #9CA3AF !important; }
body .bn em { background: var(--pcp-accent) !important; color: var(--pcp-accent-ink) !important; }
@keyframes bnPulse { 0%, 100% { background-color: var(--pcp-surface); } 50% { background-color: var(--bn-tint); } }
body .bn[data-sev="high"] { --bn-tint: color-mix(in srgb, var(--pcp-danger) 9%, var(--pcp-surface)); animation: bnPulse 3.2s ease-in-out infinite !important; }
body .bn[data-sev="mid"]  { --bn-tint: color-mix(in srgb, var(--pcp-warn) 7%, var(--pcp-surface)); animation: bnPulse 4.5s ease-in-out infinite !important; }
body .bn[data-sev="high"]:nth-child(2) { animation-delay: .6s !important; }
body .bn[data-sev="low"] { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  body .bn { animation: none !important; }
  body .bn[data-sev="high"], body .bn[data-sev="mid"] { background-color: var(--bn-tint) !important; }
}

/* 6. Filtros rápidos (pcp-filterbar + pcp-seg) */
body .bar2 {
  display: flex !important; align-items: center; gap: 12px !important; flex-wrap: wrap;
  background: none !important; box-shadow: none !important; backdrop-filter: none !important;
  border-radius: 0 !important; padding: 0 !important;
}
body .seg, body .pcp-seg {
  display: inline-flex !important; flex-wrap: nowrap !important; gap: 0 !important;
  border: 1px solid var(--pcp-border); border-radius: var(--pcp-radius-btn); overflow: hidden;
  background: var(--pcp-surface) !important; box-shadow: none !important; padding: 0 !important;
}
body .seg button, body .pcp-seg button {
  --mnR: transparent; --mnS: transparent;
  border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important;
  color: var(--pcp-text-muted) !important; padding: 6px 11px !important; font: 600 12px/1.35 inherit !important; font-family: inherit !important;
  cursor: pointer; display: inline-flex !important; align-items: center; gap: 6px; animation: none !important; transform: none !important;
  backdrop-filter: none !important;
}
body .seg button + button, body .pcp-seg button + button { border-left: 1px solid var(--pcp-border) !important; }
body .seg button::before, body .seg button::after { display: none !important; }
body .seg button:hover, body .pcp-seg button:hover { background: var(--pcp-surface-subtle) !important; color: var(--pcp-text) !important; transform: none !important; }
body .seg button.on, body .pcp-seg button.is-active { background: var(--pcp-chip-active-bg) !important; color: var(--pcp-chip-active-ink) !important; }
body .seg button i, body .pcp-seg button i {
  font-style: normal; font-size: 10.5px !important; padding: 0 5px !important; border-radius: 99px !important;
  background: var(--pcp-chip-badge-bg) !important; color: var(--pcp-chip-badge-ink) !important; box-shadow: none !important; font-weight: 600;
}
body .seg button.on i, body .pcp-seg button.is-active i { background: var(--pcp-chip-badge-active-bg) !important; color: var(--pcp-chip-badge-active-ink) !important; }
body .pcp-seg.sm button { padding: 5px 9px !important; font-size: 11px !important; }
.pcp-seg-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--pcp-text-muted); margin-right: -6px; }
body .bar2 select#f_dem {
  border: 1px solid var(--pcp-border); background: var(--pcp-surface); color: var(--pcp-text-muted);
  border-radius: var(--pcp-radius-btn); padding: 6px 8px; font-size: 12px; font-weight: 600; font-family: inherit;
}
body .bar2 label.chk.pcp-hide { display: none !important; }
body .bar2 .pcp-sp { flex: 1; }
body .bar2 .pcp-count { font-size: 11px; color: var(--pcp-text-muted); padding: 4px 2px; font-variant-numeric: tabular-nums; }

/* 7. Tabla (pcp-card + table) */
body .card {
  background: var(--pcp-surface) !important; border: 1px solid var(--pcp-border) !important;
  border-radius: var(--pcp-radius-card) !important; box-shadow: none !important; backdrop-filter: none !important;
  overflow: auto; max-height: calc(100vh - 380px) !important; min-height: 240px;
}
body table { border-collapse: separate !important; border-spacing: 0 !important; width: 100%; font-size: 12px; }
body th {
  position: sticky; top: 0; z-index: 5; text-align: left; font-size: 10.5px !important; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px !important; white-space: nowrap; cursor: pointer;
  background: var(--pcp-surface-subtle) !important; color: var(--pcp-text-muted) !important;
  border-bottom: 0 !important;
}
body th.n, body td.n { text-align: right; }
body td {
  padding: 7px 10px !important; border-top: 1px solid var(--pcp-border) !important; border-bottom: 0 !important;
  vertical-align: middle; white-space: nowrap; color: var(--pcp-text) !important; background: transparent;
}
body tr.r:hover td { background: var(--pcp-surface-subtle) !important; }
body tr.r td:first-child { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--cc, var(--pcp-border)) 35%, transparent); }
body tr.r:has(.cv.bad) td:first-child { box-shadow: inset 3px 0 0 var(--pcp-danger) !important; }
body th.pcp-hide, body td.pcp-hide { display: none !important; }
body td.cd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; color: var(--pcp-text-muted) !important; }
body td.nm { max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
body td.nm .prod { display: block; font-weight: 600; color: var(--pcp-text); overflow: hidden; text-overflow: ellipsis; }
body td.nm .cat {
  display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 500; margin-top: 1px;
  color: var(--cc, var(--pcp-text-muted)); opacity: .8; overflow: hidden; text-overflow: ellipsis;
}
body td.nm .cat::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--cc, var(--pcp-text-muted)); flex: none; }
body .mu { color: var(--pcp-text-muted); }
body .abc, body td.ab .abc {
  display: inline-block; padding: 2px 7px; border-radius: var(--pcp-radius-btn); font-size: 11px; font-weight: 600;
  border: 1px solid var(--pcp-border) !important; color: var(--pcp-text-muted) !important; background: var(--pcp-surface) !important;
}
body .dm, body .dm.S, body .dm.E, body .dm.I, body .dm.L, body .dm.N, body .dm.Z {
  background: none !important; border: 0 !important; padding: 0 !important; color: var(--pcp-text-muted) !important; font-weight: 400 !important; border-radius: 0 !important;
}
body .tr { color: var(--pcp-text-muted); font-weight: 700; }
body .tr.up { color: var(--pcp-ok-ink) !important; }
body .tr.dn, body .tr.down { color: var(--pcp-danger-ink) !important; }
body .cv {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: var(--pcp-radius-btn);
  font-variant-numeric: tabular-nums; background: var(--pcp-surface-subtle) !important; color: var(--pcp-text-muted) !important; border: 1px solid transparent;
}
body .cv.bad { background: var(--pcp-danger) !important; color: #fff !important; }
body .cv.warn { background: #FEF3C7 !important; color: var(--pcp-warn-ink) !important; border-color: var(--pcp-warn); }
body .cv.ok { background: var(--pcp-ok-soft) !important; color: var(--pcp-ok-ink) !important; border-color: var(--pcp-ok); }
body .foot { font-size: 11px; color: var(--pcp-text-muted); padding: 4px 2px; }

/* 8. Responsive */
@media (max-width: 1200px) {
  .pcp-kpi-row { flex-direction: column; }
  body .pcp-search, body .pcp-search:focus-within { width: 100%; }
  body .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ===== Resto de la hoja del tema (modales, panel lateral, etc.) ===== */
/* 9. Category pills (.cp) */
.cp {
  background: var(--pcp-surface-subtle) !important;
  border: 1px solid var(--pcp-border) !important;
  color: var(--pcp-text-muted) !important;
}

/* 10. Status badges (.cv) */
.cv { background: var(--pcp-surface-subtle) !important; color: var(--pcp-text-muted) !important; }
.cv.ok { background: var(--pcp-ok-soft) !important; color: var(--pcp-ok-ink) !important; }
.cv.warn { background: #FEF3C7 !important; color: var(--pcp-warn-ink) !important; }
.cv.bad { background: var(--pcp-danger-soft) !important; color: var(--pcp-danger-ink) !important; }

/* 11. Operation tags (.op) */
.op { background: var(--pcp-surface-subtle) !important; color: var(--pcp-text-muted) !important; }
.op.confirmed { background: var(--pcp-ok-soft) !important; color: var(--pcp-ok-ink) !important; }
.op.draft { background: #FEF3C7 !important; color: var(--pcp-warn-ink) !important; }
.op.progress { background: var(--pcp-accent) !important; color: var(--pcp-accent-ink) !important; }

/* 12. Side panel (.dr) */
body .dr {
  background: var(--pcp-surface) !important;
  border-right: 1px solid var(--pcp-border) !important;
  box-shadow: 12px 0 40px rgba(0,0,0,.12) !important;
}

/* 13. Checkbox (.chk) */
.chk .bx { background: var(--pcp-border) !important; }
.chk input:checked + .bx { background: var(--pcp-accent) !important; }

/* 14. Settings modal (.set .sb) */
.set .sb {
  background: var(--pcp-surface) !important;
  border: 1px solid var(--pcp-border) !important;
}

/* 15. Scrim */
.scrim { background: rgba(0,0,0,.25) !important; }

/* 16. Spark bars */
svg rect.cur { fill: var(--pcp-accent) !important; }

/* 18. Filter bar clean styling */
.flt {
  color: var(--pcp-text-muted);
}
.flt .chk {
  color: var(--pcp-text-muted);
}

/* 19. Settings fields */
.sf {
  border-bottom-color: var(--pcp-border) !important;
  color: var(--pcp-text) !important;
}
.sf input {
  border-color: var(--pcp-border) !important;
  border-radius: var(--pcp-radius-btn) !important;
}

/* 20. ABC badge */
.abc { color: var(--pcp-text-muted) !important; }
.abc.A { background: var(--pcp-chip-active-bg) !important; color: var(--pcp-chip-active-ink) !important; }

/* 21. KPI bubble label/value overrides */
.kpi-b .lbl { color: var(--pcp-text-muted) !important; font-size: 9px !important; }
.kpi-b .val { color: var(--pcp-text) !important; }
.kpi-b .sub { color: var(--pcp-text-muted) !important; }

/* 22. Theme toggle widget */
.pcp-theme-sw {
  display: inline-flex;
  border: 1px solid var(--pcp-header-btn-border);
  border-radius: var(--pcp-radius-btn);
  overflow: hidden;
  margin-left: 8px;
}
.pcp-theme-sw button {
  border: 0;
  background: var(--pcp-header-btn-bg);
  color: var(--pcp-header-btn-ink);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.pcp-theme-sw button + button { border-left: 1px solid var(--pcp-header-btn-border); }
.pcp-theme-sw button.is-active {
  background: var(--pcp-accent);
  color: var(--pcp-accent-ink);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  body .dv, body .seg button, body .bn, body .kpi-b,
  body .dv .dot, body .seg button::before {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== v4 fixes (20261127e) ===== */
/* Etapas/cuellos de botella: SIEMPRE una sola línea (se achican, texto con elipsis; nombre completo en tooltip) */
body #bn { display: flex !important; flex-wrap: nowrap !important; gap: 6px !important; overflow-x: auto !important; overflow-y: hidden; scrollbar-width: thin; }
body #bn > .bn { flex: 1 0 auto !important; min-width: 0 !important; overflow: hidden; padding-left: 8px !important; padding-right: 8px !important; }
body #bn > .bn .bt { overflow: visible !important; text-overflow: clip !important; white-space: nowrap !important; display: block; min-width: 0; }
body #bn > .bn .bm { flex: none; }
/* Filtros de categoría: una línea, centrados */
body #divs { display: flex !important; flex-wrap: nowrap !important; justify-content: center !important; gap: 6px !important; overflow-x: auto !important; overflow-y: hidden; scrollbar-width: none; }
body #divs .dv { flex: 0 0 auto !important; white-space: nowrap !important; }
body .bar2 .seg, body #qf.seg { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
body #qf.seg button { flex: 0 0 auto !important; white-space: nowrap !important; }
body #divs .dv .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Burbujas KPI: por encima de los títulos sticky de la tabla (th z=5) y bajo el header (z=30) */
body .pcp-kpi-row, body #kpi_wrap { overflow: visible !important; }
body .kpi-b:hover, body .kpi-b:focus-within, body .kpi-b.show { z-index: 25 !important; }
/* Puente invisible entre tarjeta y burbuja + retardo al cerrar => se puede entrar y hacer clic */
.kpi-b .bub::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 14px; }
.kpi-b .bub.up::before { bottom: auto; top: 100%; }
.kpi-b .bub { transition: opacity .18s ease .35s, visibility 0s linear .55s !important; }
.kpi-b:hover .bub, .kpi-b:focus-within .bub, .kpi-b.show .bub { transition: opacity .15s ease 0s, visibility 0s !important; pointer-events: auto !important; }
.kpi-b .bub a, .kpi-b .bub button:not([disabled]) { cursor: pointer; position: relative; z-index: 1; }

/* Chips de categoría centrados */
body #divs { justify-content: center !important; }

/* Barra de filtros centrada */
body .bar2 { justify-content: center !important; }

/* ===== v4 categorías a mostrar (20261127f) ===== */
body #divs .dv.pcp-hidecat { display: none !important; }
#set_cats { margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
#set_cats .pcp-setcats-h { margin: 0 0 8px; font-size: 13px; }
#set_cats .pcp-setcats { display: flex; flex-wrap: wrap; gap: 6px 16px; }
#set_cats .pcp-setcat { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }

/* v4 h: cuellos de botella en una sola linea, nombre arriba y metricas abajo */
html body #bn > .bn{flex:1 1 auto !important;min-width:0 !important;flex-direction:column !important;align-items:flex-start !important;justify-content:center !important;gap:2px !important}
html body #bn > .bn .bt{overflow:hidden !important;text-overflow:ellipsis !important;width:100% !important;max-width:100% !important;flex:none !important;text-align:left}
