:root {
  --negro: #121212; --gris: #6b6b6b; --gris2: #9a9a9a; --linea: #e4e4e4; --fondo: #f6f6f4; --blanco: #fff;
  --acento: #1f3864; --ok: #2e7d32; --mal: #c62828; --aviso: #b26a00; --amarillo: #fff4cc;
  --serif: Georgia, "Times New Roman", serif; --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); color: var(--negro); font: 14px/1.45 var(--sans); }
a { color: var(--acento); }
button, input, select { font: inherit; }
.cargando-pagina { padding: 40vh 0; text-align: center; color: var(--gris); }

/* marca */
.marca { display: flex; align-items: center; gap: 12px; }
.marca .logo { width: 34px; height: 34px; border-radius: 8px; background: var(--negro); color: #fff; display: grid; place-items: center; font: 20px var(--serif); }
.marca b { font: 17px var(--serif); letter-spacing: .3px; display: block; }
.marca small { color: var(--gris); font-size: 10.5px; letter-spacing: 2.2px; text-transform: uppercase; }

/* acceso */
.acceso { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #111 0 38%, var(--fondo) 38%); }
.tarjeta-acceso { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 30px; box-shadow: 0 20px 50px rgba(0,0,0,.18); }
.tarjeta-acceso h1 { font: 22px var(--serif); margin: 22px 0 4px; }
.tarjeta-acceso p { color: var(--gris); margin: 0 0 18px; }

/* estructura */
.barra { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--linea); display: flex; align-items: center; gap: 18px; padding: 10px 22px; flex-wrap: wrap; }
.barra .espacio { flex: 1; }
.barra select { min-width: 280px; }
.usuario { color: var(--gris); font-size: 13px; }
.contenido { max-width: 1280px; margin: 0 auto; padding: 22px; }
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--linea); margin-bottom: 18px; flex-wrap: wrap; }
.pestanas a { padding: 9px 14px; text-decoration: none; color: var(--gris); border-bottom: 2px solid transparent; font-weight: 500; }
.pestanas a.activa { color: var(--negro); border-color: var(--negro); }
h2 { font: 21px var(--serif); margin: 0 0 4px; }
.sub { color: var(--gris); margin: 0 0 16px; }
.panel { background: #fff; border: 1px solid var(--linea); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.fila { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.fila .crece { flex: 1; }
.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.campo span { font-size: 12px; color: var(--gris); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input:not([type]), select {
  border: 1px solid #cfcfcf; border-radius: 7px; padding: 8px 10px; background: #fff; min-height: 36px; }
input:focus, select:focus { outline: 2px solid var(--acento); outline-offset: -1px; }
.btn { border: 1px solid #cfcfcf; background: #fff; border-radius: 7px; padding: 8px 14px; cursor: pointer; min-height: 36px; white-space: nowrap; }
.btn:hover { background: #f1f1f1; }
.btn.pri { background: var(--negro); border-color: var(--negro); color: #fff; }
.btn.pri:hover { background: #333; }
.btn.peligro { color: var(--mal); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ancho { width: 100%; }
.error { color: var(--mal); min-height: 20px; font-size: 13px; }
.chip { white-space: nowrap; display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; background: #eee; color: #444; }
.chip.ok { background: #e6f4ea; color: var(--ok); } .chip.mal { background: #fdecea; color: var(--mal); } .chip.aviso { background: #fff4e0; color: var(--aviso); }

/* tablas */
.tabla-env { overflow: auto; border: 1px solid var(--linea); border-radius: 10px; background: #fff; max-height: 62vh; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { position: sticky; top: 0; background: #fafafa; text-align: left; font-weight: 600; color: #444; border-bottom: 1px solid var(--linea); padding: 8px 10px; white-space: nowrap; }
td { border-bottom: 1px solid #f0f0f0; padding: 7px 10px; vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #fbfbfb; }
tfoot td { font-weight: 600; background: #fafafa; position: sticky; bottom: 0; }
.vacio { padding: 40px; text-align: center; color: var(--gris); }
.resumen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.resumen div { background: #fff; border: 1px solid var(--linea); border-radius: 10px; padding: 10px 12px; }
.resumen b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.resumen span { font-size: 12px; color: var(--gris); }

/* carga */
.zona { border: 2px dashed #cfcfcf; border-radius: 12px; padding: 26px; text-align: center; color: var(--gris); background: #fcfcfc; cursor: pointer; }
.zona.encima { border-color: var(--acento); background: #f3f6fb; }
.progreso { height: 8px; background: #eee; border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.progreso div { height: 100%; width: 0; background: var(--acento); transition: width .2s; }
.registro { max-height: 200px; overflow: auto; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; background: #fafafa; border: 1px solid var(--linea); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; }

/* modal y avisos */
.fondo-modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; padding: 22px; }
.modal h3 { font: 19px var(--serif); margin: 0 0 12px; }
.modal .pie { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
#avisos { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.aviso { background: #222; color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 380px; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.aviso.mal { background: var(--mal); }
.motor-estado { font-size: 12px; color: var(--gris); }
.motor-estado.listo { color: var(--ok); }
.mensajes td:first-child { font-weight: 600; }
.mensajes .ERROR { color: var(--mal); } .mensajes .AVISO { color: var(--aviso); }
.pie-pagina { text-align: center; color: var(--gris2); font-size: 11.5px; padding: 26px 0 30px; letter-spacing: .5px; }
@media (max-width: 720px) {
  .barra select { min-width: 0; width: 100%; }
  .contenido { padding: 14px; }
}
.ficha { font-size: 13px; }
.ficha td { padding: 4px 8px; border-bottom: 1px solid #f2f2f2; }

/* facturación y declaraciones */
.subpestanas { display: flex; gap: 2px; background: #ececea; border-radius: 9px; padding: 3px; flex-wrap: wrap; margin-bottom: 14px; }
.subpestanas a { padding: 6px 12px; border-radius: 7px; text-decoration: none; color: var(--gris); font-size: 13px; font-weight: 500; }
.subpestanas a.activa { background: #fff; color: var(--negro); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
fieldset.panel { margin: 0 0 14px; }
fieldset.panel legend { font: 15px var(--serif); padding: 0 6px; display: flex; gap: 8px; align-items: center; }
.panel.alerta { background: var(--amarillo); border-color: #f0dc9a; }
.panel.alerta.suave { background: #fffaf0; }
.panel.ok { background: #eef7ef; border-color: #cfe6d1; color: var(--ok); }
.panel h3 { font: 16px var(--serif); margin: 0 0 10px; }
table.editable td { padding: 4px 6px; }
table.editable input, table.editable select { padding: 6px 7px; }
.tabla-env.sin-borde { border: 0; padding: 0; }
.totales { margin: 12px 0 0 auto; max-width: 320px; }
.totales div { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--linea); }
.totales .total { font-size: 17px; border-bottom: 0; padding-top: 8px; }
.barra-emitir { position: sticky; bottom: 0; background: var(--fondo); padding: 12px 0; align-items: center; }
.barra-emitir .espacio { flex: 1; }
.btn.grande { padding: 11px 22px; font-size: 15px; }
.persona .info-id { min-height: 18px; }
.persona .info-id .chip { margin-right: 6px; }
.destino legend .btn { padding: 2px 8px; }
table.formulario { width: 100%; border-collapse: collapse; }
table.formulario td, table.formulario th { padding: 6px 8px; border-bottom: 1px solid var(--linea); }
table.formulario .sec td { background: #f1f1ef; font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: .4px; }
table.formulario .cas { color: var(--acento); font-weight: 600; width: 60px; font-variant-numeric: tabular-nums; }
table.formulario .fuerte td { font-weight: 700; }
table.formulario.ocultar-ceros tr.cero { display: none; }
table.formulario tr.cero td { color: var(--gris2); }
table.ficha td:first-child { color: var(--gris); width: 160px; }

a.btn { text-decoration: none; color: var(--negro); display: inline-flex; align-items: center; }
a.btn.pri { color: #fff; }
table.editable input[name=descripcion] { width: 100%; }

/* menú lateral desplegable */
.disposicion { display: flex; min-height: 100vh; }
.lateral { flex: 0 0 264px; width: 264px; height: 100vh; position: sticky; top: 0; overflow-y: auto; background: #121212; color: #d8d8d8;
  display: flex; flex-direction: column; gap: 14px; padding: 18px 12px; transition: margin-left .22s ease; z-index: 30; }
.lateral .marca { padding: 0 6px 6px; }
.lateral .marca .logo { background: #fff; color: #121212; }
.lateral .marca b { color: #fff; }
.lateral .marca small { color: #8a8a8a; font-size: 9px; letter-spacing: 1.8px; }
.lateral .empresa-sel { margin: 0 4px; }
.lateral .empresa-sel span { color: #8a8a8a; }
.lateral .empresa-sel select { width: 100%; background: #1f1f1f; color: #eee; border-color: #333; }
.menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.grupo-titulo { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px; border: 0; border-radius: 8px; background: transparent;
  color: #c9c9c9; cursor: pointer; font-weight: 500; text-align: left; }
.grupo-titulo:hover { background: #1f1f1f; color: #fff; }
.grupo-titulo span { flex: 1; }
.grupo.actual > .grupo-titulo { color: #fff; }
.flecha { width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .18s; opacity: .7; }
.grupo.abierto .flecha { transform: rotate(45deg); }
.grupo-hijos { display: none; padding: 2px 0 6px; }
.grupo.abierto .grupo-hijos { display: block; }
.grupo-hijos a { display: block; padding: 7px 10px 7px 39px; color: #9d9d9d; text-decoration: none; border-radius: 7px; font-size: 13.5px; position: relative; }
.grupo-hijos a:hover { color: #fff; background: #1a1a1a; }
.grupo-hijos a.activa { color: #fff; background: #262626; }
.grupo-hijos a.activa::before { content: ""; position: absolute; left: 22px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #fff; }
.lateral-pie { border-top: 1px solid #262626; padding: 12px 8px 0; font-size: 13px; color: #ddd; }
.lateral-pie small { color: #8a8a8a; }
.principal { flex: 1; min-width: 0; }
.disposicion.menu-oculto .lateral { margin-left: -264px; }
.barra { gap: 14px; padding: 10px 20px; }
.barra-empresa { font: 15px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icono-menu { width: 38px; padding: 0; display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.icono-menu span { display: block; width: 16px; height: 1.6px; background: var(--negro); border-radius: 2px; }
.velo { display: none; }
@media (max-width: 900px) {
  .lateral { position: fixed; left: 0; top: 0; margin-left: -280px; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .disposicion.menu-oculto .lateral { margin-left: -280px; }
  .disposicion.menu-abierto .lateral { margin-left: 0; }
  .disposicion.menu-abierto .velo { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
  .barra-empresa { max-width: 50vw; }
}

/* logo */
.marca-logo { display: block; padding: 4px 8px 8px; }
.marca-logo img { display: block; width: 100%; max-width: 200px; height: auto; }
.tarjeta-acceso .marca-logo { padding: 0 0 6px; }
.tarjeta-acceso .marca-logo img { max-width: 230px; }

/* inicio y cartera */
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.grafico { width: 100%; height: auto; display: block; }
.leyenda { display: flex; gap: 16px; font-size: 12px; color: var(--gris); margin-top: 6px; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
tr.clic { cursor: pointer; } tr.clic:hover td { background: #fafaf8; }
.panel.alerta ul { margin: 6px 0 0; padding-left: 18px; }
textarea { border: 1px solid #cfcfcf; border-radius: 7px; }

/* contabilidad */
table.diario tr.cab-asiento td { background: #f4f4f1; border-top: 2px solid #e2e2de; }
table.diario td.sangria { padding-left: 36px; }
table.plan tr.grupo-cta td { font-weight: 600; background: #fafaf8; }
table.plan tr.inactiva td { color: var(--gris2); }

/* bancos */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.tarjeta-banco { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--linea); border-radius: 12px; padding: 16px; text-decoration: none; color: inherit; }
.tarjeta-banco:hover { border-color: #bdbdb8; }
.tarjeta-banco b { font: 17px var(--serif); } .tarjeta-banco small { color: var(--gris); }
.tarjeta-banco .saldo { font-size: 24px; font-weight: 700; margin: 6px 0; }
.tarjeta-banco .chip { align-self: flex-start; } .tarjeta-banco .btn { align-self: flex-start; margin-top: 8px; }
.tarjeta-banco.inactiva { opacity: .55; }
.grid2.igual { grid-template-columns: 1fr 1fr; }
table.sel tr { cursor: pointer; } table.sel tr.elegida td { background: #e9f1ff; } table.sel tr.hecho td { color: var(--gris2); }
table.rol input { padding: 5px 6px; }

tr.total td { background: #f6f6f4; border-top: 1px solid var(--linea); }
tr.grupo td { background: #fafaf8; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }

/* inicio con color */
.resumen.color div { border-left: 4px solid var(--c, var(--linea)); }
.resumen.color b { color: var(--c, var(--negro)); }
.grid-donas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid-donas .panel { margin-bottom: 16px; }
.dona { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: center; }
.dona svg { width: 150px; flex: 0 0 150px; }
.dona ul { list-style: none; margin: 0; padding: 0; flex: 1 1 240px; min-width: 0; font-size: 12.5px; }
.dona li { display: grid; grid-template-columns: 12px minmax(0,1fr) auto 36px; gap: 6px; align-items: center; padding: 3px 0; border-bottom: 1px solid #f1f1f1; }
.dona li i { width: 10px; height: 10px; border-radius: 50%; }
.dona li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dona li b { font-variant-numeric: tabular-nums; }
.dona li small { color: var(--gris); text-align: right; }
@media (max-width: 520px) { .dona { flex-direction: column; } }

/* comparar períodos */
.comparar-ctl label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.grid-cmp { display: grid; grid-template-columns: 1fr; gap: 14px; }
.pares { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 22px; }
.par { margin-bottom: 10px; }
.par-n { font-size: 12.5px; color: var(--gris); margin-bottom: 3px; }
.par-b { display: flex; align-items: center; gap: 6px; height: 16px; margin-bottom: 3px; }
.par-b i { display: block; height: 12px; border-radius: 3px; }
.par-b span { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tabla-fija { table-layout: fixed; width: 100%; min-width: 820px; }
input[type="search"] { font: inherit; padding: 9px 11px; border: 1px solid var(--linea); border-radius: 8px; background: #fff; width: 100%; box-sizing: border-box; }
.modulos-sel{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:4px 14px}
