/* ═══════════════════════════════════════════════════════════════
   Abogados.CrewCore.ai — Polish Layer v5.0
   Micro-refinamientos ambientales y de detalle.
   Capa aditiva: se elimina revirtiendo al v4 sin romper nada.
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Fondo Ambiental (profundidad por tema) ── */
body {
  background-image:
    radial-gradient(1100px 560px at 88% -12%, rgba(62, 133, 247, 0.08) 0%, transparent 62%),
    radial-gradient(900px 520px at -8% 112%, rgba(210, 178, 94, 0.06) 0%, transparent 60%),
    radial-gradient(700px 420px at 50% 118%, rgba(96, 165, 250, 0.05) 0%, transparent 65%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

[data-theme="light"] body,
[data-bs-theme="light"] body {
  background-image:
    radial-gradient(1100px 560px at 88% -12%, rgba(37, 99, 235, 0.07) 0%, transparent 62%),
    radial-gradient(900px 520px at -8% 112%, rgba(154, 124, 46, 0.05) 0%, transparent 60%);
}

/* ── 2. Sidebar: profundidad sutil ── */
.ic-sidebar {
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, var(--bg-elevated) 130%);
  box-shadow: 1px 0 0 var(--border-subtle);
}

/* ── 3. Topbar: sombra flotante ── */
.ic-topbar {
  box-shadow: 0 1px 0 var(--border-subtle), 0 8px 32px -14px rgba(4, 8, 22, 0.45);
}

[data-theme="light"] .ic-topbar,
[data-bs-theme="light"] .ic-topbar {
  box-shadow: 0 1px 0 var(--border-subtle), 0 8px 24px -16px rgba(15, 23, 42, 0.15);
}

/* ── 4. KPI: iconos con sombra propia ── */
.stat-card > div:first-child .rounded-3,
.kpi-card > div:first-child .rounded-3,
.ic-kpi-card > div:first-child .rounded-3 {
  box-shadow: 0 2px 10px -2px var(--color-primary-glow);
}

/* ── 5. Títulos de página con acento dorado ── */
.ic-page-title {
  position: relative;
  padding-bottom: 6px;
}

.ic-page-title::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 44px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-accent), transparent);
  opacity: 0.7;
}

/* ── 6. Card headers: separación con profundidad ── */
.ic-card-header {
  box-shadow: inset 0 -1px 0 var(--border-subtle);
}

/* ── 7. Scrollbar con tinte de marca ── */
::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-glow);
}

/* ── 8. Transición de tema fluida ── */
body, .ic-sidebar, .ic-topbar, .ic-card, .stat-card, .kpi-card, .ic-kpi-card,
.ic-module-card, .modal-content, .offcanvas, .dropdown-menu {
  transition: background-color 300ms var(--motion-ease), color 300ms var(--motion-ease),
              border-color 300ms var(--motion-ease);
}

/* ── 9. Gráficas Ejecutivas (Chart.js) ── */
.chart-shell {
  position: relative;
  width: 100%;
  min-height: 260px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.chart-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.chart-legend-value {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.chart-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 20px 4px;
}

.chart-summary .cs-total {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
}

.chart-summary .cs-caption {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chart-summary .cs-delta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-success);
  background: var(--color-success-bg);
  border: 1px solid rgba(52, 211, 153, 0.22);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  white-space: nowrap;
}

[data-theme="light"] .chart-summary .cs-delta,
[data-bs-theme="light"] .chart-summary .cs-delta {
  border-color: rgba(21, 128, 61, 0.22);
}

.chart-footer-note {
  padding: 10px 20px 16px;
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chart-empty-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 16px;
  z-index: 2;
  pointer-events: none;
}

/* ── 10. Filtro de rango (7d / 30d / 60d / 90d) ── */
.chart-range {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 3px;
  flex-shrink: 0;
}

.chart-range button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--motion-fast);
  line-height: 1.3;
}

.chart-range button:hover { color: var(--text-heading); }

.chart-range button.active {
  background: var(--color-primary-bg);
  color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary-glow);
}

/* ── 11. Dashboard — tarjetas compactas, tipografía legible ── */
.dash-kpis .stat-card { padding: 12px 14px !important; }
.dash-kpis .kpi-value { font-size: 26px !important; }
.dash-kpis .stat-card > div:first-child .rounded-3 { padding: 6px 8px !important; }
.dash-kpis .stat-card > div:first-child .rounded-3 i { font-size: 17px !important; }
.dash-kpis .stat-card > div:first-child { margin-bottom: 4px !important; }
.dash-kpis .stat-card > div:first-child span { font-size: 10.5px !important; }
.dash-kpis .stat-card span[style*="font-size: 11px"] { font-size: 11.5px !important; }

.exec-analytics .ic-card-header { padding: 9px 14px !important; font-size: 13px !important; }
.exec-analytics .ic-card-body { padding: 9px 14px !important; }
.exec-analytics .chart-shell { min-height: 130px; }
.exec-analytics .chart-shell--donut { height: 140px; min-height: 140px; }
.exec-analytics .chart-summary { padding: 6px 14px 0; }
.exec-analytics .chart-summary .cs-total { font-size: 20px; }
.exec-analytics .chart-summary .cs-caption { font-size: 11px; }
.exec-analytics .chart-summary .cs-delta { font-size: 11px; padding: 2px 8px; }
.exec-analytics .chart-legend { margin-top: 5px; gap: 4px 10px; }
.exec-analytics .chart-legend-item { font-size: 12px; }
.exec-analytics .chart-legend-dot { width: 8px; height: 8px; }
.exec-analytics .chart-legend-value { font-size: 12px; }
.exec-analytics .chart-footer-note { padding: 3px 14px 9px; font-size: 11.5px; }
.exec-analytics .chart-range button { padding: 3px 9px; font-size: 11px; }

.dash-modules .ic-module-card { padding: 12px 8px 10px !important; gap: 6px !important; }
.dash-modules .ic-module-icon { width: 36px; height: 36px; font-size: 18px !important; border-radius: 10px; }
.dash-modules .ic-module-name { font-size: 12px !important; }
.dash-modules h6 { font-size: 11px !important; }

/* ── 12. Ficha de Expediente — densidad profesional ── */
#modalFichaExpediente .modal-body { font-size: 14px; }
#modalFichaExpediente .modal-title { font-size: 1.2rem; }
#modalFichaExpediente .modal-header { padding: 14px 18px !important; }
#modalFichaExpediente .nav-link { font-size: 13.5px; padding: 0.4rem 0.85rem; }
#modalFichaExpediente h6 { font-size: 0.82rem; letter-spacing: 0.07em; }
#modalFichaExpediente .fs-7 { font-size: 0.85rem !important; }
#modalFichaExpediente .fs-8 { font-size: 0.78rem !important; }
#modalFichaExpediente .fs-9 { font-size: 0.72rem !important; }
#modalFichaExpediente .fs-6 { font-size: 0.95rem !important; }
#modalFichaExpediente .fs-5 { font-size: 1.1rem !important; }
#modalFichaExpediente .fs-4 { font-size: 1.2rem !important; }
#modalFichaExpediente .fs-3 { font-size: 1.4rem !important; }
#modalFichaExpediente .doc-item-card { padding: 0.6rem 0.8rem !important; }
#modalFichaExpediente .doc-item-card .fw-bold { font-size: 13.5px; }
#modalFichaExpediente .doc-item-card .small { font-size: 11.5px; }
#modalFichaExpediente #fichaDocsList { max-height: 400px; }
#modalFichaExpediente .btn-sm { padding: 0.32rem 0.7rem !important; font-size: 12.5px !important; }

@media (max-width: 768px) {
  .exec-analytics .chart-shell { min-height: 170px; }
  .exec-analytics .chart-shell--donut { height: 150px; min-height: 150px; }
  .chart-range button { padding: 5px 12px; font-size: 12px; }
  .exec-analytics .ic-card-header { flex-wrap: wrap; gap: 8px; }
  #modalFichaExpediente .nav-link { font-size: 12px; padding: 0.35rem 0.6rem; }
  #modalFichaExpediente .fs-3 { font-size: 1.15rem !important; }
  .dash-kpis .stat-card { padding: 12px 12px !important; }
  .dash-kpis .kpi-value { font-size: 21px !important; }
}
