/* ============================================================
   KPI Dashboard Premium — MiCarnicería Obrador
   Visual impactante: gradientes, tarjetas coloridas, gráficos
   ============================================================ */

.kpi-dash {
  width: 100%;
  margin-bottom: 1.75rem;
  --kpi-r: 16px;
}

/* ── Hero banner (dona + tarjetas principales) ── */
.kpi-dash-hero-shell {
  position: relative;
  border-radius: var(--kpi-r);
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow:
    0 12px 40px rgba(91, 20, 20, 0.22),
    0 4px 12px rgba(42, 31, 26, 0.08);
}
.kpi-dash-hero-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(128deg,
    #4a1010 0%,
    #7a1f1f 28%,
    #9b3328 52%,
    #b8651a 78%,
    #c4922a 100%);
  z-index: 0;
}
.kpi-dash-hero-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 92% 8%, rgba(255,255,255,.18) 0%, transparent 42%),
    radial-gradient(circle at 4% 96%, rgba(0,0,0,.15) 0%, transparent 38%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  z-index: 0;
  pointer-events: none;
}

.kpi-dash-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  align-items: stretch;
  width: 100%;
  padding: 1.35rem 1.4rem 1.5rem;
}

/* ── Dona ── */
.kpi-dash-donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  width: 100%;
}
.kpi-donut {
  width: min(196px, 100%);
  height: min(196px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow:
    0 0 0 7px rgba(255,255,255,.28),
    0 0 0 12px rgba(255,255,255,.08),
    0 16px 48px rgba(0,0,0,.28);
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.2));
}
.kpi-donut-hole {
  width: 58%;
  height: 58%;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .4rem;
  box-shadow: inset 0 2px 10px rgba(0,0,0,.07);
}
.kpi-donut-val {
  font-family: var(--font-display);
  font-size: clamp(.9rem, 2.2vw, 1.2rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--primary-deep);
}
.kpi-donut-lbl {
  font-size: .58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-muted);
  margin-top: .2rem;
}
.kpi-donut-legend {
  list-style: none;
  margin: 0;
  padding: .65rem .9rem;
  font-size: .74rem;
  font-weight: 600;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: .35rem;
  width: 100%;
  max-width: 220px;
  background: rgba(255,255,255,.94);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.14);
  backdrop-filter: blur(8px);
}
.kpi-donut-legend li {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.dot--primary { background: var(--primary); }
.dot--success { background: #16a34a; }
.dot--danger  { background: var(--danger); }
.dot--warn    { background: #f59e0b; }
.dot--blue    { background: #6366f1; }

/* ── Tarjetas KPI ── */
.kpi-dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: .85rem;
  width: 100%;
  align-content: start;
}
.kpi-dash-cards--standalone { margin-bottom: 1rem; width: 100%; }
.kpi-dash-cards--4 { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.kpi-dash-card {
  background: #fff;
  border: none;
  border-radius: 14px;
  padding: 1rem 1.05rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .45rem;
  min-height: 118px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 18px rgba(0,0,0,.1),
    inset 0 0 0 1px rgba(255,255,255,.6);
  transition: transform .18s ease, box-shadow .18s ease;
}
.kpi-dash-card::after {
  content: "";
  position: absolute;
  top: -20px;
  right: -20px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  opacity: .07;
  pointer-events: none;
}
.kpi-dash-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 10px 28px rgba(0,0,0,.14),
    inset 0 0 0 1px rgba(255,255,255,.8);
}
.kpi-dash-card-body { flex: 1; min-width: 0; width: 100%; }

.kpi-dash-card-ico {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}

.kpi-dash-card--primary {
  background: linear-gradient(155deg, #fff8f8 0%, #ffffff 45%, #fef2f2 100%);
  box-shadow: 0 4px 18px rgba(122,31,31,.14), inset 0 0 0 1.5px rgba(122,31,31,.1);
}
.kpi-dash-card--primary::after { background: var(--primary); }
.kpi-dash-card--primary .kpi-dash-card-ico {
  background: linear-gradient(135deg, #fae3df, #fecaca);
}
.kpi-dash-card--primary .kpi-dash-card-val { color: var(--primary-deep); }

.kpi-dash-card--success {
  background: linear-gradient(155deg, #f0fdf4 0%, #ffffff 45%, #ecfdf5 100%);
  box-shadow: 0 4px 18px rgba(22,163,74,.12), inset 0 0 0 1.5px rgba(22,163,74,.12);
}
.kpi-dash-card--success::after { background: #16a34a; }
.kpi-dash-card--success .kpi-dash-card-ico {
  background: linear-gradient(135deg, #bbf7d0, #86efac);
}
.kpi-dash-card--success .kpi-dash-card-val { color: #15803d; }

.kpi-dash-card--danger {
  background: linear-gradient(155deg, #fff5f5 0%, #ffffff 45%, #fef2f2 100%);
  box-shadow: 0 4px 18px rgba(164,40,46,.12), inset 0 0 0 1.5px rgba(164,40,46,.12);
}
.kpi-dash-card--danger::after { background: var(--danger); }
.kpi-dash-card--danger .kpi-dash-card-ico {
  background: linear-gradient(135deg, #fecaca, #fca5a5);
}
.kpi-dash-card--danger .kpi-dash-card-val { color: var(--danger); }

.kpi-dash-card--warn {
  background: linear-gradient(155deg, #fffbeb 0%, #ffffff 45%, #fef3c7 100%);
  box-shadow: 0 4px 18px rgba(217,119,6,.12), inset 0 0 0 1.5px rgba(217,119,6,.12);
}
.kpi-dash-card--warn::after { background: #f59e0b; }
.kpi-dash-card--warn .kpi-dash-card-ico {
  background: linear-gradient(135deg, #fde68a, #fcd34d);
}
.kpi-dash-card--warn .kpi-dash-card-val { color: #b45309; }

.kpi-dash-card--blue {
  background: linear-gradient(155deg, #eef2ff 0%, #ffffff 45%, #e0e7ff 100%);
  box-shadow: 0 4px 18px rgba(99,102,241,.12), inset 0 0 0 1.5px rgba(99,102,241,.12);
}
.kpi-dash-card--blue::after { background: #6366f1; }
.kpi-dash-card--blue .kpi-dash-card-ico {
  background: linear-gradient(135deg, #c7d2fe, #a5b4fc);
}
.kpi-dash-card--blue .kpi-dash-card-val { color: #4338ca; }

.kpi-dash-card:not([class*="kpi-dash-card--"]) .kpi-dash-card-ico {
  background: linear-gradient(135deg, #f3ebde, #e5d9c7);
}

.kpi-dash-card-val {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  max-width: 100%;
}

/* Montos — escalan al ancho del recuadro sin desbordar */
.kpi-dash-amount {
  display: block;
  width: 100%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.08;
}
.kpi-dash-card--fill {
  container-type: inline-size;
  container-name: kpi-card;
}
.kpi-dash-card--fill .kpi-dash-amount {
  font-size: clamp(0.78rem, 10.5cqi, 1.85rem);
}
@container kpi-card (max-width: 240px) {
  .kpi-dash-card--fill .kpi-dash-amount { font-size: clamp(0.72rem, 9.5cqi, 1.45rem); }
}
@container kpi-card (max-width: 180px) {
  .kpi-dash-card--fill .kpi-dash-amount { font-size: clamp(0.68rem, 8.8cqi, 1.2rem); }
}
.kpi-donut-hole {
  container-type: inline-size;
}
.kpi-donut-hole .kpi-dash-amount {
  font-size: clamp(0.62rem, 14cqi, 1.15rem);
  max-width: 100%;
  white-space: nowrap;
}
.kpi-dash-card-lbl {
  font-size: .67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-muted);
  margin-top: .1rem;
}
.kpi-dash-card-sub {
  font-size: .76rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-top: .1rem;
  padding: .15rem .45rem;
  background: rgba(0,0,0,.04);
  border-radius: 6px;
  display: inline-block;
}

/* ── Tarjetas rellenas (ocupan todo el recuadro) ── */
.kpi-dash-cards--fill {
  grid-template-columns: 1fr;
  gap: .7rem;
}
.kpi-dash-hero .kpi-dash-cards--fill {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .85rem;
}

.kpi-dash-card--fill {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-rows: auto;
  gap: 0 .9rem;
  padding: 1.05rem 1.15rem;
  min-height: 108px;
  width: 100%;
  align-items: center;
}
.kpi-dash-card--fill .kpi-dash-card-ico {
  grid-row: 1 / -1;
  align-self: center;
  width: 58px;
  height: 58px;
  font-size: 1.65rem;
  margin-bottom: 0;
}
.kpi-dash-card--fill .kpi-dash-card-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .2rem;
  min-width: 0;
}
.kpi-dash-card--fill .kpi-dash-card-lbl {
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .07em;
  margin-top: 0;
  line-height: 1.2;
}
.kpi-dash-card--fill .kpi-dash-card-val {
  line-height: 1.08;
}
.kpi-dash-card--fill .kpi-dash-card-sub {
  display: block;
  width: 100%;
  margin-top: .35rem;
  padding: .35rem 0 0;
  background: transparent;
  border-radius: 0;
  border-top: 1px dashed rgba(0,0,0,.1);
  color: var(--ink-soft);
}
.kpi-dash-card-sub--rows {
  display: flex;
  flex-direction: column;
  gap: .28rem;
}
.kpi-dash-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .45rem;
  width: 100%;
  min-width: 0;
}
.kpi-dash-sub-lbl {
  font-size: clamp(0.65rem, 3.2cqi, 0.78rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-muted);
  flex-shrink: 0;
}
.kpi-dash-sub-val {
  font-size: clamp(0.72rem, 4.2cqi, 0.92rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
}
.kpi-dash-card-sub:not(.kpi-dash-card-sub--rows) {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .45rem;
  flex-wrap: nowrap;
}
.kpi-dash-card-sub:not(.kpi-dash-card-sub--rows) .kpi-dash-sub-val {
  text-align: right;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  font-size: clamp(0.78rem, 4cqi, 0.92rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.kpi-dash-card--fill.kpi-dash-card--primary .kpi-dash-card-sub,
.kpi-dash-card--fill.kpi-dash-card--primary .kpi-dash-sub-val { color: var(--primary-deep); }
.kpi-dash-card--fill.kpi-dash-card--success .kpi-dash-card-sub,
.kpi-dash-card--fill.kpi-dash-card--success .kpi-dash-sub-val { color: #15803d; }
.kpi-dash-card--fill.kpi-dash-card--danger  .kpi-dash-card-sub,
.kpi-dash-card--fill.kpi-dash-card--danger  .kpi-dash-sub-val { color: var(--danger); }
.kpi-dash-card--fill.kpi-dash-card--warn    .kpi-dash-card-sub,
.kpi-dash-card--fill.kpi-dash-card--warn    .kpi-dash-sub-val { color: #b45309; }

.kpi-dash-suc-block .kpi-dash-cards--fill {
  grid-template-columns: 1fr;
}

/* ── Resumen compacto en fila (sucursal / corte / reportes) ── */
.kpi-dash-cards--row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 0.55rem;
  width: 100%;
  align-items: stretch;
}

.kpi-dash-suc-block .kpi-dash-cards--row {
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
}

/* Panel corte: tarjetas más anchas, sin desbordar */
.kpi-dash-section--corte-totales .kpi-dash-cards--row {
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 0.65rem;
}

.kpi-dash-section--corte-totales .kpi-dash-card--compact {
  overflow: hidden;
  min-width: 0;
  contain: layout style;
}

.kpi-dash-section--corte-totales .kpi-dash-card-body {
  min-width: 0;
  overflow: hidden;
}

.kpi-dash-section--corte-totales .kpi-dash-card-lbl {
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
}

.kpi-dash-section--corte-totales .kpi-dash-card-val,
.kpi-dash-section--corte-totales .kpi-dash-amount {
  font-size: clamp(0.78rem, 2.2vw, 0.96rem);
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.kpi-dash-section--corte-totales .kpi-dash-card-sub {
  overflow: hidden;
}

.kpi-dash-section--corte-totales .kpi-dash-sub-row {
  flex-direction: column;
  align-items: stretch;
  gap: 0.08rem;
}

.kpi-dash-section--corte-totales .kpi-dash-sub-lbl {
  font-size: 0.54rem;
  line-height: 1.2;
  white-space: normal;
}

.kpi-dash-section--corte-totales .kpi-dash-sub-val {
  font-size: 0.62rem;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (min-width: 1100px) {
  .kpi-dash-section--corte-totales .kpi-dash-cards--row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .kpi-dash-section--corte-totales .kpi-dash-cards--row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.kpi-dash-card--compact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  min-height: 0;
  padding: 0.62rem 0.68rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(42, 31, 26, 0.07);
}

.kpi-dash-card--compact::after {
  width: 48px;
  height: 48px;
  top: -12px;
  right: -12px;
  opacity: 0.06;
}

.kpi-dash-card--compact .kpi-dash-card-ico {
  width: 30px;
  height: 30px;
  font-size: 0.95rem;
  border-radius: 8px;
  margin-bottom: 0.05rem;
}

.kpi-dash-card--compact .kpi-dash-card-body {
  width: 100%;
  gap: 0.12rem;
}

.kpi-dash-card--compact .kpi-dash-card-lbl {
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.25;
  margin: 0;
}

.kpi-dash-card--compact .kpi-dash-card-val,
.kpi-dash-card--compact .kpi-dash-amount {
  font-family: var(--font-body);
  font-size: clamp(0.82rem, 2.4vw, 1.02rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.kpi-dash-card--compact .kpi-dash-card-sub {
  width: 100%;
  margin-top: 0.2rem;
  padding: 0.28rem 0 0;
  background: transparent;
  border-top: 1px dashed rgba(107, 90, 79, 0.18);
  border-radius: 0;
  font-size: 0.62rem;
}

.kpi-dash-card--compact .kpi-dash-sub-lbl {
  font-size: 0.56rem;
  color: var(--ink-muted);
}

.kpi-dash-card--compact .kpi-dash-sub-val {
  font-size: 0.64rem;
  font-weight: 800;
}

@media (min-width: 900px) {
  .kpi-dash-suc-block .kpi-dash-cards--row {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }
}

@media (max-width: 520px) {
  .kpi-dash-suc-block .kpi-dash-cards--row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.kpi-dash-section--corte-totales {
  margin-top: 1rem;
}

.kpi-dash-corte-totales-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
  margin: 0.65rem -1rem 0;
  padding: 0.65rem 1rem;
  background: linear-gradient(180deg, #f7f3ec, #efe8dc);
  border-top: 1px dashed var(--line);
  font-size: 0.78rem;
}

.kpi-dash-corte-total-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}

.kpi-dash-corte-total-item--util strong {
  font-size: 0.95rem;
}

.kpi-dash-corte-total-lbl {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.kpi-dash-corte-total-sep {
  font-weight: 800;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .kpi-dash-corte-totales-bar {
    justify-content: center;
  }
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  font-size: .72rem;
  font-weight: 800;
  padding: .22rem .55rem;
  border-radius: 999px;
  margin-top: .25rem;
}
.kpi-trend.up   { background: #dcfce7; color: #15803d; box-shadow: 0 2px 6px rgba(22,163,74,.15); }
.kpi-trend.down { background: #fee2e2; color: #b91c1c; box-shadow: 0 2px 6px rgba(185,28,28,.15); }
.kpi-trend.same { background: #f3f4f6; color: var(--ink-muted); }

/* ── Paneles (sucursales, barras) ── */
.kpi-dash-panel {
  background: #fff;
  border: none;
  border-radius: var(--kpi-r);
  padding: 0;
  margin-top: 1.15rem;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 6px 24px rgba(42,31,26,.08);
  overflow: hidden;
}
.kpi-dash-panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  padding: .9rem 1.2rem;
  display: flex;
  align-items: baseline;
  gap: .55rem;
  flex-wrap: wrap;
  background: linear-gradient(90deg, var(--primary-soft) 0%, #fff 85%);
  border-bottom: 2px solid var(--line);
  color: var(--primary-deep);
}
.kpi-dash-panel-sub {
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-muted);
  background: rgba(122,31,31,.06);
  padding: .15rem .5rem;
  border-radius: 999px;
}
.kpi-dash-suc-grid,
.kpi-dash-bars {
  padding: 1rem 1.2rem 1.15rem;
}

.kpi-dash-bars { display: flex; flex-direction: column; gap: .7rem; }
.kpi-dash-bar-row { display: flex; flex-direction: column; gap: .28rem; }
.kpi-dash-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
  font-size: .84rem;
  font-weight: 600;
}
.kpi-dash-bar-track {
  height: 12px;
  background: #ede8e0;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.06);
}
.kpi-dash-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .45s cubic-bezier(.4,0,.2,1);
  background: linear-gradient(90deg, var(--primary), #c44);
  box-shadow: 0 1px 6px rgba(122,31,31,.35);
}
.kpi-dash-bar-fill--primary { background: linear-gradient(90deg, #7a1f1f, #c44); }
.kpi-dash-bar-fill--success { background: linear-gradient(90deg, #16a34a, #4ade80); box-shadow: 0 1px 6px rgba(22,163,74,.35); }
.kpi-dash-bar-fill--danger  { background: linear-gradient(90deg, #b91c1c, #f87171); box-shadow: 0 1px 6px rgba(185,28,28,.35); }
.kpi-dash-bar-fill--warn    { background: linear-gradient(90deg, #d97706, #fbbf24); box-shadow: 0 1px 6px rgba(217,119,6,.35); }
.kpi-dash-bar-fill--blue    { background: linear-gradient(90deg, #4f46e5, #818cf8); box-shadow: 0 1px 6px rgba(79,70,229,.35); }

.kpi-dash-suc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: .85rem;
  width: 100%;
}
.kpi-dash-suc-card {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: .9rem 1rem;
  background: linear-gradient(180deg, #fff 0%, #faf8f5 100%);
  border-left: 5px solid var(--primary);
  box-shadow: 0 3px 14px rgba(0,0,0,.06);
  transition: transform .15s ease, box-shadow .15s ease;
}
.kpi-dash-suc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.kpi-dash-suc-head {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin-bottom: .55rem;
}
.kpi-dash-suc-ico {
  font-size: 1.35rem;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border-radius: 10px;
  flex-shrink: 0;
}
.kpi-dash-suc-name { font-weight: 800; font-size: .92rem; color: var(--primary-deep); }
.kpi-dash-suc-meta { font-size: .72rem; color: var(--ink-muted); font-weight: 600; }
.kpi-dash-suc-total {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--success);
  white-space: nowrap;
}
.kpi-dash-suc-pct {
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-muted);
  margin-top: .3rem;
  text-align: right;
}

/* ── Sección por sucursal (Inicio admin) ── */
.kpi-dash-section {
  margin-top: 1.35rem;
  border: none;
  border-radius: var(--kpi-r);
  overflow: hidden;
  width: 100%;
  box-shadow: 0 10px 36px rgba(42,31,26,.1);
}
.kpi-dash-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.72rem 1.1rem;
  background: linear-gradient(128deg, #4a1010 0%, #7a1f1f 50%, #9b3328 100%);
  color: #faf6ef;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.1);
}
.kpi-dash-section-date {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .8rem;
  opacity: .9;
  background: rgba(255,255,255,.15);
  padding: .25rem .65rem;
  border-radius: 999px;
}
.kpi-dash-section-body {
  display: block;
  background: var(--bg-warm);
  width: 100%;
}
.kpi-dash-suc-block {
  background: #fff;
  padding: 0.85rem 1rem 0;
  width: 100%;
  box-sizing: border-box;
  border-bottom: 1px solid var(--line);
}
.kpi-dash-suc-block:last-child {
  border-bottom: none;
}
.kpi-dash-suc-block-title {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary-deep);
  margin-bottom: 0.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--primary-soft);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.kpi-dash-suc-block-title::before {
  content: "🏪";
  font-size: 0.9rem;
}
.kpi-dash-suc-footer {
  margin: 0.55rem -1rem 0;
  padding: 0.55rem 1rem;
  background: linear-gradient(180deg, #faf8f5, #f0ebe3);
  border-top: 1px dashed var(--line);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.5;
}
.kpi-dash-suc-footer strong { color: var(--ink); font-weight: 800; }
.kpi-dash-text-success { color: #15803d !important; }
.kpi-dash-text-danger  { color: var(--danger) !important; }

.kpi-dash-totales {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem .85rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(180deg, #f5f0ea 0%, #ede8e0 100%);
  border-top: 3px solid var(--primary);
}
.kpi-dash-totales-title {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--primary-deep);
  margin-right: .35rem;
  font-size: .95rem;
}
.kpi-dash-totales-item {
  background: #fff;
  border-radius: 999px;
  padding: .35rem .85rem;
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.kpi-dash-totales-item strong { color: var(--ink); }
.kpi-dash-totales-item--success { border-color: #bbf7d0; background: #f0fdf4; }
.kpi-dash-totales-item--success strong { color: #15803d; }
.kpi-dash-totales-item--danger  { border-color: #fecaca; background: #fff5f5; }
.kpi-dash-totales-item--danger strong  { color: var(--danger); }
.kpi-dash-totales-item--warn    { border-color: #fde68a; background: #fffbeb; }
.kpi-dash-totales-item--warn strong    { color: #b45309; }

/* ── Variantes ── */
.kpi-dash--compact .kpi-dash-cards--standalone { margin-bottom: 1.25rem; }
.kpi-dash--cliente .kpi-dash-hero,
.kpi-dash--historial .kpi-dash-hero {
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
}

/* Cards fuera del hero (sin banner) */
.kpi-dash-cards-shell {
  background: linear-gradient(180deg, #faf8f5 0%, #fff 100%);
  border-radius: var(--kpi-r);
  padding: 1.15rem;
  box-shadow: 0 4px 18px rgba(0,0,0,.06);
  margin-bottom: 1rem;
}

/* ── Responsive ── */
@media (min-width: 1200px) {
  .kpi-dash-cards { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
}
@media (max-width: 900px) {
  .kpi-dash-hero {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .kpi-dash-donut-wrap {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
  }
  .kpi-donut { width: 168px; height: 168px; }
  .kpi-donut-legend {
    flex: 1;
    min-width: 170px;
    max-width: 340px;
  }
  .kpi-dash-cards { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
  .kpi-dash-totales { flex-direction: column; align-items: flex-start; }
  .kpi-dash-section-body { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .kpi-dash-hero-shell { border-radius: 14px; }
  .kpi-dash-hero { padding: 1.1rem; }
  .kpi-dash-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .kpi-dash-card { padding: .85rem .9rem; min-height: 108px; }
  .kpi-dash-card-val { font-size: 1.15rem; }
  .kpi-dash-suc-grid { grid-template-columns: 1fr; }
  .kpi-dash-donut-wrap { flex-direction: column; align-items: center; }
}
@media (max-width: 400px) {
  .kpi-dash-cards { grid-template-columns: 1fr; }
  .kpi-donut { width: 150px; height: 150px; }
}
