/* ============================================================
   Diseño "Gestión Kinésica": se aplica sobre app.css.
   Los colores base salen del tema activo; aquí van las formas
   y los colores de cada etapa del paciente.
   ============================================================ */

:root {
  --sol: #d69a06;      --sol-bg: #fdf3d5;      --sol-txt: #7d5800;      /* amarillo · evaluación agendada */
  --evalr: #2563eb;    --evalr-bg: #e3ecfd;    --evalr-txt: #1a47a8;    /* azul · evaluación realizada */
  --lumbar: #16a34a;   --lumbar-bg: #ddf5e6;   --lumbar-txt: #12703a;   /* verde · tratamiento lumbar */
  --cervical: #7c3aed; --cervical-bg: #eee8fd; --cervical-txt: #5b26b8; /* violeta · tratamiento cervical */
  --otros: #ea7317;    --otros-bg: #fdeedd;    --otros-txt: #9a4a06;    /* naranja · otras patologías */
  --cancel: #dc2626;   --cancel-bg: #fbe4e4;   --cancel-txt: #9b1c1c;   /* rojo · cancelada o ausente */
  --okc: #1c6f47;      --okc-bg: #e3f3ea;      --okc-txt: #0e5f37;
  --grisc-bg: #e9efeb; --grisc-txt: #53645a;
  --panel-2: color-mix(in srgb, var(--primary) 4%, var(--surface));
}
body.dark {
  --sol: #e8c24a;      --sol-bg: #3a2f10;      --sol-txt: #f3dc93;
  --evalr: #5b91f5;    --evalr-bg: #17243f;    --evalr-txt: #a9c4ff;
  --lumbar: #34c26a;   --lumbar-bg: #133222;   --lumbar-txt: #8de0ad;
  --cervical: #a37bf5; --cervical-bg: #261b40;  --cervical-txt: #cbb5ff;
  --otros: #f08c3c;    --otros-bg: #3a2414;    --otros-txt: #f7bb87;
  --cancel: #e8605a;   --cancel-bg: #3a1c1b;   --cancel-txt: #f5aaa5;
  --okc: #2b8f61;      --okc-bg: #1a3529;      --okc-txt: #74d3a2;
  --grisc-bg: #26302b; --grisc-txt: #a7b8ae;
}

/* ---------- Barra lateral ---------- */
body.kine .sidebar { background: linear-gradient(180deg, var(--menu-bg) 0%, color-mix(in srgb, var(--menu-bg) 70%, #000) 100%); border-right: 1px solid rgba(255,255,255,.05); }
body.kine .brand { border-bottom: 1px solid rgba(255,255,255,.08); padding: 20px 20px 16px; }
body.kine .brand .logo-mark { background: rgba(255,255,255,.12); }
body.kine .nav { padding: 14px 12px; gap: 2px; }
body.kine .nav a, body.kine .nav button.navlink { position: relative; font-size: 13.5px; font-weight: 500; padding: 9px 12px; border-radius: 9px; opacity: 1; }
body.kine .nav a svg.ic { opacity: .82; }
body.kine .nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
body.kine .nav a.active { background: rgba(255,255,255,.11); color: #fff; font-weight: 620; }
body.kine .nav a.active svg.ic { opacity: 1; color: var(--menu-active); }
body.kine .nav a.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--menu-active); }
body.kine .nav .badge-count { background: rgba(255,255,255,.16); color: #eafaf2; font-size: 10.5px; padding: 1px 7px; }
body.kine .nav a.active .badge-count { background: var(--menu-active); color: var(--menu-bg); }
body.kine .nav .sep { background: rgba(255,255,255,.08); }
.side-foot { margin-top: auto; padding: 13px 16px; font-size: 11px; line-height: 1.6; color: color-mix(in srgb, var(--menu-text) 75%, transparent); border-top: 1px solid rgba(255,255,255,.08); }
.side-foot a { color: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Encabezados, paneles, tarjetas ---------- */
body.kine .page-head h1, .cab h1 { font-weight: 650; letter-spacing: -.2px; color: var(--header-text); }
.cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.cab h1 { margin: 0; font-size: var(--title-fs); }
.cab p { margin: 3px 0 0; color: var(--muted); font-size: .92em; }
.cab .acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.subtitulo { font-size: 11.5px; letter-spacing: .7px; text-transform: uppercase; font-weight: 700; color: var(--secondary); margin: 20px 0 9px; display: flex; align-items: center; gap: 6px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: var(--gap); box-shadow: var(--shadow); min-width: 0; }
.panel > h3 { font-size: 11.5px; letter-spacing: .9px; text-transform: uppercase; font-weight: 700; color: var(--secondary); padding-bottom: 10px; margin: 0 0 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 7px; }
.panel.sol { border-left: 4px solid var(--sol); } .panel.evalu { border-left: 4px solid var(--evalr); } .panel.trat { border-left: 4px solid var(--primary); }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: var(--gap); }
.tarjeta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.tarjeta::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--primary); }
.tarjeta.sol::before { background: var(--sol); } .tarjeta.evalr::before, .tarjeta.eva::before { background: var(--evalr); }
.tarjeta.ok::before { background: var(--okc); } .tarjeta.al::before { background: var(--cancel); }
.tarjeta.lumbar::before { background: var(--lumbar); } .tarjeta.cervical::before { background: var(--cervical); } .tarjeta.otros::before { background: var(--otros); }
.tarjeta .rot { font-size: 11px; letter-spacing: .7px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.tarjeta .val { font-size: 25px; font-weight: 640; letter-spacing: -.6px; margin-top: 5px; font-variant-numeric: tabular-nums; }
.tarjeta .sub { font-size: 11.5px; margin-top: 3px; color: var(--muted); }
.tarjeta.click { cursor: pointer; } .tarjeta.click:hover { border-color: var(--primary); }

/* ---------- Botones de etapa ---------- */
.btn.btn-s { background: var(--sol); border-color: var(--sol); color: #2b2100; }
.btn.btn-e { background: var(--evalr); border-color: var(--evalr); color: #fff; }
.btn.btn-ok { background: var(--okc); border-color: var(--okc); color: #fff; }

/* ---------- Etiquetas y leyenda ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; background: var(--grisc-bg); color: var(--grisc-txt); }
.tag.sol { background: var(--sol-bg); color: var(--sol-txt); } .tag.evalr { background: var(--evalr-bg); color: var(--evalr-txt); }
.tag.lumbar { background: var(--lumbar-bg); color: var(--lumbar-txt); } .tag.cervical { background: var(--cervical-bg); color: var(--cervical-txt); }
.tag.otros { background: var(--otros-bg); color: var(--otros-txt); } .tag.cancel, .tag.mal { background: var(--cancel-bg); color: var(--cancel-txt); }
.tag.ok, .tag.trat { background: var(--okc-bg); color: var(--okc-txt); }
.punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.punto.sol { background: var(--sol); } .punto.evalr { background: var(--evalr); } .punto.lumbar { background: var(--lumbar); } .punto.cervical { background: var(--cervical); }
.punto.otros { background: var(--otros); } .punto.cancel { background: var(--cancel); } .punto.ok, .punto.trat { background: var(--okc); }
.leyenda { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.leyenda > span { display: inline-flex; align-items: center; gap: 6px; }
.area-chip.on.lumbar { background: var(--lumbar); border-color: var(--lumbar); } .area-chip.on.cervical { background: var(--cervical); border-color: var(--cervical); } .area-chip.on.otros { background: var(--otros); border-color: var(--otros); }
.area-chip.on .punto { background: #fff; }

/* ---------- Siguiente paso / avisos ---------- */
.siguiente-paso { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--radius); margin-bottom: var(--gap); border: 1px solid var(--border); background: var(--surface); border-left: 4px solid var(--primary); }
.siguiente-paso.solic { border-left-color: var(--sol); background: color-mix(in srgb, var(--sol-bg) 60%, var(--surface)); }
.siguiente-paso.evalu { border-left-color: var(--evalr); background: color-mix(in srgb, var(--evalr-bg) 60%, var(--surface)); }
.siguiente-paso .sp-txt > b { display: block; margin-bottom: 2px; }
.siguiente-paso .sp-txt > span { color: var(--muted); font-size: .92em; }
.aviso-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.aviso-item:last-child { border-bottom: 0; }
.aviso-item .ai-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--grisc-bg); color: var(--grisc-txt); }
.aviso-item .ai-ico.sol { background: var(--sol-bg); color: var(--sol-txt); } .aviso-item .ai-ico.cancel { background: var(--cancel-bg); color: var(--cancel-txt); }
.aviso-item .ai-ico.evalr { background: var(--evalr-bg); color: var(--evalr-txt); } .aviso-item .ai-ico.ok { background: var(--okc-bg); color: var(--okc-txt); }
.aviso-item .ai-txt { flex: 1; min-width: 0; } .aviso-item .ai-txt small { display: block; color: var(--muted); }

/* ---------- Filas de turnos (inicio, evaluaciones, agenda del día) ---------- */
.fila-cita { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-left: 4px solid var(--muted); border-radius: 10px; margin-bottom: 8px; background: var(--surface); flex-wrap: wrap; }
.fila-cita.sol { border-left-color: var(--sol); } .fila-cita.evalr { border-left-color: var(--evalr); } .fila-cita.lumbar { border-left-color: var(--lumbar); }
.fila-cita.cervical { border-left-color: var(--cervical); } .fila-cita.otros { border-left-color: var(--otros); } .fila-cita.cancel { border-left-color: var(--cancel); opacity: .7; }
.fila-cita.encurso { box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 40%, transparent); }
.fila-cita .h { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; }
.fila-cita .h small { display: block; font-weight: 500; color: var(--muted); font-size: .78em; }
.fila-cita .n { flex: 1; min-width: 160px; } .fila-cita .n small { display: block; color: var(--muted); }
.fila-cita .acc { display: flex; gap: 6px; flex-wrap: wrap; }
.solicitud { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--border); border-left: 4px solid var(--sol); border-radius: 10px; margin-bottom: 8px; background: var(--surface); flex-wrap: wrap; }
.solicitud .cuando { min-width: 92px; font-weight: 700; } .solicitud .cuando small { display: block; font-weight: 500; color: var(--muted); font-size: .8em; }
.solicitud .quien { flex: 1; min-width: 180px; } .solicitud .quien small { display: block; color: var(--muted); }
.solicitud.sinhora { border-left-style: dashed; }

/* ---------- Ficha ---------- */
.ficha-cab { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 12px; }
.ficha-cab .avatar { width: 54px; height: 54px; font-size: 1.15em; background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000)); color: #fff; font-weight: 650; }
.ficha-cab .datos { flex: 1; min-width: 240px; }
.ficha-cab .datos h1 { margin: 0 0 4px; font-size: 1.45em; }
.identidad { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .9em; color: var(--muted); }
.identidad b { color: var(--text); font-weight: 600; margin-right: 3px; }
.mini { display: flex; gap: 8px; flex-wrap: wrap; }
.mini > div { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; min-width: 96px; }
.mini .r { font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.mini .v { font-size: 18px; font-weight: 640; font-variant-numeric: tabular-nums; }
.flujo { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; font-size: 12.5px; }
.flujo .paso { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.flujo .paso.hecho { color: var(--text); } .flujo .paso.actual { font-weight: 700; color: var(--text); border-color: currentColor; }
.flujo .paso.actual.sol { background: var(--sol-bg); color: var(--sol-txt); } .flujo .paso.actual.evalr { background: var(--evalr-bg); color: var(--evalr-txt); }
.flujo .paso.actual.trat { background: var(--okc-bg); color: var(--okc-txt); } .flujo .paso.actual.ok { background: var(--okc-bg); color: var(--okc-txt); }
.flujo .sep { color: var(--muted); }
.resumen-general { background: linear-gradient(180deg, var(--panel-2) 0%, var(--surface) 60%); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px 18px; margin-bottom: 12px; }
.rg-titulo { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700; color: var(--secondary); padding-bottom: 11px; margin-bottom: 13px; border-bottom: 1px solid var(--border); }
.rg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 20px; }
.rg-rot { font-size: 10px; letter-spacing: .6px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.rg-val { font-size: 15.5px; font-weight: 640; letter-spacing: -.2px; }
.rg-nota { margin-top: 12px; padding: 9px 12px; border-radius: 9px; background: color-mix(in srgb, var(--sol-bg) 55%, var(--surface)); font-size: .92em; }
.barra-prog { height: 7px; background: var(--grisc-bg); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.barra-prog > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
body.kine .tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Cronómetro ---------- */
.cronometro { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; background: linear-gradient(135deg, #14493a, #24805a); color: #fff; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; transition: background .3s; }
.cronometro.pausa { background: linear-gradient(135deg, #8a5205, #c9891f); }
.cronometro.inactivo { background: linear-gradient(135deg, #4a6259, #61796e); }
.cronometro .reloj { font-size: 38px; font-weight: 620; letter-spacing: 1.5px; font-variant-numeric: tabular-nums; line-height: 1.15; margin: 2px 0; }
.cronometro.pausa .reloj { opacity: .9; }
.cronometro .ct { flex: 1; min-width: 200px; } .cronometro .txt { font-size: 12.5px; opacity: .85; }
.cronometro .acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.cronometro .btn { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); color: #fff; }
.cronometro .btn:hover { background: rgba(255,255,255,.24); }
.cronometro .btn.fin, .cronometro .btn.ini-v { background: #fff; border-color: #fff; color: #14493a; }
.cronometro .btn.reanudar { background: #24805a; border-color: #24805a; }
.cronometro .btn.ini-e { background: var(--evalr); border-color: var(--evalr); color: #fff; }
.cronometro.pausa .btn.fin { color: #7a4804; }
.pulso { animation: pulso 1.6s infinite; }
@keyframes pulso { 0%, 100% { opacity: 1 } 50% { opacity: .55 } }
.punto-vivo { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #7dffc4; margin-right: 6px; animation: latido 1.8s infinite; flex: none; }
.punto-vivo.quieto { background: #ffe3ad; box-shadow: none; animation: none; }
.eva-esc { display: flex; align-items: center; gap: 10px; } .eva-esc input[type=range] { flex: 1; accent-color: var(--primary); }
.eva-num { font-weight: 700; color: var(--cancel); font-size: 18px; min-width: 30px; text-align: center; }
@keyframes latido { 0% { box-shadow: 0 0 0 0 rgba(125,255,196,.6); } 70% { box-shadow: 0 0 0 8px rgba(125,255,196,0); } 100% { box-shadow: 0 0 0 0 rgba(125,255,196,0); } }
.crono-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 14px; padding: 9px 12px 9px 18px; border-radius: 999px; color: #fff; max-width: calc(100vw - 20px);
  background: linear-gradient(135deg, #14493a, #24805a); box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100vw - 36px); flex-wrap: wrap; }
.crono-bar.pausa { background: linear-gradient(135deg, #8a5205, #c9891f); }
.crono-bar .bs-info { display: flex; flex-direction: column; min-width: 0; }
.crono-bar .bs-nom { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.crono-bar .bs-det { font-size: 11px; opacity: .82; white-space: nowrap; }
.crono-bar .reloj { font-size: 21px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.crono-bar .acciones { display: flex; gap: 6px; }
.crono-bar .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; border-radius: 999px; padding: 5px 11px; font-size: .86em; }
.crono-bar .btn:hover { background: rgba(255,255,255,.26); }
.crono-bar .btn.fin { background: #fff; border-color: #fff; color: #14493a; }
.crono-bar.pausa .btn.fin { color: #7a4804; }
.crono-bar .bs-txt { margin-left: 4px; }
body:has(.crono-bar) .content { padding-bottom: 96px; }
.crono-resumen { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); margin-bottom: 14px; }
.crono-resumen small { display: block; color: var(--muted); font-size: .8em; } .crono-resumen b { font-size: 1.4em; }
@media (max-width: 900px) { .crono-bar { left: 10px; right: 10px; transform: none; justify-content: space-between; border-radius: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); } body:has(.crono-bar) .content { padding-bottom: 150px; } }
@media (max-width: 620px) { .crono-bar { gap: 8px 10px; padding: 9px 12px; flex-wrap: wrap; } .crono-bar .bs-info { flex: 1; } .crono-bar .acciones { width: 100%; justify-content: flex-end; } .crono-bar .bs-nom { max-width: 120px; } .crono-bar .bs-det { display: none; } .crono-bar .reloj { font-size: 18px; } .crono-bar .bs-txt { display: none; }
  .cronometro { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; } .cronometro .acciones .btn { flex: 1; justify-content: center; } }

/* ---------- Volver ---------- */
.barra-volver { margin-bottom: 10px; }

/* ---------- Agenda: colores por etapa ---------- */
.ev.k-sol { --c: var(--sol); } .ev.k-evalr { --c: var(--evalr); } .ev.k-lumbar { --c: var(--lumbar); } .ev.k-cervical { --c: var(--cervical); } .ev.k-otros { --c: var(--otros); } .ev.k-cancel { --c: var(--cancel); }
.mev.k-sol { --c: var(--sol); } .mev.k-evalr { --c: var(--evalr); } .mev.k-lumbar { --c: var(--lumbar); } .mev.k-cervical { --c: var(--cervical); } .mev.k-otros { --c: var(--otros); } .mev.k-cancel { --c: var(--cancel); }
.ev.encurso { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ---------- Administración ---------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }

@media (max-width: 640px) {
  .tarjetas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tarjeta { padding: 12px; } .tarjeta .val { font-size: 1.3em; }
  .ficha-cab { padding: 14px; } .mini > div { min-width: 0; flex: 1; }
  .cronometro .reloj { font-size: 28px; }
}
@media print { .crono-bar, .barra-volver, .cronometro .btn { display: none !important; } }
.sesion-item { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; background: var(--surface); display: flex; flex-direction: column; gap: 3px; }

/* ---------- Editor de fichas ---------- */
.tpl-layout { display: grid; grid-template-columns: minmax(200px, 250px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.tpl-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; position: sticky; top: 76px; }
.tpl-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
.tpl-item:hover { background: var(--hover); } .tpl-item.on { background: var(--primary-soft); }
.tpl-item small { display: block; color: var(--muted); font-size: .8em; }
.tpl-edit { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--gap); align-items: start; padding-bottom: 70px; }
.tpl-preview { position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow: auto; }
.tpl-field { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; background: var(--surface); }
.tpl-field.head { border-left: 4px solid var(--secondary); background: var(--panel-2); }
.tpl-field.open { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tpl-field.over { border-color: var(--primary); border-style: dashed; }
.tpl-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; }
.tpl-row .handle { cursor: grab; color: var(--muted); }
.tpl-type { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--panel-2); color: var(--secondary); flex: none; }
.tpl-body { padding: 4px 12px 12px; border-top: 1px solid var(--border); }
.tpl-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-bar { position: fixed; bottom: 16px; left: calc(var(--menu-w) + 24px); right: 24px; z-index: 40; display: flex; gap: 8px; align-items: center; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.tpl-bar.dirty { border-color: var(--sol); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sol) 25%, transparent), var(--shadow); }
.tpl-bar.dirty .grow { color: var(--sol-txt); font-weight: 700; }
body.menu-top .tpl-bar { left: 24px; }
@media (max-width: 1200px) { .tpl-edit { grid-template-columns: minmax(0, 1fr); } .tpl-preview { position: static; max-height: none; } }
@media (max-width: 900px) { .tpl-layout { grid-template-columns: minmax(0, 1fr); } .tpl-list { position: static; } .tpl-bar { left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); } }
@media (max-width: 640px) { .tpl-bar { padding: 8px 10px; gap: 6px; } .tpl-bar .grow { font-size: 12px; line-height: 1.2; } .tpl-bar .tpl-hide { display: none; } .tpl-bar .btn { padding-left: 10px; padding-right: 10px; } .tpl-layout { padding-bottom: 80px; } }

/* ---------- Ficha lumbar: diseño en papel (bloques por sección, raíces, filas + / −) ---------- */
.contenedor-ficha, .ficha-papel { --color-primario: var(--primary); --linea: color-mix(in srgb, var(--text) 20%, transparent); }
.contenedor-ficha { background: var(--surface); padding: 20px; border-radius: 8px; max-width: 800px; margin: 0 auto; }
.encabezado-ficha h2 { color: var(--color-primario); border-bottom: 2px solid var(--color-primario); padding-bottom: 8px; margin: 0 0 20px; font-size: 1.4em; }
.bloque-seccion { background: color-mix(in srgb, var(--text) 2%, transparent); border: 1px solid color-mix(in srgb, var(--text) 8%, transparent); border-radius: 6px; padding: 15px; margin-bottom: 18px; }
.titulo-seccion { font-size: .9em; font-weight: bold; color: var(--color-primario); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .04em; }
.papel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.papel-grid > .full { grid-column: 1 / -1; }
.papel-campo { display: flex; flex-direction: column; font-size: .92em; min-width: 0; }
.papel-lbl { font-weight: 600; }
.grid-vertebras { display: grid; grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)); gap: 8px; margin: 6px 0 4px; }
.grid-opciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 8px; margin-top: 6px; }
.item-vertebra { display: flex; align-items: center; gap: 4px; background: var(--input-bg); border: 1px solid var(--linea); padding: 4px 6px; border-radius: 4px; font-size: .85em; cursor: pointer; user-select: none; }
.item-vertebra.on { border-color: var(--color-primario); background: color-mix(in srgb, var(--color-primario) 12%, var(--input-bg)); font-weight: 600; }
.item-vertebra input, .opciones-lateralidad input, .controles-eval input { accent-color: var(--color-primario); margin: 0; }
.opciones-lateralidad { display: flex; gap: 15px; flex-wrap: wrap; align-items: center; padding-top: 8px; border-top: 1px dashed var(--linea); font-size: .9em; }
.opciones-lateralidad label, .controles-eval label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.fila-evaluacion { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid color-mix(in srgb, var(--text) 6%, transparent); font-size: .9em; }
.controles-eval { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.controles-eval .sep-eval { width: 1px; height: 18px; background: var(--linea); }
.campo-control { width: 100%; padding: 8px 12px; border: 1px solid var(--linea); border-radius: 4px; margin-top: 4px; background: var(--input-bg); color: var(--text); font: inherit; }
.btn-primario { background-color: var(--color-primario); color: #fff; border: none; padding: 12px 20px; border-radius: 6px; cursor: pointer; width: 100%; font-weight: bold; font: inherit; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primario:hover { filter: brightness(1.08); } .btn-primario:disabled { opacity: .6; cursor: default; }
.tpl-preview .ficha-papel .bloque-seccion { padding: 12px; }
@media (max-width: 640px) { .contenedor-ficha { padding: 12px 4px; } .papel-grid { grid-template-columns: minmax(0, 1fr); } .bloque-seccion { padding: 12px; } }
.aviso-ficha { color: var(--danger); font-weight: 600; font-size: .88em; line-height: 1.45; padding: 8px 10px; border-left: 3px solid var(--danger); background: color-mix(in srgb, var(--danger) 7%, transparent); border-radius: 4px; margin: 6px 0; }
.form-grid > .aviso-ficha { grid-column: 1 / -1; }
.titulo-seccion .puntaje { float: right; text-transform: none; letter-spacing: 0; font-size: 1.05em; color: var(--text); background: color-mix(in srgb, var(--color-primario) 12%, transparent); padding: 2px 10px; border-radius: 999px; }

/* ---------- Fichas como la hoja impresa (sin recuadros; opciones en filas, el lado alineado a la derecha) ---------- */
.contenedor-ficha { --renglon: color-mix(in srgb, var(--text) 38%, transparent); padding: 28px 34px; border: 1px solid color-mix(in srgb, var(--text) 10%, transparent); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.ficha-papel { --renglon: color-mix(in srgb, var(--text) 38%, transparent); }
.ficha-papel .bloque-seccion { background: none; border: none; border-radius: 0; padding: 0; margin: 0 0 24px; }
.ficha-papel .titulo-seccion { color: var(--text); font-size: .95em; font-weight: 700; letter-spacing: .02em; margin-bottom: 8px; }
.ficha-papel .papel-grid { gap: 4px 22px; }
.fila-papel { display: flex; align-items: center; justify-content: space-between; gap: 6px 20px; flex-wrap: wrap; padding: 6px 0; font-size: .93em; }
.fp-izq { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; min-width: 0; }
.fp-der { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 18px; width: 230px; flex: none; }
.fp-lbl { text-transform: uppercase; margin-right: 2px; }
.cuestionario .fp-lbl { text-transform: none; }
.opc { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; user-select: none; }
.opc input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.fp-otros { display: inline-flex; align-items: baseline; gap: 6px; text-transform: uppercase; }
input.linea { width: 150px; border: none; border-bottom: 1px solid var(--renglon); border-radius: 0; background: transparent; color: var(--text); font: inherit; padding: 1px 4px; outline: none; }
input.linea:focus, .papel-campo.linea .campo-control:focus { border-bottom-color: var(--primary); }
.ficha-papel .papel-lbl { text-transform: uppercase; font-weight: 500; font-size: .9em; }
.ficha-papel .papel-campo.linea .campo-control { border: none; border-bottom: 1px solid var(--renglon); border-radius: 0; background: transparent; padding: 4px 2px; margin-top: 0; }
.ficha-papel .campo-control.renglones { border: none; border-radius: 0; padding: 0 2px; margin-top: 2px; min-height: 112px; line-height: 28px; resize: vertical;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, var(--renglon) 27px, var(--renglon) 28px); background-attachment: local; }
.opciones-papel { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.ficha-papel .aviso-ficha { margin: 4px 0 2px; }
@media (max-width: 640px) { .contenedor-ficha { padding: 14px 8px; border: none; box-shadow: none; } .fp-der { width: auto; } .fila-papel { padding: 8px 0; border-bottom: 1px dotted color-mix(in srgb, var(--text) 15%, transparent); } }

/* Inicio de sesión: a qué consultorio (base de datos) se está entrando */
.destino-login { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--hover); margin-top: -4px; }
.destino-login .grow { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.destino-login b { font-size: 1.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.destino-login small { color: var(--muted); font-size: .8em; }
.destino-login img { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; background: #fff; flex: none; }
.destino-login .avatar { width: 38px; height: 38px; background: var(--primary); color: #fff; flex: none; }
.destino-login.ok { border-color: color-mix(in srgb, var(--success) 45%, transparent); background: color-mix(in srgb, var(--success) 8%, transparent); }
.destino-login.ok > .ic { color: var(--success); }
.destino-login.mal { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); color: var(--danger); }
.login .olvido { align-self: flex-end; margin-top: -8px; }

/* Copias: conexión con Google Drive (código para google.com/device) */
.gd-codigo { border: 1px dashed var(--primary); border-radius: 12px; padding: 12px 16px; background: var(--primary-soft); }
.gd-codigo ol { margin: 0 0 10px; padding-left: 20px; line-height: 1.9; }
.gd-codigo .codigo { display: inline-block; margin: 4px 0 2px; padding: 6px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font: 700 1.6em/1.2 ui-monospace, Consolas, monospace; letter-spacing: .12em; cursor: copy; user-select: all; }

/* Niveles vertebrales (marca + observación por nivel) y opciones propias */
.niveles-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 22px; margin-top: 4px; }
.niveles-grid .nivel { display: flex; align-items: center; gap: 10px; padding: 4px 8px; border-radius: 8px; border: 1px solid transparent; }
.niveles-grid .nivel.on { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.niveles-grid .nivel .opc { flex: none; min-width: 52px; }
.niveles-grid .nivel input:not([type=checkbox]) { flex: 1; min-width: 0; border: none; border-bottom: 1px solid var(--renglon, var(--border)); border-radius: 0; background: transparent; color: var(--text); font: inherit; padding: 3px 4px; outline: none; }
.niveles-grid .nivel input:not([type=checkbox]):focus { border-bottom-color: var(--primary); }
.agregar-otra { display: flex; gap: 8px; align-items: center; margin-top: 8px; max-width: 420px; }
.agregar-otra input { flex: 1; min-width: 0; }
@media (max-width: 640px) { .niveles-grid { grid-template-columns: minmax(0, 1fr); } }

/* Fechas de sesiones elegidas a mano y resumen de precios */
.fila-sesion { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.fila-sesion b { min-width: 74px; font-size: .92em; }
.fila-sesion input[type=date] { flex: 1; min-width: 0; } .fila-sesion input[type=time] { width: 112px; }
.resumen-precio { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2, var(--hover)); border: 1px solid var(--border); }
.resumen-precio > div { display: flex; flex-direction: column; } .resumen-precio span { color: var(--muted); font-size: .8em; }
.resumen-precio .tot b { font-size: 1.15em; color: var(--primary); }
@media (max-width: 640px) { .fila-sesion { flex-wrap: wrap; } .fila-sesion b { min-width: 100%; } .fila-sesion input[type=time] { width: auto; flex: 1; } }
.regla-serv { padding: 10px 0; border-bottom: 1px solid var(--border); } .regla-serv:last-child { border-bottom: none; }
.evo-inicial { padding: 10px 14px; border-radius: 10px; background: var(--hover); border: 1px solid var(--border); }
.acciones-trat { flex-wrap: wrap; gap: 6px; }

/* Logo del consultorio: nunca se deforma, sea horizontal, vertical o cuadrado */
.brand.brand-logo img, .login img[alt], .hero img, .brand-logo img { width: auto; height: auto; object-fit: contain; object-position: left center; }
.brand.brand-logo img { max-height: 64px; max-width: 100%; }
@media (max-width: 900px) { .brand.brand-logo img { max-height: 48px; } }

/* Gráfico de variación del EVA y aviso de suspendidos */
.evo-dot.ini { fill: var(--sol, #f59e0b); } .evo-dot.fin { fill: var(--okc, #16a34a); }
.evo-dot.eva-in { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.eva-mejora { color: var(--okc, #16a34a); font-weight: 600; }
.eva-leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; }
.eva-leyenda .eva-k { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; background: var(--primary); }
.eva-leyenda .eva-k.ini { background: var(--sol, #f59e0b); } .eva-leyenda .eva-k.fin { background: var(--okc, #16a34a); }
.eva-leyenda .eva-k.in { background: var(--surface); border: 1.5px solid var(--muted); }
.alerta-susp .row { flex-wrap: wrap; align-items: center; }

/* Editor de fichas: secciones plegables, agregado rápido y edición en la fila */
.tpl-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tpl-group { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: var(--surface); }
.tpl-ghead { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; background: var(--primary-soft); border-radius: 10px; position: sticky; top: 0; z-index: 2; }
.tpl-ghead.top { background: var(--hover); }
.tpl-ghead .tpl-lbl.strong { font-weight: 700; flex: 1; min-width: 0; }
.tpl-gbody { padding: 6px 8px 8px; }
.tpl-lbl { flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; color: var(--text); font: inherit; padding: 4px 6px; border-radius: 6px; }
.tpl-lbl:hover { border-color: var(--border); } .tpl-lbl:focus { border-color: var(--primary); background: var(--surface); outline: none; }
.tpl-tipo { white-space: nowrap; }
.tpl-req.on { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.tpl-quick { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.tpl-quick input { flex: 1; min-width: 0; } .tpl-quick select { max-width: 190px; }
@media (max-width: 640px) { .tpl-tipo { display: none; } .tpl-quick { flex-wrap: wrap; } .tpl-quick input { flex-basis: 100%; } .tpl-quick select { flex: 1; max-width: none; } }
/* Más ancho para las preguntas; la vista previa pasa debajo en pantallas medianas */
.tpl-edit { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.tpl-row { flex-wrap: wrap; row-gap: 2px; }
.tpl-row .tpl-lbl { flex: 1 1 170px; min-width: 150px; }
@media (max-width: 1500px) { .tpl-edit { grid-template-columns: minmax(0, 1fr); } .tpl-preview { position: static; max-height: none; } .tpl-tipo { display: inline; } }
.tpl-quick .tpl-bloque { max-width: 200px; border-color: var(--primary); color: var(--primary); font-weight: 600; }
@media (max-width: 640px) { .tpl-quick .tpl-bloque { flex: 1 1 100%; max-width: none; } }

/* ================= CELULAR: barra de abajo, inicio, agenda y fluidez ================= */
@media (max-width: 900px) {
  /* Barra inferior: 5 botones iguales, «Turno» exactamente en el centro y todas las etiquetas a la misma altura */
  .bottom-nav { justify-content: space-around; padding: 0 2px calc(2px + env(safe-area-inset-bottom)); left: 0; right: 0; width: 100%; max-width: 100vw; will-change: transform; contain: layout; }
  .bottom-nav a, .bottom-nav button { flex: 1 1 0; min-width: 0; height: 56px; justify-content: flex-end; padding: 0 0 6px; gap: 3px; line-height: 1.1; }
  .bottom-nav a span, .bottom-nav button > span:not(.circle):not(.badge-count) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav .plus { overflow: visible; }
  .bottom-nav .plus span.circle { margin-top: -22px; width: 48px; height: 48px; }
  .bottom-nav .plus span.lbl { line-height: 1.1; }
  .bottom-nav .badge-count { right: calc(50% - 22px); top: 4px; }
  .content { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

  /* Inicio: botones y tarjetas parejos */
  .cab { gap: 10px; margin-bottom: 14px; }
  .cab .acciones { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  .cab .acciones .btn { justify-content: center; min-height: 46px; }
  .cab .acciones .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .tarjetas > :last-child:nth-child(odd) { grid-column: 1 / -1; }

  /* Agenda: los nombres de las columnas no empujan el ancho */
  .cal-head .colh { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: var(--colw, 130px); padding: 6px 2px; font-size: .8em; }

  /* Fluidez al tocar y desplazar */
  html { -webkit-text-size-adjust: 100%; }
  * { -webkit-tap-highlight-color: transparent; }
  button, a, .chip, .btn, select, label, .tarjeta, summary, [role=button] { touch-action: manipulation; }
  body { overscroll-behavior-y: none; }
  .modal-bg, .modal, .cal, .table-wrap { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  input, select, textarea { font-size: 16px; }   /* evita el zoom automático al escribir */
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Ficha del paciente en celular: cabecera compacta para ver enseguida el contenido */
@media (max-width: 640px) {
  .ficha-cab { padding: 12px; gap: 10px; }
  .ficha-cab .avatar { width: 46px; height: 46px; font-size: 1.05em; }
  .ficha-cab h1 { font-size: 1.3em; margin-bottom: 2px; }
  .ficha-cab .identidad { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: .84em; }
  .ficha-cab .identidad span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
  .ficha-cab .identidad span b { font-size: .8em; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
  .ficha-cab .datos > div.row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .ficha-cab .datos > div.row .btn { justify-content: center; }
  .ficha-cab .datos > p.row { flex-wrap: wrap; gap: 6px; } .ficha-cab .datos > p.row .tag { max-width: 100%; white-space: normal; }
  .ficha-cab .mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
  .ficha-cab .mini > div { padding: 8px 8px; min-width: 0; }
  .ficha-cab .mini .v { font-size: 1.05em; overflow-wrap: anywhere; }
  .flujo { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .flujo::-webkit-scrollbar { display: none; } .flujo .paso { white-space: nowrap; flex: none; }
}
@media (max-width: 900px) {
  /* Barra del cronómetro: mismo margen a los dos lados, centrada y justo encima de la barra de abajo */
  .crono-bar { left: 10px; right: auto; width: calc(100vw - 20px); max-width: none; transform: none; bottom: calc(68px + env(safe-area-inset-bottom)); box-sizing: border-box; }
}

/* ---------- Menú lateral: animación y detalle ---------- */
.sidebar { --ease: cubic-bezier(.22, 1, .36, 1); }
.nav a, .nav button.navlink { position: relative; transition: background .22s ease, transform .22s var(--ease), opacity .2s ease; will-change: transform; }
.nav a svg.ic { transition: transform .25s var(--ease); }
.nav a:hover { transform: translateX(3px); }
.nav a:hover svg.ic { transform: scale(1.12); }
.nav a:active { transform: scale(.97); }
.nav a.active { box-shadow: 0 4px 14px rgba(0,0,0,.18); font-weight: 600; }
.nav a.active::before { content: ''; position: absolute; left: -10px; top: 22%; bottom: 22%; width: 4px; border-radius: 0 4px 4px 0; background: var(--menu-active-text, #fff); opacity: .9; animation: navInd .35s var(--ease); }
@keyframes navInd { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.side-foot { transition: opacity .3s; }
.sidebar::-webkit-scrollbar { width: 6px; } .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 6px; }
.menu-cerrar { display: none; }

@media (max-width: 900px) {
  .sidebar { width: min(84vw, 320px); transform: translate3d(-104%, 0, 0); visibility: hidden; opacity: .98; border-radius: 0 22px 22px 0; overscroll-behavior: contain;
    transition: transform .42s var(--ease), visibility 0s linear .42s, box-shadow .42s ease; box-shadow: none; z-index: 60; touch-action: pan-y; }
  body.menu-open .sidebar { transform: translate3d(0, 0, 0); visibility: visible; transition: transform .42s var(--ease), visibility 0s; box-shadow: 12px 0 48px rgba(0,0,0,.35); }
  .backdrop, body.menu-open .backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(8, 15, 30, .5); opacity: 0; pointer-events: none;
    -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); transition: opacity .35s ease, backdrop-filter .35s ease, -webkit-backdrop-filter .35s ease; }
  body.menu-open .backdrop { opacity: 1; pointer-events: auto; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  body.menu-open { overflow: hidden; }
  .sidebar .brand, .sidebar .nav a, .sidebar .side-foot { opacity: 0; transform: translateX(-18px); transition: opacity .3s ease, transform .4s var(--ease); }
  body.menu-open .sidebar .brand, body.menu-open .sidebar .nav a, body.menu-open .sidebar .side-foot { opacity: 1; transform: none; }
  body.menu-open .sidebar .brand { transition-delay: .06s; }
  body.menu-open .sidebar .nav a { transition-delay: calc(.08s + var(--i, 0) * 28ms); }
  body.menu-open .sidebar .side-foot { transition-delay: .35s; }
  .nav a { padding: 12px 14px; font-size: 1.02em; }
  .nav a:hover { transform: none; }
  .nav a.active::before { left: -10px; }
  .menu-cerrar { display: grid; place-items: center; position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: var(--menu-text); cursor: pointer; transition: background .2s, transform .3s var(--ease); }
  .menu-cerrar:active { transform: rotate(90deg) scale(.9); background: rgba(255,255,255,.22); }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .backdrop, .nav a, .sidebar .brand, .sidebar .side-foot { transition-duration: .01s !important; transition-delay: 0s !important; } }

/* ---------- Menú lateral: versión rápida para celulares ---------- */
@media (max-width: 900px) {
  .sidebar { transition: transform .26s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .26s; box-shadow: none; will-change: transform; contain: layout paint; }
  body.menu-open .sidebar { transition: transform .26s cubic-bezier(.2, .8, .2, 1), visibility 0s; box-shadow: 8px 0 24px rgba(0,0,0,.28); }
  .backdrop, body.menu-open .backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; transition: opacity .22s ease; }
  body.menu-open .backdrop { background: rgba(8, 15, 30, .55); }
  .sidebar .brand, .sidebar .nav a, .sidebar .side-foot { transform: none; opacity: 1; transition: none; }
  body.menu-open .sidebar .nav a { animation: navIn .24s ease-out both; animation-delay: calc(var(--i, 0) * 12ms); }
  body.menu-open .sidebar .brand, body.menu-open .sidebar .side-foot { animation: navIn .24s ease-out both; }
  .nav a.active::before { animation: none; }
}
@keyframes navIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
