/* =====================================================================
   CuentasSinLíos · Estilos
   Estilo «libreta» del manual de identidad: papel claro, tinta de bolígrafo
   azul, línea roja de margen. Letra grande y botones amplios para leer y
   pulsar con comodidad. Al imprimir se quitan menús y colores de fondo.
   ===================================================================== */
:root {
  --papel: #FBFAF4;       /* fondo de la hoja */
  --sup: #FFFFFF;         /* tarjetas */
  --boli: #1D3FA8;        /* azul bolígrafo: enlaces y botones */
  --grafito: #3E4046;     /* texto */
  --gris: #6D7079;        /* texto secundario */
  --cuadricula: #DCE6EF;  /* líneas finas */
  --margen: #C8302A;      /* línea roja de margen */
  --rojo: #C8302A;        /* gastos y cifras negativas */
  --ok: #2F7D3A;          /* ingresos y confirmaciones */
  --amarillo: #F6E54E;    /* subrayado */
  --f-texto: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-titulo: "Bitter", Georgia, "Times New Roman", serif;
  --f-cifras: "Courier Prime", "Courier New", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { font-size: 17px; }
body { margin: 0; background: var(--papel); color: var(--grafito); font-family: var(--f-texto); line-height: 1.5; }
a { color: var(--boli); }
h1, h2 { font-family: var(--f-titulo); color: var(--grafito); line-height: 1.2; }
h1 { font-size: 1.7rem; margin: .4rem 0 1rem; }
h2 { font-size: 1.25rem; margin: 0 0 .8rem; }
small, .nota { color: var(--gris); }
.nota { font-size: .92rem; }

/* ---------- Barra superior y pestañas ---------- */
.barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  padding: .6rem 1rem; background: var(--sup); border-bottom: 2px solid var(--cuadricula); }
.marca { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--boli); font-family: var(--f-titulo); font-size: 1.35rem; }
.marca b { font-weight: 800; }
.menu-usuario { display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; font-size: .95rem; }
.menu-usuario .quien { color: var(--gris); }
.menu-usuario .salir { font-weight: 700; }
.pestanas { display: flex; flex-wrap: wrap; gap: .3rem; padding: .5rem 1rem 0; background: var(--sup); border-bottom: 2px solid var(--boli); }
.pestanas a { padding: .55rem 1rem; text-decoration: none; border-radius: 8px 8px 0 0; color: var(--grafito); font-weight: 700; }
.pestanas a.activa { background: var(--boli); color: #fff; }
.pestanas a.destacada:not(.activa) { color: var(--ok); }
.pestanas .proyecto { color: var(--gris); font-weight: 400; margin-right: .5rem; }

/* ---------- Hoja de libreta ---------- */
.hoja { max-width: 1150px; margin: 0 auto; padding: 1.2rem 1rem 3rem 1.6rem; position: relative; }
.hoja::before { content: ""; position: absolute; left: .6rem; top: 0; bottom: 0; border-left: 2px solid var(--margen); opacity: .35; }
.pie { text-align: center; color: var(--gris); font-size: .85rem; padding: 1rem; }

.tarjeta { background: var(--sup); border: 1px solid var(--cuadricula); border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.dos-columnas { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 0 1.2rem; }
.titulo-con-selector { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; }

/* ---------- Inicio ---------- */
.rejilla-proyectos, .rejilla-informes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
.proyecto-tarjeta { text-decoration: none; color: inherit; display: block; transition: transform .1s, box-shadow .1s; border-top: 6px solid var(--boli); }
.proyecto-tarjeta:hover, .proyecto-tarjeta:focus { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(29,63,168,.15); }
.proyecto-tarjeta h2 { color: var(--boli); }
.proyecto-tarjeta .cifra { font-family: var(--f-cifras); font-size: 1.6rem; font-weight: 700; margin: .2rem 0; }
.proyecto-tarjeta p { margin: .2rem 0; }
.etiqueta { display: inline-block; font-size: .8rem; background: var(--cuadricula); border-radius: 99px; padding: .1rem .6rem; margin-bottom: .4rem; }
.enlace-tarjeta { text-decoration: none; color: inherit; }

/* ---------- Cifras grandes ---------- */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.cifra-caja { background: var(--sup); border: 1px solid var(--cuadricula); border-radius: 12px; padding: .8rem 1rem; }
.cifra-caja span { display: block; color: var(--gris); font-size: .9rem; }
.cifra-caja strong { font-family: var(--f-cifras); font-size: 1.45rem; }
.positivo { color: var(--ok); }
.negativo { color: var(--rojo); }

/* ---------- Tablas ---------- */
.tabla { width: 100%; border-collapse: collapse; font-size: .95rem; margin-bottom: 1rem; }
.tabla th { text-align: left; font-size: .85rem; color: var(--gris); border-bottom: 2px solid var(--cuadricula); padding: .4rem .5rem; }
.tabla td { border-bottom: 1px solid var(--cuadricula); padding: .4rem .5rem; vertical-align: top; }
.tabla .num { text-align: right; font-family: var(--f-cifras); white-space: nowrap; }
.tabla .fecha { white-space: nowrap; font-family: var(--f-cifras); }
.tabla tr.total td { font-weight: 700; border-top: 2px solid var(--grafito); border-bottom: none; }
.tabla tr.subtitulo td { font-weight: 700; background: #F3F5FA; }
.tabla .sangria { padding-left: 1.6rem; }
.tabla tr.apagada td { color: var(--gris); }
.tabla tr.inicio-asiento td { border-top: 2px solid var(--cuadricula); }
.tabla .vacio, .vacio { text-align: center; color: var(--gris); padding: 1.5rem; }
.tabla.estrecha { font-size: .8rem; }
.tabla-desplazable { overflow-x: auto; }
.barras .ancho { width: 35%; min-width: 90px; }
.barra-i, .barra-g { display: block; height: 7px; border-radius: 4px; margin: 3px 0; }
.barra-i { background: var(--ok); }
.barra-g { background: var(--rojo); }
.marca-aviso { font-size: .75rem; background: #FDE7E5; color: var(--rojo); border-radius: 4px; padding: 0 .3rem; }
.discreto { text-decoration: none; color: var(--gris); }
pre.detalle { white-space: pre-wrap; font-size: .8rem; background: #F3F5FA; padding: .6rem; border-radius: 6px; max-height: 400px; overflow: auto; }

/* ---------- Formularios ---------- */
.formulario label, .filtros label { display: block; font-weight: 700; margin-bottom: .8rem; }
.filtros { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; margin-bottom: 1rem; }
.filtros label { margin-bottom: 0; font-size: .9rem; }
input, select, button, textarea { font: inherit; }
input:not([type=checkbox]):not([type=radio]), select {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .65rem; border: 1px solid #B8C3D3; border-radius: 8px; background: #fff; color: var(--grafito); min-height: 44px; }
.filtros input, .filtros select { width: auto; min-width: 150px; }
input:focus, select:focus, button:focus, a:focus { outline: 3px solid var(--amarillo); outline-offset: 1px; }
input.importe { text-align: right; font-family: var(--f-cifras); }
.fila-campos { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.fila-campos > label { flex: 1 1 180px; }
.fila-campos > label.crece { flex: 3 1 300px; }
.casilla { font-weight: 400 !important; display: flex !important; gap: .5rem; align-items: center; }
fieldset { border: 1px solid var(--cuadricula); border-radius: 10px; margin: 0 0 1rem; padding: .8rem 1rem; }
legend { font-weight: 700; padding: 0 .3rem; }
.tipos { display: flex; flex-wrap: wrap; gap: .6rem; }
.opcion-tipo { display: flex !important; align-items: center; gap: .4rem; margin: 0 !important; padding: .55rem .9rem; border: 2px solid var(--cuadricula); border-radius: 10px; cursor: pointer; }
.opcion-tipo:has(input:checked) { border-color: var(--boli); background: #EEF2FC; }
.estrecho { max-width: 560px; }
.lineas-asiento select { min-width: 220px; }
.lineas-asiento input.importe { min-width: 110px; }
.selector-ej label { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.selector-ej select { width: auto; margin: 0; }

/* ---------- Botones ---------- */
.boton { display: inline-block; padding: .55rem 1.1rem; border-radius: 10px; border: 2px solid var(--boli); background: #fff; color: var(--boli);
  font-weight: 700; text-decoration: none; cursor: pointer; min-height: 44px; line-height: 1.6; }
.boton.principal { background: var(--boli); color: #fff; }
.boton.grande { font-size: 1.1rem; padding: .7rem 1.6rem; }
.boton.pequeno { padding: .2rem .6rem; min-height: 34px; font-size: .85rem; }
.boton.peligro { border-color: var(--rojo); color: var(--rojo); }
.boton:hover { filter: brightness(1.1); }
.acciones { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1rem; }
.en-linea { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.en-linea input { width: auto !important; display: inline-block !important; margin: 0 !important; }
.paginacion { display: flex; gap: 1rem; align-items: center; justify-content: center; }

/* ---------- Avisos ---------- */
.aviso { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; border-left: 6px solid; }
.aviso ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.aviso-ok { background: #E9F6EC; border-color: var(--ok); }
.aviso-error { background: #FDECEA; border-color: var(--rojo); }
.aviso-info { background: #EEF2FC; border-color: var(--boli); }

/* ---------- Entrada ---------- */
.entrar { max-width: 420px; margin: 2rem auto; text-align: center; }
.entrar form { text-align: left; }
.entrar h1 { color: var(--boli); }

/* ---------- Informes ---------- */
.informe-cabecera { display: none; }
.botones-informe { margin: 0 0 1rem; }
.resumen-final { max-width: 640px; }

@media (max-width: 640px) {
  html { font-size: 16px; }
  .hoja { padding-left: 1rem; padding-right: .7rem; }
  .hoja::before { display: none; }
  .tabla { font-size: .85rem; }
  .pestanas a { padding: .45rem .6rem; }
}

/* =====================================================================
   IMPRESIÓN (y «Guardar como PDF»)
   ===================================================================== */
@page { size: A4; margin: 14mm 12mm 16mm;
  @bottom-right { content: "Página " counter(page) " de " counter(pages); font-size: 9pt; color: #555; }
  @bottom-left { content: "CuentasSinLíos"; font-size: 9pt; color: #555; } }
@media print {
  html { font-size: 10.5pt; }
  body { background: #fff; color: #000; }
  .no-imprimir, .barra, .pestanas, .pie, .aviso, .filtros, .selector-ej { display: none !important; }
  .hoja { max-width: none; padding: 0; }
  .hoja::before { display: none; }
  .tarjeta, .cifra-caja { border: none; box-shadow: none; padding: 0; margin-bottom: .6rem; }
  a { color: #000; text-decoration: none; }
  .informe-cabecera { display: flex; gap: .8rem; align-items: flex-start; border-bottom: 2px solid #000; padding-bottom: .4rem; margin-bottom: .8rem; }
  .informe-cabecera h1 { margin: 0; font-size: 15pt; }
  .informe-proyecto { font-weight: 700; color: var(--boli); }
  .informe-datos { font-size: 9pt; color: #333; }
  .tabla { font-size: 9.5pt; }
  .tabla thead { display: table-header-group; }       /* repite los títulos de columna en cada página */
  .tabla tr { page-break-inside: avoid; }
  .tabla tr.subtitulo td { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .barra-i, .barra-g { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cifras { display: flex; gap: 2rem; }
  .tabla-desplazable { overflow: visible; }
}
