/* ═══════════════════════════════════════════════════════════
   Design System — AsiscomexRisk
   Filosofía: Flat + Depth · Dark sidebar · Semáforos de estado
   ═══════════════════════════════════════════════════════════ */

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --surface-alt: #f8fafc;
  --border:      #e2e8f0;
  --border-soft: #f1f5f9;

  --text-1: #0f172a;
  --text-2: #1e293b;
  --text-3: #64748b;
  --text-4: #94a3b8;

  /* Aliases usados por páginas de Monitoreo/TBML/Alertas/Tareas */
  --text:       var(--text-2);
  --text-muted: var(--text-3);
  --bg-card:    var(--surface);

  --primary:   #0ea5e9;
  --primary-h: #0284c7;
  --accent:    #6366f1;
  --gradient:  linear-gradient(135deg, #0ea5e9, #6366f1);

  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.12);
  --shadow-brand: 0 4px 20px rgba(14,165,233,0.4);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

/* ─── Reset & base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-2);
  background: var(--bg);
  line-height: 1.5;
}

/* ─── MudBlazor sidebar overrides ──────────────────────── */
.mud-drawer .mud-nav-link {
  color: #94a3b8 !important;
  border-radius: 6px;
  margin-bottom: 1px;
  font-size: 13px;
}
.mud-drawer .mud-nav-link:hover {
  background: #334155 !important;
  color: #e2e8f0 !important;
}
.mud-drawer .mud-nav-link-active,
.mud-drawer .tcc-nav-active {
  background: rgba(14,165,233,0.12) !important;
  color: #ffffff !important;
}
.mud-drawer .mud-nav-link .mud-icon-root {
  color: #94a3b8;
  width: 16px;
  height: 16px;
}
.mud-drawer .mud-nav-link-active .mud-icon-root,
.mud-drawer .tcc-nav-active .mud-icon-root {
  color: #0ea5e9 !important;
}
.mud-drawer .mud-nav-link:focus,
.mud-drawer .mud-nav-link:focus-visible { outline: none !important; box-shadow: none !important; }

[tabindex="-1"]:focus { outline: none; }

/* Glow decorativo del sidebar */
.mud-drawer-content {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  position: relative;
  overflow: hidden;
}
.mud-drawer-content::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(14,165,233,0.16) 0%, transparent 68%);
  pointer-events: none;
  z-index: 0;
}
.mud-drawer-content::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -70px;
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(99,102,241,0.13) 0%, transparent 68%);
  pointer-events: none;
  z-index: 0;
}
.mud-drawer-content > * { position: relative; z-index: 1; }

/* ─── MudBlazor font override ── */
.mud-typography,
.mud-button-root,
.mud-input-root input,
.mud-input-root textarea,
.mud-select-input,
.mud-chip,
.mud-table-cell,
.mud-nav-link,
.mud-menu-item,
.mud-list-item,
.mud-snackbar,
.mud-dialog,
.mud-popover {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif !important;
}
.mud-button-root { text-transform: none !important; }

/* ─── Status badges (semáforo) ──────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-verde    { background: #dcfce7; color: #15803d; }
.status-verde::before    { background: #16a34a; }
.status-amarillo { background: #fef9c3; color: #a16207; }
.status-amarillo::before { background: #ca8a04; }
.status-naranja  { background: #ffedd5; color: #c2410c; }
.status-naranja::before  { background: #ea580c; }
.status-rojo     { background: #fee2e2; color: #dc2626; }
.status-rojo::before     { background: #dc2626; }
.status-azul     { background: #dbeafe; color: #1d4ed8; }
.status-azul::before     { background: #2563eb; }
.status-gris     { background: #f1f5f9; color: #64748b; }
.status-gris::before     { background: #94a3b8; }

/* ─── Tablas ─────────────────────────────────────────────── */
.app-table { width: 100%; border-collapse: collapse; }
.app-table th {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  text-align: left;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.app-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}
.app-table tr:last-child td { border-bottom: none; }
.app-table tr:hover td { background: #f8fafc; }

/* ─── Tipografía de página ──────────────────────────────── */
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 24px;
}

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; color: #0f172a; }

/* ─── Formularios ───────────────────────────────────────── */
.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  display: block;
  margin-bottom: 4px;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  display: block;
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #0f172a;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  appearance: auto;
}
.form-input:focus {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}
.form-input:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}
.form-input.error { border-color: #ef4444; }

.form-section {
  margin-bottom: 24px;
}
.form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 16px;
}
.form-grid {
  display: grid;
  gap: 14px;
}
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 768px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: #0ea5e9; cursor: pointer; }
.form-check-label { font-size: 13px; font-weight: 500; color: #374151; }
.form-check-sub   { font-size: 11px; color: #94a3b8; margin-top: 1px; }

/* ─── Botones ─────────────────────────────────────────────── */
.btn {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary { background: #0ea5e9; color: #fff; }
.btn-primary:hover { background: #0284c7; }
.btn-outline { background: transparent; border: 1px solid #e2e8f0; color: #374151; }
.btn-outline:hover { background: #f8fafc; }
.btn-secondary { background: #f1f5f9; border: 1px solid #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-ghost { background: transparent; color: #64748b; }
.btn-ghost:hover { background: #f1f5f9; color: #374151; }
.btn-gradient {
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #fff;
  box-shadow: 0 4px 20px rgba(14,165,233,0.3);
}
.btn-gradient:hover {
  box-shadow: 0 6px 28px rgba(14,165,233,0.45);
  transform: translateY(-1px);
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* ─── KPI Grid ───────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 1024px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 20px;
  border: 1px solid #e2e8f0;
}
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
  margin-bottom: 4px;
}
.kpi-value.warning { color: #ca8a04; }
.kpi-value.danger  { color: #dc2626; }
.kpi-sub {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
}
.kpi-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.kpi-badge.green  { background: #dcfce7; color: #15803d; }
.kpi-badge.red    { background: #fee2e2; color: #dc2626; }
.kpi-badge.yellow { background: #fef9c3; color: #a16207; }
.kpi-badge.blue   { background: #dbeafe; color: #1d4ed8; }

/* ── Vista Switcher (Dashboard) ──────────────────────────── */
.vista-switcher {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.vista-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.vista-btn:hover { background: #e2e8f0; color: #0f172a; }
.vista-btn-active { background: #fff !important; color: #0f172a !important; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ── KPI skeleton loading ─────────────────────────────────── */
.kpi-skeleton {
  min-height: 88px;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ─── Spinner ───────────────────────────────────────────── */
.btn-spin {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin-anim 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin-anim { to { transform: rotate(360deg); } }

/* ─── Glosario / ayudas contextuales ───────────────────────── */
.glosario-term {
  border-bottom: 1px dotted currentColor;
  cursor: help;
  position: relative;
}
.glosario-tip {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 1400;
  width: 260px; max-width: 80vw;
  background: #1e293b; color: #e2e8f0; border: 1px solid #334155;
  border-radius: 8px; padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  font-size: 11px; line-height: 1.45; font-weight: 400; text-align: left;
  white-space: normal;
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .12s ease, transform .12s ease; pointer-events: none;
}
.glosario-term:hover .glosario-tip,
.glosario-term:focus .glosario-tip,
.glosario-term:focus-within .glosario-tip {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.glosario-tip-title { display: block; font-weight: 700; color: #fff; margin-bottom: 4px; font-size: 12px; }
.glosario-tip-def   { display: block; color: #cbd5e1; }
.glosario-tip-src   { display: block; margin-top: 6px; color: #64748b; font-size: 10px; font-style: italic; }

/* Interruptor global: ocultar ayudas (clase en <html>) */
.ayudas-ocultas .glosario-term { border-bottom: none; cursor: inherit; }
.ayudas-ocultas .glosario-tip  { display: none !important; }

/* ─── Blazor error boundary ──────────────────────────────── */
.blazor-error-boundary {
  background: #fee2e2;
  padding: 1rem;
  color: #dc2626;
  border-radius: 6px;
}
.blazor-error-boundary::after {
  content: "Ocurrió un error. Recargue la página.";
}

/* ═══════════════════════════════════════════════════════════
   Login — Split panel
   ═══════════════════════════════════════════════════════════ */
.lp-wrap { display: flex; min-height: 100vh; }

.lp-brand {
  width: 42%;
  min-height: 100vh;
  background: #0f172a;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 44px;
  overflow: hidden;
  flex-shrink: 0;
}
.lp-brand::before {
  content: '';
  position: absolute;
  top: -140px; right: -140px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(14,165,233,0.18) 0%, transparent 68%);
  pointer-events: none;
}
.lp-brand::after {
  content: '';
  position: absolute;
  bottom: -100px; left: -80px;
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(99,102,241,0.14) 0%, transparent 68%);
  pointer-events: none;
}
.lp-brand-logo { position: relative; z-index: 1; }
.lp-logo-text { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; color: #ffffff; }
.lp-logo-text span { color: #38bdf8; }
.lp-logo-sub { font-size: 11px; color: #475569; margin-top: 4px; font-weight: 500; }
.lp-brand-center { position: relative; z-index: 1; }
.lp-headline { font-size: 30px; font-weight: 800; color: #ffffff; line-height: 1.2; letter-spacing: -0.5px; margin-bottom: 14px; }
.lp-headline span {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.lp-desc { font-size: 13px; color: #64748b; line-height: 1.65; max-width: 300px; }
.lp-features { list-style: none; margin-top: 32px; display: flex; flex-direction: column; gap: 14px; }
.lp-features li { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #94a3b8; }
.lp-feat-dot {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lp-feat-dot svg { width: 14px; height: 14px; }
.lp-feat-dot.sky     { background: rgba(14,165,233,0.15); color: #38bdf8; }
.lp-feat-dot.indigo  { background: rgba(99,102,241,0.15); color: #818cf8; }
.lp-feat-dot.emerald { background: rgba(16,185,129,0.15); color: #34d399; }
.lp-brand-foot { position: relative; z-index: 1; font-size: 11px; color: #334155; }

.lp-form { flex: 1; background: #f1f5f9; display: flex; align-items: center; justify-content: center; padding: 48px 40px; }
.lp-box { width: 100%; max-width: 400px; }
.lp-form-header { margin-bottom: 28px; }
.lp-step-lbl { font-size: 10px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.lp-form-title { font-size: 22px; font-weight: 700; color: #0f172a; letter-spacing: -0.3px; }
.lp-form-sub { font-size: 13px; color: #64748b; margin-top: 6px; }
.lp-form-foot { margin-top: 24px; font-size: 12px; color: #94a3b8; text-align: center; }

.field { margin-bottom: 16px; }
.field-lbl { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.field-ctrl { position: relative; display: flex; align-items: center; }
.field-pfx { position: absolute; left: 12px; color: #94a3b8; display: flex; pointer-events: none; }
.field-pfx svg { width: 16px; height: 16px; }
.field-inp {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #0f172a;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.field-inp:focus { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,0.12); }
.field-inp:disabled { opacity: 0.6; cursor: not-allowed; }
.field-valid { display: block; font-size: 12px; color: #dc2626; margin-top: 4px; }

.login-err {
  background: #fee2e2;
  border-left: 3px solid #dc2626;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: #dc2626;
  margin-bottom: 16px;
}
.login-btn {
  width: 100%;
  height: 44px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(14,165,233,0.4);
  transition: box-shadow 0.15s, transform 0.15s;
  font-family: 'Segoe UI', system-ui, sans-serif;
  margin-top: 8px;
}
.login-btn:hover:not(:disabled) { box-shadow: 0 6px 28px rgba(14,165,233,0.5); transform: translateY(-1px); }
.login-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }
.login-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
}
.login-sep::before,
.login-sep::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #dbe4ee;
}
.google-btn {
  width: 100%;
  height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #1f2937;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  transition: all 0.18s ease;
}
.google-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.google-btn:hover { border-color: #94a3b8; box-shadow: 0 6px 20px rgba(15,23,42,0.12); transform: translateY(-1px); color: #111827; }
.login-foot { text-align: center; font-size: 11px; color: #94a3b8; }

@media (max-width: 900px) {
  .lp-brand { display: none; }
  .lp-form  { background: #f1f5f9; padding: 32px 24px; }
}

/* ═══════════════════════════════════════════════════════════
   Tema oscuro
   ═══════════════════════════════════════════════════════════ */
html.app-dark {
  --bg:          #0f172a;
  --surface:     #1e293b;
  --surface-alt: #243044;
  --border-soft: #1e293b;
  --text-1:      #f1f5f9;
  --text-2:      #e2e8f0;
  --text-3:      #94a3b8;
  --text-4:      #64748b;
}

html.app-dark .card             { background: #1e293b; border-color: #334155; }
html.app-dark .card-header      { border-color: #334155; }
html.app-dark .card-title       { color: #f1f5f9; }
html.app-dark .page-title       { color: #f1f5f9; }
html.app-dark .page-subtitle    { color: #94a3b8; }

html.app-dark .app-table th {
  background: #1e293b;
  color: #64748b;
  border-bottom-color: #334155;
}
html.app-dark .app-table td     { color: #e2e8f0; border-bottom-color: #243044; }
html.app-dark .app-table tr:last-child td { border-bottom: none; }
html.app-dark .app-table tr:hover td { background: #243044; }

html.app-dark .btn-outline      { border-color: #334155; color: #94a3b8; background: transparent; }
html.app-dark .btn-outline:hover { background: #1e293b; color: #e2e8f0; }
html.app-dark .btn-secondary    { background: #243044; border-color: #334155; color: #e2e8f0; }
html.app-dark .btn-secondary:hover { background: #334155; }
html.app-dark .btn-ghost        { color: #94a3b8; }
html.app-dark .btn-ghost:hover  { background: #243044; color: #e2e8f0; }

/* Fondo tema claro: franja superior + dot grid */
.mud-main-content {
  background:
    linear-gradient(180deg, rgba(14,165,233,0.055) 0%, transparent 280px),
    radial-gradient(circle, #cbd5e1 1px, transparent 1px) !important;
  background-size: auto, 22px 22px !important;
  background-position: top left, 0 0 !important;
}

/* Fondo tema oscuro: glows + dot grid */
html.app-dark .mud-main-content {
  background:
    radial-gradient(ellipse at 92% 8%,  rgba(14,165,233,0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 8%  92%, rgba(99,102,241,0.07) 0%, transparent 50%),
    radial-gradient(circle, rgba(148,163,184,0.18) 1px, transparent 1px) !important;
  background-size: auto, auto, 22px 22px !important;
  background-position: top left, top left, 0 0 !important;
}

html.app-dark .kpi-card           { background: #1e293b; border-color: #334155; }
html.app-dark .kpi-label          { color: #64748b; }
html.app-dark .kpi-value          { color: #f1f5f9; }
html.app-dark .kpi-value.warning  { color: #fbbf24; }
html.app-dark .kpi-value.danger   { color: #f87171; }
html.app-dark .kpi-sub            { color: #64748b; }
html.app-dark .vista-switcher     { background: #0f172a; }
html.app-dark .vista-btn          { color: #64748b; }
html.app-dark .vista-btn:hover    { background: #1e293b; color: #f1f5f9; }
html.app-dark .vista-btn-active   { background: #1e293b !important; color: #f1f5f9 !important; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
html.app-dark .kpi-skeleton       { background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%); background-size: 200% 100%; }
html.app-dark .kpi-badge.green  { background: rgba(22,163,74,0.15);  color: #4ade80; }
html.app-dark .kpi-badge.red    { background: rgba(220,38,38,0.15);  color: #f87171; }
html.app-dark .kpi-badge.yellow { background: rgba(202,138,4,0.15);  color: #fbbf24; }
html.app-dark .kpi-badge.blue   { background: rgba(37,99,235,0.15);  color: #60a5fa; }

html.app-dark .status-verde    { background: rgba(22,163,74,0.15);  color: #4ade80; }
html.app-dark .status-amarillo { background: rgba(202,138,4,0.15);  color: #fbbf24; }
html.app-dark .status-naranja  { background: rgba(234,88,12,0.15);  color: #fb923c; }
html.app-dark .status-rojo     { background: rgba(220,38,38,0.15);  color: #f87171; }
html.app-dark .status-azul     { background: rgba(37,99,235,0.15);  color: #60a5fa; }
html.app-dark .status-gris     { background: rgba(100,116,139,0.15);color: #94a3b8; }
html.app-dark .status-verde::before    { background: #4ade80; }
html.app-dark .status-amarillo::before { background: #fbbf24; }
html.app-dark .status-naranja::before  { background: #fb923c; }
html.app-dark .status-rojo::before     { background: #f87171; }
html.app-dark .status-azul::before     { background: #60a5fa; }
html.app-dark .status-gris::before     { background: #94a3b8; }

html.app-dark .lp-form { background: #0a0f1e; }

html.app-dark .form-input          { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.app-dark .form-input:focus    { border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14,165,233,0.15); }
html.app-dark .form-input:disabled { background: #0f172a; color: #475569; }
html.app-dark .form-label          { color: #94a3b8; }
html.app-dark .form-section-title  { color: #64748b; border-color: #1e293b; }
html.app-dark .form-check          { background: #1e293b; border-color: #334155; }
html.app-dark .form-check-label    { color: #cbd5e1; }

/* ── Markdown rendered content ──────────────────────────────────── */
.md { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.md h1, .md h2, .md h3, .md h4 { color: var(--text-1); font-weight: 700; margin: 12px 0 6px; }
.md h1 { font-size: 16px; } .md h2 { font-size: 15px; } .md h3, .md h4 { font-size: 13px; }
.md p  { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md li { margin-bottom: 2px; }
.md strong { font-weight: 700; color: var(--text-1); }
.md em     { font-style: italic; }
.md code   { font-family: monospace; font-size: 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; }
.md pre    { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; overflow-x: auto; margin: 0 0 8px; }
.md pre code { background: none; border: none; padding: 0; }
.md table  { width: 100%; border-collapse: collapse; margin: 0 0 10px; font-size: 12px; }
.md th     { background: var(--surface-alt); font-weight: 700; color: var(--text-1); text-align: left; padding: 6px 10px; border: 1px solid var(--border); }
.md td     { padding: 5px 10px; border: 1px solid var(--border); color: var(--text-2); }
.md tr:nth-child(even) td { background: var(--surface-alt); }
.md blockquote { border-left: 3px solid var(--border); margin: 0 0 8px; padding: 4px 12px; color: var(--text-3); font-style: italic; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
html.app-dark .md th { background: #1e293b; }
html.app-dark .md tr:nth-child(even) td { background: #1e293b; }

/* ── Dimension tabs (Riesgo Empresarial 360°) ───────────────────── */
.dim-tabs { display:flex; gap:0; border-bottom:1px solid var(--border); padding:0 20px; flex-shrink:0; overflow-x:auto; }
.dim-tab  { padding:10px 16px; font-size:13px; background:none; border:none; border-bottom:2px solid transparent; margin-bottom:-1px; color:var(--text-3); cursor:pointer; font-weight:500; white-space:nowrap; display:flex; align-items:center; gap:6px; transition:color .15s; }
.dim-tab:hover:not(:disabled) { color:var(--text-1); }
.dim-tab:disabled  { opacity:.45; cursor:default; }
.dim-tab-active    { color:#0ea5e9 !important; border-bottom-color:#0ea5e9 !important; font-weight:600; }
.dim-soon          { font-size:10px; background:rgba(100,116,139,.14); color:#64748b; border-radius:4px; padding:1px 6px; font-weight:500; }
.dim-score         { font-size:10px; border-radius:4px; padding:1px 6px; font-weight:700; }

/* Tooltip sobre scores en la tabla */
.score-tip { position:relative; cursor:help; }
.score-tip[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #e2e8f0;
    padding: 7px 11px;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 400;
    white-space: pre;
    z-index: 300;
    min-width: 200px;
    max-width: 300px;
    line-height: 1.6;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    pointer-events: none;
}
.score-tip[data-tip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
    z-index: 300;
    pointer-events: none;
}
html.app-dark .dim-tab { color:#475569; }
html.app-dark .dim-tab:hover:not(:disabled) { color:#e2e8f0; }
html.app-dark .dim-soon { background:rgba(100,116,139,.25); color:#94a3b8; }
