/* Panel IGA · app de banco moderna, clara y funcional. En la barra solo entra lo que existe. */
:root {
  --bg: #f4f6f8; --card: #fff; --ink: #0b1220; --mut: #5b6472; --line: #e3e7ec; --borde: #c9d1da;
  --acc: #61214f; --acc-osc: #4b1a3d; --acc2: #f5ecf3; --rojo: #b42318; --mal2: #fde8e8;
  --fuente: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100dvh; color: var(--ink); font: 500 15px/1.5 var(--fuente); background: var(--bg); }
::selection { background: var(--acc2); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.inline { display: inline; }
.enlace { font: inherit; background: none; border: 0; padding: 0; color: var(--acc); font-weight: 600; cursor: pointer; }
.enlace.r { color: var(--rojo); }

/* Barra superior */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 22px; padding: 12px 28px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; line-height: 1.15; }
.logo-tile { display: grid; place-items: center; width: 40px; height: 36px; border-radius: 10px; background: var(--acc); flex: none; }
.logo-iga { display: block; width: 26px; aspect-ratio: 800 / 324; background: #fff;
  -webkit-mask: url(/static/logo_iga.png) center / contain no-repeat; mask: url(/static/logo_iga.png) center / contain no-repeat; }
.logo span small { display: block; font-weight: 500; color: var(--mut); font-size: 12px; }
.nav { display: flex; gap: 6px; }
.nav a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: var(--mut); font-weight: 600; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--acc2); color: var(--acc); }
.user { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--mut); font-weight: 600; font-size: 14px; }
.user i { width: 32px; height: 32px; border-radius: 50%; background: #dfe6ee; display: grid; place-items: center; font-style: normal; color: var(--ink); font-weight: 800; }
.user a { color: var(--mut); text-decoration: none; }
.user a:hover, .user .enlace:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.user a.on { color: var(--acc); }
.user .enlace { color: var(--mut); font-size: 14px; }

/* Contenido */
.contenido { max-width: 1040px; margin: 28px auto; padding: 0 20px; display: grid; gap: 22px; }
.titulo h1 { font-size: 26px; margin: 0 0 4px; font-weight: 800; letter-spacing: -.01em; }
.sub { color: var(--mut); margin: 0; }
h2 { margin: 0; font-size: 18px; font-weight: 800; }
.cuenta { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--bg); color: var(--mut); font-size: 13px; font-weight: 700; margin-left: 6px; vertical-align: 2px; }
.aviso { margin: 0; padding: 11px 14px; border-radius: 10px; font-weight: 600; border: 1px solid transparent; }
.aviso-ok { background: var(--acc2); color: var(--acc); border-color: #e5cfe0; }
.aviso-mal { background: var(--mal2); color: var(--rojo); border-color: #f4c4c0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.card-form { display: grid; gap: 16px; }
.card-estrecha { max-width: 440px; }

/* Subida */
.drop { position: relative; display: grid; gap: 4px; text-align: center; border: 2px dashed var(--borde); border-radius: 12px; padding: 30px 20px; background: #fafbfc; cursor: pointer; transition: border-color .15s, background .15s; }
.drop input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop b { font-size: 17px; overflow-wrap: anywhere; }
.drop span { color: var(--mut); font-size: 14px; }
.drop:hover, .drop.sobre { border-color: var(--acc); background: #faf5f9; }
.drop.lleno { border-style: solid; border-color: var(--acc); background: var(--acc2); }
.fila { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: end; margin-top: 16px; }
.opcion { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--ink); padding: 11px 4px; white-space: nowrap; cursor: pointer; }
.opcion input { width: 18px; height: 18px; accent-color: var(--acc); margin: 0; }
.campo { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--mut); }
input[type=text], input[type=password], input[type=search], input[type=date], input:not([type]) { font: inherit; font-weight: 500; color: var(--ink); padding: 11px 12px; border: 1px solid var(--borde); border-radius: 9px; background: #fff; width: 100%; }
input[type=date] { box-sizing: border-box; min-height: 46px; font-family: var(--fuente); }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }
input::placeholder { color: #7c8593; }
input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc2); }
.btn { font: inherit; font-weight: 700; padding: 12px 22px; border-radius: 9px; border: 0; background: var(--acc); color: #fff; cursor: pointer; transition: background .15s; }
.btn:hover { background: var(--acc-osc); }
.btn:disabled { background: #c7cbd3; cursor: not-allowed; }
.btn-ancho { width: 100%; }

/* Lista */
.head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.buscar { width: 240px; padding: 9px 12px; }
.vacio { color: var(--mut); margin: 0; padding: 8px 0; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th { text-align: left; font-size: 12px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; padding: 0 12px 12px 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.tabla td { padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tr:last-child td { border: 0; }
.tabla th:last-child, .tabla td:last-child { padding-right: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--mut); white-space: nowrap; }
.fecha { white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc { display: flex; gap: 12px; align-items: center; min-width: 0; }
.ext { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 11px; background: #eef2f6; color: var(--mut); flex: none; }
.ext-xlsx, .ext-xls, .ext-xlsm { background: #e3f4ea; color: #1d6f42; }
.ext-pdf { background: #fde8e8; color: var(--rojo); }
.ext-csv { background: #e6eefc; color: #1d4ed8; }
.doc-t { min-width: 0; display: grid; gap: 1px; }
.nombre { font-weight: 700; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.nombre:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--acc); }
.doc-t small { color: var(--mut); font-size: 13px; }
.acc { white-space: nowrap; text-align: right; }
.acc-i { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.chip { font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .02em; padding: 5px 10px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; margin-right: 6px; }
.chip.privado { background: var(--acc2); color: var(--acc); border-color: #e2cfdc; }
.chip.publico { background: #e3f4ea; color: #1d6f42; border-color: #bfe3cc; }
.chip:hover { filter: brightness(.96); }
.acc a, .acc .enlace { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13px; background: #fff; transition: background .15s, border-color .15s; }
.acc a:hover, .acc .enlace:hover { background: var(--bg); border-color: var(--borde); }
.acc .enlace.r { color: var(--rojo); }

/* Entrar */
.pantalla-entrar .contenido { max-width: 420px; padding-top: clamp(30px, 12vh, 110px); }
.entrar { display: grid; gap: 22px; }
.logo-grande { justify-content: center; font-size: 22px; }
.logo-grande { flex-direction: column; gap: 8px; text-align: center; }
.logo-iga-grande { width: 120px; background: var(--acc); }
.logo-viga { display: block; height: 36px; width: auto; }
.logo-viga-grande { height: 72px; }

/* Conmutador desarrollo / como Ismael (solo usuarios de desarrollo) */
.vista { display: flex; padding: 3px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); }
.vista button { font: inherit; font-size: 13px; font-weight: 700; border: 0; background: none; color: var(--mut); padding: 6px 11px; border-radius: 7px; cursor: pointer; }
.vista button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgb(11 18 32 / .12); }
.modo-dev .top { box-shadow: inset 0 3px 0 #d97706; }
.modo-dev .vista button.on:first-child { color: #92400e; }
.maquina { font-size: 12px; font-weight: 800; letter-spacing: .06em; color: #fff; padding: 5px 10px; border-radius: 7px; white-space: nowrap; }
.maquina-viga { background: #61214f; }
.maquina-ismael { background: #0e7490; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Móvil */
@media (max-width: 720px) {
  .top { padding: 10px 14px; gap: 12px; flex-wrap: wrap; }
  .logo span small { display: none; }
  .user { gap: 10px; }
  .user-nombre { display: none; }
  .vista { order: 3; width: 100%; }
  .vista button { flex: 1; }
  .contenido { margin: 16px auto; padding: 0 12px; gap: 14px; }
  .card { padding: 16px; border-radius: 12px; }
  .fila { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .head { flex-wrap: wrap; }
  .buscar { width: 100%; }
  .tabla thead { display: none; }
  .tabla, .tabla tbody, .tabla tr, .tabla td { display: block; }
  .tabla tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tabla tr:last-child { border: 0; }
  .tabla td { padding: 3px 0; border: 0; }
  .tabla td.num { display: inline-block; text-align: left; padding-left: 6px; }
  .tabla td.num::before { content: "· "; }
  .tabla td.acc { padding: 10px 0 0 50px; text-align: left; }
  .tabla td.acc .acc-i { justify-content: flex-start; }
}

/* Posición global: donut de un sector por zona; al pasar por encima,
   el centro enseña la zona, su valor y su porcentaje */
.posicion { display: grid; place-items: center; padding: 32px 22px; }
.donut-bloque { display: grid; grid-template-columns: auto minmax(0, 360px); gap: 40px; align-items: center; width: 100%; justify-content: center; }
.cuadro { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.donut figcaption span { max-width: 170px; justify-self: center; line-height: 1.25; }
.leyenda-donut { list-style: none; margin: 0; padding: 0; display: grid; }
.ley-fila { display: grid; grid-template-columns: 12px 1fr auto 44px 12px; gap: 10px; align-items: center; padding: 9px 6px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; }
.ley-fila span { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ley-fila b { font-weight: 700; font-variant-numeric: tabular-nums; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.ley-fila em { font-style: normal; color: var(--mut); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ley-fila:hover { background: var(--bg); }
a.ley-fila:hover span { color: var(--acc); }
/* Chevron: solo las filas en las que se puede entrar (enlace); las hojas dejan el hueco para que las cifras cuadren */
.ley-fila .mas { width: 12px; height: 12px; display: block; color: var(--mut); opacity: .55; transition: transform .15s, opacity .15s, color .15s; }
.ley-fila .mas svg { width: 100%; height: 100%; display: block; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
a.ley-fila:hover .mas { color: var(--acc); opacity: 1; transform: translateX(2px); }
.ley-fila.fuera .cuadro { background: none !important; border: 2px dashed var(--borde); }
.donut svg:has(.sector.resalta) .sector:not(.resalta) { opacity: .35; }
a.sector.resalta circle { stroke-width: 15; }
@media (max-width: 760px) { .donut-bloque { grid-template-columns: 1fr; justify-items: center; gap: 24px; } .leyenda-donut { width: 100%; } }
.donut { margin: 0; position: relative; width: min(340px, 100%); }
.donut svg { width: 100%; height: auto; display: block; overflow: visible; }
.sector { cursor: pointer; outline: none; transition: opacity .15s; }
.sector circle { transition: stroke-width .15s; }
g.sector { cursor: default; }
.atras { pointer-events: auto; justify-self: center; display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; padding: 5px 12px 5px 8px; border: 1px solid var(--borde); border-radius: 9px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 13px; transition: border-color .15s, color .15s; }
.atras svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.atras:hover { border-color: var(--acc); color: var(--acc); }
.donut .atras { position: absolute; top: 66.5%; left: 50%; transform: translateX(-50%); margin: 0; }  /* fuera del flujo: el texto sigue centrado */
.donut svg:has(.sector:hover, .sector:focus-visible) .sector:not(:hover, :focus-visible) { opacity: .35; }
a.sector:hover circle, a.sector:focus-visible circle { stroke-width: 15; }  /* solo se ensancha si se puede entrar */
.donut figcaption { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; pointer-events: none; }
.donut figcaption span { color: var(--mut); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.donut figcaption b { font-size: 24px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.donut figcaption em { font-style: normal; color: var(--mut); font-weight: 700; font-variant-numeric: tabular-nums; min-height: 1.5em; }

/* Documentos madre: de dónde sale cada cifra del panel */
.docs { list-style: none; margin: 0; padding: 0; }
.docs li { display: grid; gap: 2px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.docs li:last-child { border: 0; }
.docs b { font-weight: 700; }
.doc-abrir { color: var(--acc); text-decoration: none; justify-self: start; }
.doc-abrir:hover { text-decoration: underline; text-underline-offset: 3px; }
.docs span { color: var(--mut); font-size: 14px; }
.vacio { color: var(--mut); margin: 0; padding: 6px 0; }

/* Cifras marcadas (semáforo): rojo = inventada, gris = datos de origen de más de DIAS_ANTIGUO días, verde = bien */
:root { --subr-inv: #d92d20; --subr-ant: #b8c0ca; --subr-bien: #12b76a; --subr-forz: #2e90fa; }
.inventado, .antiguo, .bien, .forzado { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 5px; text-decoration-skip-ink: none; }
.inventado { text-decoration-color: var(--subr-inv); }
.antiguo { text-decoration-color: var(--subr-ant); }
.bien { text-decoration-color: var(--subr-bien); }
.forzado { text-decoration-color: var(--subr-forz); }
.forzar { position: absolute; z-index: 5; display: grid; gap: 10px; min-width: 240px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgb(11 18 32 / .16); }
.forzar[hidden] { display: none; }
.forzar label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--mut); }
.forzar input[name=valor] { font: inherit; font-size: 16px; font-weight: 700; padding: 9px 11px; border: 1px solid var(--borde); border-radius: 9px; font-variant-numeric: tabular-nums; }
.forzar-cifra { display: flex; gap: 6px; }
.forzar-cifra input { flex: 1; min-width: 0; width: auto; }
.forzar select { width: auto; flex: none; font: inherit; font-weight: 700; padding: 0 10px; border: 1px solid var(--borde); border-radius: 9px; background: #fff; color: var(--ink); }
.forzar div { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.forzar .btn { padding: 8px 16px; }
.leyenda-estados { display: grid; gap: 4px; margin: 0; color: var(--mut); font-size: 13px; }
.leyenda-estados b { font-weight: 700; color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 3px; }
.docs-tabla { width: 100%; border-collapse: collapse; }
.docs-tabla td { vertical-align: top; }
.docs-tabla td:first-child { width: 18px; padding-top: 19px; }
.doc-sub { display: block; color: var(--mut); font-size: 13px; }
.doc-fecha { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sem { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--line); }
.sem-verde { background: var(--subr-bien); border-color: var(--subr-bien); }
.sem-gris { background: var(--subr-ant); border-color: var(--subr-ant); }
.sem-rojo { background: var(--subr-inv); border-color: var(--subr-inv); }
.sem-naranja { background: #f79009; border-color: #f79009; }
.docs-leyenda { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; }
.docs-leyenda .sem { width: 9px; height: 9px; vertical-align: middle; margin-right: 4px; }
/* Documentos necesarios: extractos en árbol (sociedad → cuenta) y el resto en lista */
.nec-grupo > summary, .nec-arbol summary { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; cursor: pointer; list-style: none; padding: 10px 0; }
.nec-grupo > summary::-webkit-details-marker, .nec-arbol summary::-webkit-details-marker { display: none; }
.nec-grupo > summary::before, .nec-arbol summary::before { content: "▸"; color: var(--mut); width: 10px; font-size: 12px; }
.nec-grupo[open] > summary::before, .nec-arbol details[open] > summary::before { content: "▾"; }
.nec-grupo > summary b { font-size: 17px; }
.nec-grupo > summary .doc-sub, .nec-arbol summary .doc-sub { display: inline; }
.nec-arbol, .nec-arbol ul, .nec-lista { list-style: none; margin: 0; padding: 0; }
.nec-arbol { padding-left: 20px; border-left: 1px solid var(--line); margin-left: 5px; }
.nec-arbol ul { padding-left: 38px; }
.nec-doc { display: grid; grid-template-columns: 14px 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.nec-lista .nec-doc:first-child { border-top: 0; }
.nec-doc .sem { margin-top: 5px; }
.nec-doc b { font-weight: 700; }
.nec-doc .doc-fecha { text-align: right; }
.sem-nada { background: #fff; }
.nec-nota { margin: 12px 0 0 25px; }
.docs code { font-size: 12px; background: var(--bg); padding: 1px 6px; border-radius: 5px; }
.neg { color: var(--rojo); }

/* Divisa: selector junto al título y nota del cambio bajo el donut */
.titulo-div { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.segmento-div { display: flex; padding: 3px; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.segmento-div button { font: inherit; font-size: 14px; font-weight: 700; padding: 7px 13px; border: 0; border-radius: 8px; background: none; color: var(--mut); cursor: pointer; }
.segmento-div button.on { background: var(--acc2); color: var(--acc); }
.segmento-div button:hover:not(.on) { color: var(--ink); }
.nota-cambio { margin: 0; color: var(--mut); font-size: 13px; }
/* Aviso bajo el donut: de qué no hay datos (ámbar, discreto: no es un error, es una carencia) */
.aviso-datos { display: flex; gap: 9px; align-items: flex-start; margin: 0; padding: 9px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: #b54708; background: #fffaeb; border: 1px solid #fedf89; }
.aviso-datos p { margin: 0; }
.aviso-datos b { font-weight: 700; }
.aviso-datos-titulo { font-weight: 700; }
.aviso-datos-grupo { margin-top: 3px; font-weight: 500; }
.aviso-datos-grupo summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 6px; width: max-content; }
.aviso-datos-grupo summary::-webkit-details-marker { display: none; }
.aviso-datos-grupo summary::after { content: "▸"; font-size: 11px; opacity: .7; }
.aviso-datos-grupo[open] summary::after { content: "▾"; }
.aviso-datos-grupo ul { margin: 2px 0 4px 0; padding-left: 18px; list-style: disc; font-weight: 500; opacity: .9; }
.aviso-datos-grupo li { line-height: 1.5; }
.aviso-datos-pie { color: #93370d; opacity: .85; font-weight: 500; margin-top: 3px !important; }
.aviso-datos svg { flex: none; width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Miga de pan de la posición global */
.migas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 14px; font-weight: 600; }
.migas a { color: var(--mut); text-decoration: none; }
.migas a:hover { color: var(--acc); text-decoration: underline; text-underline-offset: 3px; }
.migas span { color: var(--borde); }

/* Fecha de cada cifra al pasar por su valor en la leyenda */
.ley-fila[data-fecha] { position: relative; }
.ley-fila[data-fecha]:hover::after { content: attr(data-fecha); position: absolute; right: 76px; bottom: calc(100% - 2px); z-index: 5; white-space: nowrap; padding: 6px 10px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; text-decoration: none; box-shadow: 0 6px 18px rgb(11 18 32 / .18); pointer-events: none; }
@media (max-width: 640px) {
  .nec-arbol { padding-left: 8px; }
  .nec-arbol ul { padding-left: 16px; }
}

/* Instrucciones */
.alcance { color: var(--mut); }
.seccion { margin: 10px 0 -2px; }
.nav-iconos a { padding: 9px 11px; display: grid; place-items: center; }
.nav-iconos svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icono-en-texto { display: inline-grid; place-items: center; vertical-align: -5px; padding: 2px 4px; border-radius: 6px; color: var(--acc); background: var(--acc2); }
.icono-en-texto svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Estructura societaria: árbol de texto, tabla y formulario */
.acciones { display: flex; gap: 16px; align-items: center; }
.btn-peq { padding: 9px 16px; text-decoration: none; display: inline-block; }
.btn-gris { background: #6b7280; }
.punto { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, #8a94a0); vertical-align: 1px; }
.leyenda-cat { list-style: none; margin: 0 0 14px; padding: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--mut); border-bottom: 1px solid var(--line); }
.leyenda-cat .punto { margin-right: 6px; }
.arbol, .arbol ul { list-style: none; margin: 0; padding: 0; }
.arbol ul { margin-left: 9px; padding-left: 20px; border-left: 1px solid var(--line); }
.arbol li { padding: 4px 0; }
.arbol .linea { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.arbol .linea .punto { align-self: center; }
.arbol .pct { color: var(--acc); font-weight: 700; font-size: 13px; }
.arbol small { color: var(--mut); font-size: 12px; }
.arbol .editar { font-size: 12px; color: var(--mut); text-decoration: none; opacity: 0; }
.arbol li:hover > .linea .editar, .arbol .linea .editar:focus { opacity: 1; }
.arbol .notas { color: var(--mut); font-size: 13px; margin: 1px 0 3px 18px; max-width: 70ch; }
.arbol .titular > .linea b { font-size: 17px; }
.baja > .linea b, .tabla tr.baja td b { text-decoration: line-through; color: var(--mut); }
.tabla-soc td { vertical-align: top; font-size: 14px; }
.tabla-soc .notas-td { color: var(--mut); font-size: 13px; max-width: 34ch; }
.card-estrecha-2 { max-width: 640px; margin-bottom: 18px; }
.card-estrecha-2 h2 { margin-bottom: 8px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
select, textarea { font: inherit; font-weight: 500; color: var(--ink); padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; width: 100%; box-sizing: border-box; }
select:focus, textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc2); }
.historial { list-style: none; margin: 0; padding: 0; }
.historial li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.historial li:last-child { border: 0; }
.historial .doc-sub { margin-bottom: 2px; }
.tabla-hist { margin-top: 10px; font-size: 14px; }
.tabla-hist td { padding-top: 9px; padding-bottom: 9px; vertical-align: top; }

/* Sociedades (solo Desarrollo) */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.kpi { display: grid; gap: 2px; }
.kpi-t { font-size: 12px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.kpi b { font-size: 24px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--mut); font-size: 13px; }
.soc-tabla td, .soc-tabla th { font-variant-numeric: tabular-nums; }
.soc-tabla tfoot td { border-top: 2px solid var(--borde); border-bottom: 0; }
.soc-tabla tr.con-deuda td:first-child { border-left: 3px solid var(--rojo); padding-left: 10px; }
.mut { color: var(--mut); }
@media (max-width: 720px) { .kpis { grid-template-columns: 1fr; } }
.ejemplo { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #e6eefc; color: #1d4ed8; cursor: help; }
.confirmado { font-style: normal; color: #1d6f42; font-weight: 800; cursor: help; }
.poliza { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--borde); }
.poliza:hover { text-decoration-color: var(--acc); }
.soc-aviso { margin: 14px 0 0; }
.soc-anadir { margin-top: 16px; } .soc-anadir summary { cursor: pointer; color: var(--mut); font-weight: 600; font-size: 13px; }
.soc-anadir .fila { margin-top: 10px; align-items: end; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.historial { margin: 0 0 14px; padding-left: 18px; font-size: 14px; } .historial li { margin: 3px 0; }


/* Posición Global (la hoja de Jesús sin Excel; solo Desarrollo, 28-sep-2026) */
.pg-pagina .contenido { max-width: 1400px; }
.pg-card { min-width: 0; }
.pg-card + .pg-card { margin-top: 18px; }
.pg-card h2 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.01em; }
.pg-card h2 + .sub { margin-bottom: 14px; font-size: 14px; }
.pg-scroll { overflow-x: auto; }
.pg { font-size: 13px; min-width: 1500px; }
.pg th, .pg td { padding: 7px 8px 7px 0; white-space: nowrap; }
.pg .pg-nombre { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 190px; max-width: 230px; white-space: normal; padding-right: 14px; box-shadow: 6px 0 8px -6px rgb(11 18 32 / .12); }
.pg .pg-nombre .nombre { font-size: 14px; }
.pg .pg-nombre .doc-sub { font-size: 12px; }
.pg td.num { color: var(--ink); }
.pg .pg-h { color: var(--mut); }                       /* histórico congelado */
.pg th.pg-h { color: var(--mut); }
.pg td.pg-r a { text-decoration-thickness: 3px; text-underline-offset: 4px; color: inherit; }
.pg td.pg-r a:not(.bien) { text-decoration: none; }
.pg td.pg-r { background: #f4fbf7; }
.pg th.pg-r { color: #067647; }
.pg td.pg-p { font-style: italic; }
.pg th.pg-p { color: #1d4ed8; }
.pg .pg-p-cel { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--borde); }
.pg .pg-p-cel:hover { border-bottom-color: var(--acc); color: var(--acc); }
.pg .pg-prev { display: block; font-size: 11px; color: var(--mut); font-style: italic; }
.pg .pg-der { border-left: 1px solid var(--line); padding-left: 10px; }
.pg th.pg-der:first-of-type, .pg td.pg-der:first-of-type { padding-left: 14px; }
.pg tr.pg-tipo td { padding-top: 16px; padding-bottom: 4px; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--mut); border-bottom: 0; }
.pg tr.pg-sub td { color: var(--mut); font-weight: 600; border-bottom: 2px solid var(--line); }
.pg tfoot td { border-top: 2px solid var(--borde); font-weight: 700; border-bottom: 0; }
.pg tr.pg-acum td { border-top: 0; color: var(--mut); font-weight: 600; }
.pg-leyenda { margin-top: 14px; }
.pg-ley-h { color: var(--mut); }
.pg-ley-p { font-style: italic; color: #1d4ed8; }
.pg-concluidas { margin-top: 14px; }
.pg-concluidas summary { cursor: pointer; color: var(--mut); font-weight: 600; font-size: 13px; }
.pg-concluidas .pg { margin-top: 8px; }
.pg-bandeja td, .pg-socs td { font-size: 14px; vertical-align: top; }
.pg-asignar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pg-asignar select { width: auto; max-width: 280px; padding: 8px 10px; font-size: 13px; }
.pg-asignar .btn-peq { padding: 8px 14px; font-size: 13px; background: #fff; color: var(--ink); border: 1px solid var(--line); }
.pg-asignar .btn-peq:hover { background: var(--bg); border-color: var(--borde); }
.pg-asignar .check { font-size: 13px; color: var(--mut); }
.pg-ficha .card-form { margin-bottom: 18px; }
.pg-check { align-self: end; padding-bottom: 12px; }
.pg-anios td, .pg-anios th { padding-top: 6px; padding-bottom: 6px; font-size: 14px; }
.pg-anios tr.pg-en-curso td { background: #f4fbf7; }
input.pg-input { width: 150px; text-align: right; font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; padding: 7px 9px; border: 1px solid var(--borde); border-radius: 8px; }
input.pg-input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc2); }
.pg-movs td { padding-top: 0; border-bottom: 0; }
.pg-movs summary { cursor: pointer; color: var(--mut); font-size: 13px; font-weight: 600; }
.pg-movs-t { margin: 6px 0 10px; font-size: 13px; }
.pg-movs-t td { padding: 6px 10px 6px 0; }
.pg-mov-acc { white-space: nowrap; }
.pg-mov-acc select { width: auto; font-size: 12px; padding: 4px 6px; margin-right: 6px; }
.pg-guardar { margin-top: 14px; }
.pg-reglas li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.pg-reglas .inline { display: inline; }
.pg-summary { cursor: pointer; font-weight: 700; }
.pg-quitar { display: flex; gap: 10px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.pg-quitar input { width: 260px; padding: 7px 10px; font-size: 13px; }
.inline { display: inline; }

/* Bandeja única de Posición Global (28-sep): categorías de gasto, sugerencias, barra */
.pg-h3 { margin: 22px 0 4px; font-size: 16px; }
.pg-h3 + .sub { margin-bottom: 10px; font-size: 14px; }
.pg-mas { margin-top: 8px; } .pg-mas summary { cursor: pointer; color: var(--acc); font-weight: 700; font-size: 14px; }
.pg-nueva { font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; width: 220px; }
.pg-cat td { font-size: 14px; vertical-align: top; }
.pg-cat details summary { cursor: pointer; font-weight: 700; }
.pg-cat-movs { margin: 6px 0 4px 10px; width: calc(100% - 10px); font-size: 13px; }
.pg-cat-movs td { padding: 5px 10px 5px 0; }
.pg-barra { display: flex; height: 22px; border-radius: 7px; overflow: hidden; background: var(--line); margin: 6px 0 8px; }
.pg-barra i { display: block; height: 100%; }
.pg-barra .b-inv, .pg-leyenda-barra b.b-inv { background: #12b76a; }
.pg-barra .b-gasto, .pg-leyenda-barra b.b-gasto { background: #98a2b3; }
.pg-barra .b-grupo, .pg-leyenda-barra b.b-grupo { background: #2e90fa; }
.pg-barra .b-dec, .pg-leyenda-barra b.b-dec { background: #d92d20; }
.pg-leyenda-barra { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pg-leyenda-barra b { color: #fff; padding: 1px 7px; border-radius: 5px; font-size: 12px; margin-right: 4px; }
.pg-tir { cursor: help; border-bottom: 1px dotted var(--borde); }
.soc-bajo-donut { margin-top: 18px; }
.soc-bajo-donut > .titulo { margin-bottom: 12px; } .soc-bajo-donut h2 { margin: 0 0 4px; font-size: 20px; }
.soc-bajo-donut .card { border: 0; padding: 0; box-shadow: none; }
.pg .pg-oculta { visibility: hidden; }                /* columna a medias bajo la columna fija (posicion_global.html) */

/* Control (solo Desarrollo, 29-sep-2026) */
.ctl-seccion { font-size: 20px; margin: 22px 0 12px; }
.ctl-mes select { width: auto; }
.ctl-pregunta { border-left: 5px solid #12b76a; margin-bottom: 18px; }
.ctl-no { border-left-color: var(--rojo); }
.ctl-q { font-size: 15px; color: var(--mut); margin: 0 0 6px; font-weight: 700; }
.ctl-a { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 8px; }
.ctl-si .ctl-a { color: #12b76a; }
.ctl-no .ctl-a { color: var(--rojo); }
.ctl-detalle { margin: 0 0 6px; }
.ctl-fuente { margin: 0; color: var(--mut); font-size: 13px; }
.ctl-tabla td, .ctl-tabla th { font-variant-numeric: tabular-nums; font-size: 14px; }
.ctl-tabla tr.e-sin_cobro td:first-child { border-left: 3px solid var(--rojo); padding-left: 10px; }
.ctl-tabla tr.e-ambiguo td:first-child { border-left: 3px solid #f79009; padding-left: 10px; }
.etq { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.etq-amb { background: #fef0c7; color: #b54708; }
.etq-sin { background: var(--mal2); color: var(--rojo); }
.ctl-vac { margin-top: 18px; }
.ctl-vac h2, .ctl-sueltos h2 { font-size: 17px; margin: 0 0 8px; }

/* Catálogo de documentos editable (29-sep) */
.cat-nombre { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--borde); }
.cat-nombre:hover { text-decoration-color: var(--acc); }
.cat-anadir { margin: 12px 0 0; }
.es { margin-top: 3px; font-size: 12px; color: var(--mut); }
.es select { font: inherit; font-size: 12px; color: var(--mut); border: 1px solid transparent; border-radius: 6px; background: transparent; padding: 1px 2px; max-width: 260px; }
.es select:hover, .es select:focus { border-color: var(--borde); background: #fff; color: var(--ink); }

/* Partidas del donut, editables (29-sep) */
.partidas-zonas { display: grid; gap: 16px; margin-bottom: 18px; }
.partidas-cab, .partidas-fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.partidas-cab input[name=nombre] { font-weight: 800; font-size: 17px; max-width: 320px; }
.partidas-cab input[type=color] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--borde); border-radius: 8px; background: #fff; cursor: pointer; }
.partidas-lista { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.partidas-fila input[name=nombre] { max-width: 320px; padding: 8px 10px; }
.partidas-fila .cuadro { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.partidas-fila .clave { font-size: 12px; font-variant-numeric: tabular-nums; }
.partidas-nueva { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.historial-partidas summary { cursor: pointer; font-weight: 700; }
.historial-partidas .historial { margin-top: 10px; }
.ley-fila.sin-dato span { color: var(--mut); }
.partidas-enlace { margin: 6px 0 0; font-size: 13px; } .partidas-enlace a { color: var(--mut); }

/* Globo con las cuentas de cada sociedad (Sociedades, columna Cuentas; Uxío 29-sep) */
.globo-cont { position: relative; display: inline-block; cursor: help; text-decoration: underline dotted var(--borde); text-underline-offset: 4px; outline: none; }
.globo { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 320px; max-width: 460px; padding: 10px 12px; background: #fff; color: var(--ink); border: 1px solid var(--borde); border-radius: 10px; box-shadow: 0 8px 24px rgba(11, 18, 32, .12); text-align: left; font-size: 13px; }
.globo-cont:hover .globo, .globo-cont:focus .globo, .globo-cont:focus-within .globo { display: block; }
.globo table { width: 100%; border-collapse: collapse; }
.globo td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.globo tr:last-child td { border: 0; }
.globo td small { display: block; color: var(--mut); font-size: 11px; }
.globo td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.soc-tabla td.num .globo-cont { color: var(--mut); }
.globo .iban { font-variant-numeric: tabular-nums; letter-spacing: .02em; font-weight: 600; }
.globo { min-width: 400px; }
.btn-rojo { background: var(--rojo); } .btn-rojo:hover { background: #8f1c12; }
.eliminar { border-color: #f4c4c0; }

/* Aviso flotante de guardado sin recarga (sinrecarga.js, 29-sep-2026) */
.sr-aviso { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; margin: 0;
  background: #12b76a; color: #fff; padding: 8px 18px; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.sr-aviso.sr-mal { background: #d92d20; }
.sr-aviso[hidden] { display: none; }

/* Coste de estructura (propuesta, 29-sep-2026) */
.est-cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.est-k { display: block; color: var(--gris, #667085); font-size: 13px; }
.est-v { font-size: 22px; }
.est-rojo { color: #d92d20; }
.est-tabla td, .est-tabla th { white-space: nowrap; }
.est-movs { margin: 6px 0 4px; font-size: 13px; }

/* Caja en tres líneas: prueba local (29-sep-2026) */
.ct-conmutador { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; }
.ct-tabla td { vertical-align: top; }
.ct-lista { margin: 6px 0 4px 18px; padding: 0; font-size: 14px; }
.ct-lista li { margin: 2px 0; }

/* Reenvío de extractos a la app de Juandi, en Recibidos (30-sep-2026) */
.doc-t small.rv { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.doc-t small.rv::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.rv-bien { color: #067647 !important; } .rv-ojo { color: #b54708 !important; } .rv-mal { color: var(--rojo) !important; } .rv-cola { color: var(--mut) !important; }

/* Franja de avisos del régimen permanente, arriba de todas las pantallas (app/avisos.py, 30-sep-2026) */
.aviso-arriba { background: #fffaeb; border-bottom: 1px solid #fedf89; color: #93370d; font-size: 13px; font-weight: 600;
  padding: 6px 24px; text-align: center; }
.aviso-arriba a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.aviso-arriba.grave { background: #fef3f2; border-bottom-color: #fecdca; }
.aviso-arriba a.grave { color: #b42318; font-weight: 700; }   /* iga sin conexión con sviga o con la app (2-oct-2026) */

/* Documentos: qué pasa con cada cosa que se sube (30-sep-2026) */
.doc-que-pasa { margin: 12px 0 4px; padding-left: 18px; color: var(--mut); font-size: 13px; line-height: 1.5; }
.doc-que-pasa li { margin: 3px 0; }
.doc-que-pasa b { color: var(--ink); }

/* Móvil (30-sep): la hoja Posición Global sigue siendo una tabla que se desliza de lado con la columna de nombres fija;
   la regla general de móvil la convertía en tarjetas y la desmontaba. */
@media (max-width: 720px) {
  .contenido > * { min-width: 0; }   /* sin esto, una tabla ancha estira su tarjeta y la página entera se sale de la pantalla */
  .top { position: static; }   /* en móvil la barra ocupa dos o tres filas: fija se comía un cuarto de pantalla */
  .tabla.pg { display: table; }
  .tabla.pg thead { display: table-header-group; }
  .tabla.pg tbody { display: table-row-group; }
  .tabla.pg tfoot { display: table-footer-group; }
  .tabla.pg tr { display: table-row; padding: 0; border: 0; }
  .tabla.pg th, .tabla.pg td { display: table-cell; padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); }
  .tabla.pg td.num { text-align: right; padding-left: 0; }
  .tabla.pg td.num::before { content: none; }
  .pg .pg-nombre { min-width: 128px; max-width: 150px; padding-right: 10px; }
  .pg-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  /* Estructura: el porcentaje con su signo y el botón Editar sin la sangría de Documentos */
  .tabla-soc td.num:not(:empty)::before { content: ""; }
  .tabla-soc td.num:not(:empty)::after { content: " %"; }
  .tabla-soc td.num { padding-left: 0; font-weight: 700; }
  .tabla-soc td.acc { padding-left: 0; }
}
