/* V248: arranque estable, render legado eliminado y módulos estadísticos interactivos. */
html.pdv247-dashboard-booting .dashboard-page:not(.pdv244-enhanced) {
  position: relative;
  min-height: calc(100vh - 80px);
  background: #f4f7fb;
}
html.pdv247-dashboard-booting .dashboard-page:not(.pdv244-enhanced) > * {
  visibility: hidden !important;
}
html.pdv247-dashboard-booting .dashboard-page:not(.pdv244-enhanced)::before {
  content: "Cargando dashboard visual…";
  position: absolute;
  inset: 22px;
  z-index: 2;
  display: grid;
  place-items: center;
  min-height: 320px;
  border-radius: 26px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: linear-gradient(135deg, rgba(24,95,165,.10), rgba(255,255,255,.96));
  color: #64748b;
  font-weight: 900;
}

/* PDV360 V244 — Dashboard visual avanzado.
   Capa aislada: solo afecta /empresa/dashboard cuando el renderizador V244 está activo. */
html, body { max-width: 100%; overflow-x: hidden; }
.dashboard-page.pdv244-enhanced,
.pdv244-dashboard {
  --pdv244-bg: #f4f7fb;
  --pdv244-surface: rgba(255,255,255,.94);
  --pdv244-surface-strong: #ffffff;
  --pdv244-ink: #102033;
  --pdv244-muted: #64748b;
  --pdv244-line: rgba(15, 23, 42, .10);
  --pdv244-blue: #185fa5;
  --pdv244-blue-2: #2b7ad1;
  --pdv244-green: #16a34a;
  --pdv244-amber: #f59e0b;
  --pdv244-red: #dc2626;
  --pdv244-purple: #7c3aed;
  --pdv244-cyan: #0891b2;
  --pdv244-shadow: 0 18px 45px rgba(15, 23, 42, .09);
  color: var(--pdv244-ink);
}
.dashboard-page.pdv244-enhanced {
  padding: 22px;
  background:
    radial-gradient(circle at top left, rgba(24,95,165,.13), transparent 34%),
    radial-gradient(circle at top right, rgba(245,158,11,.13), transparent 28%),
    var(--pdv244-bg);
  min-height: calc(100vh - 80px);
}
.pdv244-dashboard * { box-sizing: border-box; }
.dashboard-page.pdv244-enhanced > :not(.pdv244-dashboard) { display: none !important; }

/* V248: eliminar definitivamente la fila KPI heredada y cualquier panel V229/Vue anterior. */
html body.route-dashboard-home .dashboard-page.pdv244-enhanced > :not(.pdv244-dashboard),
html body .dashboard-page.pdv244-enhanced > [data-pdv244-legacy-hidden="true"] {
  display: none !important;
  visibility: hidden !important;
}
.pdv244-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(24,95,165,.96), rgba(15,35,70,.96));
  box-shadow: var(--pdv244-shadow);
  color: #fff;
  margin-bottom: 18px;
  overflow: hidden;
  position: relative;
}
.pdv244-hero::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255,255,255,.20), transparent 62%);
  right: -120px;
  top: -160px;
  pointer-events: none;
}
.pdv244-title-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; position: relative; z-index: 1; }
.pdv244-title-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,.16);
  font-size: 30px;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.pdv244-title { margin: 0; font-size: clamp(26px, 3vw, 42px); line-height: 1; font-weight: 900; letter-spacing: -.045em; }
.pdv244-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.pdv244-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  white-space: nowrap;
}
.pdv244-actions { display: flex; gap: 10px; position: relative; z-index: 1; }
.pdv244-btn {
  appearance: none;
  border: 0;
  border-radius: 16px;
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 900;
  color: #0f2a45;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.pdv244-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(0,0,0,.16); }
.pdv244-btn:active { transform: translateY(0); opacity: .88; }
.pdv244-btn.dark { background: #0f2238; color: #fff; box-shadow: none; }
.pdv244-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(145px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.pdv244-kpi {
  min-width: 0;
  min-height: 126px;
  border-radius: 24px;
  padding: 16px;
  background: var(--pdv244-surface-strong);
  border: 1px solid var(--pdv244-line);
  box-shadow: 0 12px 30px rgba(15,23,42,.06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}
.pdv244-kpi::after {
  content: "";
  position: absolute;
  inset: auto -35px -45px auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--kpi-glow, rgba(24,95,165,.11));
}
.pdv244-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; z-index: 1; }
.pdv244-kpi-icon { width: 42px; height: 42px; border-radius: 16px; display: grid; place-items: center; font-size: 23px; background: var(--kpi-soft, #eef6ff); }
.pdv244-kpi-label { font-size: 12px; color: var(--pdv244-muted); font-weight: 900; text-transform: uppercase; letter-spacing: .035em; text-align: right; }
.pdv244-kpi-value { position: relative; z-index: 1; font-size: clamp(19px, 2.1vw, 28px); font-weight: 950; line-height: 1; letter-spacing: -.045em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pdv244-kpi-foot { position: relative; z-index: 1; height: 6px; border-radius: 999px; background: #e5edf8; overflow: hidden; }
.pdv244-kpi-foot span { display: block; height: 100%; width: var(--fill, 62%); border-radius: inherit; background: var(--kpi-color, var(--pdv244-blue)); }
.pdv244-kpi.blue { --kpi-color: var(--pdv244-blue); --kpi-soft: #e8f2ff; --kpi-glow: rgba(24,95,165,.13); }
.pdv244-kpi.green { --kpi-color: var(--pdv244-green); --kpi-soft: #eafaf0; --kpi-glow: rgba(22,163,74,.13); }
.pdv244-kpi.amber { --kpi-color: var(--pdv244-amber); --kpi-soft: #fff7e6; --kpi-glow: rgba(245,158,11,.15); }
.pdv244-kpi.red { --kpi-color: var(--pdv244-red); --kpi-soft: #fff1f1; --kpi-glow: rgba(220,38,38,.12); }
.pdv244-kpi.purple { --kpi-color: var(--pdv244-purple); --kpi-soft: #f4efff; --kpi-glow: rgba(124,58,237,.13); }
.pdv244-kpi.cyan { --kpi-color: var(--pdv244-cyan); --kpi-soft: #eafcff; --kpi-glow: rgba(8,145,178,.13); }
.pdv244-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}
.pdv244-card {
  min-width: 0;
  border-radius: 26px;
  padding: 18px;
  background: var(--pdv244-surface);
  border: 1px solid rgba(15,23,42,.09);
  box-shadow: 0 14px 34px rgba(15,23,42,.065);
  overflow: hidden;
}
.pdv244-card.span-3 { grid-column: span 3; }
.pdv244-card.span-4 { grid-column: span 4; }
.pdv244-card.span-5 { grid-column: span 5; }
.pdv244-card.span-6 { grid-column: span 6; }
.pdv244-card.span-7 { grid-column: span 7; }
.pdv244-card.span-8 { grid-column: span 8; }
.pdv244-card.span-12 { grid-column: span 12; }
.pdv244-card.clickable { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.pdv244-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(15,23,42,.10); }
.pdv244-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pdv244-card-title { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 17px; line-height: 1.1; font-weight: 950; letter-spacing: -.02em; }
.pdv244-card-title .bubble { width: 36px; height: 36px; border-radius: 14px; display: grid; place-items: center; background: #edf5ff; font-size: 20px; }
.pdv244-mini-stat { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.pdv244-mini-stat b { font-size: 20px; line-height: 1; }
.pdv244-mini-stat small { color: var(--pdv244-muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.pdv244-chart-box { width: 100%; height: 272px; border-radius: 22px; background: linear-gradient(180deg, #f9fbff, #eef4fb); border: 1px solid rgba(15,23,42,.07); overflow: hidden; }
.pdv244-chart-box.compact { height: 228px; }
.pdv244-chart-box svg { display: block; width: 100%; height: 100%; }
.pdv244-svg-grid { stroke: rgba(100,116,139,.20); stroke-width: 1; }
.pdv244-svg-bar { fill: rgba(24,95,165,.72); }
.pdv244-svg-bar.alt { fill: rgba(245,158,11,.82); }
.pdv244-svg-line { fill: none; stroke: #0f2a45; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.pdv244-svg-dot { fill: #0f2a45; stroke: #fff; stroke-width: 3; }
.pdv244-axis-label { fill: #64748b; font-size: 11px; font-weight: 800; }
.pdv244-donut-wrap { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: center; }
.pdv244-donut {
  width: 164px;
  height: 164px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--pdv244-blue) 0deg, var(--pdv244-blue) 140deg, var(--pdv244-amber) 140deg, var(--pdv244-amber) 250deg, var(--pdv244-red) 250deg, var(--pdv244-red) 360deg);
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.10), 0 14px 30px rgba(15,23,42,.10);
}
.pdv244-donut::before {
  content: attr(data-total);
  width: 94px;
  height: 94px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  font-size: 25px;
  font-weight: 950;
  letter-spacing: -.045em;
}
.pdv244-legend { display: grid; gap: 9px; min-width: 0; }
.pdv244-legend-row { display: grid; grid-template-columns: 13px minmax(0,1fr) auto; gap: 9px; align-items: center; font-size: 13px; color: #334155; font-weight: 800; }
.pdv244-legend-dot { width: 13px; height: 13px; border-radius: 5px; background: var(--dot, var(--pdv244-blue)); }
.pdv244-legend-row span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdv244-bars-list { display: grid; gap: 12px; }
.pdv244-hbar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; }
.pdv244-hbar-main { min-width: 0; display: grid; gap: 6px; }
.pdv244-hbar-title { display: flex; justify-content: space-between; gap: 10px; min-width: 0; font-size: 13px; font-weight: 900; color: #1e293b; }
.pdv244-hbar-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdv244-hbar-title small { color: var(--pdv244-muted); font-weight: 800; white-space: nowrap; }
.pdv244-hbar-track { height: 12px; border-radius: 999px; background: #e8eef7; overflow: hidden; }
.pdv244-hbar-track span { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--pdv244-blue), var(--pdv244-blue-2)); }
.pdv244-hbar-value { font-size: 13px; font-weight: 950; white-space: nowrap; }
.pdv244-status-pills { display: grid; gap: 10px; }
.pdv244-status-pill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: #f8fbff;
  border: 1px solid rgba(15,23,42,.07);
}
.pdv244-status-pill b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: capitalize; }
.pdv244-status-pill strong { font-size: 20px; }
.pdv244-status-progress { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: #e7eef7; overflow: hidden; }
.pdv244-status-progress span { display:block; height:100%; width:var(--w,0%); background: linear-gradient(90deg, var(--pdv244-amber), var(--pdv244-blue)); }
.pdv244-table-wrap { overflow: auto; border-radius: 18px; border: 1px solid rgba(15,23,42,.08); }
.pdv244-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; background: #fff; }
.pdv244-table th, .pdv244-table td { padding: 12px 14px; border-bottom: 1px solid #e9eef5; text-align: left; vertical-align: middle; }
.pdv244-table th { background: #f7faff; color: #475569; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 950; }
.pdv244-table tr:last-child td { border-bottom: 0; }
.pdv244-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 900; background: #eaf2ff; color: #164a84; white-space: nowrap; }
.pdv244-badge.red { background: #fff1f1; color: #b91c1c; }
.pdv244-badge.amber { background: #fff7e6; color: #a16207; }
.pdv244-badge.green { background: #eafaf0; color: #166534; }
.pdv244-empty { display: grid; place-items: center; min-height: 140px; border-radius: 20px; border: 1px dashed rgba(100,116,139,.35); background: #f8fbff; color: var(--pdv244-muted); font-weight: 850; text-align: center; padding: 18px; }
.pdv244-error { padding: 14px; border-radius: 18px; background: #fff1f1; color: #991b1b; font-weight: 850; border: 1px solid rgba(220,38,38,.18); margin-bottom: 14px; }
.pdv244-loader { display: grid; place-items: center; min-height: 320px; font-weight: 900; color: var(--pdv244-muted); }

.pdv244-kpi.clickable,
.pdv244-card.clickable {
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  outline: none;
}
.pdv244-kpi.clickable:hover,
.pdv244-card.clickable:hover,
.pdv244-kpi.clickable:focus-visible,
.pdv244-card.clickable:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(24,95,165,.34);
  box-shadow: 0 18px 42px rgba(15,23,42,.12);
}
.pdv244-kpi.clickable:focus-visible,
.pdv244-card.clickable:focus-visible {
  box-shadow: 0 0 0 4px rgba(24,95,165,.15), 0 18px 42px rgba(15,23,42,.12);
}
.pdv244-detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.pdv244-detail-metric {
  min-width: 0;
  padding: 15px;
  border: 1px solid #e2eaf4;
  border-radius: 18px;
  background: linear-gradient(145deg, #fbfdff, #f3f7fc);
  display: grid;
  gap: 5px;
}
.pdv244-detail-metric small {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .035em;
}
.pdv244-detail-metric b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #102033;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.05;
  letter-spacing: -.045em;
}
.pdv244-detail-metric span {
  color: #718096;
  font-size: 11px;
  font-weight: 700;
}
.pdv244-detail-section { margin-top: 18px; }
.pdv244-detail-section:first-child { margin-top: 0; }
.pdv244-detail-section h4 {
  margin: 0 0 11px;
  color: #1e293b;
  font-size: 15px;
  font-weight: 950;
}
.pdv244-detail-table .pdv244-table { min-width: 680px; }

.pdv244-modal-overlay { position: fixed; inset: 0; z-index: 99999; background: rgba(15,23,42,.58); backdrop-filter: blur(5px); display: grid; place-items: center; padding: 22px; }
.pdv244-modal { width: min(1040px, 100%); max-height: min(760px, calc(100vh - 38px)); overflow: hidden; border-radius: 28px; background: #fff; box-shadow: 0 35px 90px rgba(0,0,0,.32); display: flex; flex-direction: column; }
.pdv244-modal-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 1px solid #e7edf5; }
.pdv244-modal-title { margin: 0; font-size: 22px; font-weight: 950; letter-spacing: -.035em; }
.pdv244-modal-body { padding: 18px 20px; overflow: auto; }
.pdv244-modal-actions { display: flex; gap: 10px; align-items: center; }
.pdv244-icon-btn { width: 42px; height: 42px; border-radius: 14px; border: 0; background: #eef4fb; cursor: pointer; font-weight: 950; font-size: 18px; }
.pdv244-modal-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pdv244-quote-card { border: 1px solid #e7edf5; border-radius: 20px; padding: 14px; display: grid; gap: 8px; background: #fbfdff; }
.pdv244-quote-top { display:flex; justify-content:space-between; gap:10px; align-items:start; }
.pdv244-quote-top b { font-size: 16px; }
.pdv244-quote-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:8px; font-size:12px; color:#475569; font-weight:800; }
.pdv244-quote-grid span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width: 1320px) {
  .pdv244-kpi-grid { grid-template-columns: repeat(4, minmax(145px, 1fr)); }
  .pdv244-card.span-3, .pdv244-card.span-4 { grid-column: span 6; }
  .pdv244-card.span-5, .pdv244-card.span-6, .pdv244-card.span-7, .pdv244-card.span-8 { grid-column: span 12; }
}
@media (max-width: 980px) {
  .pdv244-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .dashboard-page.pdv244-enhanced { padding: 14px; }
  .pdv244-hero { grid-template-columns: 1fr; border-radius: 22px; }
  .pdv244-actions { justify-content: stretch; }
  .pdv244-btn { flex: 1; }
  .pdv244-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pdv244-grid { grid-template-columns: 1fr; }
  .pdv244-card, .pdv244-card.span-3, .pdv244-card.span-4, .pdv244-card.span-5, .pdv244-card.span-6, .pdv244-card.span-7, .pdv244-card.span-8, .pdv244-card.span-12 { grid-column: 1 / -1; }
  .pdv244-donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .pdv244-legend { width: 100%; }
  .pdv244-modal-cards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .pdv244-detail-metrics { grid-template-columns: 1fr; }
  .pdv244-kpi-grid { grid-template-columns: 1fr; }
  .pdv244-title-wrap { align-items: flex-start; }
  .pdv244-title-icon { width: 48px; height: 48px; border-radius: 16px; }
  .pdv244-card-head { flex-direction: column; align-items: stretch; }
  .pdv244-mini-stat { align-items: flex-start; }
  .pdv244-chart-box { height: 235px; }
}
