:root {
  --navy: #052d6f;
  --navy-2: #0d417f;
  --red: #c81d3d;
  --red-soft: #fdecef;
  --ink: #17243a;
  --muted: #68758a;
  --line: #dfe5ee;
  --surface: #ffffff;
  --background: #f4f6f9;
  --green: #147a4d;
  --green-soft: #e9f7ef;
  --amber: #9a6512;
  --amber-soft: #fff6df;
  --shadow: 0 12px 32px rgba(5, 45, 111, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { margin: 0; min-height: 100%; color: var(--ink); background: var(--background); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, select { font: inherit; }

.topbar { position: sticky; top: 0; z-index: 20; min-height: 74px; display: flex; align-items: center; gap: 24px; padding: 12px clamp(18px, 3vw, 46px); background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 3px 18px rgba(13, 31, 61, 0.05); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: linear-gradient(145deg, var(--navy), var(--navy-2)); font: 800 23px/1 Georgia, serif; box-shadow: 0 8px 16px rgba(5, 45, 111, 0.2); }
.brand strong, .brand small { display: block; }
.brand strong { color: var(--navy); font-size: 16px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.main-nav { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.main-nav a { padding: 9px 12px; border-radius: 9px; color: #4f6079; font-size: 13px; font-weight: 700; text-decoration: none; }
.main-nav a:hover, .main-nav a.active { color: var(--navy); background: #edf3fb; }
.user-menu { display: flex; align-items: center; gap: 12px; }
.build-chip { padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .04em; background: #f8fafc; }
.user-copy { text-align: right; }
.user-copy strong, .user-copy small { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.user-copy strong { font-size: 11px; }
.user-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.nav-toggle { display: none; margin-left: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--navy); font-weight: 700; }

.shell { width: min(1500px, calc(100% - 36px)); min-height: calc(100vh - 132px); margin: 0 auto; padding: 30px 0 46px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 6px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; color: var(--navy); font-size: clamp(26px, 3vw, 38px); line-height: 1.1; letter-spacing: -0.035em; }
h2 { margin-bottom: 6px; color: var(--navy); font-size: 20px; letter-spacing: -0.02em; }
h3 { margin-bottom: 5px; color: var(--navy); font-size: 15px; }
.lede { max-width: 920px; margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 0; border-radius: 9px; padding: 9px 14px; background: var(--navy); color: #fff; font-weight: 750; font-size: 12px; text-decoration: none; cursor: pointer; }
.button:hover { filter: brightness(1.08); }
.button-secondary { background: #edf3fb; color: var(--navy); border: 1px solid #d6e0ef; }
.button-ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.button-small { min-height: 32px; padding: 6px 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-head p { margin: 0; color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.section { margin-top: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 12px; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }

.metric-card { min-height: 150px; padding: 18px; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; left: 0; bottom: 0; width: 74px; height: 3px; background: var(--red); }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-value { display: block; margin: 13px 0 7px; color: var(--navy); font-size: clamp(23px, 2.4vw, 34px); line-height: 1; letter-spacing: -0.04em; }
.metric-note { color: var(--muted); font-size: 11px; line-height: 1.45; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

.decision-card { overflow: hidden; }
.decision-summary { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #fff 0%, #f3f7fd 100%); }
.decision-summary h2 { margin-bottom: 7px; font-size: 24px; }
.decision-summary p:last-child { max-width: 900px; margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.comparison-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.comparison-grid article { min-width: 0; padding: 17px 20px; border-right: 1px solid var(--line); }
.comparison-grid article:last-child { border-right: 0; }
.comparison-grid span, .comparison-grid strong, .comparison-grid small { display: block; }
.comparison-grid span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.comparison-grid strong { margin: 7px 0 6px; color: var(--navy); font-size: clamp(19px, 2vw, 27px); letter-spacing: -.035em; }
.comparison-grid small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.comparison-grid-wide { padding: 0; }
.component-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 13px 20px; border-top: 1px solid var(--line); background: #fafbfd; color: #526176; font-size: 11px; line-height: 1.5; }
.component-strip strong { color: var(--ink); }
.compact-top { padding-top: 13px !important; }
.compact-bottom { padding-bottom: 13px !important; }

.monthly-bars { display: grid; grid-template-columns: repeat(8, minmax(70px, 1fr)); align-items: end; gap: 12px; min-height: 285px; overflow-x: auto; }
.monthly-bar-item { display: grid; grid-template-rows: 28px 190px auto auto; gap: 5px; min-width: 70px; text-align: center; }
.monthly-bar-value { align-self: end; color: var(--navy); font-size: 10px; font-weight: 800; white-space: nowrap; }
.monthly-bar-track { position: relative; height: 190px; border-radius: 8px 8px 3px 3px; background: #eef2f7; overflow: hidden; }
.monthly-bar-fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #3976bb, var(--navy)); }
.monthly-bar-item.partial .monthly-bar-fill { background: linear-gradient(180deg, #e75a72, var(--red)); }
.monthly-bar-item strong { color: var(--ink); font-size: 11px; }
.monthly-bar-item small { color: var(--muted); font-size: 9px; }
.aum-bars { min-height: 245px; }
.aum-bars .monthly-bar-item { grid-template-rows: 28px 150px auto auto; }
.aum-bars .monthly-bar-track { height: 150px; }
.flat-table { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 16px 16px; }
.fact small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.45; }

.source-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 4px; }
.source-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #4d5d73; font-size: 11px; text-decoration: none; }
.source-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.source-chip.stale::before, .source-chip.sin_datos::before { background: var(--amber); }

.alert-card { display: block; min-height: 195px; padding: 19px; text-decoration: none; transition: transform .16s ease, box-shadow .16s ease; }
.alert-card:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(5, 45, 111, 0.13); }
.alert-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.alert-count { color: var(--navy); font-size: 36px; font-weight: 800; letter-spacing: -0.05em; }
.alert-arrow { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #eef3fa; color: var(--navy); font-size: 18px; }
.alert-card p { margin: 9px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.period-box { padding-top: 11px; border-top: 1px solid var(--line); color: #4d5d73; font-size: 10px; line-height: 1.55; }
.period-box strong { color: var(--ink); }
.severity-critical { border-top: 4px solid var(--red); }
.severity-high { border-top: 4px solid #e36b3d; }
.severity-medium { border-top: 4px solid #d5a227; }
.severity-unknown { border-top: 4px solid #9aa4b3; }

.notice { border: 1px solid #c9d8ec; border-left: 4px solid var(--navy); border-radius: 12px; padding: 14px 16px; background: #f4f8fd; color: #334965; font-size: 12px; line-height: 1.55; }
.notice-warning { border-color: #edd5a5; border-left-color: var(--amber); background: var(--amber-soft); }
.notice-error { border-color: #f0bbc5; border-left-color: var(--red); background: var(--red-soft); color: #8f2036; }
.notice-success { border-color: #bfe2ce; border-left-color: var(--green); background: var(--green-soft); color: #17623f; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 13px; border-bottom: 1px solid #e9edf3; text-align: left; vertical-align: top; font-size: 12px; }
th { position: sticky; top: 0; z-index: 1; background: #f3f6fa; color: #4b5a6f; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
tbody tr[data-row-link] { cursor: pointer; }
tbody tr[data-row-link]:hover { background: #f7faff; }
.number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.strong-link { color: var(--navy); font-weight: 750; text-decoration: none; }
.strong-link:hover { text-decoration: underline; }
.empty { padding: 28px; color: var(--muted); text-align: center; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: #edf2f8; color: #40516a; font-size: 9px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }

.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: end; padding: 16px; }
.field { flex: 1 1 240px; }
.field label { display: block; margin-bottom: 6px; color: #4d5d73; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.field input, .field select { width: 100%; min-height: 40px; border: 1px solid #cfd8e5; border-radius: 9px; padding: 8px 11px; background: #fff; color: var(--ink); }
.tabs { display: flex; gap: 7px; overflow: auto; padding-bottom: 4px; }
.tabs a { flex: 0 0 auto; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #4f6079; font-size: 11px; font-weight: 750; text-decoration: none; }
.tabs a.active { background: var(--navy); border-color: var(--navy); color: #fff; }

.detail-hero { padding: 23px; background: linear-gradient(135deg, #fff 0%, #f5f9ff 100%); }
.detail-hero .meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; }
.fact-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.fact { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fafbfd; }
.fact span, .fact strong { display: block; }
.fact span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.fact strong { margin-top: 6px; color: var(--navy); font-size: 14px; overflow-wrap: anywhere; }
.history-bars { display: flex; align-items: end; gap: 5px; min-height: 130px; padding-top: 12px; }
.history-bar { flex: 1; min-width: 5px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #3e75b8, var(--navy)); position: relative; }
.history-bar:hover::after { content: attr(data-label); position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%); width: max-content; max-width: 170px; padding: 6px 8px; border-radius: 7px; background: var(--ink); color: #fff; font-size: 9px; z-index: 4; }

.source-card { padding: 18px; }
.source-card dl { margin: 14px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; }
.source-card dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.source-card dd { margin: 0; color: var(--ink); font-size: 12px; font-weight: 650; }
.workflow { counter-reset: step; }
.workflow .card { position: relative; padding: 20px 20px 20px 68px; }
.workflow .card::before { counter-increment: step; content: counter(step); position: absolute; left: 20px; top: 20px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--navy); color: #fff; font-weight: 800; }

.footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px clamp(18px, 3vw, 46px); border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 10px; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: #fff; }
.login-visual { display: flex; flex-direction: column; justify-content: space-between; padding: clamp(34px, 6vw, 78px); background: radial-gradient(circle at 80% 20%, #164f93 0, var(--navy) 35%, #021a40 100%); color: #fff; }
.login-visual h1 { max-width: 650px; color: #fff; font-size: clamp(38px, 5vw, 68px); }
.login-visual p { max-width: 620px; color: #cfddf1; line-height: 1.7; }
.login-badge { width: fit-content; padding: 8px 10px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-box { width: min(420px, 100%); }
.login-box h2 { font-size: 30px; }
.login-box .field { margin-top: 16px; }
.login-box .button { width: 100%; margin-top: 20px; min-height: 46px; }
.login-help { margin-top: 18px; color: var(--muted); font-size: 11px; line-height: 1.5; }

@media (max-width: 1100px) {
  .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-nav { display: none; position: absolute; top: 66px; left: 18px; right: 18px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
  .main-nav.open { display: grid; }
  .nav-toggle { display: inline-flex; }
  .user-menu { margin-left: 0; }
  .comparison-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comparison-grid article:nth-child(2) { border-right: 0; }
  .comparison-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 820px) {
  .shell { width: min(100% - 24px, 1500px); padding-top: 20px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .grid-5, .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 38vh; }
  .user-copy { display: none; }
  .footer { flex-direction: column; }
  .decision-summary { align-items: flex-start; flex-direction: column; }
  .comparison-grid { grid-template-columns: 1fr; }
  .comparison-grid article { border-right: 0; border-bottom: 1px solid var(--line); }
  .comparison-grid article:last-child { border-bottom: 0; }
  .monthly-bars { grid-template-columns: repeat(8, minmax(82px, 1fr)); }
}

@media (max-width: 520px) {
  .topbar { gap: 10px; padding: 10px 12px; }
  .brand small { display: none; }
  .user-menu .button { font-size: 0; width: 34px; padding: 0; }
  .user-menu .button::after { content: "×"; font-size: 18px; }
  .fact-list { grid-template-columns: 1fr; }
  .card-head { flex-direction: column; }
}
