:root {
  --fondo: #f3f4f6; --papel: #fff; --tinta: #1c2430; --suave: #5b6578; --linea: #e4e7ec;
  --marca: #1f5fd1; --marca-oscura: #184ba6; --marca-clara: #e8f0fe;
  --bien: #0f7352; --bien-fondo: #e3f6ee; --mal: #c0362c; --mal-fondo: #fdecea; --aviso-fondo: #fff4d6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--tinta); background: var(--fondo); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
a { color: var(--marca); }

/* Armazón: menú a la izquierda, trabajo a la derecha */
.app { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }
.lado { background: var(--fondo); padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { font-weight: 800; font-size: 18px; letter-spacing: -.02em; padding: 4px 8px 10px; }
.logo span { color: var(--marca); }
.empresa-sel { width: 100%; padding: 9px 10px; border: 1px solid var(--linea); border-radius: 8px; background: var(--papel); font-weight: 600; margin-bottom: 8px; }
.lado .grupo { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); padding: 12px 10px 4px; }
.lado a.op { display: block; padding: 7px 10px; border-radius: 6px; color: var(--tinta); text-decoration: none; }
.lado a.op:hover { background: #e7e9ee; }
.lado a.op.activa { background: #e1e4ea; font-weight: 600; }
.lado a.op.pronto { color: #5b6578; }
.lado .abajo { margin-top: auto; border-top: 1px solid var(--linea); padding-top: 8px; }
.quien { padding: 6px 10px; font-size: 13px; }
.quien small { display: block; color: var(--suave); }
.zona { background: var(--papel); margin: 8px 8px 8px 0; border-radius: 10px; border: 1px solid var(--linea); padding: 22px 26px; min-width: 0; }
.cabecera { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.cabecera .hueco { flex: 1; }

/* Piezas */
.boton { border: 1px solid var(--linea); background: var(--papel); padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.boton:hover { background: #f6f7f9; }
.boton.principal { background: var(--marca); border-color: var(--marca); color: #fff; }
.boton.principal:hover { background: var(--marca-oscura); }
.boton.peligro { color: var(--mal); }
.boton.enlace { border: 0; background: none; color: var(--marca); padding: 4px 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d0d5dd; border-radius: 6px; background: #fff; }
a:focus-visible, button:focus-visible, summary:focus-visible, tr[tabindex]:focus-visible { outline: 2px solid var(--marca); outline-offset: -2px; }
input:focus, select:focus, textarea:focus, .boton:focus-visible { outline: 2px solid var(--marca); outline-offset: 1px; }
label { display: block; font-size: 12px; color: var(--suave); margin-bottom: 4px; }
.campo { margin-bottom: 12px; min-width: 0; }
.rejilla { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; }
.rejilla .ancho { grid-column: 1 / -1; }
.barra > input { min-width: 0; flex: 1; }
.barra { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.barra input[type=search] { max-width: 260px; margin-left: auto; }
.pestanas { display: inline-flex; border: 1px solid var(--linea); border-radius: 6px; overflow: hidden; }
.pestanas button { border: 0; background: var(--papel); padding: 7px 12px; cursor: pointer; }
.pestanas button.activa { background: var(--marca-clara); color: var(--marca); font-weight: 600; }

.tabla-caja { border: 1px solid var(--linea); border-radius: 8px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; color: var(--suave); font-weight: 600; background: #f8f9fb; padding: 9px 12px; white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--linea); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fafc; }
td.fuerte { font-weight: 600; }
.vacio { padding: 46px 20px; text-align: center; color: var(--suave); }
.vacio b { display: block; color: var(--tinta); font-size: 16px; margin-bottom: 4px; }
.chapa { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; background: var(--bien-fondo); color: var(--bien); }
.chapa.gris { background: #eef0f3; color: var(--suave); }
.chapa.azul { background: var(--marca-clara); color: var(--marca); }

.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tarjeta { border: 1px solid var(--linea); border-radius: 8px; padding: 14px 16px; }
.tarjeta small { color: var(--suave); }
.tarjeta strong { display: block; font-size: 24px; margin-top: 2px; }

/* Panel lateral de edición */
.velo { position: fixed; inset: 0; background: rgba(16, 24, 40, .35); display: flex; justify-content: flex-end; z-index: 10; }
.panel { background: var(--papel); width: min(560px, 100%); height: 100%; overflow-y: auto; padding: 22px 24px; box-shadow: -8px 0 24px rgba(16, 24, 40, .12); }
.panel .cabecera { margin-bottom: 14px; }
.error { background: var(--mal-fondo); color: var(--mal); padding: 9px 12px; border-radius: 6px; margin-bottom: 12px; }
.nota { background: var(--aviso-fondo); padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.nota code { font-size: 15px; font-weight: 700; user-select: all; }

/* Entrada */
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.entrada .caja { background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; padding: 30px; width: min(380px, 100%); }
.entrada .logo { font-size: 26px; padding: 0 0 4px; }
.entrada p { color: var(--suave); margin: 0 0 18px; }
.entrada .boton { width: 100%; padding: 10px; }

.redondo.menu-mov { display: none; }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lado { position: static; height: auto; }
  .zona { margin: 0 8px 8px; padding: 16px; }
  .rejilla { grid-template-columns: minmax(0, 1fr); }
  .redondo.menu-mov { display: inline-flex; }
  .lado:not(.abierto) > :not(.logo-fila) { display: none; }
  .zona { overflow-x: auto; }
  .barra select, .barra > div, .barra input { max-width: 100%; }
  /* Líneas de factura: cada línea es una tarjeta (concepto arriba, el resto en dos columnas con su rótulo) */
  .lineas thead { display: none; }
  .lineas, .lineas tbody { display: block; }
  .lineas tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--linea); }
  .lineas td { display: block; width: auto !important; padding: 0; border: 0; }
  .lineas td.c-con, .lineas td:not([class]) { grid-column: 1 / -1; }
  .lineas td.c-tot { padding-top: 0; text-align: right; align-self: end; font-weight: 700; }
  .lineas td[class*="c-"]:not(.c-con):not(.c-tot)::before { display: block; font-size: 11px; color: var(--suave); }
  .lineas td.c-cant::before { content: 'Cantidad'; }
  .lineas td.c-pre::before { content: 'Precio'; }
  .lineas td.c-dto::before { content: 'Descuento %'; }
  .lineas td.c-iva::before { content: 'IVA'; }
  .lineas td.c-cta::before { content: 'Tipo de gasto'; }
}

/* Ventas */
.lado a.op.sub { padding-left: 26px; font-size: 13px; }
a.tarjeta { text-decoration: none; color: inherit; display: block; }
a.tarjeta:hover { border-color: #c4cad4; }
.tarjeta.alerta strong { color: var(--mal); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; background: #f8f9fb; cursor: default; }
.chapa.rojo { background: var(--mal-fondo); color: var(--mal); }
.chapa.ambar { background: var(--aviso-fondo); color: #8a5a00; }
.barra select { width: auto; }
.doc-cab { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 0 14px; }
.lineas { width: 100%; margin: 6px 0 10px; }
.lineas td { padding: 6px 4px; white-space: normal; vertical-align: top; border-top: 0; }
.lineas tbody tr { cursor: default; }
.lineas tbody tr:hover { background: none; }
.lineas .c-con { width: 26%; }
.lineas .c-cant, .lineas .c-dto { width: 8%; }
.lineas .c-pre, .lineas .c-iva { width: 11%; }
.lineas .c-tot { width: 11%; padding-top: 14px; }
.lineas input.num { text-align: right; }
.pie-doc { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 30px; margin-top: 8px; }
.totales { border-top: 1px solid var(--linea); }
.totales div { display: flex; justify-content: space-between; padding: 8px 2px; border-bottom: 1px solid var(--linea); }
.totales .gordo { font-weight: 800; font-size: 17px; }
.visor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.fondo-hoja { background: #dfe3ea; border-radius: 8px; padding: 22px; }
.hoja { background: #fff; max-width: 780px; margin: 0 auto; padding: 44px 48px; box-shadow: 0 1px 4px rgba(16, 24, 40, .15); font-size: 13px; }
.hoja .emisor { text-align: right; margin-bottom: 26px; }
.hoja .emisor b { font-size: 15px; }
.hoja .datos { display: flex; justify-content: space-between; border-top: 1px solid #ccc; padding-top: 16px; margin-bottom: 26px; }
.hoja .datos .tot { text-align: right; }
.hoja .datos .tot b { font-size: 20px; display: block; margin-top: 4px; }
.hoja table { margin-bottom: 14px; }
.hoja th { background: none; border-bottom: 1px solid #ccc; color: var(--tinta); text-transform: uppercase; font-size: 11px; }
.hoja td { white-space: normal; border-top: 0; border-bottom: 1px solid #eee; cursor: default; }
.hoja td small { display: block; color: #555; }
.hoja tbody tr:hover { background: none; }
.hoja .suma { margin-left: auto; width: 300px; }
.hoja .suma div { display: flex; justify-content: space-between; padding: 5px 0; }
.hoja .suma .gordo { font-weight: 800; border-top: 1px solid #ccc; margin-top: 4px; padding-top: 9px; }
.hoja .pie { margin-top: 26px; color: #444; white-space: pre-wrap; }
.lateral h2 { margin-top: 18px; }
.lateral .fila { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; align-items: center; }
.lateral .fila span:first-child { color: var(--suave); }
.lateral .acciones { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.lateral .huella { font: 11px ui-monospace, Consolas, monospace; color: var(--suave); word-break: break-all; }
@media (max-width: 1000px) { .visor, .pie-doc, .doc-cab { grid-template-columns: 1fr; } }
@media print {
  body { background: #fff; }
  .lado, .cabecera, .lateral, .velo { display: none !important; }
  .app { display: block; }
  .zona { border: 0; margin: 0; padding: 0; }
  .visor { display: block; }
  .fondo-hoja { background: none; padding: 0; }
  .hoja { box-shadow: none; max-width: none; padding: 0; }
  .no-imprimir { display: none !important; }
  .zona { overflow: visible; }
  .tarjetas, .tabla-caja, .dos > div { break-inside: avoid; }
}
.informe-cab { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.informe-cab h1 { margin: 0; }
.informe-cab .hueco { flex: 1; }
.informe-cab .nota { margin: 2px 0 0; background: none; border: 0; padding: 0; }

.barra input[type=date] { width: auto; flex: 0 0 auto; }
.pie-lista { justify-content: flex-end; margin-top: 10px; color: var(--suave); }
.boton:disabled { opacity: .45; cursor: default; }

[hidden] { display: none !important; }
.selector { position: relative; }
.desplegable { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin-top: 2px; background: #fff; border: 1px solid #d0d5dd; border-radius: 6px; box-shadow: 0 8px 20px rgba(16, 24, 40, .12); max-height: 320px; overflow-y: auto; }
.desplegable button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; }
.desplegable button:hover { background: var(--marca-clara); }
.desplegable button small { color: var(--suave); }
.desplegable .crear { color: var(--marca); font-weight: 600; border-top: 1px solid var(--linea); }
.desplegable .nada { padding: 10px; color: var(--suave); }
.lateral .paso { padding: 6px 0; border-bottom: 1px solid var(--linea); }
.lateral .paso small { display: block; color: var(--suave); }

/* Compras */
.soltar { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 16px; margin-bottom: 14px; border: 2px dashed #b9c0cc; border-radius: 10px; background: #fff; cursor: pointer; text-align: center; }
.soltar small { color: var(--suave); }
.soltar:hover, .soltar:focus-visible, .soltar.encima { border-color: var(--marca); background: var(--marca-clara); outline: none; }
.compra { display: grid; grid-template-columns: minmax(320px, 5fr) 6fr; gap: 18px; align-items: start; }
.compra-visor { position: sticky; top: 12px; background: #fff; border: 1px solid var(--linea); border-radius: 8px; overflow: hidden; }
.compra-visor iframe { display: block; width: 100%; height: 78vh; border: 0; }
.compra-visor img { display: block; width: 100%; max-height: 78vh; object-fit: contain; background: #f3f4f6; }
.compra-visor .pie-visor { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--linea); font-size: 13px; color: var(--suave); }
.compra .lateral.pagos { margin-top: 18px; }
@media (max-width: 1100px) { .compra { grid-template-columns: 1fr; } .compra-visor { position: static; } .compra-visor iframe { height: 60vh; } }

/* Tesorería */
.entra { color: #067647; } .sale { color: #b42318; }
.mov-cab { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 14px; margin-bottom: 12px; background: var(--fondo); border-radius: 8px; }
.mov-cab small { display: block; color: var(--suave); }
.mov-cab strong { font-size: 20px; white-space: nowrap; }
table.casar input[type=text] { width: 110px; }
table.casar tr.sugerida { background: var(--marca-clara); }
table.casar small { color: var(--suave); }
.panel:has(table.casar) { width: min(900px, 100%); }
table.casar td { white-space: normal; } table.casar td small { display: block; }

/* Contabilidad */
table.diario tr.asiento td { background: var(--fondo); border-top: 2px solid var(--linea); cursor: pointer; }
table.diario tr.apunte td { border: 0; padding-top: 3px; padding-bottom: 3px; cursor: default; }
table.diario td.al-haber { padding-left: 34px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.informe { margin-bottom: 12px; }
.informe small { color: var(--suave); }
.informe thead th { font-size: 14px; color: var(--tinta); }
.c-cta select { max-width: 190px; }
@media (max-width: 1000px) { .dos { grid-template-columns: minmax(0, 1fr); } }

/* Cashflow */
table.flujo meter { width: 120px; height: 10px; }
table.flujo tr { cursor: default; }

/* Menú con iconos, buscador y botón de crear */
.icono { width: 18px; height: 18px; flex: 0 0 auto; opacity: .85; }
.lado a.op { display: flex; align-items: center; gap: 10px; }
.lado a.op.sub { padding-left: 38px; }
.lado a.op.activa .icono { opacity: 1; }
.logo-fila { display: flex; align-items: center; gap: 2px; padding-bottom: 6px; }
.logo-fila .logo { padding-bottom: 4px; }
.logo-fila .hueco { flex: 1; }
.redondo { border: 0; background: none; padding: 6px; border-radius: 6px; cursor: pointer; display: inline-flex; }
.redondo:hover { background: #e1e4ea; }
.quien { display: flex; align-items: center; gap: 10px; }
.inicial { width: 28px; height: 28px; border-radius: 6px; background: var(--tinta); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.flotante { position: fixed; z-index: 30; background: var(--papel); border: 1px solid var(--linea); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); padding: 6px; min-width: 230px; }
.flotante button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: 6px; cursor: pointer; text-align: left; }
.flotante button:hover { background: #f2f4f7; }
.velo.centro { justify-content: center; align-items: flex-start; padding-top: 12vh; }
.buscador { background: var(--papel); width: min(620px, 92vw); border-radius: 12px; box-shadow: 0 20px 48px rgba(16, 24, 40, .22); padding: 12px; }
.buscador input { font-size: 16px; padding: 11px 12px; }
.resultados { max-height: 56vh; overflow-y: auto; margin-top: 8px; }
.resultado { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.resultado:hover, .resultado:focus-visible { background: #f2f4f7; outline: none; }
.resultado small { display: block; color: var(--suave); }
.nada { padding: 18px; color: var(--suave); text-align: center; }

/* Portada */
.portada { max-width: 860px; margin: 0 auto; }
.saludo { font-size: 24px; margin: 6px 0 18px; }
.aparte { margin: 26px 0 12px; }
.bloque { border: 1px solid var(--linea); border-radius: 12px; margin-bottom: 18px; background: var(--papel); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); overflow: hidden; }
.bloque-cab { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--linea); }
.bloque-cab h2 { margin: 0; font-size: 16px; }
.bloque-cab small { color: var(--suave); }
.bloque-cab .hueco { flex: 1; }
.bloque-cuerpo { padding: 14px 18px 8px; }
select.discreto { width: auto; border-color: transparent; background: transparent; font-weight: 600; cursor: pointer; }
select.discreto:hover { background: #f2f4f7; }
.cifras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px; }
.cifra small { color: var(--suave); font-size: 13px; }
.cifra strong { font-size: 26px; letter-spacing: -.01em; margin-right: 8px; }
.cambio { font-size: 12px; font-weight: 700; white-space: nowrap; }
.cambio.sube { color: var(--bien); }
.cambio.baja { color: var(--mal); }
.accion { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-top: 1px solid var(--linea); color: var(--tinta); text-decoration: none; }
.bloque-cab + .accion { border-top: 0; }
.accion:hover { background: #f8fafc; }
.accion .cuadro { width: 32px; height: 32px; border-radius: 6px; background: var(--marca-clara); display: inline-flex; align-items: center; justify-content: center; }
.accion .texto { flex: 1; }
.accion .donde { color: var(--suave); }
.grafico { width: 100%; height: auto; display: block; }
.grafico .guia { stroke: #eef0f3; stroke-width: 1; }
.grafico .eje { font-size: 11px; fill: #667085; }
.grafico .ingreso { fill: #1f5fd1; }
.grafico .gasto { fill: #f0a35c; }
.leyenda { font-size: 12px; color: var(--suave); display: inline-flex; align-items: center; gap: 6px; }
.leyenda::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: #1f5fd1; }
.leyenda.gasto::before { background: #f0a35c; }
@media (max-width: 720px) { .cifras { grid-template-columns: 1fr; } }

/* Configuración de la empresa */
.ajustes { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; }
.ajustes-menu { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; }
.ajustes-menu .grupo { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); padding: 12px 10px 4px; }
.ajustes-menu a.op { display: block; padding: 7px 10px; border-radius: 6px; color: var(--tinta); text-decoration: none; }
.ajustes-menu a.op:hover { background: #e7e9ee; }
.ajustes-menu a.op.activa { background: var(--marca-clara); color: var(--marca-oscura); font-weight: 600; }
.ajustes-titulo { margin-bottom: 14px; }
.ajuste-bloque { background: var(--papel); border: 1px solid var(--linea); border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; }
.ajuste-bloque .nota { margin: -6px 0 12px; }
.ajuste-bloque p.nota:last-child { margin-bottom: 0; }
.nota { color: var(--suave); }
.logo-empresa { max-height: 64px; max-width: 220px; border: 1px solid var(--linea); border-radius: 6px; padding: 4px; background: #fff; }
label.marca { display: flex; gap: 8px; align-items: center; }
.fila-lista { align-items: end; padding-bottom: 8px; border-bottom: 1px dashed var(--linea); margin-bottom: 10px; }
.ajuste-bloque input[type=color] { height: 36px; padding: 2px; width: 72px; }
@media (max-width: 800px) { .ajustes { grid-template-columns: minmax(0, 1fr); } .ajustes-menu { position: static; flex-direction: row; flex-wrap: wrap; } .ajustes-menu .grupo { width: 100%; } }
.ajuste-bloque .nota, .ajustes-cuerpo > .nota { background: none; padding: 0; border: 0; color: var(--suave); }
.ajustes-cuerpo > .nota { margin-bottom: 12px; }

.casilla { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.casilla input { width: auto; }
.panel-correo { margin: 12px 0; }
.panel-correo textarea, .ajustes-cuerpo textarea { width: 100%; box-sizing: border-box; font: inherit; }
.chapa.enviado { background: #e3f4e8; color: #17653a; }
.chapa.error { background: #fde8e8; color: #9b1c1c; }
.chapa.pendiente { background: #fff4d6; color: #7a5300; }
.chapa.cancelado { background: #eee; color: #555; }
.aviso { background: #fff4d6; color: #5a4300; padding: 8px 10px; border-radius: 6px; margin: 8px 0; }

.lateral .tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.lateral .pestana { flex: 1; padding: 7px 6px; border: 1px solid var(--linea); background: transparent; border-radius: 6px; cursor: pointer; font: inherit; color: var(--suave); }
.lateral .pestana.activa { background: var(--texto, #1a2233); color: #fff; border-color: transparent; }
.lateral .tab-msg, .lateral .tab-hist { display: none; }
.lateral[data-tab="mensajes"] > :not(.tabs):not(.tab-msg), .lateral[data-tab="historial"] > :not(.tabs):not(.tab-hist) { display: none; }
.lateral[data-tab="mensajes"] > .tab-msg, .lateral[data-tab="historial"] > .tab-hist { display: block; }
.lateral[data-tab="general"] > .tab-hist { display: none; }
.lateral textarea { width: 100%; box-sizing: border-box; font: inherit; }
.hilo { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.burbuja { padding: 8px 10px; border-radius: 8px; background: #eef3ff; white-space: pre-wrap; }
.burbuja.nota { background: #fff4d6; }
.burbuja small { display: block; color: var(--suave); margin-bottom: 2px; }

/* Analítica: barra de cada fila */
.barra-celda { width: 150px; }
.barra-celda progress { width: 140px; height: 8px; accent-color: var(--marca); vertical-align: middle; }

/* Bloque con borde dentro de una pantalla (no confundir con .panel, que es el cajón lateral) */
.bloque { border: 1px solid var(--linea); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.bloque .barra { margin-top: 10px; }

.revision { list-style: none; padding: 0; margin: 8px 0 0; }
.revision li { padding: 4px 0; display: flex; gap: 8px; align-items: baseline; }

/* ===== Pulido de diseño (12/11/2026): un solo sistema de alturas, radios, sombras y foco ===== */
:root {
  --radio: 10px; --radio-s: 8px; --alto: 36px;
  --sombra-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --sombra-s: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --foco: 0 0 0 3px rgba(31, 95, 209, .20);
  --tinta: #182230; --suave: #626d80; --linea: #e6e9ef; --fondo: #f4f5f8;
}
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; letter-spacing: -.003em; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
h2 { font-weight: 650; letter-spacing: -.01em; }
::selection { background: rgba(31, 95, 209, .18); }
td.num, th.num, .totales, .hoja td, .cifra strong, .tarjeta strong, .mov-cab strong { font-variant-numeric: tabular-nums; }

/* Armazón */
.lado { padding: 14px 12px; gap: 2px; }
.logo { font-size: 19px; }
select.empresa-sel { background-image: linear-gradient(45deg, transparent 50%, #6b7587 50%), linear-gradient(135deg, #6b7587 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.barra input[type=search] { max-width: 340px; }
.empresa-sel { height: var(--alto); padding: 0 10px; border-radius: var(--radio-s); box-shadow: var(--sombra-xs); margin-bottom: 10px; }
.lado .grupo { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; padding: 16px 10px 6px; }
.lado a.op { padding: 8px 10px; border-radius: var(--radio-s); transition: background .12s, color .12s; font-weight: 500; }
.lado a.op:hover { background: rgba(24, 34, 48, .06); }
.lado a.op.activa { background: var(--papel); color: var(--marca-oscura); font-weight: 600; box-shadow: var(--sombra-s); }
.lado a.op.activa .icono { opacity: 1; }
.lado a.op.sub { font-weight: 500; }
.lado a.op.sub.activa { box-shadow: none; background: transparent; color: var(--marca); }
.zona { border-radius: 14px; box-shadow: var(--sombra-s); padding: 26px 30px; margin: 10px 10px 10px 0; }
.cabecera { margin-bottom: 20px; }

/* Botones y campos: todos a la misma altura */
.boton { height: var(--alto); padding: 0 14px; border-radius: var(--radio-s); box-shadow: var(--sombra-xs); font-weight: 600; transition: background .12s, border-color .12s, box-shadow .12s, transform .05s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.boton:hover { background: #f5f6f9; border-color: #d3d8e0; }
.boton:active { transform: translateY(.5px); }
.boton.principal { box-shadow: 0 1px 2px rgba(24, 75, 166, .35), inset 0 1px 0 rgba(255, 255, 255, .14); }
.boton.principal:hover { background: var(--marca-oscura); border-color: var(--marca-oscura); }
.boton.enlace { box-shadow: none; border: 0; height: auto; padding: 4px 6px; }
.boton.enlace:hover { background: var(--marca-clara); }
.boton.peligro:hover { background: var(--mal-fondo); border-color: #f1c1bd; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], select { height: var(--alto); padding: 0 11px; border-radius: var(--radio-s); border-color: #d6dbe3; box-shadow: var(--sombra-xs); transition: border-color .12s, box-shadow .12s; }
textarea { padding: 9px 11px; border-radius: var(--radio-s); border-color: #d6dbe3; box-shadow: var(--sombra-xs); line-height: 1.5; }
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: #bfc6d1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--marca); box-shadow: var(--foco); }
.boton:focus-visible { outline: none; box-shadow: var(--foco); }
::placeholder { color: #98a1b2; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #6b7587 50%), linear-gradient(135deg, #6b7587 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
select.discreto { background-color: transparent; box-shadow: none; border-color: transparent; }
input[type=checkbox], input[type=radio] { accent-color: var(--marca); width: 16px; height: 16px; cursor: pointer; }
label { font-weight: 500; margin-bottom: 5px; }
.campo { margin-bottom: 14px; }
.pestanas { border-radius: var(--radio-s); padding: 2px; gap: 2px; background: #eef0f4; border-color: transparent; }
.pestanas button { height: 30px; border-radius: 6px; background: transparent; color: var(--suave); font-weight: 500; transition: background .12s, color .12s; }
.pestanas button:hover { color: var(--tinta); }
.pestanas button.activa { background: var(--papel); color: var(--tinta); font-weight: 600; box-shadow: var(--sombra-s); }

/* Tablas: más aire, cabecera discreta, sin bordes duros */
.tabla-caja { border-radius: var(--radio); border-color: var(--linea); box-shadow: var(--sombra-xs); background: var(--papel); }
th { background: #f8f9fb; color: var(--suave); font-size: 12px; font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--linea); }
td { padding: 12px 14px; border-top: 1px solid #eef0f4; }
tbody tr:first-child td { border-top: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #f7f9fc; }
tr[tabindex]:focus-visible { outline: none; background: var(--marca-clara); box-shadow: inset 3px 0 0 var(--marca); }
tfoot td { background: #f8f9fb; border-top: 1px solid var(--linea); }
.vacio { padding: 56px 20px; }

/* Etiquetas de estado: píldora con punto */
.chapa { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; }
.chapa::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }

/* Tarjetas y bloques */
.tarjeta { border-radius: var(--radio); box-shadow: var(--sombra-xs); padding: 16px 18px; transition: border-color .12s, box-shadow .12s; }
a.tarjeta:hover { border-color: #c3cad6; box-shadow: var(--sombra-s); }
.tarjeta strong { font-size: 26px; letter-spacing: -.02em; margin-top: 4px; }
.bloque { border-radius: var(--radio); box-shadow: var(--sombra-xs); }
.ajuste-bloque { border-radius: var(--radio); box-shadow: var(--sombra-xs); padding: 18px 20px; }
.cifra strong { font-size: 28px; font-weight: 700; letter-spacing: -.025em; }
.accion { transition: background .1s; }
.accion .cuadro { border-radius: var(--radio-s); }
.saludo { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }

/* Cajón lateral, ventanas y menús */
.velo { background: rgba(16, 24, 40, .42); }
.panel { box-shadow: -12px 0 32px rgba(16, 24, 40, .16); }
.flotante, .desplegable { border-radius: var(--radio); }
.flotante button, .desplegable button { transition: background .1s; }
.error { border-radius: var(--radio-s); border: 1px solid #f5c6c2; }
.nota { border-radius: var(--radio-s); }
.hoja { border-radius: 3px; box-shadow: 0 2px 10px rgba(16, 24, 40, .14); }
.fondo-hoja { border-radius: var(--radio); }

/* Entrada */
.entrada { background: radial-gradient(900px 420px at 50% -8%, #dfe9fc 0%, rgba(223, 233, 252, 0) 70%), var(--fondo); }
.entrada .caja { border-radius: 16px; padding: 36px 34px; box-shadow: 0 10px 30px rgba(16, 24, 40, .10), 0 2px 6px rgba(16, 24, 40, .05); border-color: #e1e5ec; }
.entrada .logo { font-size: 30px; padding-bottom: 6px; }
.entrada .boton { height: 40px; }
.entrada input { height: 40px; }

/* Detalles finos */
* { scrollbar-width: thin; scrollbar-color: #c6ccd7 transparent; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 760px) { .zona { padding: 18px 16px; border-radius: 12px; } .boton, input, select { min-height: 40px; } }

/* Portada en dos columnas: cifras arriba a todo el ancho; gráfico a la izquierda y pendientes a la derecha */
.portada { max-width: 1180px; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.portada > .saludo { grid-column: 1 / -1; margin: 0 0 2px; }
.portada > .aparte { grid-column: 1 / -1; margin: 12px 0 0; }
.portada > section:nth-of-type(1) { grid-column: 1 / -1; }
.portada > .bloque { margin-bottom: 0; }
.portada ~ .tarjetas, .portada ~ .portada { max-width: 1180px; margin-left: auto; margin-right: auto; }
.portada ~ .tarjetas { margin-top: 14px; margin-bottom: 0; }
.cifras { padding: 20px 22px 22px; gap: 24px; }
.cifra small { font-weight: 500; }
select.discreto { background-image: linear-gradient(45deg, transparent 50%, #6b7587 50%), linear-gradient(135deg, #6b7587 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
@media (max-width: 1000px) { .portada { grid-template-columns: minmax(0, 1fr); } .portada > section:nth-of-type(1) { grid-column: auto; } }

/* Coherencia: enlaces con aspecto de botón y pestañas del lateral */
a.boton { text-decoration: none; color: var(--tinta); }
a.boton.principal { color: #fff; }
.lateral .tabs { background: #eef0f4; padding: 2px; border-radius: var(--radio-s); gap: 2px; }
.lateral .pestana { border: 0; height: 30px; padding: 0 6px; border-radius: 6px; font-weight: 500; transition: background .12s, color .12s; }
.lateral .pestana:hover { color: var(--tinta); }
.lateral .pestana.activa { background: var(--papel); color: var(--tinta); font-weight: 600; box-shadow: var(--sombra-s); }
.lateral .acciones .boton { width: 100%; }

/* Las celdas con texto largo se recortan con «…» para que importes y estado queden siempre a la vista */
.tabla-caja td { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.tabla-caja td.num, .tabla-caja td:has(.chapa), .tabla-caja td:has(input), .tabla-caja td:has(button) { max-width: none; overflow: visible; }

/* Tipografía Inter (licencia OFL, ver fuentes/LICENCIA-Inter-OFL.txt), alojada en el propio servidor */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fuentes/inter-latin-wght-normal.woff2) format("woff2-variations"), url(fuentes/inter-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fuentes/inter-latin-ext-wght-normal.woff2) format("woff2-variations"), url(fuentes/inter-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
body { font-feature-settings: "cv11", "ss03"; font-size: 14px; }
td.num, th.num, .totales, .hoja td, .cifra strong, .tarjeta strong, .mov-cab strong, table td { font-feature-settings: "tnum", "cv11"; }

/* Tesorería: tarjetas de cuenta, estado vacío grande y pasos */
.cuentas { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
a.cuenta { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; border: 1px solid var(--linea); border-radius: var(--radio); background: var(--papel); box-shadow: var(--sombra-xs); color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s, transform .12s; }
a.cuenta:hover { border-color: #c3cad6; box-shadow: var(--sombra-s); transform: translateY(-1px); }
.cuenta-cab { display: flex; align-items: center; gap: 12px; }
.cuenta-cab > .icono { margin-left: auto; opacity: .45; }
.cuenta-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--marca-clara); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.cuenta-datos { min-width: 0; }
.cuenta-datos b { display: block; font-weight: 650; }
.cuenta-datos small, .cuenta-saldo small, .cuenta-conc small { color: var(--suave); display: block; }
.cuenta-datos small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cuenta-saldo strong { font-size: 28px; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.cuenta-conc progress { width: 100%; height: 6px; margin-bottom: 6px; accent-color: var(--bien); }
a.cuenta.pendiente .cuenta-conc progress { accent-color: #d98a1d; }
.vacio-grande { border: 1px dashed #cdd3dd; border-radius: var(--radio); background: var(--papel); padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vacio-grande .boton { margin-top: 14px; }
.vacio-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--marca-clara); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.vacio-ic .icono { width: 26px; height: 26px; opacity: 1; }
.pasos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.pasos li { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border: 1px solid var(--linea); border-radius: var(--radio); background: var(--papel); }
.pasos li b { display: block; font-weight: 650; margin-bottom: 2px; }
.pasos li small { color: var(--suave); }
.num-paso { width: 26px; height: 26px; border-radius: 50%; background: var(--marca); color: #fff; font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.nota-pie { color: var(--suave); font-size: 13px; margin: 14px 2px 0; }

/* Barras de progreso con el mismo estilo en todo el programa */
progress { appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; background: #e9ecf1; overflow: hidden; --prog: var(--marca); }
progress::-webkit-progress-bar { background: #e9ecf1; border-radius: 999px; }
progress::-webkit-progress-value { background: var(--prog); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--prog); border-radius: 999px; }
.cuenta-conc progress { --prog: var(--bien); }
a.cuenta.pendiente .cuenta-conc progress { --prog: #d98a1d; }

/* Contactos: círculo con iniciales */
.quien-fila { display: inline-flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; font-size: 11px; font-weight: 700; letter-spacing: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.av0 { background: #e0ebff; color: #1d4fb3; } .av1 { background: #dcf5e8; color: #11704a; } .av2 { background: #fdeccc; color: #8a5a00; }
.av3 { background: #fde1ea; color: #a3224f; } .av4 { background: #ece3fb; color: #5d33b0; } .av5 { background: #d9f1f4; color: #0c6a78; }

/* ===== Móvil: listas en tarjetas, cabeceras ordenadas, gráfico con desplazamiento ===== */
@media (max-width: 760px) {
  .tabla-caja { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .tabla-caja > table:not(.lineas):not(.casar), .tabla-caja > table:not(.lineas):not(.casar) > tbody { display: block; }
  .tabla-caja > table:not(.lineas):not(.casar) > thead { display: none; }
  .tabla-caja > table:not(.lineas):not(.casar) > tbody > tr { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--sombra-xs); }
  .tabla-caja > table:not(.lineas):not(.casar) > tbody > tr:hover { background: var(--papel); }
  .tabla-caja > table:not(.lineas):not(.casar) td { display: block; border: 0; padding: 0; max-width: none; white-space: normal; overflow: visible; text-align: left; overflow-wrap: anywhere; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 500; color: var(--suave); margin-bottom: 1px; }
  .tabla-caja > table:not(.lineas):not(.casar) td:empty { display: none; }
  .tabla-caja > table:not(.lineas):not(.casar) td:has(input[type=checkbox]) { position: absolute; top: 12px; right: 14px; }
  .tabla-caja > table:not(.lineas):not(.casar) td.fuerte:first-child { grid-column: 1 / -1; font-size: 15px; }
  .tabla-caja tfoot { display: none; }

  .cabecera { gap: 10px; }
  .cabecera h1 { flex-basis: 100%; }
  .cabecera .hueco { display: none; }
  .cabecera .boton { flex: 1 1 auto; }
  .barra { gap: 8px; }
  .barra > select, .barra > input, .barra > div { flex: 1 1 140px; min-width: 0; max-width: none; margin-left: 0; }
  .barra input[type=search] { flex-basis: 100%; max-width: none; }
  .bloque-cab { flex-wrap: wrap; row-gap: 4px; }
  .bloque-cab small { flex-basis: 100%; order: 3; }
  .bloque-cuerpo { overflow-x: auto; }
  .grafico { min-width: 560px; }
  .cifras { gap: 16px; padding: 16px 18px; }
  .cifra strong { font-size: 24px; }
  .cuentas { grid-template-columns: minmax(0, 1fr); }
  .velo .panel { width: 100%; }
  h1 { font-size: 22px; }
}

/* Móvil: las listas de facturas enseñan primero lo importante (número, estado, quién, cuánto, cuándo) */
@media (max-width: 760px) {
  .tabla-caja > table:not(.lineas):not(.casar) td:has(input[type=checkbox]) { display: none; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Núm."] { order: 1; font-size: 15px; font-weight: 700; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Estado"] { order: 2; justify-self: end; text-align: right; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Núm."]::before, .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Estado"]::before, .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Cliente"]::before, .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Proveedor"]::before, .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Descripción"]::before { display: none; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Cliente"], .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Proveedor"] { order: 3; grid-column: 1 / -1; font-weight: 600; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Total"] { order: 4; font-weight: 700; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Pendiente"] { order: 5; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Fecha"] { order: 6; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Vencimiento"] { order: 7; }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Descripción"] { order: 8; grid-column: 1 / -1; color: var(--suave); }
  .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Subtotal"], .tabla-caja > table:not(.lineas):not(.casar) td[data-label="IVA"], .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Forma de pago"], .tabla-caja > table:not(.lineas):not(.casar) td[data-label="Núm. interno"] { display: none; }
}

/* Móvil: factura que cabe, cifras en dos columnas, pestañas con desplazamiento */
@media (max-width: 760px) {
  .fondo-hoja { padding: 8px; overflow-x: auto; }
  .hoja { padding: 22px 16px; font-size: 12px; max-width: 100%; }
  .hoja .datos { flex-wrap: wrap; gap: 12px; }
  .hoja .suma { width: 100%; }
  .hoja th { font-size: 10px; padding: 8px 4px; }
  .hoja td { padding: 8px 4px; }
  .tarjetas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tarjeta { padding: 12px 14px; }
  .tarjeta strong { font-size: 20px; }
  .pestanas { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .pestanas button { white-space: nowrap; flex: 0 0 auto; }
  .lateral .acciones .boton { min-height: 44px; }
}

.chapa a { color: inherit; text-decoration: none; }
.chapa a:hover { text-decoration: underline; }

/* Móvil: sin ampliación automática al escribir (iPhone) y menú de Configuración en una sola tira */
@media (max-width: 760px) {
  input, select, textarea { font-size: 16px; }
  .ajustes-menu { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 6px; scrollbar-width: none; margin: 0 -2px; }
  .ajustes-menu .grupo { display: none; }
  .ajustes-menu a.op { white-space: nowrap; flex: 0 0 auto; border: 1px solid var(--linea); border-radius: 999px; padding: 6px 14px; background: var(--papel); }
  .ajustes-menu a.op.activa { background: var(--marca-clara); border-color: transparent; }
}

/* Pantalla de entrada */
.entrada .caja { width: min(400px, 100%); }
.entrada .logo { text-align: center; margin-bottom: 18px; }
.entrada-titulo { font-size: 20px; font-weight: 650; margin: 0 0 4px; text-align: center; letter-spacing: -.01em; }
.entrada .caja > p { text-align: center; margin-bottom: 22px; }
.entrada .boton { margin-top: 8px; }
.entrada-pie { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--linea); text-align: center; font-size: 12px; color: var(--suave); }

/* Listas: columnas a elegir y más filtros */
.menu-cols { position: relative; }
.menu-cols > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; }
.menu-cols > summary::-webkit-details-marker { display: none; }
.menu-cols-caja { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 200px; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: 0 10px 30px rgba(16, 24, 40, .14); padding: 10px 12px; display: grid; gap: 6px; }
.menu-cols-caja label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.mas-filtros { margin: -2px 0 10px; }
.mas-filtros > summary { cursor: pointer; font-size: 13px; color: var(--suave); margin-bottom: 8px; }

/* Menú lateral más corto: la cuenta es un solo botón con menú, y las opciones ocupan menos alto */
.lado { gap: 1px; }
.lado a.op { padding: 6px 10px; }
.lado a.op.sub { padding-top: 4px; padding-bottom: 4px; }
.lado .grupo { padding: 10px 10px 3px; }
.empresa-sel { margin-bottom: 6px; }
.lado .abajo { padding-top: 6px; }
.usuario { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: var(--radio-s); background: none; cursor: pointer; text-align: left; font: inherit; color: var(--tinta); }
.usuario:hover, .usuario[aria-expanded="true"] { background: rgba(24, 34, 48, .06); }
.usuario-nombre { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usuario-nombre small { display: block; font-weight: 400; color: var(--suave); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.usuario-flecha { color: var(--suave); font-size: 13px; }
.flotante.cuenta { padding: 6px; }
.cuenta-quien { padding: 8px 10px 10px; border-bottom: 1px solid var(--linea); margin-bottom: 4px; display: grid; gap: 2px; font-size: 13px; }
.cuenta-quien small { color: var(--suave); overflow: hidden; text-overflow: ellipsis; }

/* Cabeceras ordenables */
th.ordenable { cursor: pointer; user-select: none; }
th.ordenable:hover { color: var(--tinta); }
th.ordenable::after { content: ''; display: inline-block; margin-left: 6px; width: 0; height: 0; vertical-align: middle; }
th.ordenable[aria-sort="ascending"]::after { border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 5px solid var(--marca); }
th.ordenable[aria-sort="descending"]::after { border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--marca); }
th.ordenable[aria-sort]:not([aria-sort="none"]) { color: var(--marca-oscura); }
th.ordenable:focus-visible { outline: 2px solid var(--marca); outline-offset: -2px; }

/* Accesibilidad: «Saltar al contenido» (solo se ve con el teclado) y la zona de contenido sin recuadro al enfocarla */
.saltar { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--marca); color: #fff; border: 0; border-radius: var(--radio-s); padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.saltar:focus { top: 12px; }
main.zona:focus { outline: none; }

/* Preguntas en lenguaje corriente (dentro del buscador) */
.resultado.pregunta { background: var(--marca-clara); }
.resp { padding: 14px 16px; display: grid; gap: 10px; max-height: 62vh; overflow-y: auto; }
.resp-frase { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
.resp-cifra { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.resp-cifra strong { font-size: 28px; letter-spacing: -.02em; }
.resp-cifra small, .resp-como { color: var(--suave); font-size: 12px; }
.resp-como { margin: 0; }
.resp-comp { font-size: 13px; font-weight: 600; color: var(--bien); }
.resp-comp.mal { color: #b42318; }
.resp-tabla h4 { margin: 4px 0 4px; font-size: 12px; color: var(--suave); text-transform: uppercase; letter-spacing: .05em; }
.resp-tabla table { width: 100%; font-size: 13px; }
.resp-tabla td { padding: 3px 0; border: 0; }
.resp-doc { display: flex; justify-content: space-between; gap: 12px; width: 100%; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.resp-doc:hover { background: #f2f4f7; }
.resp-ejemplos { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; align-items: center; }
.resp-ejemplos small { flex-basis: 100%; color: var(--suave); }

/* La lupa en el móvil: más arriba y con más sitio para la respuesta */
@media (max-width: 760px) {
  .velo.centro { padding-top: 3vh; }
  .velo.centro .buscador { width: 96vw; }
  .resp { max-height: 72vh; padding: 12px 10px; }
  .resp-cifra strong { font-size: 24px; }
}

/* Caja de pregunta en la portada */
.pregunta-rapida { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 620px; margin: 0 0 16px; padding: 10px 14px; border: 1px solid var(--linea); border-radius: 10px; background: var(--papel); color: var(--suave); font: inherit; text-align: left; cursor: pointer; }
.pregunta-rapida:hover { border-color: #b8c2d1; }
.pregunta-rapida span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pregunta-rapida kbd { font: 12px/1 inherit; border: 1px solid var(--linea); border-radius: 5px; padding: 3px 6px; color: var(--suave); }
@media (max-width: 760px) { .pregunta-rapida kbd { display: none; } }

/* Requerimientos */
.req-grupo { margin: 14px 0 20px; }
.req-grupo h3 { margin: 0 0 8px; font-size: 14px; }
.req-grupo h3 small { color: var(--suave); font-weight: 400; }
tr.coincide td { background: #f0f7ff; }

/* Conexión directa con el banco */
.conexion-bloque .bloque-cab { flex-wrap: wrap; }
.conexiones { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; padding: 16px 18px 18px; }
.conexion { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border: 1px solid var(--linea); border-radius: var(--radio); background: var(--papel); min-width: 0; }
.conexion.por-renovar { border-color: #e0a100; box-shadow: 0 0 0 2px rgba(224, 161, 0, .15); }
.conexion-cab { display: flex; align-items: center; gap: 12px; }
.conexion-cab .cuenta-datos { flex: 1; min-width: 0; }
.conexion-aviso { color: #8a5a00; font-weight: 600; }
.conexion-cuentas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.conexion-cuentas li { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--linea); padding-top: 6px; }
.conexion .acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.conexion-msg:empty { display: none; }
@media (max-width: 760px) { .conexiones { grid-template-columns: minmax(0, 1fr); padding: 12px; } }
.conexion-bloque { margin-top: 18px; }

/* Importes que se abren en la lista de facturas que los forman (Impuestos) */
.enlace-importe { font: inherit; font-variant-numeric: inherit; color: var(--marca); background: none; border: 0; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.enlace-importe:hover, .enlace-importe:focus-visible { background: var(--marca-clara); text-decoration-style: solid; }
.panel:has(.tabla-caja table tfoot) { width: min(1060px, 100%); }
.panel input[type=search] { width: 100%; box-sizing: border-box; margin: 8px 0; }

/* Registro de actividad */
.filtros-actividad { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 4px 0 14px; }
.filtros-actividad label { display: flex; flex-direction: column; gap: 3px; min-width: 130px; }
.filtros-actividad label.ancha { flex: 1 1 220px; }
.filtros-actividad input, .filtros-actividad select { width: 100%; }
.paginacion { display: flex; align-items: center; gap: 8px; margin: 12px 0 24px; }
.nowrap { white-space: nowrap; }

/* Gráficos (graficos.js) */
.grafico-caja { width: 100%; }
.grafico .s-entra, .grafico .s-ingreso, .grafico .s-cobrar { fill: #1f5fd1; }
.grafico .s-sale, .grafico .s-gasto, .grafico .s-pagar { fill: #f0a35c; }
.grafico .s-antes { fill: #b9c6dd; }
.grafico .s-gasto-antes { fill: #f6d3ad; }
.grafico .guia.cero { stroke: #b8bfcc; }
.grafico .linea-saldo { stroke: #0f7352; stroke-width: 2.5; stroke-linejoin: round; }
.grafico .punto-saldo { fill: #fff; stroke: #0f7352; stroke-width: 2; }
.leyenda-grafico { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; }
.leyenda.entra::before, .leyenda.ingreso::before, .leyenda.cobrar::before { background: #1f5fd1; }
.leyenda.sale::before, .leyenda.gasto::before, .leyenda.pagar::before { background: #f0a35c; }
.leyenda.antes::before { background: #b9c6dd; }
.leyenda.gasto-antes::before { background: #f6d3ad; }
.leyenda.saldo::before { background: #0f7352; border-radius: 50%; }
.horizontales { display: grid; gap: 6px; }
.h-fila { display: grid; grid-template-columns: minmax(90px, 220px) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 4px 6px; border-radius: 8px; color: inherit; text-decoration: none; }
a.h-fila:hover { background: var(--marca-clara); }
.h-etiqueta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.h-pista { display: block; height: 12px; background: #eef0f3; border-radius: 6px; overflow: hidden; }
.h-barra { display: block; height: 100%; background: #1f5fd1; border-radius: 6px; }
.h-valor { font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; white-space: nowrap; }
.h-valor small { display: block; color: var(--suave); font-size: 11px; }
@media (max-width: 760px) { .h-fila { grid-template-columns: minmax(0, 1fr) auto; } .h-pista { grid-column: 1 / -1; order: 3; } }
.h-barra.naranja { background: #f0a35c; }
.portada .bloque.ancho { grid-column: 1 / -1; }

/* Escáner por correo */
.direccion-escaner { background: var(--papel); border: 1px solid var(--linea); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; display: grid; gap: 8px; }
.direccion-fila { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.direccion-fila code { font-size: 15px; font-weight: 600; background: var(--marca-clara); color: var(--marca); padding: 8px 12px; border-radius: 8px; overflow-wrap: anywhere; }
.ajustes-escaner { display: grid; gap: 14px; max-width: 640px; }
.ajustes-escaner label { display: grid; gap: 6px; }
.ajustes-escaner label.casilla { display: flex; gap: 8px; align-items: center; }
.ajustes-escaner textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--linea); border-radius: 8px; resize: vertical; }
small.suave, .suave { color: var(--suave); }
.boton.chico { padding: 2px 8px; font-size: 12px; margin-left: 8px; }
.h-pista { position: relative; }
.h-marca { position: absolute; top: 0; bottom: 0; width: 2px; background: #1b2434; opacity: .55; }
.texto-alerta { color: #b3261e; }

/* Cierre de ejercicio y modelo 200 */
.fila-ajuste { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin: 0 0 8px; align-items: center; }
.ajustes-200 { margin: 8px 0 12px; }
@media (max-width: 760px) { .fila-ajuste { grid-template-columns: minmax(0, 1fr); } }
.tabla-caja tr.total td { background: var(--marca-clara); }

/* Áreas de trabajo (Contable · Fiscal · Laboral) */
.areas { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; margin: 4px 0 10px; background: var(--fondo-suave, #eef0f4); border-radius: 10px; }
.areas .area { text-align: center; padding: 6px 4px; font-size: 13px; font-weight: 600; color: var(--suave, #5b6578); border-radius: 8px; text-decoration: none; }
.areas .area:hover { color: var(--texto, #101828); }
.areas .area.activa { background: #fff; color: var(--texto, #101828); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.areas .area:focus-visible { outline: 2px solid var(--marca, #2563eb); outline-offset: 1px; }
.pestanas { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 14px; border-bottom: 1px solid var(--borde, #e4e7ec); }
.pestanas .pestana { padding: 8px 12px; font-size: 14px; font-weight: 600; color: var(--suave, #5b6578); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pestanas .pestana.activa { color: var(--texto, #101828); border-bottom-color: var(--marca, #2563eb); }
/* Formularios de Laboral: la etiqueta encima del campo */
.laboral .rejilla > label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; color: var(--suave, #5b6578); min-width: 0; }
.laboral .rejilla > label > input:not([type=checkbox]), .laboral .rejilla > label > select { width: 100%; }
.laboral label.marca { display: inline-flex; align-items: center; gap: 6px; margin: 4px 14px 10px 0; font-size: 13px; }

.fila-activa td { background: var(--acento-suave, #eef4ff); font-weight: 600; }

tr.clicable { cursor: pointer; }
tr.clicable:hover td { background: var(--acento-suave, #eef4ff); }


.enlace-olvido { display: block; margin-top: 12px; text-align: center; font-size: 14px; color: #1f5fd1; }
.bloque .acciones { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }

/* Árbol de la organización (Administración → Ver en árbol) */
ul.arbol { list-style: none; margin: 0; padding-left: 22px; border-left: 1px solid var(--borde, #d8dde6); }
ul.arbol.raiz { padding-left: 0; border-left: 0; }
.arbol-rama > summary { cursor: pointer; padding: 6px 0; }
.arbol-hoja { padding: 4px 0; }

/* Comercial: embudo de ventas */
.op-embudo { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.op-col { background: var(--fondo-suave, #f6f7f9); border: 1px solid var(--linea); border-radius: 10px; padding: 10px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.op-col-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 2px 4px; }
.op-col-cab small { color: var(--suave); }
.op-tarjeta { background: #fff; border: 1px solid var(--linea); border-radius: 8px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.op-tarjeta:hover, .op-tarjeta:focus-visible { border-color: #1f5fd1; outline: none; }
.op-pie { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.op-cierres { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.op-cierre { border: 2px dashed var(--linea); border-radius: 10px; padding: 14px; text-align: center; color: var(--suave); font-size: 14px; }
.op-cierre.ganada { border-color: #0f5c42; }
@media (max-width: 760px) { .op-embudo { grid-auto-flow: row; grid-auto-columns: auto; } .op-cierres { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) { .op-tarjeta { background: transparent; } }
.op-sub { color: var(--suave); font-size: 13px; }
.lista-simple { list-style: none; margin: 0 0 10px; padding: 0; } .lista-simple li { padding: 6px 0; border-bottom: 1px solid var(--linea); }
.op-nueva-act { display: grid; grid-template-columns: 130px minmax(0, 1fr) 150px auto; gap: 8px; align-items: center; margin-bottom: 14px; }
@media (max-width: 760px) { .op-nueva-act { grid-template-columns: minmax(0, 1fr); } }
.op-barra { height: 10px; min-width: 4px; border-radius: 5px; background: #1f5fd1; opacity: .75; }
