/* 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; }
.actualizar { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--mut); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.actualizar svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.actualizar:hover { background: var(--bg); border-color: var(--borde); color: var(--ink); }
.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; gap: 14px; align-items: end; margin-top: 16px; }
.campo { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--mut); }
input[type=text], input[type=password], input[type=search], 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::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 { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.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); }

/* 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; }

@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; }
  .actualizar { padding: 6px 8px; font-size: 0; gap: 0; }
  .actualizar svg { width: 16px; height: 16px; }
  .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.fecha { display: inline-block; padding-left: 50px; }
  .tabla td.num { display: inline-block; text-align: left; padding-left: 6px; }
  .tabla td.num::before { content: "· "; }
  .tabla td.acc { justify-content: flex-start; padding: 10px 0 0 50px; }
}

/* Posición global: donut de un sector por zona (España, Hong Kong, Emiratos); 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; 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); }
.ley-fila.fuera .cuadro { background: none !important; border: 2px dashed var(--borde); }
.donut svg:has(.sector.resalta) .sector:not(.resalta) { opacity: .35; }
.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; }
.sector:hover circle, .sector:focus-visible circle { stroke-width: 15; }
.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; }
.forzar select { font: inherit; font-weight: 700; padding: 0 8px; 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 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; }

/* 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: 54px; 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; }
