/* Base: tipografia del sistema (sin fuentes externas), layout, navegacion y pantalla de acceso. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums; font-size: 15px; line-height: 1.45;
}
html[data-tema="glass"] body { background: var(--fondo-pagina); background-attachment: fixed; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; }
a { color: var(--blue); }
a:hover { color: var(--bluehover); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
html[data-tema="glass"] :focus-visible { outline-color: #FFFFFF; }
button, input, select, textarea { font: inherit; color: var(--ink); }
input, select, textarea { background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.solo-lectores { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Ocultar montos */
.oculto .m { visibility: hidden; position: relative; white-space: nowrap; }
.oculto .m::after { content: '$ ***'; visibility: visible; position: absolute; left: 0; top: 0; }

/* Layout */
.app { min-height: 100vh; display: flex; }
.lateral {
  display: none; flex: none; width: 248px; height: 100vh; position: sticky; top: 0; overflow-y: auto;
  padding: 28px 16px; background: var(--nav); color: var(--nav-ink); flex-direction: column; gap: 4px;
  -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque);
}
.marca { font-weight: 700; font-size: 20px; padding: 0 12px 18px; letter-spacing: -0.01em; }
.lateral-pie { margin-top: auto; padding: 24px 12px 0; font-size: 12px; line-height: 1.5; color: var(--nav-muted); }
.columna { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.barra { display: flex; align-items: center; gap: 8px; padding: 12px 16px 0; }
.barra-marca { font-weight: 700; font-size: 17px; }
.estado-datos { flex: 1; text-align: right; color: var(--muted); font-size: 12px; }
.boton-icono {
  width: 44px; height: 44px; flex: none; padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink);
  -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque);
}
.boton-icono[aria-pressed="true"] { background: var(--bluebg); color: #FFFFFF; border-color: transparent; }
.contenido { flex: 1 1 auto; padding: 16px 16px 112px; max-width: 1180px; width: 100%; margin: 0 auto; outline: none; }
.contenido h1 { margin-bottom: 4px; }
.sub { color: var(--muted); margin: 0 0 16px; }

.tarjeta {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  box-shadow: var(--sombra); -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque);
}
.vacio { text-align: center; color: var(--muted); padding: 32px 18px; }

/* Navegacion lateral (compu) */
#nav-lateral { display: flex; flex-direction: column; gap: 4px; }
.nav-fila { position: relative; }
.nav-link {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 8px;
  color: var(--nav-muted); text-decoration: none; font-size: 15px; font-weight: 500; white-space: nowrap;
}
.nav-link:hover { color: var(--nav-ink); background: var(--soft); }
.nav-link[aria-current="page"] { color: var(--nav-ink); background: var(--nav-activo); font-weight: 600; }
.nav-link svg { flex: none; }
.nav-sub { margin-left: 21px; padding-left: 12px; border-left: 1px solid var(--line2); display: flex; flex-direction: column; gap: 2px; }
.nav-sub .nav-link { min-height: 44px; font-size: 14px; }
.nav-toggle {
  position: absolute; right: 2px; top: 0; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--nav-muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.nav-toggle svg { transition: transform 0.2s ease; }
.nav-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

/* Navegacion movil */
.nav-movil {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: 76px; padding: 0 6px 10px;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque);
}
.nav-m {
  min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 500; border: 0; background: transparent; cursor: pointer; padding: 0;
}
.nav-m[aria-current="page"], .nav-m[aria-expanded="true"] { color: var(--ink); font-weight: 600; }
.mas-panel {
  position: fixed; left: 8px; right: 8px; bottom: 84px; z-index: 21; padding: 8px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line2); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque);
}
.mas-panel .nav-link { color: var(--ink); }
.mas-panel .nav-link[aria-current="page"] { background: var(--soft2); }

@media (min-width: 900px) {
  .lateral { display: flex; }
  .nav-movil, .mas-panel { display: none !important; }
  .barra-marca { display: none; }
  .barra { padding: 20px 32px 0; justify-content: flex-end; }
  .contenido { padding: 12px 32px 48px; }
}

/* Acceso: configuracion inicial y bloqueo */
.acceso {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto; padding: 24px 16px; display: flex; align-items: flex-start; justify-content: center;
  background: var(--bg);
}
html[data-tema="glass"] .acceso { background: var(--fondo-pagina); }
.acceso-caja { width: 100%; max-width: 440px; margin: auto; }
.acceso-caja h1 { font-size: 24px; margin-bottom: 6px; }
.acceso-caja p { color: var(--muted); margin: 0 0 16px; }
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo label { font-size: 13px; font-weight: 600; }
.campo input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 10px; }
.campo small { color: var(--muted); font-size: 12px; }
.boton {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--primary); color: var(--onprimary);
  font-weight: 600; cursor: pointer; width: 100%;
}
.boton[disabled] { opacity: 0.6; cursor: progress; }
.boton-sec { background: transparent; color: var(--ink); border: 1px solid var(--line2); }
.mensaje { padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.mensaje-error { background: var(--errorbg); color: var(--error); border: 1px solid var(--error); }
.mensaje-info { background: var(--infobg); color: var(--ink); border: 1px solid var(--infobd); }

.avisos { position: fixed; left: 12px; right: 12px; bottom: 92px; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.aviso { pointer-events: auto; max-width: 420px; padding: 10px 14px; border-radius: 10px; background: var(--primary); color: var(--onprimary); font-size: 14px; }
@media (min-width: 900px) { .avisos { bottom: 24px; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
