:root {
  --radar-primary: #0b192c;
  --radar-primary-soft: #14263d;
  --radar-accent: #1e40af;
  --radar-accent-hover: #1d4ed8;
  --radar-cyan: #0284c7;
  --radar-bg: #f8fafc;
  --radar-card: #ffffff;
  --radar-border: #e2e8f0;
  --radar-muted: #64748b;
  --radar-high-bg: #fef2f2;
  --radar-high-border: #fca5a5;
  --radar-high-text: #b91c1c;
  --radar-mid-bg: #fff7ed;
  --radar-mid-border: #fdba74;
  --radar-mid-text: #c2410c;
  --radar-low-bg: #f0fdf4;
  --radar-low-border: #86efac;
  --radar-low-text: #15803d;
  --radar-radius: 10px;
  --radar-shadow: 0 1px 3px rgba(11, 25, 44, 0.04), 0 8px 22px rgba(11, 25, 44, 0.06);
}

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--radar-bg);
  color: var(--radar-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.profile-profesional {
  --radar-accent: #0f766e;
  --radar-accent-hover: #115e59;
  --radar-cyan: #0d9488;
}
body.profile-profesional .hero {
  background: linear-gradient(135deg, #fff 0%, #f5fbfa 60%, #ecfdf5 100%);
}
body.profile-profesional .hero::after {
  border-color: rgba(15, 118, 110, .18);
  box-shadow: 0 0 0 48px rgba(15, 118, 110, .04), 0 0 0 96px rgba(13, 148, 136, .025);
}
body.profile-profesional .radar-navbar .nav-link:hover,
body.profile-profesional .radar-navbar .nav-link.active {
  background: #ecfdf5;
}

a { color: var(--radar-accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--radar-accent-hover); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1100;
  background: var(--radar-primary); color: white; padding: .75rem 1rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.radar-navbar {
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--radar-border);
  backdrop-filter: blur(14px);
  padding: .45rem 0;
}

.brand-logo { width: 194px; height: 48px; object-fit: contain; object-position: left center; }
.navbar-toggler { border: 1px solid var(--radar-border); box-shadow: none !important; }
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='%230b192c' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}
.radar-navbar .nav-link {
  color: #475569; font-size: .9rem; font-weight: 650; padding: .65rem .85rem !important;
  border-radius: 8px;
}
.radar-navbar .nav-link:hover, .radar-navbar .nav-link.active { color: var(--radar-accent); background: #eff6ff; }
.admin-link { margin-left: .35rem; border: 1px solid var(--radar-border); }

main { flex: 1; }
.site-main { padding-top: 2.25rem; padding-bottom: 4rem; }

h1, h2, h3, h4, h5, h6 { color: var(--radar-primary); letter-spacing: -.025em; }
.page-title { font-size: clamp(2rem, 4vw, 3.15rem); line-height: 1.08; font-weight: 750; }
.eyebrow {
  color: var(--radar-accent); font-size: .72rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; margin-bottom: .6rem;
}
.page-intro { color: var(--radar-muted); font-size: 1.05rem; max-width: 670px; }
.mono { font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace; }

.hero {
  position: relative; overflow: hidden; padding: clamp(2.2rem, 5vw, 4.5rem);
  background: linear-gradient(135deg, #fff 0%, #f8fbff 60%, #eff6ff 100%);
  border: 1px solid var(--radar-border); border-radius: 18px; box-shadow: var(--radar-shadow);
}
.hero::after {
  content: ""; position: absolute; width: 360px; height: 360px; right: -140px; top: -180px;
  border: 1px solid rgba(30, 64, 175, .16); border-radius: 50%;
  box-shadow: 0 0 0 48px rgba(30, 64, 175, .035), 0 0 0 96px rgba(2, 132, 199, .025);
}
.legal-hero::before {
  content: "§"; position: absolute; right: 8%; bottom: -3.5rem; z-index: 0;
  color: rgba(30, 64, 175, .045); font-family: Georgia, serif; font-size: 15rem; line-height: 1;
}
.hero-copy { position: relative; z-index: 1; max-width: 790px; }
.hero-title { font-size: clamp(2.15rem, 5vw, 4rem); line-height: 1.04; font-weight: 780; letter-spacing: -.05em; max-width: 820px; }
.hero-title .accent { color: var(--radar-accent); }
.hero-subtitle { color: #475569; max-width: 680px; font-size: clamp(1rem, 2vw, 1.2rem); }
.hero-meta { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; margin-top: 2rem; }
.hero-stat { display: flex; align-items: center; gap: .55rem; color: #475569; font-size: .86rem; font-weight: 600; }
.hero-stat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--radar-cyan); box-shadow: 0 0 0 4px color-mix(in srgb, var(--radar-cyan) 16%, white); }

.btn { border-radius: 9px; font-weight: 650; padding: .62rem 1rem; }
.btn-primary { --bs-btn-bg: var(--radar-accent); --bs-btn-border-color: var(--radar-accent); --bs-btn-hover-bg: var(--radar-accent-hover); --bs-btn-hover-border-color: var(--radar-accent-hover); }
.btn-outline-primary { --bs-btn-color: var(--radar-accent); --bs-btn-border-color: #bfdbfe; --bs-btn-hover-bg: #eff6ff; --bs-btn-hover-color: var(--radar-accent-hover); --bs-btn-hover-border-color: #93c5fd; }
.btn-dark { --bs-btn-bg: var(--radar-primary); --bs-btn-border-color: var(--radar-primary); }

.section-block { margin-top: 4.25rem; }
.section-header { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.2rem; }
.section-title { font-size: 1.45rem; font-weight: 750; margin: 0; }
.section-kicker { color: var(--radar-muted); margin: .25rem 0 0; font-size: .9rem; }
.section-count { color: var(--radar-muted); font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }

.radar-card {
  position: relative; overflow: hidden;
  height: 100%; background: var(--radar-card); border: 1px solid var(--radar-border);
  border-radius: var(--radar-radius); box-shadow: 0 1px 2px rgba(15, 23, 42, .035);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.radar-card.has-daily-ribbon .card-body { padding-top: 3.35rem; }
.daily-ribbon {
  position: absolute; z-index: 3; top: 1.25rem; right: -3rem; width: 11rem;
  transform: rotate(45deg); padding: .32rem 0; color: #fff; text-align: center;
  font-size: .66rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase;
  box-shadow: 0 2px 7px rgba(15, 23, 42, .18); pointer-events: none;
}
.ribbon-new { background: #0f766e; }
.ribbon-updated { background: #1d4ed8; }
.radar-card:hover { transform: translateY(-3px); border-color: #cbd5e1; box-shadow: var(--radar-shadow); }
.radar-card .card-body { padding: 1.35rem; display: flex; flex-direction: column; }
.radar-card .card-title { font-size: 1.08rem; line-height: 1.35; font-weight: 720; margin: .85rem 0 .7rem; }
.card-summary { color: #475569; font-size: .93rem; }
.radar-insight-box, .radar-action-box { padding: .72rem .85rem; border-radius: 0 8px 8px 0; font-size: .84rem; margin-top: .7rem; }
.radar-insight-box { background: #f8fafc; border-left: 3px solid var(--radar-accent); }
.radar-action-box { background: var(--radar-mid-bg); border-left: 3px solid var(--radar-mid-text); }
.box-label { display: block; font-size: .66rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .2rem; }
.card-footer-meta { border-top: 1px solid #f1f5f9; margin-top: auto; padding-top: 1rem; }
.radar-card.is-actionable { border-top: 3px solid var(--radar-accent); }
.decision-label { margin-top: .8rem; font-size: .64rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.decision-action { color: var(--radar-mid-text); }
.decision-info { color: var(--radar-muted); }
.section-actionable .section-title { color: var(--radar-accent); }
.section-actionable .section-header { border-left: 4px solid var(--radar-accent); padding-left: 1rem; }
.section-informative .section-header { border-left: 4px solid #94a3b8; padding-left: 1rem; }

.badge { border-radius: 999px; padding: .36rem .62rem; font-size: .68rem; letter-spacing: .025em; }
.badge-category { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; text-transform: capitalize; }
.badge-priority-alta { background: var(--radar-high-bg); border: 1px solid var(--radar-high-border); color: var(--radar-high-text); }
.badge-priority-media { background: var(--radar-mid-bg); border: 1px solid var(--radar-mid-border); color: var(--radar-mid-text); }
.badge-priority-baja { background: var(--radar-low-bg); border: 1px solid var(--radar-low-border); color: var(--radar-low-text); }
.badge-source-primary { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.badge-state { background: #f1f5f9; color: #475569; border: 1px solid var(--radar-border); }
.badge-status-completada { background: var(--radar-low-bg); border: 1px solid var(--radar-low-border); color: var(--radar-low-text); }
.badge-status-error { background: var(--radar-high-bg); border: 1px solid var(--radar-high-border); color: var(--radar-high-text); }
.badge-status-en_curso { background: var(--radar-mid-bg); border: 1px solid var(--radar-mid-border); color: var(--radar-mid-text); }

.source-link { color: #475569; text-decoration: none; font-size: .8rem; font-weight: 650; }
.source-link:hover { color: var(--radar-accent); }
.source-link::before { content: "↗"; color: var(--radar-cyan); margin-right: .3rem; }

.radar-list { display: grid; gap: .75rem; }
.radar-item { background: #fff; border: 1px solid var(--radar-border); border-radius: 12px; padding: 1rem 1.15rem; }
.radar-date { color: var(--radar-accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; font-weight: 700; }

.panel-card, .filter-card, .article-shell, .login-card {
  background: #fff; border: 1px solid var(--radar-border); border-radius: var(--radar-radius); box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.panel-card { padding: 1.35rem; }
.panel-card-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--radar-muted); }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.metric { background: var(--radar-bg); border: 1px solid var(--radar-border); border-radius: 10px; padding: .8rem; }
.metric-value { display: block; font-size: 1.35rem; font-weight: 760; line-height: 1.15; }
.metric-label { color: var(--radar-muted); font-size: .72rem; font-weight: 650; }
.action-card { color: white; background: linear-gradient(145deg, var(--radar-primary), #173b75); border: 0; }
.action-card h2, .action-card .panel-card-title { color: white; }
.action-card p { color: #cbd5e1; }
.action-card .btn-light { color: var(--radar-primary); }

.filter-card { padding: 1.2rem; }
.form-label { color: #475569; font-size: .76rem; font-weight: 750; margin-bottom: .35rem; }
.form-control, .form-select { border-color: var(--radar-border); border-radius: 8px; min-height: 42px; color: var(--radar-primary); }
.form-control:focus, .form-select:focus { border-color: #93c5fd; box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .1); }

.history-table-wrap { background: #fff; border: 1px solid var(--radar-border); border-radius: var(--radar-radius); overflow: hidden; }
.history-table { margin: 0; }
.history-table thead th { background: #f8fafc; color: var(--radar-muted); border-bottom: 1px solid var(--radar-border); font-size: .69rem; letter-spacing: .06em; text-transform: uppercase; padding: .85rem 1rem; }
.history-table tbody td { border-color: #f1f5f9; padding: .9rem 1rem; vertical-align: middle; }
.history-table tbody td:first-child { white-space: nowrap; }
.history-title { color: var(--radar-primary); font-weight: 680; text-decoration: none; }
.history-title:hover { color: var(--radar-accent); }
.pagination .page-link { border-color: var(--radar-border); color: var(--radar-primary); font-weight: 600; }
.pagination .active > .page-link { background: var(--radar-accent); border-color: var(--radar-accent); color: white; }

.article-shell { padding: clamp(1.4rem, 4vw, 2.8rem); }
.article-title { font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 760; line-height: 1.08; }
.article-lead { color: #334155; font-size: 1.16rem; line-height: 1.7; }
.article-section { margin-top: 2rem; }
.article-section h2 { font-size: 1rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.article-insight, .article-action { padding: 1.2rem 1.3rem; border-radius: 0 10px 10px 0; }
.article-insight { background: #f8fafc; border-left: 4px solid var(--radar-accent); }
.article-action { background: var(--radar-mid-bg); border-left: 4px solid var(--radar-mid-text); }
.sidebar-sticky { position: sticky; top: 92px; }
.related-link { display: block; color: var(--radar-primary); font-weight: 650; text-decoration: none; line-height: 1.35; }
.legal-disclaimer { color: var(--radar-muted); background: #f8fafc; border: 1px solid var(--radar-border); border-radius: 7px; padding: .8rem; font-size: .72rem; line-height: 1.5; }

.login-wrap { min-height: 60vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 430px; padding: 2rem; }
.login-mark { width: 64px; height: 64px; margin-bottom: 1.25rem; }

.alert { border-radius: 10px; border-width: 1px; }
.breadcrumb { font-size: .82rem; }
.breadcrumb-item a { color: var(--radar-muted); text-decoration: none; }

.site-footer { margin-top: auto; background: #fff; border-top: 1px solid var(--radar-border); }
.footer-grid { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.4rem 0; }
.footer-brand { font-weight: 800; letter-spacing: -.02em; }
.footer-brand span { color: var(--radar-accent); }
.footer-copy { color: var(--radar-muted); font-size: .78rem; }

@media (max-width: 991.98px) {
  .radar-navbar .navbar-collapse { padding: .8rem 0; }
  .admin-link { margin-left: 0; }
  .hero::after { opacity: .55; }
  .sidebar-sticky { position: static; margin-top: 1.5rem; }
}

@media (max-width: 767.98px) {
  .site-main { padding-top: 1.25rem; }
  .brand-logo { width: 168px; }
  .hero { border-radius: 16px; padding: 1.6rem; }
  .hero-meta { display: grid; gap: .65rem; }
  .section-block { margin-top: 3rem; }
  .section-header { align-items: start; }
  .footer-grid { align-items: start; flex-direction: column; }
  .history-table thead { display: none; }
  .history-table, .history-table tbody, .history-table tr, .history-table td { display: block; width: 100%; }
  .history-table tr { padding: .8rem 1rem; border-bottom: 1px solid var(--radar-border); }
  .history-table td { padding: .25rem 0 !important; border: 0; }
  .history-table td:not(.history-primary) { display: inline-block; width: auto; margin-right: .55rem; font-size: .78rem; color: var(--radar-muted); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
