/* Estilo inspirado en iOS (cristal líquido imitado con CSS). Letra del sistema: no se descarga ninguna. */
/* Estilo «Glassy» (2/12/2026): oscuro cálido, cristal grafito y tarjetas de colores. Oscuro por defecto. */
/* Los colores y las formas de cada estilo son variables (ver docs/estilos/README.md). Este es «Cristal», el de siempre, y también
   el de reserva. Los otros estilos están en estilos/*.css. [data-estilo="cristal"] sirve además para las vistas previas de Ajustes. */
:root, [data-estilo="cristal"] {
  --fondo: #15110e; --texto: #f6f1ec; --suave: #cdc3ba; --linea: rgba(255, 240, 225, .1);
  --marca: #ffb067; --mal: #ff7b72; --mal-fondo: #4a1c18; --ok: #34d399; --ok-fondo: #0f3326; --impuesto: #ffc27a;
  --solido: #231d19; --relleno: rgba(255, 240, 225, .08);
  --cristal: linear-gradient(160deg, rgba(128, 110, 96, .30), rgba(58, 48, 42, .32));
  --placa: rgba(255, 240, 225, .07); --borde: rgba(255, 240, 225, .11);
  --brillo: inset 0 1px 0 rgba(255,255,255,.08), 0 18px 44px rgba(0,0,0,.32);
  /* Fondo liso con un degradado suave de arriba abajo: sin manchas borrosas detrás. */
  --fondo-alto: #262019;
  --marco: rgba(52, 44, 38, .55); --oscura: rgba(12, 10, 9, .72); --oscura-texto: #f6f1ec; --oscura-suave: rgba(246, 241, 236, .62); --grafico: #f2a65a;
  --degradado: linear-gradient(135deg, #ff9f43, #ff5e7e); --sobre-degradado: #fff;
  --boton: #f6f1ec; --boton-texto: #1a1512;
  /* Accesibilidad (ACC-05, ACC-06): textos y bordes que se distinguen (4,5:1 y 3:1 o más). */
  --pendiente: #ffc27a; --ok-texto: #6ff0bd; --borde-campo: rgba(255, 240, 225, .45);
  --nav-fondo: rgba(0, 0, 0, .18); --nav-movil: rgba(28, 23, 20, .72);
  /* Tarjetas de colores por concepto: letra, trazos de los gráficos pequeños y botón. */
  --tc-fondo: transparent; --tc-borde: rgba(255, 255, 255, .12); --tc-texto: #fff; --tc-suave: rgba(255, 255, 255, .74);
  --tc-trazo: #fff; --tc-pista: rgba(255, 255, 255, .2); --tc-col: rgba(255, 255, 255, .9); --tc-area: rgba(255, 255, 255, .14);
  --tc-chip: rgba(0, 0, 0, .28); --tc-chip-suave: rgba(255, 255, 255, .16); --tc-ir: #fff; --tc-ir-texto: #1a1512;
  /* Formas y letras (solo hace falta ponerlas en la variante oscura; la clara las hereda). */
  --fondo-capa: linear-gradient(180deg, var(--fondo-alto), var(--fondo) 70%);
  --vidrio: blur(18px) saturate(180%); --vidrio-movil: blur(22px) saturate(160%);
  --r-grande: 28px; --r-panel: 24px; --r-tabla: 22px; --r-chico: 18px; --r-boton: 999px; --r-campo: 12px;
  --f-texto: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, sans-serif;
  --f-titulo: var(--f-texto); --f-cifras: var(--f-texto); --f-etiqueta: var(--f-texto); --f-tabla: var(--f-texto);
  --f-empresa: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; --peso-empresa: 200;
  color-scheme: dark;
}
:root {
  font-family: var(--f-texto);
  font-variant-numeric: tabular-nums; line-height: 1.4; color: var(--texto); background: var(--fondo);
}
/* El claro solo sale si quien mira lo pide con data-theme="light". */
:root[data-theme="light"], [data-estilo="cristal"][data-theme="light"] {
  --fondo: #eceef1; --texto: #16181c; --suave: #474c54; --linea: rgba(20, 25, 35, .13);
  --marca: #9a4708; --mal: #b3140c; --mal-fondo: #ffe7e5; --ok: #0f7a4d; --ok-fondo: #ddf5e9; --impuesto: #8a4100;
  --solido: #ffffff; --relleno: rgba(20, 25, 35, .06);
  --cristal: linear-gradient(160deg, rgba(255,255,255,.78), rgba(255,255,255,.6));
  --placa: rgba(255, 255, 255, .7); --borde: rgba(255, 255, 255, .8);
  --brillo: inset 0 1px 0 rgba(255,255,255,.9), 0 10px 28px rgba(20,30,50,.10);
  --fondo-alto: #f7f8fa;
  --marco: rgba(255, 255, 255, .5); --oscura: rgba(20, 22, 26, .88); --grafico: #c26d14;
  --oscura-texto: #f6f1ec; --oscura-suave: rgba(246, 241, 236, .62);
  --degradado: linear-gradient(135deg, #ff9f43, #ff5e7e); --sobre-degradado: #fff;
  --boton: #16181c; --boton-texto: #ffffff;
  --pendiente: #8a4100; --ok-texto: #0b5e3b; --borde-campo: rgba(20, 25, 35, .58);
  --nav-fondo: rgba(255, 255, 255, .45); --nav-movil: rgba(255, 255, 255, .82);
  --tc-fondo: transparent; --tc-borde: rgba(255, 255, 255, .12); --tc-texto: #fff; --tc-suave: rgba(255, 255, 255, .74);
  --tc-trazo: #fff; --tc-pista: rgba(255, 255, 255, .2); --tc-col: rgba(255, 255, 255, .9); --tc-area: rgba(255, 255, 255, .14);
  --tc-chip: rgba(0, 0, 0, .28); --tc-chip-suave: rgba(255, 255, 255, .16); --tc-ir: #fff; --tc-ir-texto: #1a1512;
  color-scheme: light;
}
* { box-sizing: border-box; }
/* body crea su propia capa para que el fondo de colores (body::before) quede por encima del fondo del body, y no tapado. */
body { margin: 0; min-height: 100vh; background: var(--fondo); color: var(--texto); position: relative; z-index: 0; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--fondo-capa);
}

/* Superficies de cristal */
nav, .cristal, .ficha, .tabla-ancha, .demo-ventana, .demo-flota {
  background: var(--cristal); border: 1px solid var(--borde); box-shadow: var(--brillo);
  backdrop-filter: var(--vidrio); -webkit-backdrop-filter: var(--vidrio);
}

header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.25rem; max-width: 1200px; margin: 0 auto; padding: .9rem 1.25rem 0; }
/* Nombre de la empresa: grande y de trazo fino, con letras del sistema (no se descarga ninguna). */
header strong { font-family: var(--f-empresa); font-size: clamp(1.35rem, 1rem + 1.2vw, 1.9rem); font-weight: var(--peso-empresa); letter-spacing: .02em; line-height: 1.15; overflow-wrap: anywhere; text-transform: uppercase; }
/* Sin logo todavía: logo y nombre son un botón para ponerlo. El lápiz sale solo al pasar por encima
   (o al llegar con el teclado); en pantallas táctiles, sin ratón, se ve siempre. */
header .poner-logo { display: flex; align-items: center; gap: .8rem; min-width: 0; padding: .25rem .6rem .25rem .25rem; margin-left: -.25rem; background: none; border: 1px solid transparent; box-shadow: none; border-radius: 18px; text-align: left; color: inherit; transition: background .2s, border-color .2s; }
header .poner-logo:hover, header .poner-logo:focus-visible { background: var(--cristal); border-color: var(--borde); }
header .poner-logo .lapiz { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--boton); color: var(--boton-texto); opacity: 0; transform: scale(.8); transition: opacity .2s, transform .2s; }
header .poner-logo:hover .lapiz, header .poner-logo:focus-visible .lapiz { opacity: 1; transform: none; }
@media (hover: none) { header .poner-logo .lapiz { opacity: .85; transform: none; } }
header .poner-logo .lapiz svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Logo de la empresa: sobre una placa clara, porque casi todos los logos están pensados para fondo blanco. */
img.logo-empresa { flex: none; display: block; width: auto; max-width: 150px; object-fit: contain; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.94); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.cabeza-izq img.logo-empresa { height: 34px; }
.logo-vista { display: grid; place-items: center; min-height: 130px; margin: .5rem 0 .9rem; border-radius: 20px; border: 1px dashed var(--borde); }
.logo-vista img.logo-empresa { height: 96px; max-width: 280px; padding: 6px; }
.tu-empresa-logo { margin-bottom: .6rem; }
.tu-empresa-logo img.logo-empresa { height: 64px; max-width: 220px; }
.tu-empresa-logo .simbolo { border-radius: 28%; }
p.suave { color: var(--suave); }
/* El margen automático la centra; .ficha pondría el suyo. */
dialog.ficha { margin: auto; width: min(420px, calc(100% - 2rem)); color: var(--texto); }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog input { width: 100%; }
dialog .aviso { margin: 0 0 .75rem; }
nav { display: flex; gap: 2px; padding: 5px; border-radius: var(--r-boton); position: sticky; top: .6rem; z-index: 5; }
nav a { padding: .45rem .85rem; border-radius: var(--r-boton); color: var(--texto); text-decoration: none; font-weight: 500; white-space: nowrap; }
nav a:hover { background: var(--relleno); }
nav a[aria-current] { background: var(--placa); color: var(--marca); box-shadow: inset 0 1px 1px var(--borde), 0 3px 12px rgba(0,60,140,.2); }
nav svg { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.usuario { color: var(--suave); font-size: .9rem; }
.etiqueta { background: var(--placa); color: var(--marca); padding: .25rem .7rem; border-radius: var(--r-boton); font-size: .85rem; }
main { max-width: 1200px; margin: 0 auto; padding: .5rem 1.25rem 3rem; }
main.centro { max-width: 460px; padding-top: 2rem; }
footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem 1rem; color: var(--suave); font-size: .82rem; padding: 1.5rem 1rem 2rem; }
h1 { font-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.3rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.12; margin: 1rem 0 .35rem; }
h2 { font-size: 1.2rem; margin: .2rem 0 .75rem; }
a { color: var(--marca); }
.nota, .avisos { color: var(--suave); font-size: .9rem; }
small { color: var(--suave); }
.aviso:empty { display: none; }
.aviso { max-width: 1160px; margin: .75rem auto 0; padding: .7rem 1.1rem; border-radius: var(--r-chico); }
/* Aviso de la app: flota arriba, con icono y botón de cerrar. */
.aviso.flotante { position: fixed; z-index: 30; top: max(.9rem, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 2rem)); margin: 0;
  display: flex; align-items: center; gap: .7rem; padding: .65rem .7rem .65rem .8rem; border: 1px solid var(--borde); box-shadow: 0 18px 40px rgba(20,30,80,.22);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); animation: bajar .28s cubic-bezier(.2,.9,.3,1.2); }
.aviso.flotante.ok { background: color-mix(in srgb, var(--ok-fondo) 88%, transparent); }
.aviso.flotante.mal { background: color-mix(in srgb, var(--mal-fondo) 92%, transparent); }
.aviso-icono { flex: none; display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; color: #fff; font-weight: 700; font-size: .9rem; }
.ok .aviso-icono { background: var(--ok); } .mal .aviso-icono { background: var(--mal); }
.ok .aviso-icono, .mal .aviso-icono { color: var(--solido); }
.aviso-texto { flex: 1; font-weight: 500; }
.aviso-cerrar { flex: none; width: 2rem; height: 2rem; padding: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.3rem; line-height: 1; }
@keyframes bajar { from { opacity: 0; transform: translate(-50%, -12px) scale(.98); } }
.aviso.ok { background: var(--ok-fondo); color: var(--ok); }
.aviso.mal { background: var(--mal-fondo); color: var(--mal); }

/* Botones y campos */
button, .boton { font: inherit; font-weight: 600; font-size: .95rem; padding: .55rem 1.15rem; border: 1px solid transparent; border-radius: var(--r-boton); background: var(--relleno); color: var(--texto); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none; transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease; }
button:active, .boton:active { transform: scale(.97); }
button:hover, .boton:hover { border-color: var(--marca); }
button.principal, .boton.principal { background: linear-gradient(135deg, #1a7cf0, #4f5df5); color: #fff; box-shadow: inset 0 1px 1px rgba(255,255,255,.45), 0 8px 20px rgba(40,90,230,.32); }
button.principal:hover, .boton.principal:hover { border-color: transparent; box-shadow: inset 0 1px 1px rgba(255,255,255,.45), 0 10px 26px rgba(40,90,230,.42); }
button.peligro-fuerte { background: linear-gradient(135deg, #e0382d, #c11f3a); box-shadow: inset 0 1px 1px rgba(255,255,255,.4), 0 8px 20px rgba(200,30,40,.3); }
button.peligro { color: var(--mal); }
button.pequeno { padding: .25rem .7rem; font-size: .85rem; }
button:disabled { opacity: .6; cursor: wait; }
input, select { font: inherit; color: var(--texto); padding: .55rem .8rem; border: 1px solid var(--linea); border-radius: var(--r-campo); background: var(--placa); max-width: 100%; transition: border-color .2s ease, box-shadow .2s ease; }
input:focus, select:focus { outline: none; border-color: var(--marca); box-shadow: 0 0 0 4px color-mix(in srgb, var(--marca) 22%, transparent); }
input::placeholder { color: color-mix(in srgb, var(--suave) 75%, transparent); }
option { background: var(--solido); color: var(--texto); }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: #0a6edc; vertical-align: text-bottom; }
/* color transparente: oculta «Ningún archivo seleccionado» y deja solo el botón azul. */
input[type=file] { padding: 0; border: 0; background: none; border-radius: var(--r-boton); color: transparent; }
input[type=file]::file-selector-button { font: inherit; font-weight: 500; margin-right: .75rem; padding: .5rem 1.1rem; border: 0; border-radius: var(--r-boton); background: linear-gradient(#0a6edc, #005bc4); color: #fff; cursor: pointer; }
.oculto { display: none; }
:focus-visible { outline: 3px solid var(--marca); outline-offset: 2px; }

/* Resumen */
.titulo { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; }
.portada { display: flex; flex-wrap: wrap; gap: .9rem; margin-bottom: .9rem; }
.cristal { border-radius: var(--r-panel); padding: 1.1rem 1.25rem; }
.cristal > span { display: block; color: var(--suave); }
.cristal strong { display: block; font-size: 1.8rem; letter-spacing: -.02em; }
.cristal .boton { margin-top: .5rem; }
.saldo { flex: 3 1 420px; min-width: 0; }
.saldo > strong { font-size: clamp(2.2rem, 6vw, 3rem); line-height: 1.15; }
.lateral { flex: 1 1 250px; display: flex; flex-direction: column; gap: .9rem; }
.lateral > :last-child { flex: 1; }
.impuesto { color: var(--impuesto); }
dl { margin: .4rem 0 0; }
dl div { display: flex; justify-content: space-between; gap: .5rem; padding: .4rem 0; border-top: 1px solid var(--linea); }
dd { margin: 0; }
.grafico { display: block; width: 100%; margin: .5rem 0 .25rem; }
.grafico rect { fill: var(--grafico); }
.grafico .zona { fill: transparent; }
.grafico .barra:hover rect:not(.zona) { filter: brightness(1.12); }
.grafico rect.rojo { fill: var(--mal); }
.grafico rect.pasado { opacity: .45; }
.grafico rect.futuro { fill-opacity: .12; stroke: var(--grafico); stroke-width: 1.5; stroke-dasharray: 4 3; }
.grafico rect.futuro.rojo { stroke: var(--mal); }
.grafico .eje { stroke: var(--linea); }
.grafico text { fill: var(--suave); font-size: 13px; text-anchor: middle; }

/* Tablas */
.tabla-ancha { overflow-x: auto; border-radius: var(--r-tabla); padding: .25rem .5rem; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .55rem .65rem; border-bottom: 1px solid var(--linea); text-align: left; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
table.resumen td, table.resumen thead th { text-align: right; }
/* La primera columna es transparente; solo se tapa cuando hay meses pasando por debajo. */
table.resumen tbody th { position: sticky; left: 0; font-weight: 400; }
.desplazada table.resumen tbody th { background: var(--solido); }
/* El mes actual solo se marca en su cabecera: un fondo en toda la columna tapaba el cristal. */
table.resumen thead .hoy { color: var(--marca); }
table.resumen tr.destacada > * { font-weight: 600; }
td.importe, .importe { text-align: right; }
.negativo { color: var(--mal); }

/* Formularios y listas */
.filtros { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin: 1rem 0 .5rem; }
.ficha { border-radius: var(--r-grande); padding: 1.1rem 1.35rem; margin-bottom: 1rem; max-width: 640px; }
.ficha label { display: grid; gap: .25rem; margin-bottom: .7rem; font-size: .92rem; }
.ficha label.casilla { display: block; }
.botones { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.entrar button { width: 100%; margin-top: .5rem; }
.mayusculas { text-transform: uppercase; }
/* Alta de la cuenta: una pregunta por pantalla. */
.alta h1 { font-size: 1.6rem; margin-top: 0; }
.alta .botones { margin-top: .75rem; }
.alta .botones > * { flex: 1 1 auto; text-align: center; }
.alta .aviso { margin: 0; }
/* En PC, entrar y alta ocupan unos 2/3 de la pantalla. En móvil se quedan como estaban. */
@media (min-width: 761px) {
  main.centro { max-width: none; width: 66.667%; min-height: 100vh; padding: 1.5rem 0; display: flex; flex-direction: column; justify-content: center; }
  /* Mismo margen por los cuatro lados: título arriba, botones abajo y lo demás repartido en medio. */
  .centro .ficha { display: flex; flex-direction: column; width: 100%; max-width: none; min-height: 66.667vh; margin: 0; padding: clamp(2rem, 3.5vw, 4rem); font-size: clamp(1.05rem, .5rem + .8vw, 1.4rem); }
  .centro .ficha h1 { font-size: 2.1em; margin: 0 0 1.25rem; }
  .centro .ficha label, .centro .ficha .nota { font-size: 1em; }
  .centro .ficha p { margin: 0 0 .8rem; }
  .centro .ficha button, .centro .ficha .boton { padding: .7rem 1.4rem; }
  .centro .ficha .botones, .centro .ficha.entrar > button { margin-top: auto; }
  .centro .ficha.entrar .nota { margin: 1rem 0 0; }
  /* Paso 1: la casilla del nombre, más corta y centrada. El rótulo no se ve, pero lo siguen leyendo los lectores de pantalla. */
  .centro .alta label:has(> .mayusculas) { width: 65%; align-self: center; }
  .centro .alta label:has(> .mayusculas) > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .centro .alta label > .mayusculas { width: 100%; text-align: center; }
  /* Entrar y alta con demostración: la tarjeta a la izquierda y la «foto» de la app a la derecha. */
  main.centro.con-demo { width: min(1280px, 100% - 3rem); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 4vw, 4.5rem); align-items: center; }
  .con-demo .lado { display: flex; flex-direction: column; min-width: 0; }
  .con-demo .ficha { font-size: clamp(1rem, .55rem + .6vw, 1.25rem); }
}
.lista { display: grid; gap: .6rem; margin: 1rem 0; }
/* Sin desenfoque: puede haber cientos de movimientos y la página iría lenta. */
.mov { background: var(--placa); border: 1px solid var(--borde); border-radius: var(--r-chico); padding: .75rem 1rem; box-shadow: 0 4px 14px rgba(30,50,110,.08); }
.mov.decidido { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.mov .cabeza { display: grid; grid-template-columns: 6.5rem 1fr auto auto; gap: .75rem; align-items: baseline; }
.mov .texto { overflow-wrap: anywhere; }
.mov .estado { font-size: .8rem; color: var(--suave); }
.mov .campos { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; align-items: center; }

/* Demostración: una versión pequeña de Resumen con datos inventados. Solo se mira. */
.demo { position: relative; min-width: 0; margin-top: 1.5rem; padding-bottom: 5rem; user-select: none; }
.demo-ventana { border-radius: var(--r-grande); padding: 1.1rem 1.3rem 1.2rem; }
.demo-barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.demo-nombre { font-size: 1.15rem; font-weight: 200; letter-spacing: .04em; text-transform: uppercase; }
.demo-pestanas { display: flex; gap: 2px; padding: 4px; border-radius: var(--r-boton); background: var(--relleno); font-size: .75rem; font-weight: 500; }
.demo-pestanas span { padding: .25rem .6rem; border-radius: var(--r-boton); white-space: nowrap; }
.demo-pestanas .activa { background: var(--placa); color: var(--marca); box-shadow: inset 0 1px 1px var(--borde), 0 2px 8px rgba(0,60,140,.18); }
.demo-saldo { display: flex; flex-direction: column; margin: 1rem 0 .1rem; color: var(--suave); font-size: .85rem; }
.demo-saldo strong { color: var(--texto); font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.15; letter-spacing: -.02em; }
.demo-filas { display: grid; margin-top: .5rem; }
.demo-fila { display: grid; grid-template-columns: 3rem 1fr auto; gap: .6rem; padding: .5rem 0; border-top: 1px solid var(--linea); font-size: .85rem; }
.demo-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-flota { position: absolute; left: -1.25rem; bottom: .5rem; display: flex; flex-direction: column; padding: .8rem 1.1rem; border-radius: 20px; font-size: .8rem; }
.demo-flota span, .demo-flota small { color: var(--suave); }
.demo-flota strong { font-size: 1.1rem; }
.demo-nota { position: absolute; right: .25rem; bottom: 0; margin: 0; color: var(--suave); font-size: .8rem; }
@media (max-width: 760px) { .demo-flota { left: .5rem; bottom: 1.7rem; } .demo-nota { left: .5rem; right: auto; bottom: 0; } .demo { padding-bottom: 7rem; } }

/* Móvil: la barra de pestañas flota abajo */
@media (max-width: 760px) {
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  nav { position: fixed; top: auto; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  nav a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .4rem 0; font-size: .69rem; }
  nav svg { display: block; }
  .largo { display: none; }
  .mov .cabeza { grid-template-columns: auto 1fr; }
  .mov .importe { text-align: left; }
}

/* Sin transparencias solo si se pide más contraste o el navegador no sabe desenfocar.
   Pau decidió que el cristal se vea aunque el sistema tenga las transparencias quitadas. */
@media (prefers-contrast: more) {
  nav, .cristal, .ficha, .tabla-ancha, .mov, .demo-ventana, .demo-flota { background: var(--solido); border-color: var(--linea); backdrop-filter: none; -webkit-backdrop-filter: none; }
  body::before { display: none; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  nav, .cristal, .ficha, .tabla-ancha, .demo-ventana, .demo-flota { background: var(--solido); }
}


/* ---------- Acabado premium (1/12/2026) ---------- */
.subtitulo { margin: 0 0 1rem; color: var(--suave); font-size: 1.02rem; max-width: 62ch; }
.titulo { align-items: flex-end; margin-bottom: .6rem; }
.titulo .botones { margin-bottom: 1rem; }
h2.seccion { font-size: 1.1rem; margin: 1.6rem 0 .7rem; }
h3 { font-size: 1.1rem; margin: .2rem 0 .35rem; }

/* Marca */
.marca { display: inline-flex; align-items: center; gap: .55rem; font-weight: 650; letter-spacing: -.01em; color: var(--texto); }
.marca .simbolo { flex: none; border-radius: 28%; box-shadow: 0 6px 16px rgba(60,80,230,.28); }
footer .marca { font-size: .9rem; } footer .marca .simbolo { box-shadow: none; }
.cabeza-izq { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.cabeza-izq .simbolo { flex: none; border-radius: 28%; box-shadow: 0 6px 18px rgba(60,80,230,.3); }
.cabeza-der { display: flex; align-items: center; gap: .6rem; }
.usuario { display: inline-flex; align-items: center; gap: .5rem; }
.avatar { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--degradado); color: var(--sobre-degradado); font-weight: 700; font-size: .85rem; }

/* Carga */
main.cargando { min-height: 80vh; display: grid; place-content: center; justify-items: center; gap: .5rem; color: var(--suave); }
main.cargando img { border-radius: 28%; animation: latido 1.4s ease-in-out infinite; box-shadow: 0 10px 30px rgba(60,80,230,.3); }
@keyframes latido { 50% { transform: scale(.92); opacity: .75; } }

/* Cambio de pantalla suave */
.pantalla { view-transition-name: pantalla; }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } }

/* Tarjetas de cifras */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; margin-bottom: .9rem; }
.kpi strong { font-size: clamp(1.6rem, 1.2rem + 1vw, 2rem); margin: .1rem 0 .15rem; }
.kpi small { display: block; }
.kpi.positivo strong { color: var(--ok); }
.kpi.destacado { margin-bottom: 1rem; max-width: 640px; }
.cambio { font-weight: 600; }
.cambio.bueno { color: var(--ok); } .cambio.malo { color: var(--mal); }

/* Gastos por concepto: barras de un solo color, con la cifra al lado. */
.conceptos { margin-bottom: .9rem; }
.conceptos ul { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .65rem; }
.conceptos li { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; }
.concepto-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.concepto-valor { font-weight: 600; } .concepto-valor small { font-weight: 400; }
.concepto-barra { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--relleno); overflow: hidden; }
.concepto-barra span { display: block; height: 100%; border-radius: 4px; background: var(--grafico); }

/* Primeros pasos */
.primeros { margin-bottom: 1rem; padding: 1.4rem 1.5rem; }
.primeros-cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.primeros h2 { font-size: 1.35rem; margin: 0 0 .2rem; }
.primeros .subtitulo { margin-bottom: .8rem; }
.progreso-texto { color: var(--suave); font-weight: 600; white-space: nowrap; }
.progreso { height: 6px; border-radius: 3px; background: var(--relleno); overflow: hidden; margin-bottom: 1rem; }
.progreso span { display: block; height: 100%; border-radius: 3px; background: var(--degradado); }
.primeros ol { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .5rem; }
.primeros li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .9rem; padding: .75rem .9rem; border-radius: var(--r-chico); }
.primeros li > div { display: grid; }
.primeros li strong { display: block; font-size: 1rem; letter-spacing: 0; } .primeros li > div > span { color: var(--suave); font-size: .92rem; }
.primeros li.siguiente { background: var(--placa); box-shadow: inset 0 1px 1px var(--borde), 0 6px 18px rgba(30,50,110,.1); }
.primeros li.hecho strong { text-decoration: line-through; color: var(--suave); }
.paso-marca { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--linea); color: var(--suave); font-weight: 700; font-size: .9rem; }
.hecho .paso-marca { border-color: transparent; background: var(--ok); color: var(--solido); }
.siguiente .paso-marca { border-color: var(--marca); color: var(--marca); }

/* Pantallas vacías */
.vacio { display: grid; justify-items: center; text-align: center; gap: .35rem; padding: 2.5rem 1.5rem; margin: .5rem 0 1rem; }
.vacio p { margin: 0 0 .6rem; color: var(--suave); max-width: 46ch; }
.vacio-icono { display: grid; place-items: center; width: 3.4rem; height: 3.4rem; margin-bottom: .4rem; border-radius: 18px; background: var(--placa); color: var(--marca); box-shadow: inset 0 1px 1px var(--borde), 0 8px 22px rgba(30,50,110,.12); font-size: 1.4rem; font-weight: 700; }
.vacio-icono.ok { color: var(--ok); }
.vacio-icono svg, .ajuste-icono svg, .zona-icono svg, .privado svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Cifras en fila (Subir y Movimientos) */
.cifras { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0 1rem; }
.cifra { display: flex; align-items: baseline; gap: .4rem; padding: .5rem .95rem; border-radius: var(--r-boton); background: var(--placa); border: 1px solid var(--borde); box-shadow: 0 4px 14px rgba(30,50,110,.07); }
.cifra strong { font-size: 1.05rem; } .cifra span { color: var(--suave); font-size: .9rem; }
.cifra.pendiente strong { color: #c46a00; } .cifra.listo strong { color: var(--ok); }
.archivo-nombre { overflow-wrap: anywhere; margin-top: 1rem; }

/* Subir: zona para soltar el archivo */
.zona-archivo { display: grid; justify-items: center; gap: .55rem; padding: 3rem 1.5rem; border-radius: var(--r-grande); border: 2px dashed color-mix(in srgb, var(--marca) 45%, transparent);
  background: var(--cristal); box-shadow: var(--brillo); backdrop-filter: var(--vidrio); -webkit-backdrop-filter: var(--vidrio);
  text-align: center; cursor: pointer; transition: border-color .2s ease, transform .2s ease, background-color .2s ease; }
.zona-archivo:hover, .zona-archivo.encima { border-color: var(--marca); transform: translateY(-2px); }
.zona-archivo.encima { background: color-mix(in srgb, var(--marca) 10%, var(--placa)); }
.zona-archivo strong { font-size: 1.15rem; }
.zona-archivo > span:not(.zona-icono) { color: var(--suave); }
.zona-archivo small { margin-top: .2rem; }
.zona-icono { display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 22px; color: var(--sobre-degradado); background: var(--degradado); box-shadow: 0 12px 28px rgba(60,80,230,.35); }
.zona-icono svg { width: 1.9rem; height: 1.9rem; }
.leyendo { cursor: progress; }
.girando { width: 1.8rem; height: 1.8rem; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--sobre-degradado) 40%, transparent); border-top-color: var(--sobre-degradado); animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.privado { display: flex; align-items: center; justify-content: center; gap: .45rem; color: var(--suave); font-size: .9rem; }
.privado svg { width: 1.05rem; height: 1.05rem; }

/* Movimientos */
.pastilla { display: inline-block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; padding: .15rem .6rem; border-radius: var(--r-boton); background: var(--relleno); font-size: .85rem; font-weight: 500; }
.pastilla.ingreso { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pastilla.personal { background: color-mix(in srgb, var(--impuesto) 14%, transparent); color: var(--impuesto); }
td.acciones { text-align: right; white-space: nowrap; }
button.icono { width: 2.1rem; height: 2.1rem; padding: 0; background: transparent; color: var(--suave); }
button.icono:hover { background: var(--relleno); border-color: transparent; color: var(--marca); }
button.icono.peligro:hover { color: var(--mal); }
button.icono svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabla-ancha thead th { color: var(--suave); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tabla-ancha tbody tr { transition: background-color .15s ease; }
.tabla-ancha tbody tr:hover { background: color-mix(in srgb, var(--marca) 6%, transparent); }
@media (min-width: 761px) {
  .formulario { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; max-width: 760px; }
  .formulario h2, .formulario .botones, .formulario label.casilla, .formulario > label:has(input[type=checkbox]) { grid-column: 1 / -1; }
}

/* Ajustes */
.rejilla-ajustes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 1rem; align-items: start; }
.rejilla-ajustes .ficha { max-width: none; margin: 0; }
.ajuste-icono { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; margin-bottom: .6rem; border-radius: 14px; background: var(--placa); color: var(--marca); box-shadow: inset 0 1px 1px var(--borde), 0 6px 16px rgba(30,50,110,.1); }
.ajuste-icono svg { width: 1.3rem; height: 1.3rem; }
.rejilla-ajustes .marca { margin-bottom: .6rem; }

/* Ventanas propias (sustituyen a confirm) */
dialog.dialogo { width: min(440px, calc(100% - 2rem)); padding: 1.6rem; text-align: left; animation: aparecer .22s cubic-bezier(.2,.9,.3,1.15); }
dialog[open]::backdrop { background: rgba(10, 14, 30, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dialogo h2 { font-size: 1.3rem; margin: .4rem 0 .5rem; }
.dialogo p { margin: 0 0 .6rem; color: var(--suave); }
.dialogo .botones { justify-content: flex-end; margin-top: 1.2rem; }
.dialogo dl { margin: .4rem 0 .8rem; }
.dialogo-icono { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: color-mix(in srgb, var(--marca) 14%, transparent); color: var(--marca); font-weight: 800; font-size: 1.2rem; }
.dialogo-icono.peligro { background: var(--mal-fondo); color: var(--mal); }
@keyframes aparecer { from { opacity: 0; transform: translateY(10px) scale(.97); } }

/* Entrar y alta */
.ficha .marca { margin-bottom: 1.4rem; font-size: 1.05rem; }
.arriba-ficha { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.arriba-ficha .marca { margin-bottom: 1.4rem; }
.pasos { display: flex; align-items: center; gap: .35rem; margin-bottom: 1.4rem; }
.pasos > span { width: 1.8rem; height: 5px; border-radius: 3px; background: var(--relleno); transition: background .3s ease; }
.pasos > span.hecho { background: color-mix(in srgb, var(--marca) 55%, transparent); }
.pasos > span.actual { background: var(--degradado); }
.pasos small { margin-left: .4rem; }
.ficha h1 { margin-top: 0; }
.entrar .cabecera-ficha { margin-bottom: 1rem; }
.entrar .cabecera-ficha h1 { margin-bottom: .3rem; }
.entrar .subtitulo { margin: 0; }
@media (min-width: 761px) {
  .centro .ficha .subtitulo { font-size: .85em; margin-bottom: 0; }
  /* Título arriba, los campos en medio y los botones abajo. */
  .centro .ficha.alta .subtitulo + *, .centro .ficha.entrar .campos-ficha { margin-top: auto; }
  .centro .ficha.alta .botones, .centro .ficha.entrar > button { margin-top: auto; }
  .centro .ficha .arriba-ficha .marca, .centro .ficha.entrar > .marca { margin-bottom: 1.6rem; }
}

/* Demostración: barra de ventana con tres puntos */
.demo-ventana { position: relative; }
.demo-ventana::before { content: ""; display: block; width: 46px; height: 10px; margin: -.2rem 0 .8rem; background:
  radial-gradient(circle at 5px 5px, #ff5f57 4.5px, transparent 5px), radial-gradient(circle at 23px 5px, #febc2e 4.5px, transparent 5px), radial-gradient(circle at 41px 5px, #28c840 4.5px, transparent 5px); }

/* Móvil */
@media (max-width: 760px) {
  header { padding-top: .7rem; }
  header strong { font-size: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 62vw; }
  .cabeza-izq > .simbolo, .cabeza-izq .poner-logo > .simbolo { width: 30px; height: 30px; }
  .cabeza-izq img.logo-empresa { height: 30px; max-width: 110px; }
  .usuario-correo { display: none; }
  .titulo .botones { width: 100%; } .titulo .botones > * { flex: 1; }
  /* Movimientos en el móvil: cada apunte es una tarjeta, sin desplazar a los lados. */
  .tabla-ancha:has(.tabla-movs) { padding: .25rem .4rem; }
  .tabla-movs thead { display: none; }
  .tabla-movs tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "prov importe" "concepto acciones" "fecha acciones"; gap: .25rem .75rem; padding: .7rem .6rem; border-bottom: 1px solid var(--linea); }
  .tabla-movs tbody tr:last-child { border-bottom: 0; }
  .tabla-movs td { padding: 0; border: 0; white-space: normal; }
  .tabla-movs .c-prov { grid-area: prov; font-weight: 600; overflow-wrap: anywhere; }
  .tabla-movs .c-importe { grid-area: importe; font-weight: 700; }
  .tabla-movs .c-concepto { grid-area: concepto; }
  .tabla-movs .c-fecha { grid-area: fecha; color: var(--suave); font-size: .85rem; }
  .tabla-movs .c-ftr { display: none; }
  .tabla-movs .acciones { grid-area: acciones; align-self: end; }
  .kpis { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .kpis .kpi { padding: .9rem 1rem; border-radius: var(--r-tabla); }
  .kpis .kpi:last-child { grid-column: 1 / -1; }
  .kpi strong { font-size: 1.35rem; }
  .kpi > span, .kpi small { font-size: .82rem; }
  .titulo > label { margin-bottom: .6rem; }
  .zona-archivo { padding: 2.2rem 1.2rem; }
  .primeros li { grid-template-columns: auto 1fr; } .primeros li .boton { grid-column: 1 / -1; }
  .aviso.flotante { top: auto; bottom: calc(96px + env(safe-area-inset-bottom)); }
  footer { padding-bottom: 1rem; }
}

@media (prefers-contrast: more) {
  .zona-archivo, .aviso.flotante { background: var(--solido); backdrop-filter: none; -webkit-backdrop-filter: none; }
}


/* ---------- Estilo «Glassy» (2/12/2026): como el panel de la foto que eligió Pau ---------- */
h1 { font-weight: 650; letter-spacing: -.03em; }
h2.seccion { font-weight: 650; letter-spacing: -.01em; }
.cristal { border-radius: var(--r-panel); }
.cristal > span, .kpi > span { font-size: .85rem; }

/* Botones: el principal es una píldora clara con letra oscura; el resto, cristal suave. */
button.principal, .boton.principal { background: var(--boton); color: var(--boton-texto); box-shadow: 0 8px 22px rgba(0,0,0,.28); }
button.principal:hover, .boton.principal:hover { box-shadow: 0 12px 28px rgba(0,0,0,.36); transform: translateY(-1px); }
button, .boton { border-color: var(--borde); }
button:hover, .boton:hover { border-color: color-mix(in srgb, var(--texto) 30%, transparent); }
input[type=file]::file-selector-button { background: var(--boton); color: var(--boton-texto); }
input, select { border-radius: var(--r-campo); }

/* Pestañas: texto sencillo; la activa, una píldora clara. */
nav { background: var(--nav-fondo); border-color: var(--borde); box-shadow: none; }
nav a { color: var(--suave); font-size: .92rem; }
nav a:hover { color: var(--texto); }
nav a[aria-current] { background: var(--relleno); color: var(--texto); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 14px rgba(0,0,0,.18); }
.avatar { background: var(--degradado); }

/* En PC toda la app va dentro de un gran panel de cristal, como una ventana. */
@media (min-width: 761px) {
  .marco { max-width: 1280px; margin: 1.25rem auto 0; border-radius: 34px; background: var(--marco); border: 1px solid var(--borde);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 30px 80px rgba(0,0,0,.35); padding: .5rem .5rem 1.25rem; }
  .marco header { padding: .75rem 1.25rem .25rem; }
  .marco main { padding-top: .25rem; }
}

/* Tarjetas de cifras: la primera, oscura; las otras, cristal claro. */
.kpi { border-radius: var(--r-tabla); }
.kpi.oscura { background: var(--oscura); border-color: rgba(255,255,255,.08); color: var(--oscura-texto); }
.kpi.oscura > span, .kpi.oscura small { color: var(--oscura-suave); }
.kpi strong { font-weight: 700; }

/* Tarjetas de colores por concepto */
.tarjetas-conceptos { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.tarjeta-color { --c1: #f59e2b; --c2: #7a4310; position: relative; display: flex; flex-direction: column; gap: .55rem; min-width: 0; min-height: 232px; padding: .8rem;
  border-radius: var(--r-tabla); color: var(--tc-texto); border: 1px solid var(--tc-borde); overflow: hidden;
  background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--c1) 90%, transparent), transparent 70%), linear-gradient(180deg, var(--c2) 0%, #17110e 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 14px 30px rgba(0,0,0,.32); transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease; }
.tarjeta-color:hover { transform: translateY(-5px); box-shadow: inset 0 1px 0 rgba(255,255,255,.24), 0 22px 40px rgba(0,0,0,.4); }
.tarjeta-color.naranja { --c1: #f59e2b; --c2: #6e3a0d; } .tarjeta-color.violeta { --c1: #7a5cff; --c2: #2c1d6b; }
.tarjeta-color.rojo { --c1: #f0475e; --c2: #6b1622; } .tarjeta-color.verde { --c1: #34c77b; --c2: #124a2c; }
.tarjeta-color.turquesa { --c1: #1fb5ad; --c2: #0c4044; } .tarjeta-color.magenta { --c1: #d84bc9; --c2: #561650; }
.tarjeta-color.azul { --c1: #3a84ff; --c2: #11306b; } .tarjeta-color.ambar { --c1: #e8b73c; --c2: #5c4410; }
.tarjeta-arriba { display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.chip { display: inline-block; padding: .16rem .5rem; border-radius: 999px; background: var(--tc-chip); color: var(--tc-texto); font-size: .7rem; font-weight: 650; white-space: nowrap; }
.chip.suave { background: var(--tc-chip-suave); justify-self: start; }
.punto { width: 1.35rem; height: 1.35rem; border-radius: 50%; background: rgba(255,255,255,.16); box-shadow: inset 0 0 0 4px rgba(0,0,0,.12); }
.tarjeta-grafico { flex: 1; display: grid; place-items: center; min-height: 84px; }
.mini { display: block; width: 100%; height: 74px; overflow: visible; }
.mini.medidor, .mini.anillo { max-width: 118px; }
.mini .fondo { fill: none; stroke: var(--tc-pista); stroke-width: 7; stroke-linecap: round; }
.mini .valor { fill: none; stroke: var(--tc-trazo); stroke-width: 7; stroke-linecap: round; }
.mini text { fill: var(--tc-texto); font-size: 14px; font-weight: 750; text-anchor: middle; }
.mini.anillo text { font-size: 15px; } .mini text.pie { font-size: 7px; font-weight: 500; fill: var(--tc-suave); }
.mini.columnas rect { fill: var(--tc-col); }
.mini.linea .trazo { fill: none; stroke: var(--tc-trazo); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.mini.linea .area { fill: var(--tc-area); }
.tarjeta-pie { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; }
.tarjeta-textos { display: grid; gap: .2rem; min-width: 0; }
.tarjeta-textos strong { font-size: .92rem; line-height: 1.2; letter-spacing: -.01em; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tarjeta-textos small { color: var(--tc-suave); font-size: .72rem; line-height: 1.3; }
button.ir { flex: none; padding: .45rem .8rem; border: 0; border-radius: var(--r-campo); background: var(--tc-ir); color: var(--tc-ir-texto); font-size: .78rem; font-weight: 600; }
button.ir:hover { background: #f0f0f0; }
button.ir svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Tablas, movimientos y fichas con el mismo cristal grafito */
.tabla-ancha { border-radius: var(--r-tabla); }
.mov { background: var(--placa); border-color: var(--borde); box-shadow: none; }
.cifra { box-shadow: none; }
.vacio-icono, .ajuste-icono { box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.zona-archivo { border-color: color-mix(in srgb, var(--marca) 40%, transparent); }
.primeros li.siguiente { box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 22px rgba(0,0,0,.18); }

@media (max-width: 760px) {
  .tarjetas-conceptos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  nav a { font-size: .69rem; }
  .tarjeta-color { min-height: 214px; padding: .7rem; border-radius: calc(var(--r-tabla) - 2px); }
  nav { background: var(--nav-movil); backdrop-filter: var(--vidrio-movil); -webkit-backdrop-filter: var(--vidrio-movil); }
}
@media (prefers-contrast: more) {
  .marco { background: var(--solido); }
  .tarjeta-color { background: var(--c2); }
}

/* ---------- Transición entre pantallas (2/12/2026): deslizamiento lateral sencillo ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
/* La caja de la pantalla no se mueve ni cambia de alto: solo se desliza su contenido, en horizontal. */
::view-transition-group(pantalla) { animation: none; }
::view-transition-old(pantalla) { animation: .32s cubic-bezier(.4, 0, .2, 1) both salir-izquierda; }
::view-transition-new(pantalla) { animation: .32s cubic-bezier(.4, 0, .2, 1) both entrar-derecha; }
:root[data-direccion="atras"]::view-transition-old(pantalla) { animation-name: salir-derecha; }
:root[data-direccion="atras"]::view-transition-new(pantalla) { animation-name: entrar-izquierda; }
@keyframes salir-izquierda { to { opacity: 0; transform: translateX(-60px); } }
@keyframes salir-derecha { to { opacity: 0; transform: translateX(60px); } }
@keyframes entrar-derecha { from { opacity: 0; transform: translateX(60px); } }
@keyframes entrar-izquierda { from { opacity: 0; transform: translateX(-60px); } }

/* Pestañas: la píldora de la activa se desliza hasta su sitio, sin rebote. La barra ya es sticky (PC) o fixed (móvil). */
nav a { position: relative; z-index: 1; transition: color .25s ease, background-color .2s ease; }
nav a[aria-current] { background: transparent; box-shadow: none; }
.indicador { position: absolute; z-index: 0; left: 0; top: 0; width: var(--w, 0); height: var(--h, 0); transform: translate(var(--x, 0), var(--y, 0));
  border-radius: var(--r-boton); background: var(--relleno); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 14px rgba(0,0,0,.18);
  transition: transform .32s cubic-bezier(.4, 0, .2, 1), width .32s cubic-bezier(.4, 0, .2, 1); pointer-events: none; }
.indicador.quieto { transition: none; }
@media (max-width: 760px) { .indicador { background: color-mix(in srgb, var(--marca) 16%, transparent); } }

/* Menos movimiento si la persona lo pide (al final, para que mande sobre todo lo anterior). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Enlace para saltar al contenido: invisible hasta que llega el foco del teclado. */
.saltar { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; border-radius: var(--r-boton); background: var(--boton); color: var(--boton-texto); font-weight: 600; text-decoration: none; }
.saltar:focus { top: 1rem; }

/* Páginas legales (web/legal): texto largo, cómodo de leer. */
.pagina-legal header { max-width: 860px; justify-content: flex-start; }
.pagina-legal header nav { position: static; flex-wrap: wrap; border-radius: 22px; }
.pagina-legal header nav a { padding: .45rem .8rem; border-radius: var(--r-boton); color: var(--suave); text-decoration: none; font-size: .9rem; }
.pagina-legal header nav a[aria-current] { background: var(--cristal-fuerte, rgba(255,255,255,.12)); color: var(--texto); }
.pagina-legal .volver { color: var(--texto); text-decoration: none; font-weight: 600; margin-right: auto; }
main.legal { max-width: 860px; margin: 1.25rem auto 3rem; padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 2rem; line-height: 1.6; }
main.legal h1 { margin: .2rem 0 .2rem; }
main.legal h2 { font-size: 1.15rem; margin: 1.8rem 0 .5rem; }
main.legal .fecha { color: var(--suave); margin-top: 0; }
main.legal a { color: var(--marca); }
main.legal dl > div { display: grid; grid-template-columns: minmax(9rem, 30%) 1fr; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--borde); }
main.legal dt { color: var(--suave); } main.legal dd { margin: 0; }
main.legal table { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; font-size: .92rem; }
main.legal th, main.legal td { text-align: left; vertical-align: top; padding: .5rem .6rem; border-bottom: 1px solid var(--borde); }
main.legal .resumen-legal { padding: .4rem 1.2rem .6rem; border-radius: 20px; border: 1px solid var(--borde); background: rgba(255,255,255,.04); }
main.legal .resumen-legal h2 { margin-top: .6rem; }
main.legal pre.licencia { white-space: pre-wrap; font-size: .8rem; color: var(--suave); max-height: 28rem; overflow: auto; padding: 1rem; border-radius: 14px; border: 1px solid var(--borde); }
mark.pendiente { background: #ffd34d; color: #2a1d00; padding: 0 .25rem; border-radius: 4px; font-weight: 600; }
@media (max-width: 760px) {
  main.legal dl > div { grid-template-columns: 1fr; gap: 0; }
  main.legal table { display: block; overflow-x: auto; }
}
main.legal strong, main.legal em { display: inline; font-size: inherit; font-weight: 650; letter-spacing: normal; color: inherit; }
main.legal em { font-weight: inherit; }
main.legal ul { padding-left: 1.3rem; } main.legal li { margin: .3rem 0; }

/* ---- Accesibilidad (auditoría del 2/12/2026, informe en docs/AUDITORIA-2026-12-02.md) ---- */
/* ACC-05: más contraste en los textos suaves, enlaces y cifras pendientes (4,5:1 o más sobre el cristal). */
.cifra.pendiente strong { color: var(--pendiente); }
.pastilla.ingreso { color: var(--ok-texto); }
/* ACC-06: el borde de casillas y desplegables se distingue (3:1). */
input, select, textarea { border-color: var(--borde-campo); }
/* ACC-07: con «colores forzados» (alto contraste de Windows) las sombras desaparecen: el contorno transparente se vuelve visible. */
input:focus, select:focus, textarea:focus { outline: 2px solid transparent; outline-offset: 1px; }
@media (forced-colors: active) {
  header nav a[aria-current] { outline: 2px solid CanvasText; outline-offset: -2px; }
  .indicador { display: none; }
}
/* ACC-19: un botón desactivado no está «cargando». */
button:disabled { cursor: not-allowed; }
/* ACC-03: lo que tiene el foco no queda debajo de la barra fija del móvil ni del aviso de arriba. */
html { scroll-padding-top: 5rem; }
@media (max-width: 760px) {
  html { scroll-padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  /* ACC-05 y ACC-20: pestañas del móvil legibles y botones de icono de 44 px. */
  header nav a { color: var(--texto); font-size: .72rem; }
  header nav a > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  button.icono { width: 44px; height: 44px; }
  button.ir { min-height: 44px; }
  /* ACC-16: la cabecera de la tabla se oculta a la vista, pero no al lector de pantalla. */
  .tabla-movs thead { display: table-header-group; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* ACC-04: a 320 px, «Movimientos» no cabe: se queda en «Apuntes». */
.corto { display: none; }
@media (max-width: 360px) { .largo-solo { display: none; } .corto { display: inline; } }
/* Solo para lectores de pantalla. */
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Pie: enlaces legales. */
/* Las reglas de «nav» son para el menú de pantallas; aquí se deshacen (con más peso que :root[data-theme] nav). */
:root footer nav.legales { position: static; display: flex; flex-wrap: wrap; gap: .3rem 1rem; justify-content: center; width: 100%; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
:root footer nav.legales a { display: inline; flex: none; padding: .3rem 0; color: var(--suave); font-size: .85rem; text-decoration: underline; background: none; }
.capa-privacidad { margin-top: .9rem; }
.capa-privacidad a, .condiciones a { color: var(--marca); }
.condiciones .casilla { display: flex; gap: .6rem; align-items: flex-start; line-height: 1.45; }
.condiciones .casilla input { margin-top: .2rem; flex: none; width: 1.2rem; height: 1.2rem; }
.supuestos p { margin: .35rem 0; }
/* ACC-09: el error va junto a su campo. */
.error-campo { color: var(--mal); font-size: .88rem; margin: .25rem 0 0; }
[aria-invalid="true"] { border-color: var(--mal) !important; }
/* ACC-12: barra con el recuento y Guardar, siempre a mano mientras se revisa. */
.barra-revision { background: var(--solido); box-shadow: 0 8px 28px rgba(0,0,0,.3); }
.barra-revision { position: sticky; bottom: .8rem; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; margin-top: 1rem; padding: .7rem 1rem; border-radius: var(--r-tabla); }
@media (max-width: 760px) { .barra-revision { bottom: calc(88px + env(safe-area-inset-bottom)); } }

/* Ajustes: un solo panel con secciones separadas por una línea, no una tarjeta para cada cosa. */
.rejilla-ajustes { display: block; max-width: 760px; padding: 0 1.5rem; border-radius: var(--r-grande); }
.rejilla-ajustes > .ficha { background: none; border: 0; border-top: 1px solid var(--linea); border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 1.3rem 0; margin: 0; max-width: none; }
.rejilla-ajustes > .ficha:first-child { border-top: 0; }
.rejilla-ajustes .tu-empresa-logo { float: right; }
.tarjeta-textos small + small { margin-top: .1rem; }
.tarjeta-pie { flex-direction: column; align-items: stretch; }
.tarjeta-pie button.ir { align-self: start; }
.primeros .saltar-primeros { margin-top: .2rem; }

/* Pantalla completa en PC: el panel ocupa todo el ancho (hasta 1680 px) y todo el alto; el pie queda abajo. */
@media (min-width: 761px) {
  #app { min-height: 100vh; display: flex; flex-direction: column; }
  .marco { flex: 1; display: flex; flex-direction: column; width: calc(100% - 2.5rem); max-width: 1680px; }
  .marco > header, .marco > main { width: 100%; max-width: none; }
  .marco > main { flex: 1; display: flex; flex-direction: column; }
  .marco > main > .pantalla, .marco > main > .pantalla > section { flex: 1; display: flex; flex-direction: column; }
  /* Resumen de una cuenta sin movimientos: saldo e impuestos llenan lo que queda de pantalla. */
  .inicio { flex: 1; display: flex; flex-direction: column; }
  .portada.llena { flex: 1; align-items: stretch; }
  .portada.llena .saldo { display: flex; flex-direction: column; }
  .portada.llena .saldo .grafico { margin-top: auto; }
}
/* En pantallas anchas, Ajustes en dos columnas (las líneas de separación siguen alineadas por filas). */
@media (min-width: 1100px) {
  .rejilla-ajustes { display: grid; grid-template-columns: 1fr 1fr; column-gap: 3rem; max-width: none; }
  .rejilla-ajustes > .ficha:nth-child(2) { border-top: 0; }
}
@media (min-width: 1100px) {
  .inicio.con-pasos { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: .9rem; align-items: stretch; margin-bottom: .9rem; }
  .inicio.con-pasos > .primeros { margin: 0; }
  .inicio.con-pasos .portada { flex-direction: column; flex-wrap: nowrap; margin: 0; }
  .inicio.con-pasos .portada > * { flex: none; }
  .inicio.con-pasos .portada > .lateral { flex: 1; }
}

/* Impuestos: cómo sale cada cifra */
.explicacion { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: .9rem; margin-bottom: 1rem; }
.explicacion h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.explicacion .nota { margin: 0 0 .5rem; }
.explicacion dl div.total { font-weight: 650; border-top: 2px solid var(--linea); }
.explicacion dd { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Entrada al Resumen: barras y gráficos crecen mientras las cifras cuentan (src/web/animar.ts). */
@keyframes crecer { from { transform: scaleY(0); } }
@keyframes llenar { from { stroke-dasharray: 0 999; } }
@keyframes dibujar { from { clip-path: inset(0 100% 0 0); } }
.entrando .grafico .barra rect:not(.zona), .entrando svg.mini.columnas rect {
  transform-box: fill-box; transform-origin: 50% 100%; animation: crecer 1s cubic-bezier(.2, .8, .2, 1) both; }
/* Una barra detrás de otra; las de saldo negativo crecen hacia abajo desde el cero. */
.entrando .grafico .barra:nth-of-type(2) rect:not(.zona) { animation-delay: 45ms; }
.entrando .grafico .barra:nth-of-type(3) rect:not(.zona) { animation-delay: 90ms; }
.entrando .grafico .barra:nth-of-type(4) rect:not(.zona) { animation-delay: 135ms; }
.entrando .grafico .barra:nth-of-type(5) rect:not(.zona) { animation-delay: 180ms; }
.entrando .grafico .barra:nth-of-type(6) rect:not(.zona) { animation-delay: 225ms; }
.entrando .grafico .barra:nth-of-type(7) rect:not(.zona) { animation-delay: 270ms; }
.entrando .grafico .barra:nth-of-type(8) rect:not(.zona) { animation-delay: 315ms; }
.entrando .grafico .barra:nth-of-type(9) rect:not(.zona) { animation-delay: 360ms; }
.entrando .grafico .barra:nth-of-type(10) rect:not(.zona) { animation-delay: 405ms; }
.entrando .grafico .barra:nth-of-type(11) rect:not(.zona) { animation-delay: 450ms; }
.entrando .grafico .barra:nth-of-type(12) rect:not(.zona) { animation-delay: 495ms; }
.entrando .grafico .barra rect.rojo:not(.zona) { transform-origin: 50% 0; }
.entrando svg.mini .valor { animation: llenar 1.1s cubic-bezier(.2, .8, .2, 1) both; }
.entrando svg.mini.linea polyline, .entrando svg.mini.linea polygon { animation: dibujar 1.1s cubic-bezier(.2, .8, .2, 1) both; }

/* ---------- Producto (4/12/2026): piezas nuevas con las variables de siempre ---------- */
.cuadre dd.cuadra { color: var(--ok); }
.cuadre .nota { margin: .5rem 0 0; }
.tabla-movs .c-prov small.banco { display: block; max-width: 30rem; overflow: hidden; text-overflow: ellipsis; font-weight: 400; font-size: .8rem; }
@media (max-width: 760px) { .tabla-movs .c-prov small.banco { white-space: normal; max-width: none; } }
.aviso-accion { flex: none; }

/* ---------- Letras por estilo (las variables valen lo mismo en Cristal: no cambia nada) ---------- */
h1, h2, h3, .marca { font-family: var(--f-titulo); }
.cristal strong, .kpi strong, .saldo > strong, .cifra strong, .tarjeta-textos small, .mini text, .demo-saldo strong { font-family: var(--f-cifras); }
td.importe, .importe, .tabla-ancha td, .tabla-ancha th, .explicacion dd, .cristal dd, .demo-fila { font-family: var(--f-tabla); }
.cristal > span, .kpi > span, .tabla-ancha thead th, .estado, .etiqueta, .progreso-texto, .pastilla { font-family: var(--f-etiqueta); }

/* ---------- Selector de estilo (Ajustes): miniaturas con las dos versiones de cada estilo ---------- */
fieldset.estilos { border: 0; margin: 0 0 1rem; padding: 0; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: .8rem; }
fieldset.estilos > legend { padding: 0; margin-bottom: .5rem; font-size: .92rem; }
.estilo-opcion { display: grid; align-content: start; gap: .45rem; padding: .6rem; border: 2px solid var(--linea); border-radius: var(--r-chico); cursor: pointer; background: var(--placa); }
.estilo-opcion:hover { border-color: var(--borde-campo); }
.estilo-opcion:has(input:checked) { border-color: var(--marca); }
.estilo-opcion:has(input:focus-visible) { outline: 3px solid var(--marca); outline-offset: 2px; }
.estilo-cabeza { display: flex; align-items: center; gap: .55rem; min-height: 28px; }
.estilo-cabeza input { margin: 0; flex: none; width: 1.2rem; height: 1.2rem; }
.estilo-opcion small { color: var(--suave); line-height: 1.3; }
.vista { display: grid; grid-template-columns: 1fr 1fr; border-radius: 10px; overflow: hidden; border: 1px solid var(--linea); }
.vista-mitad { display: grid; align-content: start; gap: .28rem; padding: .5rem; min-height: 5.2rem; background: var(--fondo); }
.vista-mitad .v-titulo { height: .42rem; width: 55%; border-radius: 2px; background: var(--texto); }
.vista-mitad .v-linea { height: .3rem; width: 80%; border-radius: 2px; background: var(--suave); }
.vista-mitad .v-panel { display: flex; align-items: flex-end; gap: .2rem; height: 2.3rem; padding: .3rem; border-radius: min(var(--r-panel), 9px); border: 1px solid var(--borde); background: var(--cristal); box-shadow: var(--brillo); }
.vista-mitad .v-panel b { flex: 1; border-radius: 2px; background: var(--grafico); }
.vista-mitad .v-panel b:nth-child(1) { height: 45%; } .vista-mitad .v-panel b:nth-child(2) { height: 70%; }
.vista-mitad .v-panel b:nth-child(3) { height: 55%; } .vista-mitad .v-panel b:nth-child(4) { height: 100%; background: var(--marca); }
.vista-mitad .v-boton { height: .5rem; width: 38%; border-radius: min(var(--r-boton), 4px); background: var(--boton); }
.estilo-cabeza strong, .cristal .estilo-cabeza strong { display: inline; font-size: 1.05rem; font-weight: 650; letter-spacing: 0; font-family: var(--f-titulo); }

/* Selector de estilo en la pantalla de entrar: más pequeño, sin la frase de cada estilo (el texto de la letra no cambia). */
.entrar fieldset.estilos.compacto { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem; margin: .9rem 0 0; }
.entrar fieldset.estilos.compacto .estilo-opcion { position: relative; }
.entrar fieldset.estilos.compacto .estilo-cabeza { justify-content: center; }
.entrar fieldset.estilos.compacto .estilo-cabeza input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; } /* el aro de la elegida es el borde de la opción */
.entrar fieldset.estilos.compacto .estilo-cabeza strong { font-size: .72rem; font-weight: 600; }
@media (max-width: 760px) { .entrar fieldset.estilos.compacto { grid-template-columns: repeat(3, minmax(0, 1fr)); } .entrar fieldset.estilos.compacto .estilo-cabeza strong { font-size: .8rem; } }
.entrar fieldset.estilos.compacto .estilo-opcion { padding: .4rem; gap: .3rem; }
.entrar fieldset.estilos.compacto .estilo-opcion small { display: none; }
.entrar fieldset.estilos.compacto .vista-mitad { min-height: 0; padding: .3rem; }
.entrar fieldset.estilos.compacto .vista-mitad:last-child { display: none; } /* aquí solo la versión oscura de la miniatura; en Ajustes salen las dos */
.entrar fieldset.estilos.compacto .vista-mitad .v-boton, .entrar fieldset.estilos.compacto .vista-mitad .v-linea, .entrar fieldset.estilos.compacto .vista-mitad .v-titulo { display: none; }
.entrar fieldset.estilos.compacto .v-panel { height: 1.2rem; }
.entrar fieldset.estilos.compacto { margin-top: .6rem; }
.entrar fieldset.estilos.compacto legend { font-size: .85em; margin-bottom: .3rem; }
.entrar fieldset.estilos.compacto .vista { grid-template-columns: 1fr; }
