/* Radar Empresas — hoja única, sin dependencias. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --ink: #141a24;
  --ink-2: #3b4555;
  --muted: #6b7486;
  --line: #e2e6ec;
  --line-2: #d3d9e2;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-soft: #e8eefc;
  --amber: #f59e0b;
  --ok: #15803d;      --ok-soft: #e7f5ec;
  --warn: #b45309;    --warn-soft: #fdf3e2;
  --bad: #b91c1c;     --bad-soft: #fbeaea;
  --f-alta: #15803d;
  --f-organo: #1d4ed8;
  --f-capital: #7c3aed;
  --f-estructura: #0e7490;
  --f-baja: #b91c1c;
  --f-otros: #6b7486;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117;
    --surface: #151a22;
    --surface-2: #1b212b;
    --ink: #e6e9ef;
    --ink-2: #c3c9d4;
    --muted: #8a93a5;
    --line: #262d39;
    --line-2: #323a48;
    --accent: #6d95ff;
    --accent-ink: #0b1020;
    --accent-soft: #1b2643;
    --ok: #4ade80;      --ok-soft: #13291c;
    --warn: #fbbf24;    --warn-soft: #2d230f;
    --bad: #f87171;     --bad-soft: #2f1517;
    --f-alta: #4ade80;
    --f-organo: #6d95ff;
    --f-capital: #b794ff;
    --f-estructura: #22c3dd;
    --f-baja: #f87171;
    --f-otros: #8a93a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.sprite { display: none; }
[hidden] { display: none !important; }
.i {
  width: 1em; height: 1em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.125em;
}
.mono { font-family: var(--mono); font-size: .93em; letter-spacing: -.01em; }
.tenue { color: var(--muted); }
.pequeno { font-size: 12px; }
.num { text-align: right; white-space: nowrap; }
kbd {
  font: 11px var(--mono); padding: 0 5px; border: 1px solid var(--line-2);
  border-bottom-width: 2px; border-radius: 4px; background: var(--surface);
}

/* Barra de progreso de las peticiones */
.progreso {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 50;
  background: linear-gradient(90deg, var(--accent), var(--amber));
  transform: scaleX(0); transform-origin: left; opacity: 0;
  transition: transform .4s ease, opacity .3s ease;
}
.progreso.activo { opacity: 1; transform: scaleX(.7); transition: transform 6s cubic-bezier(.1, .7, .1, 1); }

/* Cabecera */
.barra {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.marca { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 16px; letter-spacing: -.01em; }
.marca:hover { text-decoration: none; }
.marca b { font-weight: 700; }
.marca-logo { width: 26px; height: 26px; }
.logo-fondo { fill: var(--accent); }
.logo-anillo { fill: none; stroke: #fff; stroke-opacity: .55; stroke-width: 1.6; }
.logo-haz { fill: #fff; fill-opacity: .28; }
.logo-aguja { stroke: #fff; stroke-width: 1.8; stroke-linecap: round; }
.logo-centro { fill: #fff; }
.logo-eco { fill: var(--amber); }
/* Detalle: el radar barre al pasar por encima de la marca; en el login, una vuelta al entrar. */
.logo-barrido { transform-origin: 16px 16px; }
.marca:hover .logo-barrido { animation: barrido 2.4s linear infinite; }
.login .logo-barrido { animation: barrido 1.6s cubic-bezier(.3, .1, .2, 1) 1; }
@keyframes barrido { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .logo-barrido { animation: none !important; } }
.marca-logo.grande { width: 48px; height: 48px; }
.pestanas { display: flex; gap: 4px; height: 100%; }
.pestanas a {
  display: flex; align-items: center; gap: 7px; padding: 0 12px;
  color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.pestanas a:hover { color: var(--ink); text-decoration: none; }
.pestanas a.activa { color: var(--ink); border-bottom-color: var(--accent); }
.usuario { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }

main { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px; }
.pie {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  max-width: 1480px; width: 100%; margin: 0 auto; padding: 16px 24px 24px;
  color: var(--muted); font-size: 12px;
}
.pie .sql { font-family: var(--mono); }

/* Controles */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: 500 13px var(--sans); cursor: pointer; white-space: nowrap;
}
.boton:hover { border-color: var(--muted); text-decoration: none; }
.boton.primario { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.boton.primario:hover { filter: brightness(1.08); }
.boton.pequeno { height: 28px; padding: 0 10px; font-size: 12px; }
.boton.mas { width: 100%; margin-top: 12px; }
.enlace { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.enlace:hover { text-decoration: underline; }

input, select {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: 14px var(--sans);
}
input:focus, select:focus, .boton:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-color: var(--accent);
}
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.con-icono { position: relative; display: block; }
.con-icono .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.con-icono input { padding-left: 34px; }
.con-icono.grande input { height: 46px; font-size: 16px; padding-left: 40px; }
.con-icono.grande .i { left: 14px; font-size: 17px; }

/* Avisos */
.aviso {
  padding: 10px 14px; border-radius: 8px; margin: 0 0 14px;
  background: var(--warn-soft); color: var(--ink-2); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
}
.aviso-error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.nota { color: var(--muted); font-size: 12px; margin: 14px 0 0; }
.vacio { text-align: center; color: var(--muted); padding: 48px 16px; }

/* Buscador */
.buscador { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.filtros {
  position: sticky; top: 80px;
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.campo { display: flex; flex-direction: column; gap: 5px; border: 0; padding: 0; margin: 0; min-width: 0; }
.campo > span:first-child, .campo legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0; }
.campo small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.campo-doble { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.campo-doble > * { min-width: 0; }
.segmentos { display: flex; background: var(--surface-2); padding: 3px; border-radius: 9px; gap: 2px; }
.segmentos label { flex: 1; }
.segmentos input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmentos span {
  display: block; text-align: center; padding: 5px 4px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer; user-select: none;
}
.segmentos input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmentos input:focus-visible + span { outline: 2px solid var(--accent); }
.acciones { display: flex; gap: 8px; }
.acciones .primario { flex: 1; }

.resultados { min-width: 0; transition: opacity .15s; }
.resultados.cargando-datos, .carga.cargando-datos { opacity: .55; }
.resultados-cabecera { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cuenta { margin: 0; color: var(--ink-2); }
.cuenta strong { color: var(--ink); font-size: 15px; }

.bienvenida {
  padding: 40px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 7%, transparent), transparent 40%),
    var(--surface);
}
.bienvenida h2 { font-size: 20px; margin-bottom: 6px; }
.bienvenida > p { color: var(--muted); margin: 0 0 22px; }
.ejemplos { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ejemplos li { display: flex; gap: 12px; align-items: baseline; }
.ejemplos a { font-family: var(--mono); font-size: 13px; background: var(--accent-soft); padding: 3px 9px; border-radius: 6px; }
.ejemplos span { color: var(--muted); font-size: 12.5px; }

/* Tablas */
.tabla-envoltura {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tabla { width: 100%; border-collapse: collapse; }
.tabla th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  position: sticky; top: 0;
}
.tabla td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla.empresas tbody tr:hover, .persona-empresas tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.tabla .nombre { font-weight: 500; min-width: 280px; }
.tabla .nombre a { color: var(--ink); }
.tabla .nombre a:hover { color: var(--accent); }
.tabla .ubicacion { color: var(--ink-2); font-size: 13px; }
.tabla .contacto { white-space: nowrap; text-align: right; }
.tabla .contacto a { color: var(--muted); padding: 2px 4px; font-size: 15px; }
.tabla .contacto a:hover { color: var(--accent); }

.estado {
  display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 1px;
}
.estado.grande { font-size: 11.5px; padding: 3px 10px; margin: 0; }
.estado-vigente { background: var(--ok-soft); color: var(--ok); }
.estado-vigente::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent); }
.estado-disuelta, .estado-concurso { background: var(--warn-soft); color: var(--warn); }
.estado-extinguida { background: var(--surface-2); color: var(--muted); }

.paginacion { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 14px; }
.paginacion a {
  min-width: 32px; height: 32px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; color: var(--ink-2);
}
.paginacion a:hover { background: var(--surface); text-decoration: none; }
.paginacion a.actual { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.paginacion .hueco { color: var(--muted); padding: 0 4px; }
.paginacion .tenue { margin-left: 8px; font-size: 12px; }

/* Ficha */
.miga { margin-bottom: 12px; font-size: 13px; }
.miga a { color: var(--muted); }
.ficha-cabecera {
  position: relative; padding: 24px 24px 20px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
/* Detalle: el canto de una hoja registral */
.ficha-cabecera::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: linear-gradient(var(--accent), var(--amber));
}
.titulo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 6px; }
.titulo h1 { font-size: 24px; letter-spacing: -.015em; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.titulo-icono { color: var(--muted); font-size: 22px; }
.etiquetas { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.chip {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px 7px; min-height: 28px; padding: 3px 10px;
  border: 1px solid var(--line-2); border-radius: 7px; background: var(--surface);
  color: var(--ink); font: 13px var(--sans); cursor: default;
}
a.chip, button.chip { cursor: pointer; }
a.chip:hover, button.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip .i { color: var(--muted); }
.chip-k { font: 600 10.5px var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.chip.copiado { border-color: var(--ok); }
.chip.copiado::after { content: "Copiado"; font-size: 11px; color: var(--ok); }
.direccion { margin: 0; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.direccion a { display: inline-flex; align-items: center; gap: 5px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kpi.ancho { grid-column: span 2; }
.kpi-k { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kpi strong { font-size: 21px; letter-spacing: -.01em; font-weight: 650; }
.kpi-n { font-size: 12px; color: var(--muted); }
.kpi abbr { text-decoration: underline dotted; cursor: help; }

.ficha-columnas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.panel {
  padding: 18px 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0;
}
.panel > h2 { font-size: 15px; font-weight: 650; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel > h2 .i { color: var(--muted); }
.panel h3 {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 16px 0 6px;
}
.panel h3:first-of-type { margin-top: 0; }
.contador {
  display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: center;
}
.tabla.cargos td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.tabla.cargos td + td { padding-left: 12px; }
.tabla.cargos tr:last-child td { border-bottom: 0; }
.tabla.cargos .cargo { color: var(--muted); width: 38%; font-size: 13px; }
.tabla.cargos tr.cesado td:nth-child(2) a { color: var(--ink-2); }
.enlace-sociedad { display: inline-flex; gap: 6px; align-items: center; }

.desplegable { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.desplegable summary { cursor: pointer; color: var(--ink-2); font-weight: 500; list-style: none; display: flex; align-items: center; gap: 8px; }
.desplegable summary::-webkit-details-marker { display: none; }
.desplegable summary::before { content: "›"; display: inline-block; transition: transform .15s; color: var(--muted); font-size: 16px; }
.desplegable[open] summary::before { transform: rotate(90deg); }
.desplegable > :not(summary) { margin-top: 10px; }
.cargando { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.cargando::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--accent); animation: giro .7s linear infinite;
}
@keyframes giro { to { transform: rotate(360deg); } }

.tabla.capital td, .tabla.capital th { padding: 6px 8px; }
.tabla.capital th { position: static; }
.barra-col { width: 28%; }
.barra-capital {
  display: block; height: 8px; border-radius: 4px; margin-top: 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--f-capital) 55%, transparent), var(--f-capital));
}

.datos { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.datos dt { color: var(--muted); font-size: 13px; }
.datos dd { margin: 0; }
.texto-largo { white-space: pre-line; color: var(--ink-2); }
.lista-simple { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }

/* Relaciones */
.relaciones { display: grid; gap: 14px; }
.relacion { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.relacion:last-child { border-bottom: 0; padding-bottom: 0; }
.relacion-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.relacion-nombre { font-weight: 600; color: var(--ink); }
.relacion-empresas { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); display: grid; gap: 5px; }
.relacion-empresas li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; }
.relacion-empresas li.historico a { color: var(--ink-2); }
.relacion-empresas li.historico { opacity: .75; }
.cargos-mini { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.cargo-mini {
  font-size: 11px; padding: 0 6px; border-radius: 5px; line-height: 18px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.cargo-mini.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* Cronología de actos */
.filtro-tipos { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tipo input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tipo span {
  --c: var(--f-otros);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  border: 1px solid var(--line-2); font-size: 12px; color: var(--ink-2); cursor: pointer; user-select: none;
}
.tipo span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.tipo b { font-weight: 600; color: var(--muted); }
.tipo input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); color: var(--ink); }
.tipo input:focus-visible + span { outline: 2px solid var(--accent); }
.tipo-alta { --c: var(--f-alta); }
.tipo-organo { --c: var(--f-organo); }
.tipo-capital { --c: var(--f-capital); }
.tipo-estructura { --c: var(--f-estructura); }
.tipo-baja { --c: var(--f-baja); }
.tipo-otros { --c: var(--f-otros); }
.tipo.tipo-alta span { --c: var(--f-alta); }
.tipo.tipo-organo span { --c: var(--f-organo); }
.tipo.tipo-capital span { --c: var(--f-capital); }
.tipo.tipo-estructura span { --c: var(--f-estructura); }
.tipo.tipo-baja span { --c: var(--f-baja); }

.cronologia { list-style: none; margin: 0; padding: 0; position: relative; }
.cronologia::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.anuncio { position: relative; padding: 0 0 18px 26px; }
.anuncio::before {
  content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--line-2);
}
.anuncio-cab { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; font-size: 12.5px; }
.anuncio-cab time { font-weight: 650; color: var(--ink); font-size: 13.5px; }
.anuncio-enlaces { margin-left: auto; display: inline-flex; gap: 12px; }
.anuncio-enlaces a, .anuncio-enlaces .enlace { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.actos { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.acto {
  --c: var(--f-otros);
  padding: 7px 10px 7px 12px; border-radius: 8px; background: var(--surface-2);
  border-left: 3px solid var(--c);
}
.acto-tipo { font-size: 11.5px; font-weight: 650; color: var(--c); text-transform: uppercase; letter-spacing: .03em; }
.texto-acto { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.texto-acto.plegado { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.texto-acto.plegado::after { content: ""; }
.inscripcion { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* Modal del anuncio */
.modal {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.modal::backdrop { background: rgba(10, 14, 22, .45); backdrop-filter: blur(2px); }
.modal-cerrar {
  position: sticky; float: right; top: 10px; margin: 10px 10px 0 0; z-index: 1;
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
#modal-cuerpo { padding: 22px 26px 24px; }
.anuncio-completo h2 { font-size: 17px; margin: 4px 0 14px; padding-right: 40px; }
.anuncio-completo header p { margin: 0; font-size: 12.5px; }
.texto-borme {
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 16px; padding: 16px;
  background: var(--surface-2); border-radius: 8px; font: 13px/1.6 var(--mono); color: var(--ink-2);
}
.anuncio-completo footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Personas */
.personas-busqueda { max-width: 820px; margin: 0 auto; display: grid; gap: 20px; }
.lista-personas {
  list-style: none; margin: 0; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.lista-personas li { display: flex; align-items: center; justify-content: space-between; border-radius: 7px; }
.lista-personas li:hover { background: var(--surface-2); }
.lista-personas a { flex: 1; display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: var(--ink); }
.lista-personas a .i { color: var(--muted); }
.lista-personas .contador { margin-right: 10px; }
.persona-empresas tr.historico td { color: var(--muted); }
.persona-empresas tr.historico .nombre a { color: var(--ink-2); font-weight: 400; }

/* Acceso */
.pantalla-login { display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 35%),
    radial-gradient(circle at 85% 90%, color-mix(in srgb, var(--amber) 10%, transparent), transparent 35%),
    var(--bg);
}
.login {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 40px rgba(16, 24, 40, .08);
}
.login h1 { font-size: 22px; font-weight: 500; }
.login h1 b { font-weight: 700; }
.login .sub { margin: -6px 0 6px; color: var(--muted); }
.login label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.login .boton { height: 40px; margin-top: 4px; }

/* Fechas de constitución */
.sub-campo { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
input[type="date"] { font-variant-numeric: tabular-nums; padding: 0 4px 0 8px; min-width: 0; font-size: 13px; }
.atajos { display: flex; flex-wrap: wrap; gap: 4px; }
.atajos button {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  border-radius: 99px; padding: 1px 8px; font: 11.5px var(--sans); cursor: pointer;
}
.atajos button:hover { border-color: var(--accent); color: var(--accent); }

/* Catálogo CNAE */
.cnae-pagina { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.cnae-cabecera { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.cnae-cabecera h1 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.cnae-cabecera h1 .tenue { font-weight: 500; font-size: 14px; margin-left: 6px; }
.cnae-cabecera p { margin: 4px 0 0; font-size: 13px; }
.cnae-provincia { width: 230px; }
.cnae-herramientas { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cnae-herramientas .con-icono { flex: 1; min-width: 240px; }
.cnae-botones { display: flex; gap: 6px; flex-wrap: wrap; }
.cnae-secciones { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
.chip-seccion {
  width: 30px; height: 28px; border-radius: 7px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); font: 600 12.5px var(--mono); cursor: pointer;
}
.chip-seccion:hover { border-color: var(--accent); }
.chip-seccion.activa { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.arbol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.arbol .fila {
  display: grid; grid-template-columns: 22px 18px 58px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 5px 8px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; border-radius: 0;
}
.arbol .fila:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.arbol .fila > .casilla { grid-column: 2; }
.arbol .fila > .codigo { grid-column: 3; }
.arbol .seccion { background: var(--surface-2); font-weight: 600; margin-top: 0; }
.arbol .seccion .codigo { font: 700 13px var(--mono); color: var(--accent); }
.arbol .nivel-0 .actividad { font-weight: 600; }
.arbol .nivel-1 .codigo { padding-left: 12px; }
.arbol .nivel-1 .actividad { padding-left: 12px; }
.arbol .nivel-2 .codigo { padding-left: 24px; color: var(--muted); }
.arbol .nivel-2 .actividad { padding-left: 24px; color: var(--ink-2); }
.arbol .codigo { font-size: 12.5px; white-space: nowrap; }
.arbol .actividad { min-width: 0; }
.arbol .n { color: var(--muted); font-size: 12px; text-align: right; min-width: 60px; }
.arbol mark { background: color-mix(in srgb, var(--amber) 35%, transparent); color: inherit; border-radius: 2px; }
.arbol .coincide .actividad { color: var(--ink); }
.arbol .vacio { padding: 24px; text-align: center; color: var(--muted); list-style: none; }
.plegar {
  grid-column: 1; width: 22px; height: 22px; border: 0; background: none; color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer; border-radius: 5px; transition: transform .12s;
}
.plegar:hover { background: var(--surface-2); color: var(--ink); }
.plegar.abierta { transform: rotate(90deg); }
.casilla {
  width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-2); background: var(--surface);
  display: grid; place-items: center; position: relative;
}
.marcada > .casilla { background: var(--accent); border-color: var(--accent); }
.marcada > .casilla::after {
  content: ""; width: 8px; height: 4px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}
.parcial > .casilla { border-color: var(--accent); }
.parcial > .casilla::after { content: ""; width: 8px; height: 2px; background: var(--accent); border-radius: 1px; }
.arbol .marcada { background: color-mix(in srgb, var(--accent) 6%, transparent); }

.cnae-seleccion { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 100px); overflow: auto; }
.cnae-seleccion > h2 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; margin: 0; }
.sel-rangos { display: grid; gap: 6px; }
.sel-rangos > p { margin: 0; }
.sel-rango {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; align-items: center;
  padding: 6px 8px; border-radius: 8px; background: var(--accent-soft); font-size: 12.5px;
}
.sel-rango code { color: var(--accent); font-weight: 600; }
.sel-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.sel-rango .n { color: var(--muted); font-size: 11.5px; }
.sel-rango .enlace { color: var(--muted); }
.sel-rango .enlace:hover { color: var(--bad); }
.sel-total { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.sel-total strong { font-size: 22px; font-weight: 650; }
.sel-expresion {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  border: 1px dashed var(--line-2); background: var(--surface); overflow-wrap: anywhere;
}
.sel-expresion code { flex: 1; font-size: 13px; }
.sel-expresion .copiado { color: var(--ok); }
.sel-manual-fila { display: flex; gap: 6px; }
.sel-manual-fila input { height: 30px; font-size: 13px; }
.error-campo { color: var(--bad) !important; min-height: 1em; }

/* Pantallas estrechas */
@media (max-width: 1100px) {
  .ficha-columnas, .cnae-pagina { grid-template-columns: minmax(0, 1fr); }
  .cnae-seleccion { position: static; max-height: none; order: -1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  main { padding: 16px; }
  .barra { padding: 0 16px; gap: 12px; }
  .marca span { display: none; }
  .buscador { grid-template-columns: minmax(0, 1fr); }
  .filtros { position: static; }
  .tabla .nombre { min-width: 200px; }
  .arbol .fila { grid-template-columns: 22px 18px 52px minmax(0, 1fr); }
  .arbol .n { display: none; }
  .datos { grid-template-columns: minmax(0, 1fr); }
  .kpi.ancho { grid-column: auto; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .usuario span { display: none; }
  .pestanas a { padding: 0 7px; gap: 0; }
  .pestanas a .i { display: none; }
  .barra { gap: 8px; }
}
