/**
 * OCP CardioNet — Home (dashboard) moderno
 * Tarjetas, medidores y gráficos legibles. Paleta alineada al CRM.
 */

:root {
  --ocp-ink: #0f172a;
  --ocp-ink-soft: #475569;
  --ocp-muted: #64748b;
  --ocp-line: #e2e8f0;
  --ocp-card: #ffffff;
  --ocp-bg: #eef3f8;
  --ocp-brand: #009ec5;
  --ocp-brand-dark: #083a54;
  --ocp-radius: 16px;
  --ocp-radius-sm: 12px;
  --ocp-shadow: 0 6px 22px rgba(15, 23, 42, .07);
  --ocp-shadow-hover: 0 12px 30px rgba(15, 23, 42, .12);
}

.ocp-home {
  padding: 8px 16px 28px;
}

@media (min-width: 992px) {
  .ocp-home {
    padding: 10px 22px 32px;
  }
}

/* ══ Encabezado ══ */
.ocp-hero {
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  margin-bottom: 14px;
  border-radius: var(--ocp-radius);
  color: #fff;
  background: linear-gradient(120deg, #083a54 0%, #0d5377 45%, #009ec5 100%);
  box-shadow: 0 10px 30px rgba(8, 58, 84, .28);
}

.ocp-hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  pointer-events: none;
  z-index: 0;
}

.ocp-hero > * {
  position: relative;
  z-index: 1;
}

.ocp-hero__brand {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  box-sizing: border-box;
  box-shadow: 0 6px 18px rgba(8, 58, 84, .28);
}

.ocp-hero__brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ocp-hero__copy {
  flex: 1 1 260px;
  min-width: 0;
}

.ocp-hero__title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .2px;
  color: #fff;
  border: none;
  padding: 0;
}

.ocp-hero__sub {
  display: block;
  margin-top: 5px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: .92;
}

.ocp-hero__period {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  margin-right: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  font-size: 11.5px;
  font-weight: 600;
}

.ocp-hero__period--muted {
  opacity: .9;
  font-weight: 500;
}

.ocp-hero__actions {
  flex: 0 0 auto;
  margin-left: auto;
  position: relative;
  z-index: 30;
}

.ocp-hero__actions .btn-group {
  position: relative;
}

.ocp-hero__dates {
  z-index: 1060 !important;
  min-width: 220px;
  margin-top: 6px;
  padding: 6px 0;
  overflow: visible;
}

.ocp-hero__dates > li > a {
  padding: 8px 16px;
  white-space: nowrap;
}

.dashboard-page .content-wrapper,
.dashboard-page .ocp-home {
  overflow: visible;
}

.ocp-hero__actions .btn-group > .btn {
  height: 42px;
  border: none;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(8, 58, 84, .25);
}

.ocp-hero__period-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  color: #08405c !important;
  background: #fff !important;
  border-radius: 10px 0 0 10px !important;
}

.ocp-hero__period-caret {
  padding: 0 13px;
  color: #fff !important;
  background: rgba(0, 0, 0, .22) !important;
  border-radius: 0 10px 10px 0 !important;
}

@media (max-width: 767px) {
  .ocp-hero__actions {
    margin-left: 0;
    width: 100%;
  }

  .ocp-hero__actions .btn-group {
    display: flex;
    width: 100%;
  }

  .ocp-hero__period-btn {
    flex: 1;
  }

  .ocp-hero__title {
    font-size: 19px;
  }
}

/* ══ Tarjetas KPI ══ */
.ocp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.ocp-kpi {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 16px 18px;
  border-radius: var(--ocp-radius);
  background: var(--ocp-card);
  border: 1px solid var(--ocp-line);
  box-shadow: var(--ocp-shadow);
  text-decoration: none !important;
  transition: transform .18s ease, box-shadow .18s ease;
}

.ocp-kpi:hover,
.ocp-kpi:focus {
  transform: translateY(-3px);
  box-shadow: var(--ocp-shadow-hover);
}

.ocp-kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--kpi-color, var(--ocp-brand));
}

.ocp-kpi__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ocp-kpi__icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: var(--kpi-color, var(--ocp-brand));
  background: var(--kpi-soft, rgba(0, 158, 197, .12));
}

.ocp-kpi__label {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ocp-muted);
  line-height: 1.25;
}

.ocp-kpi__value {
  display: block;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--ocp-ink);
  letter-spacing: -.5px;
}

.ocp-kpi__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ocp-muted);
}

.ocp-kpi__share {
  color: var(--kpi-color, var(--ocp-brand));
  font-weight: 800;
}

.ocp-kpi__bar {
  margin-top: 9px;
  height: 6px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.ocp-kpi__bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--kpi-color, var(--ocp-brand));
}

/* Colores por tarjeta */
.ocp-kpi--lead {
  --kpi-color: #16a34a;
  --kpi-soft: rgba(22, 163, 74, .12);
}

.ocp-kpi--prospecto {
  --kpi-color: #d97706;
  --kpi-soft: rgba(217, 119, 6, .12);
}

.ocp-kpi--oportunidad {
  --kpi-color: #0891b2;
  --kpi-soft: rgba(8, 145, 178, .12);
}

.ocp-kpi--off {
  --kpi-color: #dc2626;
  --kpi-soft: rgba(220, 38, 38, .12);
}

.ocp-kpi--cita {
  --kpi-color: #2563eb;
  --kpi-soft: rgba(37, 99, 235, .12);
}

.ocp-kpi--venta {
  --kpi-color: #059669;
  --kpi-soft: rgba(5, 150, 105, .12);
}

.ocp-kpi--abiertas {
  --kpi-color: #16a34a;
  --kpi-soft: rgba(22, 163, 74, .12);
}

.ocp-kpi--asesor {
  --kpi-color: #d97706;
  --kpi-soft: rgba(217, 119, 6, .12);
}

.ocp-kpi--paciente {
  --kpi-color: #0891b2;
  --kpi-soft: rgba(8, 145, 178, .12);
}

.ocp-kpi--periodo {
  --kpi-color: #2563eb;
  --kpi-soft: rgba(37, 99, 235, .12);
}

.ocp-kpi--msg {
  --kpi-color: #0d9488;
  --kpi-soft: rgba(13, 148, 136, .12);
}

.ocp-kpi--sla {
  --kpi-color: #dc2626;
  --kpi-soft: rgba(220, 38, 38, .12);
}

.ocp-kpi--ia {
  --kpi-color: #009ec5;
  --kpi-soft: rgba(0, 158, 197, .12);
}

.ocp-kpi--requiere {
  --kpi-color: #dc2626;
  --kpi-soft: rgba(220, 38, 38, .12);
}

.ocp-kpi-note {
  margin: -6px 0 16px;
  font-size: 12px;
  color: var(--ocp-muted);
}

/* ══ Paneles ══ */
.ocp-panel {
  background: var(--ocp-card);
  border: 1px solid var(--ocp-line);
  border-radius: var(--ocp-radius);
  box-shadow: var(--ocp-shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.ocp-panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ocp-line);
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fb 100%);
}

.ocp-panel__icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  background: linear-gradient(135deg, #0d5377, #009ec5);
}

.ocp-panel__titles {
  min-width: 0;
  flex: 1 1 auto;
}

.ocp-panel__title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ocp-ink);
  line-height: 1.25;
}

.ocp-panel__hint {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ocp-muted);
}

.ocp-panel__total {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(0, 158, 197, .1);
  border: 1px solid rgba(0, 158, 197, .2);
  color: #076a86;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ocp-panel__body {
  padding: 16px 18px;
}

.ocp-panel__body--flush {
  padding: 0;
}

/* ══ Medidores de nivel ══ */
.ocp-gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.ocp-gauge {
  text-align: center;
  padding: 14px 10px 12px;
  border-radius: var(--ocp-radius-sm);
  background: #f8fbfd;
  border: 1px solid var(--ocp-line);
}

.ocp-gauge__chart {
  height: 132px;
  margin: 0 auto;
}

.ocp-gauge__label {
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ocp-ink-soft);
  line-height: 1.3;
}

.ocp-gauge__hint {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ocp-muted);
}

/* ══ Gráficos ══ */
.ocp-chart {
  width: 100%;
  min-height: 300px;
}

.ocp-chart--tall {
  min-height: 340px;
}

/* Leyenda manual (dona de cobertura) */
.ocp-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--ocp-line);
}

.ocp-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ocp-ink-soft);
}

.ocp-legend__item strong {
  color: var(--ocp-ink);
  font-variant-numeric: tabular-nums;
}

.ocp-legend__dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
}

.ocp-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--ocp-muted);
  font-size: 13.5px;
  background: #f8fafc;
  border: 1px dashed var(--ocp-line);
  border-radius: var(--ocp-radius-sm);
}

.ocp-empty .fa {
  display: block;
  margin-bottom: 8px;
  font-size: 26px;
  opacity: .5;
}

/* ══ Tablas ══ */
.ocp-table-wrap {
  max-height: 330px;
  overflow: auto;
}

.ocp-table {
  width: 100%;
  margin: 0;
  font-size: 13px;
  border-collapse: collapse;
}

.ocp-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 16px;
  background: #f1f6fa;
  border-bottom: 1px solid var(--ocp-line) !important;
  color: var(--ocp-ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ocp-table tbody td {
  padding: 10px 16px;
  border-top: 1px solid #f1f5f9 !important;
  color: var(--ocp-ink);
  vertical-align: middle;
}

.ocp-table tbody tr:hover {
  background: #f0f9ff;
}

.ocp-table tbody tr.is-clickable {
  cursor: pointer;
}

.ocp-table .ocp-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.ocp-table tfoot td,
.ocp-table tr.ocp-table__total td {
  padding: 11px 16px;
  background: #f8fafc;
  border-top: 2px solid var(--ocp-line) !important;
  font-weight: 800;
  color: var(--ocp-ink);
}

.ocp-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 9px;
  border-radius: 7px;
  background: #eef2f7;
  color: var(--ocp-ink-soft);
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.ocp-rank--1 {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #fff;
}

.ocp-rank--2 {
  background: linear-gradient(135deg, #64748b, #94a3b8);
  color: #fff;
}

.ocp-rank--3 {
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
}

/* Barra proporcional dentro de la tabla */
.ocp-meter {
  display: block;
  height: 5px;
  margin-top: 6px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.ocp-meter > span {
  display: block;
  height: 100%;
  border-radius: 999px
}

/* Etapas del embudo con color */
.ocp-stage {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ocp-stage__dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
}

/* ══ Pie informativo ══ */
.ocp-foot-note {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding: 11px 16px;
  border-radius: var(--ocp-radius-sm);
  background: #fff;
  border: 1px solid var(--ocp-line);
  font-size: 12px;
  color: var(--ocp-muted);
}

/* ══ Utilidades de rejilla ══ */
.ocp-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.ocp-grid--2 {
  grid-template-columns: 1fr;
}

.ocp-grid--3 {
  grid-template-columns: 1fr;
}

@media (min-width: 992px) {
  .ocp-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ocp-grid--3 {
    grid-template-columns: 1.15fr 1fr;
  }
}

@media (min-width: 1400px) {
  .ocp-grid--3 {
    grid-template-columns: 1fr 1.1fr 1fr;
  }
}

.ocp-grid > .ocp-panel {
  margin-bottom: 0;
}

/* El wrapper de AdminLTE no debe cortar el contenido */
.dashboard-page .content-wrapper {
  background: var(--ocp-bg) !important;
}
