:root {
  /* Paleta CIVFD — tomada del documento de marca.
     Navy #000932 · Cobalto #0440a0 · Azur #0d74da · Cian #139ef1 · Cian pálido #ace1f1
     Todo derivado a tintes suaves para no perder delicadeza. */
  --navy: #000932;
  --navy-soft: #0a1a42;
  --cobalt: #0440a0;
  --azure: #0d74da;
  --cyan: #139ef1;
  --cyan-pale: #ace1f1;

  --cream: #f7fafd;
  --cream-deep: #eef5fb;
  --paper: #ffffff;
  --gold: #0d74da;
  --gold-light: #139ef1;
  --gold-dim: rgba(19, 158, 241, 0.12);
  --blue-raw: #0a3a7d;
  --blue-mid: #2a6fb5;
  --blue-light: #eaf3fb;
  --ink: #0a1a42;
  --ink-secondary: #3f5473;
  --ink-muted: #6d7f96;
  --border: #dbe7f3;
  --border-soft: #e8f0f8;
  --shadow: 0 1px 2px rgba(10, 26, 66, 0.04), 0 10px 30px -14px rgba(10, 26, 66, 0.12);
  --hairline: rgba(13, 116, 218, 0.18);
  --glow-cyan: 0 0 0 1px rgba(19, 158, 241, 0.14), 0 6px 22px -10px rgba(19, 158, 241, 0.35);

  /* Superficies suaves (canvas claro) */
  --surface-soft: #f2f8fd;

  --radius: 12px;
  --radius-sm: 9px;
  --font: "Inter", "SF Pro Text", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", ui-monospace, monospace;
  --success: #2d8a5c;
  --warn: #c9872a;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--blue-light);
  color: var(--blue-raw);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
}

.site-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1.25rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
}

.brand-lockup {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-block {
  display: flex;
  flex-direction: column;
  /* Sin gap: el aire entre el wordmark y el nombre completo se ajusta con
     margen negativo en el nombre, para poder pasarlo de cero.
     El SVG mide 52 de alto y el wordmark termina en y=33. A 200 px de ancho
     (escala 200/220) eso deja ~17 px de aire muerto abajo del texto. */
  gap: 0;
  /* Ancho efectivo del logo: el del atributo width, acotado por el viewport */
  --brand-logo-w: min(200px, 52vw);
}

.brand-fullname {
  margin: 0;
  /* Alinea la "C" de "Centro" justo debajo de la "C" de CIVFD.
     En el SVG el wordmark arranca en x=58 sobre un viewBox de 220. */
  margin-left: calc(var(--brand-logo-w) * 58 / 220);
  /* −4 mm de separación respecto del logo. El hueco de caja era 4,66 px y el
     objetivo es quitarte 15,12 px (4 mm), así que va en negativo. Es seguro
     porque el SVG trae ~17 px de aire muerto bajo el wordmark: el nombre
     sube hasta ahí, nunca se monta sobre la tinta del logo. */
  margin-top: calc(4.66px - 4mm);
  font-size: 0.86rem;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: var(--blue-raw);
  white-space: nowrap;
}

.brand-lockup:hover .brand-logo {
  filter: brightness(1.03);
}

.brand-logo {
  display: block;
  height: auto;
  max-width: min(220px, 52vw);
}

.brand-context {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-align: right;
  flex: 1;
  min-width: 12rem;
}

.brand-context strong {
  font-weight: 700;
  color: var(--blue-raw);
}

@media (max-width: 520px) {
  .site-brand {
    flex-direction: column;
    align-items: flex-start;
  }
  .brand-context {
    text-align: left;
  }
  .brand-fullname {
    font-size: 0.76rem;
    white-space: normal;
  }
}

.stack-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(28, 24, 20, 0.55);
  backdrop-filter: blur(4px);
}

.stack-gate[hidden] {
  display: none !important;
}

.stack-gate-card {
  max-width: 420px;
  padding: 1.35rem 1.5rem;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stack-gate-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--blue-raw);
}

.stack-gate-spinner {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.85rem;
  border: 3px solid var(--border-soft);
  border-top-color: var(--blue-raw);
  border-radius: 50%;
  animation: stack-spin 0.85s linear infinite;
}

.stack-gate-spinner[hidden] {
  display: none;
}

@keyframes stack-spin {
  to {
    transform: rotate(360deg);
  }
}

.stack-gate-hint {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.stack-gate-card.stack-gate-fatal .stack-gate-spinner {
  display: none;
}

.site-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--paper);
  border-bottom: 1px solid var(--border-soft);
}

.site-nav-link {
  padding: 0.45rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-secondary);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.site-nav-link:hover {
  color: var(--navy);
  background: #eaf3fb;
  border-color: var(--hairline);
}

.site-nav-link.is-active {
  color: #ffffff;
  background: linear-gradient(180deg, #1668c4 0%, #0d55a8 52%, #032f7d 100%);
  border-color: rgba(4, 64, 160, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 9, 50, 0.2),
    0 1px 2px rgba(4, 64, 160, 0.3),
    0 4px 12px -6px rgba(4, 64, 160, 0.5);
}

.portal-hero {
  text-align: center;
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.portal-hero h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--blue-raw);
}

.portal-hero p {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.portal-hero a {
  color: var(--gold);
  font-weight: 600;
}

.portal-goal {
  margin-top: 0.55rem !important;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-soft);
  font-size: 0.8rem !important;
  color: var(--ink-secondary) !important;
}

.shell-status {
  max-width: 720px;
}

.service-panel {
  padding: 1.35rem 1.5rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.service-panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--blue-raw);
}

.service-summary {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.service-summary.is-ok {
  color: var(--success);
}

.service-summary.is-warn {
  color: var(--warn);
}

.service-list {
  list-style: none;
  margin: 1.1rem 0 0;
  padding: 0;
  border-top: 1px solid var(--border-soft);
}

.service-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.86rem;
}

.service-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ink-muted);
  flex-shrink: 0;
}
.service-row.is-ok .service-dot {
  background: var(--success);
}

.service-row.is-down .service-dot {
  background: var(--warn);
}

.service-name {
  flex: 1;
  color: var(--ink);
}

.service-state {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.service-row.is-ok .service-state {
  color: var(--success);
}

.service-row.is-down .service-state {
  color: var(--warn);
}

/* Métricas del servicio: mismas tarjetas metálicas que los módulos */
.service-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.7rem;
  margin: 1.15rem 0 0;
  padding: 0;
  border-top: 0;
}

.service-meta > div {
  position: relative;
  padding: 0.9rem 1rem 0.95rem;
  border: 1px solid rgba(13, 116, 218, 0.28);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(168deg, #eaf3fd 0%, #d3e5f8 45%, #bcd7f0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 2px 1px -1px rgba(255, 255, 255, 0.85),
    inset 0 -2px 4px -1px rgba(4, 64, 160, 0.16),
    0 1px 2px rgba(10, 26, 66, 0.07),
    0 8px 18px -10px rgba(4, 64, 160, 0.4);
}

/* Franja superior de color, igual que la cabecera de un nodo */
.service-meta > div::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #0440a0 0%, #0d74da 52%, #139ef1 100%);
}

/* Cepillado metálico sutil por encima del fondo */
.service-meta > div::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0px,
      rgba(255, 255, 255, 0.07) 1px,
      rgba(255, 255, 255, 0) 2px,
      rgba(0, 9, 50, 0.006) 3px
    ),
    linear-gradient(128deg, rgba(255, 255, 255, 0) 62%, rgba(255, 255, 255, 0.34) 100%);
}

.service-meta dt {
  position: relative;
  z-index: 1;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: #1d3f6d;
}

.service-meta dd {
  position: relative;
  z-index: 1;
  margin: 0.28rem 0 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

/* La fecha es texto, no un número: un punto menos de cuerpo */
.service-meta > div:last-child dd {
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0;
}

.service-actions {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
main.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.kpi-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--ink-secondary);
  margin-bottom: 1.25rem;
  padding: 0.7rem 1rem;
  background: #f6fafd;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.kpi-bar::before {
  content: none;
}


.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.85rem;
}

.module-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.35rem;
  appearance: none;
  border: 1px solid rgba(203, 216, 235, 0.9);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: box-shadow 0.22s, transform 0.18s, border-color 0.22s;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 2px 1px -1px rgba(255, 255, 255, 0.75),
    inset 0 -1px 0 rgba(0, 9, 50, 0.07),
    inset 1px 0 0 rgba(255, 255, 255, 0.55),
    inset -1px 0 0 rgba(0, 9, 50, 0.03),
    0 1px 2px rgba(10, 26, 66, 0.06),
    0 7px 18px -10px rgba(10, 26, 66, 0.25);
  overflow: hidden;
}

/* Brillo metálico: banda de luz que cruza la esquina superior +
   micro-textura de cepillado horizontal, imperceptible pero presente. */
.module-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0px,
      rgba(255, 255, 255, 0.16) 1px,
      rgba(255, 255, 255, 0) 2px,
      rgba(0, 9, 50, 0.012) 3px,
      rgba(255, 255, 255, 0) 4px
    ),
    linear-gradient(
      128deg,
      rgba(255, 255, 255, 0.92) 0%,
      rgba(255, 255, 255, 0.38) 20%,
      rgba(255, 255, 255, 0) 44%,
      rgba(0, 9, 50, 0.03) 76%,
      rgba(255, 255, 255, 0.3) 100%
    );
  pointer-events: none;
}

.module-card > * {
  position: relative;
  z-index: 1;
}

.module-card:hover {
  border-color: rgba(255, 255, 255, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 2px 1px -1px rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 9, 50, 0.08),
    inset 1px 0 0 rgba(255, 255, 255, 0.7),
    inset -1px 0 0 rgba(0, 9, 50, 0.04),
    0 2px 4px rgba(10, 26, 66, 0.07),
    0 16px 30px -12px rgba(4, 64, 160, 0.3);
  transform: translateY(-2px);
}

.module-card .icon {
  font-size: 1.15rem;
  line-height: 1;
  color: var(--blue-raw);
  margin-bottom: 0.15rem;
}

.module-card strong {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  line-height: 1.3;
  color: var(--blue-raw);
}

.module-card span {
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.45;
  color: var(--ink-muted);
}

/* Colores por módulo — fondos metálicos muestreados de la referencia.
   Cada tarjeta combina un degradado diagonal sutil con el brillo
   superior del ::after, que produce el efecto de chapa pulida. */
.module-card.tone-blue {
  background: linear-gradient(168deg, #f4f7fc 0%, #dbe4f3 42%, #cdd8ea 100%);
}

.module-card.tone-gold {
  background: linear-gradient(168deg, #f7fafe 0%, #e4edfb 44%, #d3def0 100%);
}

.module-card.tone-sage {
  background: linear-gradient(168deg, #f6fcff 0%, #dbedfa 44%, #c9dfee 100%);
}

.module-card.tone-clay {
  background: linear-gradient(168deg, #f8fdff 0%, #dff4fb 44%, #cde4ed 100%);
}

.module-card.tone-slate {
  background: linear-gradient(168deg, #f7fbfe 0%, #e4f0fa 44%, #d5e1ee 100%);
}

.module-card[class*="tone-"] .icon {
  opacity: 1;
}

.module-card.tone-blue .icon,
.module-card.tone-blue strong {
  color: var(--navy);
}

.module-card.tone-gold .icon,
.module-card.tone-gold strong {
  color: var(--cobalt);
}

.module-card.tone-sage .icon,
.module-card.tone-sage strong {
  color: #0a5fa8;
}

.module-card.tone-clay .icon,
.module-card.tone-clay strong {
  color: #05587f;
}

.module-card.tone-slate .icon,
.module-card.tone-slate strong {
  color: #23477a;
}

.module-card.tone-blue span {
  color: #3a4f76;
}

.module-card.tone-gold span {
  color: #2a4f86;
}

.module-card.tone-sage span {
  color: #2a6289;
}

.module-card.tone-clay span {
  color: #245c7d;
}

.module-card.tone-slate span {
  color: #45597a;
}

.module-card[class*="tone-"]:hover {
  filter: none;
}

.module-card[class*="tone-"]:focus-visible {
  outline: 2px solid var(--azure);
  outline-offset: 2px;
}

.activity-feed {
  margin-top: 1.25rem;
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font-size: 0.8rem;
}

.activity-feed h3 {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue-raw);
}

.activity-feed ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--ink-secondary);
}

.app-window {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid rgba(203, 216, 235, 0.9);
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(10, 26, 66, 0.05),
    0 12px 34px -18px rgba(10, 26, 66, 0.3);
  overflow: hidden;
}

.window-title {
  margin: 0;
  padding: 1rem 1.25rem 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.window-subtitle {
  margin: 0;
  padding: 0 1.25rem 1rem;
  font-size: 0.8rem;
  color: var(--ink-secondary);
  border-bottom: 1px solid rgba(13, 116, 218, 0.16);
}

.window-body {
  padding: 1.25rem;
  background: linear-gradient(180deg, #ffffff 0%, #fcfdff 100%);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(4, 64, 160, 0.28);
  background: linear-gradient(180deg, #ffffff 0%, #edf5fd 50%, #d9e9f8 100%);
  color: var(--cobalt);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(0, 9, 50, 0.05),
    0 1px 2px rgba(10, 26, 66, 0.06);
  transition: box-shadow 0.16s, border-color 0.16s, color 0.16s;
}

.btn:hover {
  border-color: rgba(13, 116, 218, 0.62);
  color: var(--navy);
  background: linear-gradient(180deg, #ffffff 0%, #e2f0fc 50%, #c9e2f7 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(0, 9, 50, 0.06),
    0 2px 4px rgba(10, 26, 66, 0.08),
    0 8px 18px -10px rgba(4, 64, 160, 0.4);
}

.btn.primary {
  border-color: rgba(4, 64, 160, 0.5);
  background: linear-gradient(180deg, #1268c0 0%, #0c55a6 48%, #032f7d 100%);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    inset 0 -1px 0 rgba(0, 9, 50, 0.24),
    0 1px 2px rgba(4, 64, 160, 0.34),
    0 6px 16px -8px rgba(4, 64, 160, 0.6);
}

.btn.primary:hover {
  border-color: rgba(19, 158, 241, 0.6);
  background: linear-gradient(180deg, #0d5cb0 0%, #094a94 48%, #021f57 100%);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 9, 50, 0.28),
    0 2px 4px rgba(4, 64, 160, 0.38),
    0 10px 24px -8px rgba(13, 116, 218, 0.55);
}

.btn.ghost {
  border-color: rgba(4, 64, 160, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #f0f7fd 50%, #e2eefa 100%);
  color: var(--ink-secondary);
}

.btn.ghost:hover {
  border-color: rgba(13, 116, 218, 0.5);
  color: var(--navy);
}

.btn.solid {
  padding: 0.55rem 1.25rem;
  border-radius: 999px;
  border-color: rgba(4, 64, 160, 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #dcecfb 50%, #c2dcf5 100%);
  color: #06305f;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(10, 26, 66, 0.05);
}

.btn.solid:hover {
  border-color: rgba(4, 64, 160, 0.36);
  color: #04264c;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 2px 4px rgba(10, 26, 66, 0.07),
    0 10px 20px -10px rgba(4, 64, 160, 0.38);
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(150px, 1fr) minmax(110px, 0.7fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 700px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--cobalt);
  margin-bottom: 0.32rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

select,
input[type="search"],
input[type="text"],
textarea {
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(4, 64, 160, 0.38);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #f2f8fd 100%);
  color: var(--navy);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(4, 64, 160, 0.1);
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

select:focus,
input[type="search"]:focus,
input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--cyan);
  /* Solo el color: el atajo `background` borraba la flecha del select al enfocar */
  background-color: #ffffff;
  box-shadow:
    inset 0 1px 2px rgba(10, 26, 66, 0.04),
    0 0 0 3px rgba(19, 158, 241, 0.18);
}

select:hover,
input[type="search"]:hover,
input[type="text"]:hover,
textarea:hover {
  border-color: rgba(13, 116, 218, 0.55);
}

/* Select propio: sin flecha nativa, con color propio y relieve metálico */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.4rem;
  font-weight: 600;
  color: #06305f;
  border: 1px solid rgba(4, 64, 160, 0.45);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6.5 8 10.5l4-4' fill='none' stroke='%2306305f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #cde3fa 0%, #a9cfee 45%, #85b6e2 100%);
  background-repeat: no-repeat, no-repeat;
  background-position: right 0.75rem center, 0 0;
  background-size: 14px 14px, 100% 100%;
  text-overflow: ellipsis;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 4px -1px rgba(4, 64, 160, 0.28),
    0 1px 2px rgba(10, 26, 66, 0.12),
    0 3px 8px -4px rgba(4, 64, 160, 0.38);
}

select:hover {
  border-color: rgba(4, 64, 160, 0.7);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6.5 8 10.5l4-4' fill='none' stroke='%23000932' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #bfdaf7 0%, #9ac4ea 45%, #72a8da 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 4px -1px rgba(4, 64, 160, 0.32),
    0 1px 2px rgba(10, 26, 66, 0.14),
    0 8px 18px -8px rgba(4, 64, 160, 0.55);
}

select:focus {
  border-color: var(--cyan);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6.5 8 10.5l4-4' fill='none' stroke='%23000932' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #d8ebfd 0%, #bcdcf6 45%, #a2cdec 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 3px rgba(19, 158, 241, 0.26);
}

select::-ms-expand {
  display: none;
}

/* Menú desplegable (donde el navegador lo permita) */
select option {
  background: #ffffff;
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 500;
}

/* ---- Desplegable propio: el navegador no dibuja el menú ---- */
/* El <select> original queda en el DOM (por accesibilidad y para que el
   código siga leyendo .value) pero invisible. El tamaño va con !important
   porque las reglas de ancho de cada formulario —incluidas las de celular—
   lo agrandaban y su caja, aunque transparente, desbordaba la página. */
.civfd-native {
  position: absolute !important;
  width: 1px !important;
  min-width: 1px !important;
  max-width: 1px !important;
  height: 1px !important;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.civfd-combo {
  position: relative;
  width: 100%;
}

/* Dentro de una fila flex, el envoltorio ocupa el lugar del campo original.
   En el pedido del laboratorio tiene que conservar el tamaño de .request-select
   (15rem), no estirarse: si crece a todo el ancho empuja el campo de texto y el
   botón a un segundo renglón y el panel queda el doble de alto. */
.chat-compose .civfd-combo,
.lib-search-row .civfd-combo {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.request-row .civfd-combo {
  flex: 0 1 20rem;
  min-width: 15rem;
  max-width: 100%;
}

.request-field .civfd-combo {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.chat-compose .civfd-combo input[type="text"],
.lib-search-row .civfd-combo input {
  width: 100%;
  box-sizing: border-box;
}

.civfd-combo-btn {
  display: flex;
  align-items: center;
  /* Sin space-between: con un solo hijo no reparte nada y deja el texto
     pegado al borde donde vive la flecha de fondo. */
  justify-content: flex-start;
  gap: 0.6rem;
  width: 100%;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  /* La flecha es un background-image, no un elemento: hay que reservarle su
     lugar con padding-right. 14 px de icono + 12 de margen + 10 de aire.
     Con 22 px de reserva el texto terminaba a 3 px DIBUJADOS del chevron y
     parecía meterse debajo; ahora quedan 15. */
  padding: 0.58rem calc(0.7rem + 26px) 0.58rem 0.7rem;
  border: 1px solid rgba(4, 64, 160, 0.45);
  border-radius: var(--radius-sm);
  color: #06305f;
  background-image:
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6.5 8 10.5l4-4' fill='none' stroke='%2306305f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #cde3fa 0%, #a9cfee 45%, #85b6e2 100%);
  background-repeat: no-repeat, no-repeat;
  background-position: right 0.75rem center, 0 0;
  background-size: 14px 14px, 100% 100%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 4px -1px rgba(4, 64, 160, 0.28),
    0 1px 2px rgba(10, 26, 66, 0.12),
    0 3px 8px -4px rgba(4, 64, 160, 0.38);
  cursor: pointer;
  transition: box-shadow 0.16s, border-color 0.16s;
}

.civfd-combo-btn:hover {
  border-color: rgba(4, 64, 160, 0.7);
  background-image:
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6.5 8 10.5l4-4' fill='none' stroke='%23000932' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #bfdaf7 0%, #9ac4ea 45%, #72a8da 100%);
}

.civfd-combo-btn:focus-visible {
  outline: none;
  border-color: var(--cyan);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 3px rgba(19, 158, 241, 0.26);
}

.civfd-combo-label {
  /* Sin min-width: 0 la etiqueta no se contrae dentro del flex (min-width
     auto = ancho del contenido) y el texto avanza igual hasta el chevron. */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.civfd-combo-menu {
  position: fixed;
  z-index: 60;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: #ffffff;
  border: 1px solid rgba(13, 116, 218, 0.28);
  border-radius: var(--radius-sm);
  box-shadow:
    0 1px 2px rgba(10, 26, 66, 0.08),
    0 16px 34px -14px rgba(4, 64, 160, 0.45);
  overflow-y: auto;
}

.civfd-combo-menu.is-up {
  transform: translateY(-100%);
}

.civfd-combo-menu[hidden] {
  display: none;
}

.civfd-combo-opt {
  display: block;
  width: 100%;
  padding: 0.5rem 0.62rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.civfd-combo-opt:hover,
.civfd-combo-opt.is-cursor {
  background: #e3f1fd;
  color: var(--cobalt);
}

.civfd-combo-opt[aria-selected="true"] {
  background: linear-gradient(180deg, #d8ebfd 0%, #bcdcf6 100%);
  color: #06305f;
  font-weight: 700;
}

/* ---- Autocompletado propio: reemplaza el cuadro negro del navegador ---- */
.civfd-suggest {
  position: fixed;
  z-index: 60;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  background: #ffffff;
  border: 1px solid rgba(13, 116, 218, 0.28);
  border-radius: var(--radius-sm);
  box-shadow:
    0 1px 2px rgba(10, 26, 66, 0.08),
    0 16px 34px -14px rgba(4, 64, 160, 0.45);
  max-height: 16rem;
  overflow-y: auto;
}

.civfd-suggest[hidden] {
  display: none;
}

.civfd-suggest-opt {
  display: block;
  width: 100%;
  padding: 0.5rem 0.62rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.civfd-suggest-opt:hover,
.civfd-suggest-opt.is-cursor {
  background: #e3f1fd;
  color: var(--cobalt);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.results-table th,
.results-table td {
  border-bottom: 1px solid var(--border-soft);
  padding: 0.65rem 0.5rem;
  text-align: left;
}

.results-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--blue-raw);
  font-weight: 600;
}

.results-table tbody tr:hover {
  background: var(--blue-light);
}

.message-box {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.82rem;
  background: #f2f8fd;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
}

/* Sin contenido no ocupa espacio: evita el rectángulo vacío al pie del módulo */
.message-box:empty {
  display: none;
}

.message-box.info {
  background: #e9f3fc;
  color: var(--ink);
}

.message-box.empty {
  color: var(--ink-muted);
  font-style: italic;
}

.editor-canvas {
  min-height: 200px;
  background: linear-gradient(180deg, #eaf3fc 0%, #e2eefa 100%);
  border: 1px solid rgba(13, 116, 218, 0.22);
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 9, 50, 0.04);
}

.editor-sources {
  background: linear-gradient(180deg, #ffffff 0%, #f4f9fe 100%);
  border: 1px solid rgba(13, 116, 218, 0.28);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  margin-bottom: 1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(10, 26, 66, 0.05);
}

.editor-sources-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cobalt);
  margin-bottom: 0.4rem;
}

.editor-sources ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--ink-secondary);
}

.editor-sources li + li {
  margin-top: 0.2rem;
}

.editor-empty {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-secondary);
}

.editor-sections {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.editor-field {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid rgba(13, 116, 218, 0.26);
  border-left: 3px solid var(--azure);
  border-radius: var(--radius-sm);
  padding: 0 0.8rem 0.75rem;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(10, 26, 66, 0.06),
    0 5px 14px -10px rgba(4, 64, 160, 0.34);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.editor-field:focus-within {
  border-color: rgba(13, 116, 218, 0.5);
  border-left-color: var(--cobalt);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(10, 26, 66, 0.06),
    0 8px 20px -10px rgba(4, 64, 160, 0.42);
}

.editor-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cobalt);
  background: linear-gradient(180deg, #eaf4fd 0%, #dceafa 100%);
  border-bottom: 1px solid rgba(13, 116, 218, 0.24);
  /* Sin margen negativo: el título debe quedar dentro de la tarjeta, no encima del borde */
  margin: 0 -0.8rem 0.55rem;
  padding: 0.48rem 0.8rem;
  border-radius: 6px 6px 0 0;
  line-height: 1.35;
}

.editor-hint {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  color: var(--ink-secondary);
}

.editor-field textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 4.2rem;
  padding: 0.6rem 0.7rem;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--navy);
  background: #ffffff;
  border: 1px solid rgba(13, 116, 218, 0.26);
  border-radius: 7px;
  box-shadow: inset 0 1px 2px rgba(10, 26, 66, 0.05);
  transition: border-color 0.16s, box-shadow 0.16s;
}

.editor-field textarea::placeholder {
  color: #93a8c2;
}

.editor-field textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow:
    inset 0 1px 2px rgba(10, 26, 66, 0.04),
    0 0 0 3px rgba(19, 158, 241, 0.18);
}

.editor-note {
  min-height: 1.1rem;
  margin: 0.6rem 0 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--cobalt);
}

.editor-path {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--cobalt);
  background: #eaf3fc;
  border: 1px solid rgba(13, 116, 218, 0.24);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  word-break: break-all;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.chat-compose input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 1.5px solid rgba(4, 64, 160, 0.55);
  background: linear-gradient(180deg, #ffffff 0%, #e9f3fc 100%);
  box-shadow:
    inset 0 1px 3px rgba(4, 64, 160, 0.12),
    0 1px 0 rgba(255, 255, 255, 1);
}

.chat-compose input[type="text"]:hover {
  border-color: rgba(13, 116, 218, 0.8);
}

.chat-compose input[type="text"]:focus {
  border-color: var(--cyan);
  background: #ffffff;
  box-shadow:
    inset 0 1px 2px rgba(4, 64, 160, 0.06),
    0 0 0 3px rgba(19, 158, 241, 0.24);
}

.chat-compose input[type="text"]::placeholder {
  color: #5b7191;
  opacity: 1;
}

.module-howto-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: var(--blue-raw);
}

.module-howto-steps {
  margin: 0.35rem 0 0.5rem;
  padding-left: 1.15rem;
  font-size: 0.82rem;
  line-height: 1.45;
}

.module-howto-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

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

.chat-log {
  max-height: 220px;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 0.65rem 0.55rem;
  font-size: 0.8rem;
}

.chat-log .turn-user:first-child {
  margin-top: 0;
  padding-top: 0;
}

.chat-log:empty {
  display: none;
}

.chat-log .turn-user {
  color: var(--blue-raw);
}

.chat-log .turn-bot {
  color: var(--ink-secondary);
  margin-bottom: 0.5rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.65rem 0;
}

.tag,
.lib-tag {
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.34rem 0.72rem;
  background: #f0f7fd;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.lib-tag:hover {
  background: #e4f0fa;
  border-color: rgba(13, 116, 218, 0.32);
  color: var(--navy);
}

.lib-tag.is-active {
  background: #d3e7fa;
  border-color: rgba(4, 64, 160, 0.3);
  color: #06305f;
}

.lib-search-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.lib-search-row input {
  flex: 1;
  min-width: 0;
}

.lib-count {
  flex-shrink: 0;
  font-size: 0.76rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.lib-list {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.lib-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(168deg, #ffffff 0%, #fafcfe 100%);
  border: 1px solid rgba(214, 226, 240, 0.95);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 1);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lib-card:hover {
  border-color: rgba(255, 255, 255, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(10, 26, 66, 0.05),
    0 10px 22px -14px rgba(4, 64, 160, 0.3);
}

.lib-card-body {
  min-width: 0;
}

.lib-card-kind {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gold);
}

.lib-card-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--blue-raw);
}

.lib-card-meta {
  margin: 0.3rem 0 0;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.lib-card-action {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #06305f;
  text-decoration: none;
  background: #d6e8f9;
  border: 1px solid rgba(4, 64, 160, 0.2);
  border-radius: 999px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.lib-card-action:hover {
  background: #c2dcf5;
  border-color: rgba(4, 64, 160, 0.34);
  color: #04264c;
  box-shadow: 0 4px 14px -8px rgba(4, 64, 160, 0.4);
}

.lib-empty {
  margin: 1.25rem 0;
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-muted);
  background: var(--paper);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.lib-footnote {  margin: 1.1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-soft);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

@media (max-width: 560px) {
  .lib-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .lib-card-action {
    align-self: stretch;
    justify-content: center;
  }
}

footer.site-foot {
  text-align: center;
  font-size: 0.72rem;
  color: var(--ink-muted);
  padding: 0 1rem 1.5rem;
}

/* --- Radar: resultados con fuentes reales -------------------------- */

.radar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.radar-card {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(168deg, #ffffff 0%, #f9fcfe 100%);
  border: 1px solid rgba(214, 226, 240, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 1);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.radar-card:hover {
  border-color: rgba(255, 255, 255, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(10, 26, 66, 0.05),
    0 10px 22px -14px rgba(4, 64, 160, 0.28);
}

.radar-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.radar-evidence {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #e6f0fa;
  border: 1px solid rgba(13, 116, 218, 0.2);
  color: #33507c;
}

.radar-evidence.is-meta-analysis,
.radar-evidence.is-rct {
  background: #d8ecfb;
  border-color: rgba(4, 64, 160, 0.26);
  color: #06305f;
}

.radar-evidence.is-review,
.radar-evidence.is-cohort {
  background: #e3effb;
  border-color: rgba(13, 116, 218, 0.24);
  color: #0a3a7d;
}

.radar-evidence.is-preprint {
  background: #eaf6fe;
  border-color: rgba(19, 158, 241, 0.28);
  color: #0b5e8f;
}

.radar-evidence.is-divulgacion,
.radar-evidence.is-sin-fuente {
  background: #f2f8fd;
  border-color: rgba(109, 127, 150, 0.28);
  color: #46618c;
}

.radar-score {
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.radar-card-title {
  margin: 0 0 0.2rem;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--blue-raw);
}

.radar-card-meta {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  color: var(--ink-muted);
}

.radar-card-abstract {
  margin: 0 0 0.45rem;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.radar-card-link {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0a3a7d;
  text-decoration: none;
}

.radar-card-link:hover {
  text-decoration: underline;
}

/* --- Consola de agentes ------------------------------------------- */














.lab-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.28rem;
  vertical-align: middle;
  background: #b9ccdd;
}

.lab-dot.is-ok {
  background: #4f9bbf;
}

.lab-dot.is-idle {
  background: #b9ccdd;
}

.lab-dot.is-err {
  background: #8ba9c7;
}


.lab-engine.is-ia {
  background: #eef6fd;
  color: #06305f;
}

.lab-engine.is-det {
  background: #e6f0fa;
  color: #33507c;
}












.lab-run-stat.is-error {
  color: #3d6f9c;
}


/* --- Acceso a la landing de agentes -------------------------------- */

.lab-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius);
  background: linear-gradient(168deg, #ffffff 0%, #f7fbfe 48%, #edf4fb 100%);
  border: 1px solid rgba(203, 216, 235, 0.9);
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(0, 9, 50, 0.04),
    0 1px 2px rgba(10, 26, 66, 0.04);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.lab-entry:hover {
  border-color: rgba(255, 255, 255, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(0, 9, 50, 0.05),
    0 2px 4px rgba(10, 26, 66, 0.06),
    0 14px 26px -14px rgba(4, 64, 160, 0.28);
}

.lab-entry-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.lab-entry-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
}

.lab-entry-sub {
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.lab-entry-cta {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue-raw);
}

.status-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
  margin-top: 0;
}

/* El aire contra el separador se recortó dos veces 3 mm por lado, así que el
   margen base baja 6 mm en total. Se expresa en milímetros para que el ajuste
   sea exacto y no dependa del tamaño de fuente. El hueco inferior ya venía
   corto: se le deja un piso de 2 px para que la línea no toque la tarjeta. */
.section-divider {
  height: 1px;
  margin: max(3px, calc(2rem - 6mm)) 0 max(2px, calc(1.5rem - 6mm));
  background: var(--border);
}

/* Mismas propiedades que .module-card */
.status-card {
  padding: 1.1rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(203, 216, 235, 0.9);
  background: linear-gradient(168deg, #ffffff 0%, #f8fbfe 48%, #eef5fb 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(0, 9, 50, 0.04),
    0 1px 2px rgba(10, 26, 66, 0.04);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.18s;
}

.status-card:hover {
  border-color: rgba(255, 255, 255, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(0, 9, 50, 0.05),
    0 2px 4px rgba(10, 26, 66, 0.06),
    0 14px 26px -14px rgba(4, 64, 160, 0.26);
  transform: translateY(-1px);
}

.status-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue-raw);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-card ul {
  margin: 0 0 0.85rem;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.radar-hint {
  margin-bottom: 1rem;
  font-size: 0.8rem;
}

.aviso-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: min(520px, 92vw);
  box-shadow: var(--shadow);
}

.aviso-dialog::backdrop {
  background: rgba(28, 31, 36, 0.35);
}

.aviso-dialog form {
  padding: 1.1rem 1.25rem 1.25rem;
}

.aviso-dialog h3 {
  margin: 0 0 0.75rem;
  color: var(--blue-raw);
}

.aviso-pre {
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 0.82rem;
  line-height: 1.45;
  background: #eef5fb;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  max-height: 50vh;
  overflow-y: auto;
  margin: 0 0 1rem;
}
/* ---------- Simulador: resultado ---------- */
.sim-result {
  margin-top: 1.5rem;
  padding: 1.15rem 1.25rem 1.3rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.sim-result[hidden] {
  display: none !important;
}

.sim-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-soft);
}

.sim-result-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--blue-raw);
}

.sim-result-sub {
  margin: 0.25rem 0 0;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.sim-badge {
  flex-shrink: 0;
  padding: 0.25rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid rgba(184, 148, 45, 0.35);
  border-radius: 999px;
}

.sim-chart {
  margin: 1rem 0 0;
}

#sim-chart-svg svg {
  display: block;
  max-width: 100%;
}

.sim-chart-caption {
  margin-top: 0.4rem;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
  margin: 1.1rem 0 0;
}

.sim-metric {
  padding: 0.6rem 0.75rem;
  background: var(--cream);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.sim-metric-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.sim-metric strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1rem;
  font-weight: 650;
  color: var(--blue-raw);
}

.sim-table {
  width: 100%;
  margin-top: 1.15rem;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.sim-table caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 0.45rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.sim-table th {
  text-align: left;
  padding: 0.45rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border);
}

.sim-table td {
  padding: 0.45rem 0.6rem;
  color: var(--ink-secondary);
  border-bottom: 1px solid var(--border-soft);
}

.sim-table tbody tr:last-child td {
  border-bottom: none;
}

.sim-disclaimer {
  margin: 0.85rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-soft);
  font-size: 0.74rem;
  color: var(--ink-muted);
}

/* ---------- Simulador: historial horizontal ---------- */
.sim-history-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-soft);
}

.sim-history-section[hidden] {
  display: none !important;
}

.sim-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.sim-history-head h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue-raw);
}

.sim-history-count {
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-left: auto;
}

/* Borrar historial: acción deliberada, no decorativa */
.sim-history-clear {
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.24rem 0.55rem;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid rgba(13, 116, 218, 0.22);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.sim-history-clear:hover {
  color: #8a2f2f;
  border-color: rgba(160, 60, 60, 0.42);
  background: #fdf3f3;
}

.sim-history-clear:focus-visible {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(19, 158, 241, 0.24);
}

.sim-history-track {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.65rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.6rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.sim-history-track::-webkit-scrollbar {
  height: 7px;
}

.sim-history-track::-webkit-scrollbar-track {
  background: #eef5fb;
  border-radius: 999px;
}

.sim-history-track::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.sim-history-track::-webkit-scrollbar-thumb:hover {
  background: var(--blue-mid);
}

.sim-card {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 92vw;
  padding: 0.42rem 0.75rem;
  background: var(--paper);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  scroll-snap-align: start;
  font-size: 0.74rem;
  line-height: 1.2;
  white-space: nowrap;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.sim-card:hover {
  border-color: rgba(184, 148, 45, 0.5);
  box-shadow: 0 2px 8px rgba(61, 90, 128, 0.07);
}

.sim-card-index {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

.sim-card-time {
  font-size: 0.66rem;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.sim-card-sep {
  color: var(--border);
  flex-shrink: 0;
}

.sim-card-hypothesis {
  font-weight: 600;
  color: var(--blue-raw);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}

.sim-card-outcome {
  flex-shrink: 0;
  padding: 0.12rem 0.45rem;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-dim);
  border-radius: 999px;
}

.sim-card-view {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.15rem;
  padding: 0.22rem 0.6rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue-raw);
  background: var(--blue-light);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.sim-card-view:hover {
  background: #d6e8f9;
  border-color: #d6e8f9;
  color: #0a3a7d;
}

.sim-card-view svg {
  flex-shrink: 0;
}

.sim-history-hint {
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.sim-history-hint[hidden] {
  display: none !important;
}

/* ==================================================================
   Mobile: orden y centrado
   En pantallas angostas el contenido se apretaba en dos frentes:
   el nav partía los textos en dos líneas (el botón quedaba de 50 px de
   alto) y las tarjetas de módulos dejaban media caja vacía a la derecha
   porque el texto vive pegado arriba a la izquierda.
   ================================================================== */
@media (max-width: 560px) {
  /* --- Navegación: tres pastillas parejas, en una sola línea --- */
  .site-nav {
    gap: 0.35rem;
    padding: 0.55rem 0.75rem;
  }

  /* Tres pastillas parejas. Si el texto no entra en un renglón se acomoda en
     dos, centrado y sin que la pastilla se estire: antes "Estado del
     servicio" empujaba el botón a 50 px de alto y descuadraba la fila. */
  .site-nav {
    align-items: stretch;
  }

  .site-nav-link {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.35rem;
    font-size: 0.64rem;
    letter-spacing: 0.02em;
    text-align: center;
    white-space: normal;
    overflow-wrap: break-word;
    line-height: 1.25;
    min-height: 2.5rem;
  }

  /* --- Encabezado de marca: todo alineado al mismo eje --- */
  .site-brand {
    padding: 0.85rem 1rem;
  }

  /* La sangría está pensada para la "C" del logo grande; en pantallas
     angostas deja el nombre desalineado respecto del logo y del contexto.
     OJO: al perder la sangría el nombre pasa a ocupar el ancho completo y
     cae debajo del CÍRCULO, no del wordmark. Por eso acá el margen negativo
     de escritorio se reemplaza: montaría el nombre sobre el círculo.
     Se conserva el aire que tenía antes (2 mm menos el aire muerto del SVG). */
  .brand-fullname {
    margin-left: 0;
    margin-top: calc(2mm - 2.9px);
    font-size: 0.74rem;
    line-height: 1.4;
  }

  /* --- Portada: las tarjetas se leen centradas --- */
  main.shell {
    padding: 1rem 0.85rem 2.5rem;
  }

  .module-grid {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .module-card {
    align-items: center;
    text-align: center;
    padding: 1.15rem 1rem;
    gap: 0.3rem;
  }

  .module-card .icon {
    font-size: 1.35rem;
    margin-bottom: 0.1rem;
  }

  .module-card strong {
    font-size: 0.76rem;
    letter-spacing: 0.07em;
  }

  .module-card span {
    font-size: 0.62rem;
  }

  /* --- Tarjeta de entrada al lienzo: título y llamada apilados --- */
  .lab-entry {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 1rem 1.1rem;
  }

  .lab-entry-main {
    align-items: center;
  }

  .lab-entry-cta {
    font-size: 0.66rem;
  }

  /* --- Hoy disponible / Pendiente: una columna, sin aire de más --- */
  .status-split {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .status-card {
    padding: 1rem 1.05rem;
  }

  .status-card ul {
    padding-left: 1rem;
  }

  /* --- Estado del servicio: acciones a lo ancho, no apiladas a la izquierda --- */
  .service-actions {
    flex-direction: column;
    gap: 0.45rem;
  }

  .service-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Por debajo de 380 px se recorta solo el aire, no la letra: el cuerpo del
   nav ya se adapta con la fórmula en vw. */
@media (max-width: 380px) {
  .site-nav {
    padding: 0.5rem 0.5rem;
  }

  main.shell {
    padding: 0.9rem 0.7rem 2.25rem;
  }
}

/* Módulos en celular: el padding de escritorio (1.25rem) se comía 40 px de
   ancho útil por lado entre la tarjeta y su contenido. Se achica para que los
   resultados se lean en 390 px sin apretar el texto. */
@media (max-width: 560px) {
  .window-title {
    padding: 0.85rem 0.9rem 0.3rem;
    font-size: 0.95rem;
  }

  .window-subtitle {
    padding-inline: 0.9rem;
  }

  .window-body {
    padding: 0.9rem;
  }

  .radar-card {
    padding: 0.8rem 0.85rem;
  }

  .toolbar {
    gap: 0.4rem;
  }
}

/* ==================================================================
   Botón "Subir" — mismo formato que el de Capime, con el azul CIVFD
   Capime: píldora fija abajo a la derecha, texto "Subir", aparece
   recién después de 360 px de scroll y se oculta al imprimir.
   ================================================================== */
.civfd-subir {
  position: fixed;
  right: clamp(12px, 2.5vw, 24px);
  bottom: 22px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  min-height: 44px;
  padding: 12px 22px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  background: linear-gradient(
    168deg,
    var(--cobalt) 0%,
    #05348a 48%,
    #022a6d 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 6px 20px rgba(0, 9, 50, 0.28);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease;
}

/* Oculto por defecto: aparece cuando hay recorrido suficiente. */
.civfd-subir[hidden] {
  display: none !important;
}

.civfd-subir:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.civfd-subir:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.civfd-subir:active {
  transform: translateY(0);
}

@media (max-width: 560px) {
  .civfd-subir {
    right: 12px;
    bottom: 16px;
    min-width: 72px;
    padding: 10px 18px;
    font-size: 0.82rem;
  }
}

/* Al imprimir no tiene sentido. */
@media print {
  .civfd-subir {
    display: none !important;
  }
}
