:root {
  --navy-950: #000814;
  --navy-900: #001d3d;
  --navy-700: #003566;
  --amber-500: #ffc300;
  --amber-400: #ffd60a;

  --surface-0: #eef3f9;
  --surface-1: #ffffff;
  --surface-2: #e2eaf3;
  --line: #d3dfec;
  --ink-900: #0a1626;
  --ink-600: #47586e;
  --ink-400: #7c8aa0;

  --good: #1f7a5c;
  --good-bg: #e3f3ec;
  --warn: #b5691f;
  --warn-bg: #f8ebdc;
  --critical: #ad2b26;
  --critical-bg: #fae6e5;

  --radius-s: 6px;
  --radius-m: 10px;
  --shadow-card: 0 1px 2px rgba(0, 8, 20, 0.06), 0 6px 16px -8px rgba(0, 8, 20, 0.18);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Andika", "Segoe UI", Verdana, sans-serif;
  color: var(--ink-900);
  background: var(--surface-0);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; margin: 0; text-wrap: balance; }
p { margin: 0; }
button { font-family: inherit; }
a { color: inherit; }
::selection { background: var(--amber-500); color: var(--navy-950); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--amber-500);
  outline-offset: 2px;
  border-radius: 4px;
}

.wordmark { font-weight: 700; white-space: nowrap; }
.wm-week { color: var(--navy-700); }
.wm-mark { color: var(--amber-500); }
.wordmark-dark .wm-week { color: #fff; }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ref {
  font-weight: 700;
  font-style: italic;
  font-variant-numeric: tabular-nums;
  color: var(--navy-700);
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-400);
}

.dato {
  display: grid;
  grid-template-columns: minmax(118px, 32%) minmax(0, 1fr);
  column-gap: 16px;
  align-items: baseline;
  padding: 7px 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.dato:last-child { border-bottom: 0; }
.dato-etiqueta {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.dato-valor {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-900);
  overflow-wrap: anywhere;
}
.dato-valor a { color: var(--navy-700); text-decoration-color: var(--amber-500); text-underline-offset: 3px; }
@media (max-width: 560px) {
  .dato { grid-template-columns: 1fr; row-gap: 1px; }
}

.seal { width: 30px; height: 30px; flex-shrink: 0; }
.seal--good { color: var(--good); }
.seal--warn { color: var(--warn); }
.seal--critical { color: var(--critical); }
.seal--muted { color: var(--ink-400); }

.etapas { list-style: none; margin: 0; padding: 0; }
.etapas li { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.etapas li::before {
  content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line);
}
.etapas li:last-child::before { display: none; }
.etapas .num {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; background: var(--surface-1); color: var(--ink-400);
}
.etapas li.done .num { background: var(--navy-700); color: #fff; }
.etapas .et-body strong { font-size: 13.5px; display: block; }
.etapas .et-body span { font-size: 12px; color: var(--ink-600); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--amber-500); color: var(--navy-950); }
.btn-primary:hover { background: var(--amber-400); }
.btn-ghost { background: var(--surface-1); color: var(--navy-700); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy-700); }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface-1); color: var(--navy-700);
  cursor: pointer;
}
.btn-icon:hover { border-color: var(--navy-700); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.icon { width: 18px; height: 18px; }

.field {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 8px 12px;
}
.field input, .field select {
  border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--ink-900); width: 100%;
}
.field .icon { color: var(--ink-400); }
label.f-label {
  font-size: 12px; font-weight: 700; color: var(--ink-600);
  letter-spacing: 0.02em; margin-bottom: 6px; display: block;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
  background: var(--surface-2); color: var(--navy-700);
  border: 1px solid transparent;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--navy-700); color: #fff; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-critical { background: var(--critical-bg); color: var(--critical); }
.pill-proceso { background: var(--warn-bg); color: var(--warn); }
.pill-terceros { background: var(--surface-2); color: var(--ink-600); }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.card {
  background: var(--surface-1); border: 1px solid var(--line);
  border-radius: var(--radius-m); box-shadow: var(--shadow-card);
}
.card-pad { padding: 20px 22px; }

.filter-bar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-bar .f-group { min-width: 160px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--radius-s); width: fit-content; margin-bottom: 16px; }
.tab { padding: 8px 16px; border-radius: 6px; border: none; background: none; font-weight: 700; font-size: 13.5px; color: var(--ink-600); cursor: pointer; }
.tab:hover:not([aria-selected="true"]) { color: var(--navy-700); }
.tab[aria-selected="true"] { background: var(--navy-700); color: #fff; box-shadow: var(--shadow-card); }
.attach-btn { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--navy-700); background: none; border: none; cursor: pointer; }
.cta-subtitulo { font-size: 14px; font-weight: 700; color: var(--ink-900); margin: 0 0 12px; }

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; min-width: 720px; }
/* Cabecera destacada: fondo azulado de la paleta, texto navy y filete inferior; la columna ordenada lleva el acento ámbar. */
table.list th {
  text-align: left; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--navy-700); font-weight: 700; padding: 12px 14px;
  background: var(--surface-2); border-bottom: 2px solid var(--navy-700);
}
table.list th:first-child { border-top-left-radius: var(--radius-s); }
table.list th:last-child { border-top-right-radius: var(--radius-s); }
table.list th.activo { background: color-mix(in srgb, var(--surface-2) 86%, var(--navy-700)); border-bottom: 3px solid var(--amber-500); }
table.list td { padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: var(--surface-0); }
table.list tbody tr:last-child td { border-bottom: none; }
@media (max-width: 640px) {
  table.list.apilable { min-width: 0; }
  table.list.apilable thead { display: none; }
  table.list.apilable, table.list.apilable tbody, table.list.apilable tr { display: block; width: 100%; }
  table.list.apilable tbody tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.list.apilable tbody tr:last-child { border-bottom: none; }
  table.list.apilable td {
    display: grid; grid-template-columns: minmax(112px, 40%) 1fr; gap: 4px 16px; align-items: baseline;
    padding: 6px 0; border-bottom: none; max-width: none !important; word-break: break-word;
  }
  table.list.apilable td[data-label]::before {
    content: attr(data-label); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--ink-400); font-weight: 700; font-style: normal;
    white-space: normal; overflow-wrap: anywhere; /* .num hereda nowrap y la etiqueta se montaba sobre el dato */
  }
  table.list.apilable td.num { text-align: left; }
  table.list.apilable td.empty-note, table.list.apilable td[colspan] { display: block; text-align: center; }
  table.list.apilable td.col-acciones { display: block; width: auto; padding-top: 8px; }
  table.list.apilable td > .row-sub { grid-column: 2; margin-top: -4px; }
}

.row-title { font-weight: 700; color: var(--ink-900); }
.row-sub { font-size: 12.5px; color: var(--ink-600); margin-top: 2px; }
.row-lead { display: flex; align-items: center; gap: 12px; }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.view-head h1 { font-size: 25px; margin-top: 2px; }
.view-head .desc { color: var(--ink-600); font-size: 13.5px; margin-top: 6px; max-width: 62ch; }
.view-actions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 620px) {
  .filter-bar .f-group { min-width: 0; flex: 1 1 100%; }
  .filter-bar .f-group .field, .filter-bar .f-group input, .filter-bar .f-group select { width: 100%; box-sizing: border-box; }
}

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { padding: 16px 18px; }
.stat .eyebrow { margin-bottom: 10px; }
.stat .value { font-size: 27px; font-weight: 700; }
.stat .qualifier { font-size: 12.5px; color: var(--ink-600); margin-top: 4px; }
@media (max-width: 980px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.scrim {
  position: fixed; inset: 0; background: rgba(10, 22, 38, 0.45); z-index: 30;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-panel {
  background: var(--surface-1); border-radius: 12px; box-shadow: 0 24px 60px rgba(10, 22, 38, 0.35);
  width: min(820px, 96vw); max-height: min(88vh, 720px); display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-header h2 { font-size: 17px; margin: 0; }
.modal-header-texto { flex: 1; min-width: 0; }
.modal-header-texto h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-header-texto .row-sub { margin-top: 2px; }
.modal-panel-selector { width: min(460px, 100%); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-body table.list { min-width: 0; }
.modal-body table.list th { padding: 9px 10px; }
.modal-body table.list td { padding: 8px 10px; font-size: 13px; }
.modal-body table.list td.num { white-space: nowrap; }

.mapa-svg-contenedor { position: relative; overflow: hidden; border-radius: var(--radius-s); }
/* Táctil: con el mapa sin zoom el dedo hace scroll de la página; con zoom el gesto es del mapa (arrastrar y pellizcar). */
.mapa-svg-contenedor { touch-action: pan-y; overscroll-behavior: contain; user-select: none; -webkit-user-select: none; }
.mapa-svg-contenedor.mapa-zoom-activo { touch-action: none; }
.mapa-svg-contenedor.mapa-cargando { opacity: 0.5; pointer-events: none; transition: opacity 0.15s ease; }
.mapa-svg-contenedor svg { width: 100%; height: auto; display: block; transition: transform 0.15s ease; }
.mapa-svg-contenedor.mapa-zoom-activo { cursor: grab; }
.mapa-svg-contenedor.mapa-arrastrando { cursor: grabbing; }
.mapa-svg-contenedor.mapa-arrastrando svg { transition: none; }
.mapa-svg-contenedor svg [id] { transition: fill 0.15s ease; }
.mapa-pais-hover, .mapa-pais-hover path { fill: var(--amber-500) !important; cursor: pointer; }

.mapa-tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--navy-950); color: #fff;
  padding: 8px 12px; border-radius: 8px; box-shadow: var(--shadow-card);
  white-space: nowrap;
  opacity: 0; transform: translateY(4px) scale(0.97);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.mapa-tooltip.visible { opacity: 1; transform: translateY(0) scale(1); }
.mapa-tooltip-pais { font-size: 13px; font-weight: 700; }
.mapa-tooltip-cantidad { font-size: 11.5px; color: rgba(255, 255, 255, 0.65); margin-top: 2px; }

.bar-list .row { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; padding: 9px 0; }
.bar-list .rank { font-size: 12px; font-weight: 700; color: var(--ink-400); }
.bar-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--navy-700); border-radius: 999px; }
.bar-list .count { font-size: 13px; font-weight: 700; }

.hint { font-size: 12px; color: var(--ink-400); margin-top: 10px; }
.empty-note { padding: 30px; text-align: center; color: var(--ink-600); font-size: 13.5px; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

.blazor-error-boundary {
  background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
  padding: 1rem 1rem 1rem 3.7rem;
  color: white;
}
.blazor-error-boundary::after { content: "Ha ocurrido un error inesperado."; }

.con-tooltip { position: relative; }
.con-tooltip::after {
  content: attr(data-tooltip);
  position: absolute; right: 0; bottom: calc(100% + 8px);
  background: var(--navy-950); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; white-space: nowrap;
  padding: 5px 10px; border-radius: 6px;
  opacity: 0; transform: translateY(3px); pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease; z-index: 25;
}
.con-tooltip::before {
  content: ""; position: absolute; right: 12px; bottom: calc(100% + 3px);
  border: 5px solid transparent; border-top-color: var(--navy-950); border-bottom: 0;
  opacity: 0; pointer-events: none; transition: opacity 0.12s ease; z-index: 25;
}
.con-tooltip:hover::after, .con-tooltip:focus-visible::after { opacity: 1; transform: none; }
.con-tooltip:hover::before, .con-tooltip:focus-visible::before { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .con-tooltip::after, .con-tooltip::before { transition: none; } }

/* Interruptor accesible (role="switch"): activo = verde, inactivo = gris. */
.switch {
  position: relative; flex: 0 0 auto; width: 40px; height: 22px; padding: 0;
  border: 0; border-radius: 999px; background: var(--ink-400); cursor: pointer;
  transition: background-color 0.18s ease;
}
.switch-knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 8, 20, 0.35); transition: transform 0.18s ease;
}
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--navy-700); outline-offset: 2px; }
.switch:disabled { opacity: 0.55; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .switch, .switch-knob { transition: none; } }
