/* ================================
 * RISKNET — Enterprise Console v7
 * (REDISEÑO MODERNO E IMPACTANTE)
 * ================================ */

/* -------------------------------
 * MEJORA: Paleta de color "Tech Premium"
 * Inspirada en el VID, pero no literal.
 * ------------------------------- */
:root {
  --app-bg: #f6f9ff;
  --app-bg-alt: #eef3ff;
  --content-max-width: 1400px;

  --brand-primary: #3b82f6;
  --brand-secondary: #6366f1;
  --brand-tertiary: #8b5cf6;
  --brand-ink: #1f2a44;

  --brand-accent: #3b82f6;
  --brand-accent-strong: #2563eb;
  --brand-accent-hover: #4f8fff;
  --brand-purple-dark: #1f2a44;
  --brand-purple-surface: rgba(91, 112, 255, 0.1);
  --risknet-blue: #2563eb;

  --text-primary: #1c2140;
  --text-secondary: rgba(28, 33, 64, 0.7);
  --text-tertiary: rgba(28, 33, 64, 0.5);
  --muted-line: rgba(120, 134, 200, 0.18);

  --surface-card: #ffffff;
  --surface-card-solid: #ffffff;
  --surface-deep: rgba(255, 255, 255, 0.85);
  --surface-glass: rgba(255, 255, 255, 0.68);
  --surface-alt: rgba(255, 255, 255, 0.75);

  --border-strong: rgba(111, 136, 255, 0.35);
  --border-soft: rgba(111, 140, 255, 0.18);
  --border-color: rgba(204, 214, 248, 0.9);
  --shadow-ambient: rgba(15, 23, 42, 0.12);
  --shadow-elevated: 0 26px 48px -18px rgba(79, 114, 205, 0.25);
  --shadow-color: rgba(79, 114, 205, 0.14);

  --gradient-hero: radial-gradient(circle at 0% -20%, rgba(99, 102, 241, 0.18), transparent 55%),
                   radial-gradient(circle at 80% 0%, rgba(59, 130, 246, 0.18), transparent 60%),
                   linear-gradient(160deg, #f8fbff, #ecf2ff 62%, #e0e9ff 100%);

  --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(59, 130, 246, 0.14));
  --gradient-card-hover: linear-gradient(135deg, rgba(99, 102, 241, 0.24), rgba(59, 130, 246, 0.2));
  --gradient-kpi: linear-gradient(140deg, rgba(99, 102, 241, 0.15), rgba(59, 130, 246, 0.08));

  --glass-blur: 22px;
  --glass-border: 1px solid rgba(199, 211, 255, 0.65);

  --card-radius: 20px;
  --card-radius-sm: 16px;

  --risk-low: #22c55e;
  --risk-medium: #fbbf24;
  --risk-high: #ef4444;
  --risk-unknown: #94a3b8;
  --risk-ok: var(--risk-low);
  --risk-warn: var(--risk-medium);
  --risk-bad: var(--risk-high);

  --font-sans-primary: 'Inter', 'Nunito Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans-alt: 'Nunito Sans', 'Inter', 'Segoe UI', sans-serif;

  --fs-display: clamp(2.6rem, 4.5vw, 3.6rem);
  --fs-title: clamp(1.8rem, 3vw, 2.4rem);
  --fs-subtitle: clamp(1.05rem, 1.6vw, 1.3rem);
  --fs-body: 1rem;
  --fs-body-sm: 0.92rem;
  --fs-micro: 0.72rem;

  --tracking-micro: 0.24em;
  --tracking-tight: -0.02em;

  --transition-snappy: 0.26s ease;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  padding: 0;
  color: var(--text-primary);
  font-family: var(--font-sans-primary);
  background: var(--gradient-hero);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: '';
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(160px);
  opacity: 0.45;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background: rgba(99, 102, 241, 0.25);
  top: -200px;
  left: -140px;
}

body::after {
  background: rgba(59, 130, 246, 0.22);
  bottom: -220px;
  right: -160px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 255, 0.35);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}

.app-shell {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 2.5rem;
  padding: clamp(2rem, 4vw, 3rem);
  box-sizing: border-box;
}

/* -------------------------------
 * SIDEBAR (MEJORADO)
 * ------------------------------- */
.sidebar {
  width: 240px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid rgba(199, 211, 255, 0.5);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.2rem 1.8rem;
  transition: width 0.25s ease, opacity 0.25s ease;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: 6px 0 22px rgba(79, 114, 205, 0.08);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(204, 214, 248, 0.65);
  margin-bottom: 1.4rem;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--brand-accent);
}

.logo-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.logo-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--brand-purple-dark);
}

.logo-sub {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(31, 42, 68, 0.45);
}

.sidebar-toggle {
  background: rgba(141, 116, 255, 0.18);
  border: none;
  color: var(--brand-purple-dark);
  border-radius: 6px;
  cursor: pointer;
  margin-left: auto;
  padding: 4px;
  transition: transform 0.3s ease, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle:hover {
  background: rgba(109, 75, 255, 0.28);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nav-caption {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(28, 33, 64, 0.45);
  margin: 0.4rem 0 0.2rem 0;
}

.nav-divider {
  height: 1px;
  background: rgba(204, 214, 248, 0.6);
  margin: 1.2rem 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: rgba(28, 33, 64, 0.65);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  color: rgba(59, 130, 246, 0.65);
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--brand-purple-dark);
}

.nav-item.active {
  background: linear-gradient(120deg, rgba(99, 102, 241, 0.18), rgba(59, 130, 246, 0.18));
  box-shadow: 0 12px 24px rgba(79, 114, 205, 0.12);
  color: var(--brand-purple-dark);
}

.nav-item.active .nav-icon svg {
  color: var(--brand-accent);
}

.promo-card {
  margin-top: auto;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(59, 130, 246, 0.08));
  border-radius: 18px;
  padding: 1.2rem;
  display: grid;
  gap: 0.6rem;
  color: var(--text-secondary);
  box-shadow: 0 18px 34px rgba(79, 114, 205, 0.14);
}

.promo-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--brand-purple-dark);
}

.promo-copy {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
}

.promo-action {
  justify-self: start;
  background: rgba(59, 130, 246, 0.12);
  color: var(--brand-accent);
  border-radius: 12px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  border: none;
}

.promo-action:hover {
  background: rgba(59, 130, 246, 0.2);
}

/* -------------------------------
 * LAYOUT: CONTENIDO Y COLAPSO
 * ------------------------------- */

.content {
  flex: 1;
  margin-left: 240px;
  padding: clamp(2rem, 4vw, 3rem);
  transition: margin-left 0.25s ease;
}

body.sidebar-collapsed .sidebar {
  width: 84px;
}

body.sidebar-collapsed .content {
  margin-left: 84px;
}

body.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
  margin: 0 auto;
}

body.sidebar-collapsed .logo-area {
  justify-content: center;
}

body.sidebar-collapsed .logo {
  margin: 0;
}

body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .logo-text {
  opacity: 0;
  width: 0;
  margin-left: 0;
  pointer-events: none;
}

body.sidebar-collapsed .nav-item:hover::after {
  opacity: 1;
}

body.sidebar-collapsed footer {
  margin-left: 68px;
}

/* -------------------------------
 * HEADER
 * ------------------------------- */
.app-hero {
  background: rgba(255, 255, 255, 0.86);
  border-radius: 28px;
  padding: clamp(1.8rem, 4vw, 2.6rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: center;
  box-shadow: 0 28px 58px -24px rgba(79, 114, 205, 0.2);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.hero-headline h1 {
  margin: 0 0 0.8rem 0;
  font-size: var(--fs-title);
  font-weight: 700;
  color: var(--brand-purple-dark);
  letter-spacing: -0.01em;
}

.hero-headline p {
  margin: 0 0 1.4rem 0;
  color: var(--text-secondary);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-actions .primary {
  background: linear-gradient(120deg, var(--brand-primary), var(--brand-secondary));
  color: #fff;
  padding: 0.85rem 1.7rem;
  border-radius: 14px;
  font-weight: 600;
  box-shadow: 0 16px 28px rgba(99, 102, 241, 0.26);
}

.hero-actions .secondary {
  border-radius: 14px;
  padding: 0.85rem 1.5rem;
  color: var(--brand-accent);
  border: 1px solid rgba(59, 130, 246, 0.28);
}

.hero-kpis {
  display: grid;
  gap: 0.9rem;
  min-width: 240px;
}

.hero-chip {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(99, 102, 241, 0.16);
  display: grid;
  gap: 0.2rem;
  box-shadow: 0 18px 34px rgba(149, 156, 255, 0.16);
}

.hero-chip span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(28, 33, 64, 0.55);
}

.hero-chip strong {
  font-size: 1.8rem;
  color: var(--brand-purple-dark);
}

.hero-chip.status strong {
  font-size: 1rem;
  color: var(--brand-accent);
}

/* -------------------------------
 * ENV BANNER
 * ------------------------------- */
.env-banner {
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
  display: inline-block;
}
.env-banner.success { background: rgba(76, 175, 80, 0.15); color: var(--risk-ok); }
.env-banner.warn { background: rgba(255, 193, 7, 0.15); color: var(--risk-warn); }
.env-banner.info { background: rgba(3, 169, 244, 0.15); color: #03A9F4; }


/* -------------------------------
 * CARDS & GRID (MEJORADO)
 * ------------------------------- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 10px 24px var(--shadow-color);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  margin-bottom: 1rem;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(109, 75, 255, 0.12);
}

.card h3 {
  color: var(--text-primary);
  font-size: 1.45rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(104, 82, 186, 0.2);
  padding-bottom: 0.8rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-head h3 {
  border: none;
  padding: 0;
  margin-bottom: 0;
}
.help-tip {
  background: rgba(109, 75, 255, 0.12);
  color: var(--brand-purple-dark);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: help;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
}

.card-decision .decision-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.decision-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.decision-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.decision-badge.ok { background: rgba(76, 175, 80, 0.25); color: var(--risk-ok); }
.decision-badge.warn { background: rgba(255, 193, 7, 0.25); color: var(--risk-warn); }
.decision-badge.bad { background: rgba(244, 67, 54, 0.25); color: var(--risk-bad); }

.decision-status {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.decision-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.decision-columns h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--brand-accent);
  font-size: 1rem;
}

.decision-list {
  list-style: disc;
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-secondary);
}
.decision-list li { margin-bottom: 0.4rem; }

.history-badge,
.severity-badge,
.decision-badge,
.portal-table span.history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.severity-ok { background: rgba(76, 175, 80, 0.2); color: var(--risk-ok); }
.severity-warn { background: rgba(255, 193, 7, 0.2); color: var(--risk-warn); }
.severity-bad { background: rgba(244, 67, 54, 0.2); color: var(--risk-bad); }

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
  align-items: stretch;
}

.portal-hero {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.portal-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.kpi-item {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(236, 230, 255, 0.75));
  border-radius: 12px;
  padding: 0.95rem 1.2rem;
  border: 1px solid rgba(104, 82, 186, 0.18);
  box-shadow: 0 10px 22px rgba(109, 75, 255, 0.08);
}

.kpi-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

#heatmap {
  position: relative;
  height: 260px;
  border-radius: 16px;
  border: 1px solid rgba(104, 82, 186, 0.18);
  background: linear-gradient(135deg, rgba(141, 116, 255, 0.25), rgba(246, 245, 255, 0.9));
  overflow: hidden;
}

.heatmap-points {
  position: absolute;
  inset: 0;
}

.heatmap-point {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.9;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
}
.heatmap-point.dot-low { background: rgba(76, 175, 80, 0.8); }
.heatmap-point.dot-mid { background: rgba(255, 193, 7, 0.8); }
.heatmap-point.dot-high { background: rgba(244, 67, 54, 0.85); }

.heatmap-legend {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 0.8rem;
  background: rgba(255, 255, 255, 0.82);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.heatmap-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.3rem;
}
.heatmap-legend .dot-low { background: rgba(76, 175, 80, 0.8); }
.heatmap-legend .dot-mid { background: rgba(255, 193, 7, 0.8); }
.heatmap-legend .dot-high { background: rgba(244, 67, 54, 0.85); }

.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.portal-table thead {
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.portal-table th,
.portal-table td {
  border-bottom: 1px solid rgba(104, 82, 186, 0.16);
  padding: 0.65rem 0.5rem;
}
.portal-table tr:last-child td { border-bottom: none; }

.portal-keys .signal-toggle-panel {
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.85);
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid rgba(104, 82, 186, 0.18);
}


.toggle-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem 1rem;
  align-items: center;
}

/* -------------------------------
 * CONFIG SIDE PANEL
 * ------------------------------- */
.config-overlay {
  position: fixed;
  inset: 0;
  background: rgba(109, 75, 255, 0.18);
  z-index: 190;
  transition: opacity 0.25s ease;
}

.config-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.config-panel {
  position: fixed;
  top: 0;
  right: -520px;
  width: min(520px, 96vw);
  height: 100vh;
  background: var(--surface-card);
  border-left: 1px solid rgba(104, 82, 186, 0.2);
  box-shadow: -18px 0 30px rgba(109, 75, 255, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: right 0.3s ease;
  outline: none;
}

.config-panel.open {
  right: 0;
}

.config-panel__header,
.config-panel__footer {
  padding: 1.2rem 1.6rem;
  border-bottom: 1px solid rgba(104, 82, 186, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(243, 237, 255, 0.6);
}

.config-panel__header h3 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--text-primary);
}

.config-panel__body {
  padding: 1.6rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  background: rgba(255, 255, 255, 0.65);
}

.config-panel__body p {
  margin: 0;
  color: var(--text-secondary);
}

.config-panel__footer {
  border-bottom: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  justify-content: flex-end;
}

body.no-scroll {
  overflow: hidden;
}

/* -------------------------------
 * CORRELATION RULES CONFIG
 * ------------------------------- */
.correlation-section {
  margin-top: 2rem;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(104, 82, 186, 0.18);
  border-radius: 14px;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

.correlation-header h4 {
  margin: 0 0 0.3rem 0;
  color: var(--brand-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.correlation-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.rule-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(104, 82, 186, 0.2);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 12px 24px rgba(109, 75, 255, 0.08);
}

.rule-card.rule-unavailable {
  opacity: 0.55;
}

.rule-card.rule-unavailable .rule-missing {
  color: var(--risk-warn);
  font-size: 0.85rem;
}

.rule-card[data-status="applied"] {
  border-color: rgba(76, 175, 80, 0.45);
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.18);
}

.rule-card[data-status="not_triggered"],
.rule-card[data-status="disabled"] {
  border-color: rgba(255, 193, 7, 0.28);
}

.rule-card[data-status="unavailable"] {
  border-color: rgba(244, 67, 54, 0.35);
}

.rule-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.rule-head strong {
  font-size: 1rem;
  color: var(--text-primary);
}

.rule-severity {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.severity-critical { background: rgba(244, 67, 54, 0.15); color: var(--risk-bad); }
.severity-high     { background: rgba(255, 152, 0, 0.15); color: var(--risk-warn); }
.severity-medium   { background: rgba(33, 150, 243, 0.18); color: #5fb0ff; }
.severity-info     { background: rgba(103, 58, 183, 0.22); color: #b19cd9; }

.rule-desc,
.rule-signals,
.rule-status {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-secondary);
}

.rule-status {
  border-top: 1px solid rgba(104, 82, 186, 0.16);
  padding-top: 0.6rem;
}

.rule-status-applied { color: var(--risk-ok); }
.rule-status-not_triggered { color: var(--text-secondary); }
.rule-status-disabled { color: rgba(255, 255, 255, 0.5); }
.rule-status-unavailable { color: var(--risk-bad); }

.rule-missing {
  display: block;
  font-size: 0.78rem;
  margin-top: 0.3rem;
}

.correlationChk:disabled + span {
  opacity: 0.3;
}

/* -------------------------------
 * GAUGE (MEJORADO)
 * ------------------------------- */
#gaugeContainer {
  position: relative;
  width: 260px;
  height: 130px;
  margin: 1.5rem auto 0.5rem auto;
}

.gauge-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: conic-gradient(
    from 270deg at 50% 100%,
    var(--risk-ok) 0deg 60deg,
    var(--risk-warn) 60deg 120deg,
    var(--risk-bad) 120deg 180deg,
    transparent 180deg 360deg
  );
  border-radius: 130px 130px 0 0;
}

.gauge-needle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 4px;
  height: 110px;
  background: #e4e7ec;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(-90deg);
  transition: transform 0.8s ease-out;
  z-index: 3;
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.gauge-cover {
  position: absolute;
  top: 25px;
  left: 25px;
  width: 210px;
  height: 105px;
  background: var(--brand-purple-surface);
  border-radius: 105px 105px 0 0;
  z-index: 2;
  display: flex;
  justify-content: center;
}

.score-badge {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  position: absolute;
  bottom: 10px;
  line-height: 1;
}

/* -------------------------------
 * RISK LEVEL
 * ------------------------------- */
.risk-level {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  margin-top: 1rem;
  text-transform: uppercase;
}

.risk-level.ok { color: var(--risk-ok); }
.risk-level.warn { color: var(--risk-warn); }
.risk-level.bad { color: var(--risk-bad); }

/* -------------------------------
 * ABOUT VIEW
 * ------------------------------- */
.view {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

.view.active {
  display: block;
}

.about-banner, .about-panel {
  max-width: 960px;
  margin: 2rem auto;
  background: var(--brand-purple-surface);
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
}
.about-banner { margin-top: 0; }
.about-panel h2 { color: var(--brand-accent); }
.about-panel p { color: var(--text-secondary); line-height: 1.6; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------
 * SKELETON LOADER
 * ------------------------------- */
@keyframes pulse {
  0% { background-position: 100% 50%; }
  100% { background-position: -100% 50%; }
}

.card.loading {
  position: relative;
  overflow: hidden;
}

.card.loading::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  background-size: 200% 100%;
  animation: pulse 1.5s infinite linear;
  z-index: 10;
}

.card.loading > * {
  opacity: 0.2;
}

/* -------------------------------
 * FORMULARIOS (MEJORADO)
 * ------------------------------- */
.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-row label {
  font-weight: 600;
  color: var(--brand-accent);
  width: 80px;
  flex-shrink: 0;
  padding-top: 0.8rem;
}
.form-row input {
  flex: 1;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(104, 82, 186, 0.2);
  color: var(--text-primary);
  padding: 0.9rem 1.2rem;
  border-radius: 10px;
  transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.form-row input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(109, 75, 255, 0.2);
  background: #fff;
}

.actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: 1rem;
}

/* -------------------------------
 * BOTONES (MEJORADO)
 * ------------------------------- */
button {
  background: var(--brand-accent);
  color: var(--brand-purple-dark);
  border: none;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s, box-shadow 0.3s, transform 0.2s;
  box-shadow: 0px 3px 1px -2px rgba(0,0,0,0.2), 
              0px 2px 2px 0px rgba(0,0,0,0.14), 
              0px 1px 5px 0px rgba(0,0,0,0.12);
  text-transform: uppercase;
}
button:hover {
  background: var(--brand-accent-hover);
  box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.2), 
              0px 4px 5px 0px rgba(0,0,0,0.14), 
              0px 1px 10px 0px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}
button:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.38);
  box-shadow: none;
  cursor: not-allowed;
  transform: translateY(0);
}
button.ghost {
  background: transparent;
  color: var(--brand-accent);
  border: 1px solid var(--brand-accent);
  box-shadow: none;
}
button.ghost:hover {
  background: rgba(200, 159, 255, 0.1);
  color: var(--brand-accent);
  border-color: var(--brand-accent);
  box-shadow: none;
}

/* -------------------------------
 * SPINNER & MSG (MEJORADO)
 * ------------------------------- */
.spinner { display: inline-flex; gap: 4px; }
.spinner .dot {
  width: 8px; height: 8px; background: var(--risknet-light-blue); border-radius: 50%;
  animation: bounce 0.6s infinite alternate;
}
.spinner .dot:nth-child(2) { animation-delay: 0.2s; }
.spinner .dot:nth-child(3) { animation-delay: 0.4s; }
.hidden { display: none; }
@keyframes bounce { to { opacity: 0.3; transform: translateY(-3px); } }

.msg {
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  margin: 1rem 0;
  font-weight: 600;
}
.msg.success { background: rgba(76, 175, 80, 0.15); color: var(--risk-ok); }
.msg.error { background: rgba(244, 67, 54, 0.15); color: var(--risk-bad); }

/* -------------------------------
 * LISTA DE SEÑALES (MEJORADO)
 * ------------------------------- */
.signals {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.signals li {
  background: rgba(255, 255, 255, 0.85);
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border-left: 3px solid transparent;
  font-family: monospace;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  box-shadow: 0 8px 18px rgba(109, 75, 255, 0.08);
}
.signals li.ok { border-color: var(--risk-ok); }
.signals li.warn { border-color: var(--risk-warn); }
.signals li.bad { border-color: var(--risk-bad); }
.signals li strong { color: var(--brand-accent); }

.signals li .signal-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.signals li .signal-pre {
  margin: 0;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  background: rgba(243, 237, 255, 0.9);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

/* -------------------------------
 * TRACE / JSON (MEJORADO)
 * ------------------------------- */
.trace, .json {
  background: rgba(243, 237, 255, 0.85);
  border-radius: 10px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.86rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  color: var(--text-primary);
}
.json.code { background: rgba(230, 223, 255, 0.95); }

/* -------------------------------
 * MODAL (MEJORADO)
 * ------------------------------- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(109, 75, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 1;
  transition: opacity 0.2s ease;
}
.modal.hidden {
  opacity: 0;
  pointer-events: none;
}
.modal-dialog {
  background: var(--surface-card);
  border: 1px solid rgba(104, 82, 186, 0.2);
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(109, 75, 255, 0.16);
  width: 90%;
  max-width: 700px;
  animation: fadeIn 0.2s ease-out;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { margin: 0; color: var(--text-primary); }
.modal-header .icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 2rem;
  font-weight: 300;
  padding: 0;
  cursor: pointer;
}
.tabpanes { padding: 1.5rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(243, 237, 255, 0.7);
  border-top: 1px solid rgba(104, 82, 186, 0.18);
  border-radius: 0 0 12px 12px;
}
.note {
  background: rgba(141, 116, 255, 0.12);
  border-left: 4px solid var(--brand-accent);
  padding: 0.85rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
}
.signals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}
.sig-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(104, 82, 186, 0.18);
  padding: 1.1rem;
  border-radius: 12px;
  box-shadow: 0 12px 22px rgba(109, 75, 255, 0.07);
}
.sig-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.sig-head strong { color: var(--text-primary); }
.sig-card label { font-size: 0.8rem; color: var(--text-secondary); }
input[type="range"] { width: 100%; cursor: pointer; }

/* Switch Toggle (MEJORADO) */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.38); transition: .4s; border-radius: 24px;
}
.switch span:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
  background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + span { background-color: var(--brand-accent); }
input:checked + span:before { transform: translateX(20px); }

.preview-section { margin-top: 1.5rem; }

/* -------------------------------
 * FOOTER & RESPONSIVIDAD
 * ------------------------------- */
footer {
  text-align: center;
  font-size: 0.82rem;
  color: rgba(30, 21, 69, 0.6);
  padding: 1rem;
  margin-left: 200px;
  transition: margin-left 0.25s ease;
}

@media (max-width: 768px) {
  body.sidebar-collapsed .content { margin-left: 0; }
  .content { margin-left: 0; }
  
  footer {
    margin-left: 0;
  }
  body.sidebar-collapsed footer {
    margin-left: 0;
  }
  
  .sidebar {
    width: 200px;
    transform: translateX(-100%);
    opacity: 1;
  }
  body.sidebar-collapsed .sidebar {
      transform: translateX(-100%);
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .app-header h1 { font-size: 1.4rem; }
  .env-banner { margin-bottom: 0.5rem; }
  .grid { grid-template-columns: 1fr; }
  .signals-grid { grid-template-columns: 1fr; }
}

/* -------------------------------
 * LISTAS Y BOTONES (MEJORADO)
 * ------------------------------- */
.features-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.features-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.features-list li:last-child {
  border: none;
}

.card.centered {
  text-align: center;
}

.btn-docs, .btn-demo {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  margin: 0.3rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: 0.3s;
  text-transform: uppercase;
}

.btn-docs {
  background: var(--brand-accent);
  color: var(--brand-purple-dark);
}

.btn-docs:hover {
  background: var(--brand-accent-hover);
}

.btn-demo.ghost {
  border: 1px solid var(--brand-accent);
  color: var(--brand-accent);
}

.btn-demo.ghost:hover {
  background: rgba(200, 159, 255, 0.1);
  color: var(--brand-accent);
}


/* =========================================
 * CLASES DE MATERIAL DESIGN
 * ========================================= */

.md-typography--headline6 { font-size: 1.25rem; font-weight: 500; line-height: 2rem; letter-spacing: 0.0075em; }
.md-typography--subtitle1 { font-size: 1rem; font-weight: 500; line-height: 1.75rem; letter-spacing: 0.009375em; }
.md-typography--body1 { font-size: 1rem; font-weight: 400; line-height: 1.5rem; letter-spacing: 0.03125em; }
.md-typography--caption { font-size: 0.75rem; font-weight: 400; line-height: 1rem; letter-spacing: 0.0333333333em; }

.md-elevation--z1 { box-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12); }
.md-elevation--z2 { box-shadow: 0px 3px 1px -2px rgba(0,0,0,0.2), 0px 2px 2px 0px rgba(0,0,0,0.14), 0px 1px 5px 0px rgba(0,0,0,0.12); }
.md-elevation--z4 { box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.2), 0px 4px 5px 0px rgba(0,0,0,0.14), 0px 1px 10px 0px rgba(0,0,0,0.12); }
.md-elevation--z8 { box-shadow: 0px 5px 5px -3px rgba(0,0,0,0.2), 0px 8px 10px 1px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12); }


/* =========================================
 * ARQUITECTURA ANIMADA (FLUJO BIDIRECCIONAL)
 * ========================================= */

.explanation-text {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 900px;
}

.architecture-diagram-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 3rem;
  position: relative;
  min-height: 200px;
  overflow: hidden;
}

.arch-node-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.arch-node {
  background: var(--brand-purple-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.2rem 1.0rem;
  text-align: center;
  width: 170px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  transition: transform 0.3s ease-in-out;
  position: relative;
  animation: nodePulse 8s infinite ease-in-out;
}

.arch-node:hover {
  transform: translateY(-5px) scale(1.02);
}

.node-icon {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  line-height: 1;
  color: var(--brand-accent);
}

.arch-node h4 {
  margin: 0;
  color: var(--brand-accent);
  font-weight: 500;
  font-size: 0.9rem;
}

.arch-node p, .arch-node .features-list-inline {
  color: var(--text-secondary);
  margin-top: 0.5rem;
  margin-bottom: 0;
  line-height: 1.4;
  font-size: 0.7rem;
}

.features-list-inline {
  list-style: none;
  padding: 0;
  margin-top: 0.5rem;
}
.features-list-inline li {
  display: inline-block;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  margin: 0.15rem;
  color: var(--text-secondary);
  border-bottom: none; 
}

/* --- PAR DE FLECHAS (IDA Y VUELTA) --- */
.arch-arrow-pair {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  width: 100px;
  margin: 0 0.5rem;
}

.arch-arrow-container {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
  height: 2px;
}

.arch-arrow-container.response {
  flex-direction: row-reverse;
}

.arch-arrow-line {
  flex-grow: 1;
  height: 2px;
  border-radius: 1px;
}

.arch-arrow-head {
  width: 0;
  height: 0;
  border-style: solid;
}

/* Flecha de Request (Ida ->) - Color: --risknet-blue (#3c00a0) */
.arch-arrow-line.request {
  background-color: var(--risknet-blue);
}
.arch-arrow-head.request {
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent var(--risknet-blue);
}

/* Flecha de Response (Vuelta <-) - Color: --risk-ok (Verde) */
.arch-arrow-line.response {
  background-color: var(--risk-ok);
}
.arch-arrow-head.response {
  border-width: 6px 10px 6px 0;
  border-color: transparent var(--risk-ok) transparent transparent;
}

/* --- PAQUETE DE DATOS ANIMADO --- */
.data-packet {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  opacity: 0;
  animation-duration: 8s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

.request-packet {
  background-color: var(--risknet-blue);
  box-shadow: 0 0 8px var(--risknet-blue);
  animation-name: flowRequest;
  left: 0;
}

.response-packet {
  background-color: var(--risk-ok);
  box-shadow: 0 0 8px var(--risk-ok);
  animation-name: flowResponse;
  right: 0;
}

/* Keyframes para el flujo de Request (Ida: Izq -> Der) */
@keyframes flowRequest {
  0%   { left: 0%; opacity: 0; transform: scale(0.5); }
  5%   { left: 0%; opacity: 1; transform: scale(1); }
  20%  { left: calc(100% - 18px); opacity: 1; transform: scale(1); }
  25%  { left: calc(100% - 18px); opacity: 0; transform: scale(0.5); }
  100% { left: calc(100% - 18px); opacity: 0; }
}

/* Keyframes para el flujo de Response (Vuelta: Der -> Izq) */
@keyframes flowResponse {
  0%   { right: 0%; opacity: 0; transform: scale(0.5); }
  5%   { right: 0%; opacity: 1; transform: scale(1); }
  20%  { right: calc(100% - 18px); opacity: 1; transform: scale(1); }
  25%  { right: calc(100% - 18px); opacity: 0; transform: scale(0.5); }
  100% { right: calc(100% - 18px); opacity: 0; }
}

/* Sincronización y Retrasos (Ciclo de 8s) */
#packet-req-1 { animation-delay: 0s; }    /* User -> Bank */
#packet-req-2 { animation-delay: 1s; }    /* Bank -> Engine */
#packet-req-3 { animation-delay: 2s; }    /* Engine -> Telco */

#packet-res-1 { animation-delay: 3.5s; }  /* Telco -> Engine */
#packet-res-2 { animation-delay: 4.5s; }  /* Engine -> Bank */
#packet-res-3 { animation-delay: 5.5s; }  /* Bank -> User */

/* Animación de pulso de los nodos, coordinada */
@keyframes nodePulse {
  0%, 100% { transform: scale(1); }
  5%  { transform: scale(1.03); } /* Pulso 1 */
  10% { transform: scale(1); }
  70% { transform: scale(1); }
  75% { transform: scale(1.03); } /* Pulso 2 (respuesta) */
  80% { transform: scale(1); }
}

#arch-user   { animation-delay: 0s; }
#arch-bank   { animation-delay: 1s; }
#arch-engine { animation-delay: 2s; }
#arch-telco  { animation-delay: 3s; }


/* --- RESPONSIVIDAD DEL DIAGRAMA --- */
@media (max-width: 1200px) {
  .architecture-diagram-container {
    gap: 0.2rem;
  }
  .arch-node {
    width: 150px;
    min-height: 110px;
    padding: 0.8rem;
  }
  .arch-arrow-pair {
    width: 80px;
  }
  .node-icon { font-size: 2rem; }
  .arch-node h4 { font-size: 0.85rem; }
}

@media (max-width: 992px) { /* Tablets y móviles */
  .architecture-diagram-container {
    flex-direction: column; /* Apila todo verticalmente */
    gap: 0.5rem;
  }
  .arch-node-wrapper {
    width: 90%; /* Nodos ocupan más ancho */
  }
  .arch-node {
    width: 250px;
    min-height: 120px;
  }
  
  /* Los pares de flechas ahora son horizontales (para apilar flechas verticales) */
  .arch-arrow-pair {
    flex-direction: row; /* Flecha de ida al lado de la de vuelta */
    width: 60px; /* Ancho para dos flechas */
    height: 80px; /* Longitud vertical */
    gap: 20px;
    margin: 0.5rem 0;
  }
  
  /* Cada flecha individual es vertical */
  .arch-arrow-container {
    flex-direction: column;
    width: 2px;
    height: 100%;
  }
  .arch-arrow-container.response {
    flex-direction: column-reverse; /* Invierte para apuntar hacia arriba */
  }

  /* Punta de flecha de Request (Ida: Abajo) */
  .arch-arrow-head.request {
    border-width: 10px 6px 0 6px;
    border-color: var(--risknet-blue) transparent transparent transparent;
  }
  /* Punta de flecha de Response (Vuelta: Arriba) */
  .arch-arrow-head.response {
    border-width: 0 6px 10px 6px;
    border-color: transparent transparent var(--risk-ok) transparent;
  }

  /* Keyframes verticales para Request (Arriba -> Abajo) */
  @keyframes flowRequest {
    0%   { top: 0%; opacity: 0; transform: scale(0.5); }
    5%   { top: 0%; opacity: 1; transform: scale(1); }
    20%  { top: calc(100% - 18px); opacity: 1; transform: scale(1); }
    25%  { top: calc(100% - 18px); opacity: 0; transform: scale(0.5); }
    100% { top: calc(100% - 18px); opacity: 0; }
  }
  /* Keyframes verticales para Response (Abajo -> Arriba) */
  @keyframes flowResponse {
    0%   { bottom: 0%; opacity: 0; transform: scale(0.5); }
    5%   { bottom: 0%; opacity: 1; transform: scale(1); }
    20%  { bottom: calc(100% - 18px); opacity: 1; transform: scale(1); }
    25%  { bottom: calc(100% - 18px); opacity: 0; transform: scale(0.5); }
    100% { bottom: calc(100% - 18px); opacity: 0; }
  }
  
  .request-packet { left: -8px; /* Centra el paquete en la línea */ }
  .response-packet { right: -8px; /* Centra el paquete en la línea */ }
}

@media (max-width: 600px) {
  .arch-node {
    width: 90%;
    padding: 1rem;
    min-height: 110px;
  }
  .node-icon { font-size: 1.8rem; }
  .arch-node h4 { font-size: 0.85rem; }
  .features-list-inline li { font-size: 0.7rem; }
  
  .arch-arrow-pair {
    height: 60px;
  }
  
  .explanation-text {
    padding: 0 0.5rem;
    font-size: 0.85rem;
  }
}
/* ================================
   BLOQUE CRITERIOS DE SCORING
   ================================ */
.score-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(104, 82, 186, 0.16);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 36px rgba(109, 75, 255, 0.08);
}

.score-table th, .score-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(104, 82, 186, 0.16);
  text-align: left;
}

.score-table th {
  background: rgba(236, 230, 255, 0.7);
  color: var(--brand-purple-dark);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.score-table td {
  font-size: 0.92rem;
  color: var(--text-secondary);
}

/* Fórmula */
.formula-box {
  background: rgba(243, 237, 255, 0.75);
  border: 1px solid rgba(104, 82, 186, 0.2);
  border-radius: 12px;
  padding: 1.1rem 1.35rem;
  margin: 1.2rem 0;
  box-shadow: 0 16px 30px rgba(109, 75, 255, 0.08);
}

.formula-label {
  color: var(--brand-accent);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.55rem;
}

.formula {
  font-family: 'Fira Code', monospace;
  font-size: 0.98rem;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.92);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin: 0;
  overflow-x: auto;
}

/* Resumen */
.score-summary {
  margin-top: 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-size: 0.92rem;
  border: 1px solid rgba(104, 82, 186, 0.14);
  color: var(--text-secondary);
}

.risk-levels {
  list-style: none;
  padding: 0.5rem 0 0 0;
  margin: 0;
}

.risk-levels li {
  margin: 0.3rem 0;
  font-weight: 600;
}

.risk-levels span.ok { color: var(--risk-ok); }
.risk-levels span.warn { color: var(--risk-warn); }
.risk-levels span.bad { color: var(--risk-bad); }

/* --- About: tablas y math --- */
.about-acc { margin-top: 1rem; }
.about-acc > summary { cursor: pointer; color: var(--brand-accent); margin-bottom: .5rem; transition: color 0.2s ease; }
.about-acc[open] > summary { color: var(--brand-purple-dark); }
.table-wrap { overflow-x: auto; }
.about-table { width: 100%; border-collapse: collapse; font-size: .95rem; background: rgba(255, 255, 255, 0.92); border: 1px solid rgba(104, 82, 186, 0.12); border-radius: 10px; overflow: hidden; }
.about-table th, .about-table td { border-bottom: 1px solid rgba(104, 82, 186, 0.16); padding: .65rem .8rem; text-align: left; }
.about-table th { background: rgba(236, 230, 255, 0.65); color: var(--brand-purple-dark); font-weight: 600; }
.about-table td { color: var(--text-secondary); }
.about-table code { background: rgba(236, 230, 255, 0.6); padding: .05rem .35rem; border-radius: 4px; color: var(--brand-purple-dark); }

.math pre { background: rgba(255, 255, 255, 0.92); border: 1px solid rgba(104, 82, 186, 0.18); border-radius: 10px; padding: .85rem 1rem; overflow-x: auto; color: var(--text-primary); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6); }
.muted { color: var(--text-tertiary); font-size: .9rem; }

/* === Slider mejorado con feedback === */
.weight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 0.6rem;
}

.weight-row label {
  flex-shrink: 0;
  color: #9ad2ff;
  font-size: 0.9rem;
  width: 40px;
}

.weight-slider {
  flex: 1;
  height: 6px;
  background: linear-gradient(90deg, #6c63ff, #00e5ff);
  border-radius: 4px;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.weight-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #6c63ff;
  transition: transform 0.1s ease, background 0.2s ease;
}

.weight-slider:active::-webkit-slider-thumb {
  transform: scale(1.2);
  background: #00e5ff;
}

.weight-value {
  width: 42px;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #9ad2ff;
  transition: color 0.2s ease;
}
