/* ===== Nexadent · Ahorro de batería (móvil, si se elige en Ajustes): SIEMPRE modo noche, con los colores del programa, fondo fijo, sin efectos caros ===== */
html.ligero.ahorro[data-tema] { --fondo-base: #160A36;
  --fondo: radial-gradient(120% 70% at 90% 0%, #3B1C9E 0%, transparent 60%),
           radial-gradient(100% 60% at 0% 100%, #12357E 0%, transparent 62%),
           linear-gradient(170deg, #0C0828 0%, #1B0F4D 55%, #0E1B4A 100%);
  --noche-grad: linear-gradient(120deg, #E23FC6 0%, #F0569A 45%, #FF8A3D 100%); }
html.ligero.ahorro body { background: var(--fondo-base); transition: none; }
html.ligero.ahorro .fondo { background: var(--fondo); }
html.ligero.ahorro .fondo-animado, html.ligero.ahorro .esfera, html.ligero.ahorro .haz, html.ligero.ahorro .grano, html.ligero.ahorro .disco { display: none !important; }
/* Sin botones de día/noche: en el móvil va siempre de noche */
html.ligero.ahorro .top .tema { display: none !important; }
/* Sin cristal borroso (es lo que más gasta en el móvil): capas lisas del morado de noche */
html.ligero.ahorro *, html.ligero.ahorro *::before, html.ligero.ahorro *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html.ligero.ahorro .glass { background: rgba(38,22,92,.90); }
html.ligero.ahorro .modal.glass { background: #241452; }
html.ligero.ahorro .top { background: rgba(20,9,52,.97); }
html.ligero.ahorro .cal-capa, html.ligero.ahorro .modal-fondo { background: rgba(8,4,26,.75); }
/* Sin animaciones ni transiciones largas */
html.ligero.ahorro *, html.ligero.ahorro *::before, html.ligero.ahorro *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }

/* Ajustes */
.lg-opciones { display: flex; flex-direction: column; gap: 8px; }
.lg-opciones label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; cursor: pointer; }
.lg-opciones input { width: 20px; height: 20px; }

/* Barra de abajo y hoja «Más» (solo en pantallas de móvil) */
#barra-movil { display: none; }
@media (max-width: 820px) {
  html.ligero .side { display: none; }
  html.ligero, html.ligero body { overflow-x: clip; }
  html.ligero .app { padding: 0 10px calc(84px + env(safe-area-inset-bottom)); gap: 12px; }
  /* Arriba en dos filas: flechas · usuario · día/noche, y debajo el buscador a todo lo ancho */
  html.ligero .top { position: sticky; top: 0; z-index: 20; flex-wrap: wrap; padding: 8px 10px; gap: 8px; border-radius: 0 0 18px 18px; margin: 0 -10px; }
  html.ligero .top > * { min-width: 0; }
  html.ligero .top .buscar { order: 9; flex: 1 1 100%; }
  html.ligero .top .clinica { display: none; }
  html.ligero .top .usuario { margin-left: auto; }
  html.ligero .top .usuario b, html.ligero .top .usuario .nombre { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html.ligero .nav-hist button { width: 38px; height: 38px; }
  html.ligero .saludo h1 { font-size: 30px; }
  html.ligero #barra-movil { display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(20,9,52,.98); border-top: 1px solid rgba(255,255,255,.18); box-shadow: 0 -10px 30px -14px rgba(10,5,40,.7); }
  #barra-movil a, #barra-movil button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0; background: transparent;
    color: rgba(255,255,255,.78); font: 600 11px var(--sans); text-decoration: none; border-radius: 14px; min-height: 52px; cursor: pointer; }
  #barra-movil .on { color: #fff; background: var(--noche-grad); }
  .hoja-mas { position: fixed; inset: 0; z-index: 45; background: rgba(8,4,26,.7); display: flex; align-items: flex-end; }
  .hoja-caja { width: 100%; max-height: 80vh; overflow-y: auto; padding: 10px 14px calc(90px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: #1D1542; border-top: 2px solid #E23FC6; color: #fff; }
  .hoja-asa { width: 44px; height: 5px; border-radius: 3px; background: var(--noche-grad); margin: 0 auto 12px; }
  .hoja-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .hoja-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 12px 4px; border-radius: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
    color: #fff; text-decoration: none; font-size: 12.5px; font-weight: 600; line-height: 1.2; }
  .hoja-grid .nav-candado { display: none; }
  .hoja-grid a .txt { color: #fff !important; opacity: 1 !important; text-shadow: none; }
  .hoja-aj { display: block; text-align: center; margin-top: 14px; color: #fff; font-size: 13px; opacity: .9; }
  html.ligero .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
}

/* ===== Móvil igual que la app (13-11-2026): la barra de abajo y la hoja «Más» usan el cristal y los colores del tema ===== */
@media (max-width: 820px) {
  html.ligero:not(.ahorro) #barra-movil { background: var(--g-bg); border-top: 1px solid var(--g-borde); -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
    box-shadow: 0 -10px 30px -14px rgba(40,30,120,.35); }
  html.ligero:not(.ahorro) #barra-movil a, html.ligero:not(.ahorro) #barra-movil button { color: var(--g-txt, var(--ink)); opacity: .85; }
  html.ligero:not(.ahorro) #barra-movil .on { color: #fff; opacity: 1; }
  html.ligero:not(.ahorro) .hoja-caja { background: var(--g-bg); color: var(--g-txt, var(--ink)); -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3); }
  html.ligero:not(.ahorro) .hoja-grid a { background: rgba(255,255,255,.14); border-color: var(--g-borde); color: var(--g-txt, var(--ink)); }
  html.ligero:not(.ahorro) .hoja-grid a .txt { color: var(--g-txt, var(--ink)) !important; }
  html.ligero:not(.ahorro) .hoja-aj { color: var(--g-txt, var(--ink)); }
}

/* Pacientes en el móvil: cada paciente como una tarjeta (nombre, teléfono, avisos y lo que debe), sin tabla apretada */
@media (max-width: 820px) {
  .tabla-pac thead { display: none; }
  .tabla-pac, .tabla-pac tbody { display: block; }
  .tabla-pac tr.clic { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .tabla-pac tr.clic td { padding: 0; border: 0; }
  .tabla-pac tr.clic td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .tabla-pac tr.clic td:nth-child(6) { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right; }
  .tabla-pac tr.clic td:nth-child(2) { grid-column: 1; grid-row: 2; white-space: nowrap; color: var(--muted); font-size: 14px; }
  .tabla-pac tr.clic td:nth-child(2)::after { content: attr(data-x); }
  .tabla-pac tr.clic td:nth-child(3), .tabla-pac tr.clic td:nth-child(4) { display: none; }
  .tabla-pac tr.clic td:nth-child(5) { grid-column: 1 / -1; grid-row: 3; }
  .tabla-pac tr.clic td:nth-child(5):empty { display: none; }
}
/* «Escanear implantes» ocupa dos líneas sin descolocar la barra (14-11-2026) */
@media (max-width: 820px) { #barra-movil a span, #barra-movil button span { font-size: 10.5px; line-height: 1.1; text-align: center; } #barra-movil [data-bm="escanear"] span { max-width: 64px; } }
