/* Agenda de la Dra. Karla Vásquez — "consultorio acuarela": los colores de su logo (arcoíris durazno, mantequilla
   y celeste; azul pizarra; verde suave), papel cálido y letra redondita. El arcoíris del día es la barra de progreso. */
:root {
  --bg: #f8f6f2;
  --card: #ffffff;
  --tx: #24364b;
  --mut: #74818f;
  --suave: #a3acb7;
  --linea: rgba(36, 54, 75, .085);
  --linea2: rgba(36, 54, 75, .16);
  --azul: #4d78a6;
  --azul2: #3d6591;
  --azul-s: #e8eff7;
  --verde: #6fae66;
  --verde-s: #e7f3e4;
  --durazno: #eab39c;
  --mant: #efd088;
  --cielo: #a6d2dc;
  --rojo: #cf5d54;
  --rojo-s: #fbe7e5;
  --ambar: #b9862a;
  --ambar-s: #fbf0d7;
  --r: 20px;
  --r-s: 14px;
  --sombra: 0 1px 2px rgba(36, 54, 75, .05), 0 10px 26px -14px rgba(36, 54, 75, .22);
  --sombra2: 0 30px 70px -24px rgba(36, 54, 75, .45);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-io: cubic-bezier(.77, 0, .175, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --f: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabs-h: 66px;
  --abajo: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--tx); background: var(--bg);
  font: 16px/1.45 var(--f);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  min-height: 100dvh;
}
/* Lavado acuarela muy suave arriba, como el papel del logo. */
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 340px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 70% at 12% -10%, rgba(234, 179, 156, .22), transparent 70%),
    radial-gradient(50% 60% at 55% -20%, rgba(239, 208, 136, .2), transparent 70%),
    radial-gradient(60% 70% at 95% -10%, rgba(166, 210, 220, .3), transparent 70%);
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(77, 120, 166, .45); outline-offset: 2px; border-radius: 10px; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic.s { width: 18px; height: 18px; }
.ic.xs { width: 15px; height: 15px; stroke-width: 2.2; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--linea2);
  background: var(--card); font-weight: 800; font-size: 15px; letter-spacing: .01em;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  user-select: none; -webkit-user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primario {
  border-color: transparent; color: #fff;
  background: linear-gradient(180deg, #5a86b5, var(--azul2));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 18px -8px rgba(61, 101, 145, .7);
}
.btn.verde { border-color: transparent; color: #fff; background: linear-gradient(180deg, #7dbb74, #5e9f56); box-shadow: 0 8px 18px -10px rgba(80, 140, 72, .8); }
.btn.suave { background: var(--azul-s); border-color: transparent; color: var(--azul2); }
.btn.peligro { color: var(--rojo); border-color: rgba(207, 93, 84, .3); background: #fff; }
.btn.fantasma { background: transparent; border-color: transparent; color: var(--mut); }
.btn.grande { min-height: 54px; font-size: 17px; width: 100%; }
.btn.chico { min-height: 36px; padding: 0 13px; font-size: 14px; }
.btn.wa { background: #e5f6ea; border-color: transparent; color: #1f7a45; }
.btn.redondo { width: 44px; padding: 0; }

/* ── carga y login ── */
.cargando { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 50; transition: opacity 300ms ease; }
.cargando img { animation: latido 1.4s var(--ease-io) infinite; }
.cargando.fuera { opacity: 0; pointer-events: none; }
@keyframes latido { 50% { transform: scale(.94); } }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 28px 20px calc(28px + var(--abajo)); }
.login-caja { width: 100%; max-width: 380px; text-align: center; animation: subir 600ms var(--ease-out) both; }
.login-logo { width: 168px; height: 168px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; position: relative; isolation: isolate; }
.login-logo::before {
  content: ""; position: absolute; inset: -14px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 200deg, rgba(234, 179, 156, .5), rgba(239, 208, 136, .5), rgba(166, 210, 220, .55), rgba(111, 174, 102, .3), rgba(234, 179, 156, .5));
  filter: blur(22px); opacity: .8;
}
.login-logo img { border-radius: 50%; box-shadow: var(--sombra); background: #fff; }
.login h1 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -.01em; color: var(--azul2); }
.login-sub { margin: 6px 0 22px; color: var(--mut); }
.login form { display: grid; gap: 12px; text-align: left; }
.error { color: var(--rojo); font-weight: 700; font-size: 14px; margin: 0; }
.error:empty { display: none; }
@keyframes subir { from { opacity: 0; transform: translateY(14px); } }

/* ── campos ── */
.campo { display: grid; gap: 6px; }
.campo > span { font-size: 13px; font-weight: 800; color: var(--mut); letter-spacing: .02em; padding-left: 4px; }
.campo input, .campo textarea, .campo select, .buscar input {
  width: 100%; min-height: 50px; padding: 12px 15px; border-radius: var(--r-s);
  border: 1.5px solid var(--linea2); background: #fff; font-size: 16px; font-weight: 600;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.campo textarea { min-height: 84px; resize: vertical; line-height: 1.4; }
.campo input:focus, .campo textarea:focus, .campo select:focus, .buscar input:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 4px rgba(77, 120, 166, .14); }
.fila2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── estructura ── */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabs-h) + var(--abajo) + 14px); }
.barra {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 11px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 18px 10px;
  background: rgba(248, 246, 242, .82); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color 200ms ease;
}
.barra.borde { border-color: var(--linea); }
.barra-logo { border-radius: 50%; box-shadow: 0 2px 8px -3px rgba(36, 54, 75, .3); background: #fff; }
.barra-tit { display: grid; line-height: 1.15; min-width: 0; flex: 1; }
.barra-tit b { font-size: 16px; font-weight: 900; color: var(--azul2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-tit span { font-size: 13px; color: var(--mut); font-weight: 700; }
.nueva-escritorio { display: none; }
.vista { max-width: 640px; margin: 0 auto; padding: 6px 16px 24px; outline: none; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabs-h) + var(--abajo)); padding-bottom: var(--abajo);
  background: rgba(255, 255, 255, .9); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--linea);
}
.tab {
  position: relative; z-index: 1; border: 0; background: none; display: grid; place-items: center; align-content: center; gap: 3px;
  color: var(--suave); font-size: 12px; font-weight: 800; transition: color 200ms ease, transform 160ms var(--ease-out);
}
.tab:active { transform: scale(.94); }
.tab[aria-current="page"] { color: var(--azul2); }
.tab-pastilla {
  position: absolute; top: 9px; left: 0; width: calc(100% / 3); height: 48px; pointer-events: none;
  display: grid; place-items: center; transition: transform 380ms var(--ease-drawer);
}
.tab-pastilla::before { content: ""; width: 72px; height: 100%; border-radius: 16px; background: var(--azul-s); }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabs-h) + var(--abajo) + 16px); z-index: 21;
  width: 62px; height: 62px; border-radius: 22px; border: 0; color: #fff; display: grid; place-items: center;
  background: linear-gradient(160deg, #6a95c2, var(--azul2));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .3) inset, 0 16px 30px -12px rgba(61, 101, 145, .75);
  transition: transform 180ms var(--ease-out), opacity 200ms ease;
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: scale(.94); }
.fab.oculto { opacity: 0; transform: scale(.8); pointer-events: none; }

/* ── semana ── */
.mes { display: flex; align-items: center; gap: 6px; margin: 6px 2px 8px; }
.mes-btn { border: 0; background: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 900; font-size: 18px; color: var(--tx); padding: 6px 6px; border-radius: 10px; position: relative; }
.mes-btn input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mes .esp { flex: 1; }
.flecha { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--linea2); background: #fff; display: grid; place-items: center; color: var(--mut); transition: transform 160ms var(--ease-out); }
.flecha:active { transform: scale(.92); }
.hoy-btn { min-height: 38px; }
.semana { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); padding: 6px; background: #fff; border-radius: var(--r); box-shadow: var(--sombra); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.dia {
  position: relative; z-index: 1; border: 0; background: none; display: grid; justify-items: center; gap: 2px;
  padding: 7px 0 8px; border-radius: 15px; transition: color 200ms ease, transform 160ms var(--ease-out);
}
.dia:active { transform: scale(.93); }
.dia small { font-size: 11px; font-weight: 800; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; transition: color 200ms ease; }
.dia b { font-size: 19px; font-weight: 900; line-height: 1.1; }
.dia .puntos { display: flex; gap: 2.5px; height: 6px; align-items: center; }
.dia .puntos i { width: 5px; height: 5px; border-radius: 50%; background: var(--cielo); }
.dia .puntos i.lleno { background: var(--azul); }
.dia.hoy b { color: var(--azul); }
.dia.cerrado b, .dia.pasado b { color: var(--suave); }
.dia[aria-current="date"] { color: #fff; }
.dia[aria-current="date"] small { color: rgba(255, 255, 255, .8); }
.dia[aria-current="date"] b { color: #fff; }
.dia[aria-current="date"] .puntos i { background: rgba(255, 255, 255, .85); }
.semana-pastilla {
  position: absolute; top: 6px; bottom: 6px; left: 6px; width: calc((100% - 12px) / 7); z-index: 0; pointer-events: none;
  transition: transform 340ms var(--ease-drawer);
}
.semana-pastilla::before { content: ""; position: absolute; inset: 0 3px; border-radius: 15px; background: linear-gradient(180deg, #5f8bba, var(--azul2)); box-shadow: 0 8px 16px -8px rgba(61, 101, 145, .8); }

/* ── tarjeta del día con el arcoíris ── */
.hero { margin-top: 14px; background: #fff; border-radius: 24px; box-shadow: var(--sombra); padding: 16px 18px 16px 12px; display: flex; gap: 12px; align-items: center; }
.arco { width: 118px; flex: none; position: relative; }
.arco svg { width: 100%; height: auto; display: block; overflow: visible; }
.arco .pista { stroke: #eef0f2; }
.arco .tramo { transition: stroke-dashoffset 1000ms var(--ease-out); }
.arco .tramo.t2 { transition-delay: 70ms; }
.arco .tramo.t3 { transition-delay: 140ms; }
.arco-num { position: absolute; left: 0; right: 0; bottom: -1px; text-align: center; line-height: 1; }
.arco-num b { font-size: 21px; font-weight: 900; letter-spacing: -.02em; }
.arco-num b span { font-size: 14px; }
.arco-num small { display: block; font-size: 11px; color: var(--mut); font-weight: 800; margin-top: 2px; }
.hero-txt { min-width: 0; flex: 1; }
.hero-txt h2 { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: -.01em; line-height: 1.15; }
.hero-txt .resumen { margin: 4px 0 0; color: var(--mut); font-weight: 700; font-size: 14px; }
.sig { margin-top: 10px; display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 13px; background: var(--azul-s); color: var(--azul2); font-weight: 800; font-size: 14px; border: 0; width: 100%; text-align: left; transition: transform 160ms var(--ease-out); }
.sig:active { transform: scale(.98); }
.sig span { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.sig.espera { background: var(--ambar-s); color: #8a6417; }
.sig.listo { background: var(--verde-s); color: #3f7a38; }

/* ── avisos/banners ── */
.banner { margin-top: 12px; display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 18px; background: #fff; box-shadow: var(--sombra); animation: subir 420ms var(--ease-out) both; }
.banner .ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.banner .txt { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; }
.banner .txt b { display: block; font-size: 15px; font-weight: 900; }
.banner .txt span { color: var(--mut); font-weight: 700; }
.banner.wa .ico { background: #e5f6ea; color: #1f7a45; }
.banner.campana .ico { background: var(--ambar-s); color: var(--ambar); }
.banner .cerrar { border: 0; background: none; color: var(--suave); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; flex: none; }

/* ── línea del día ── */
.tramo-tit { display: flex; align-items: baseline; gap: 8px; margin: 22px 4px 8px; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: var(--suave); }
.lista { display: grid; gap: 8px; }
.fila { display: grid; grid-template-columns: 56px 1fr; gap: 8px; align-items: stretch; }
.fila.entra { animation: entra 420ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }
.hora { text-align: right; padding-top: 13px; line-height: 1; }
.hora b { display: block; font-size: 16px; font-weight: 900; }
.hora small { font-size: 11px; color: var(--suave); font-weight: 800; text-transform: uppercase; }
.cita {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 10px 10px 16px;
  background: #fff; border-radius: 17px; box-shadow: var(--sombra); cursor: pointer; text-align: left; overflow: hidden;
  transition: transform 160ms var(--ease-out), opacity 200ms ease, box-shadow 200ms ease;
}
.cita:active { transform: scale(.98); }
.cita::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 5px; border-radius: 0 5px 5px 0; background: var(--m-barra, var(--cielo)); }
.cita .cuerpo { flex: 1; min-width: 0; display: grid; gap: 1px; }
.cita .nom { font-weight: 900; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cita .det { font-size: 13.5px; color: var(--mut); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cita .nota { font-size: 13px; color: var(--tx); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cita .alerta { color: var(--rojo); font-weight: 800; opacity: 1; }
.cita.est-atendida, .cita.est-novino, .cita.est-cancelada { box-shadow: none; background: rgba(255, 255, 255, .55); border: 1px solid var(--linea); }
.cita.est-atendida .nom, .cita.est-novino .nom { color: var(--mut); }
.cita.est-cancelada .nom { text-decoration: line-through; color: var(--suave); }
.cita.est-llego { box-shadow: 0 0 0 2px rgba(239, 208, 136, .9), var(--sombra); }
.cita.nueva { animation: nueva 1200ms var(--ease-out); }
@keyframes nueva { 0% { box-shadow: 0 0 0 0 rgba(77, 120, 166, .5), var(--sombra); transform: scale(.97); } 30% { transform: scale(1); } 100% { box-shadow: 0 0 0 14px rgba(77, 120, 166, 0), var(--sombra); } }
.rapido { border: 0; min-height: 40px; padding: 0 13px; border-radius: 12px; font-weight: 900; font-size: 14px; background: var(--ambar-s); color: #8a6417; flex: none; transition: transform 160ms var(--ease-out); }
.rapido.atender { background: var(--verde-s); color: #3f7a38; }
.rapido:active { transform: scale(.94); }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 900; white-space: nowrap; flex: none; }
.chip.est-pendiente { background: #f1f2f4; color: var(--mut); }
.chip.est-confirmada { background: var(--azul-s); color: var(--azul2); }
.chip.est-llego { background: var(--ambar-s); color: #8a6417; }
.chip.est-llego::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ambar); animation: pulso 1.6s ease-in-out infinite; }
.chip.est-atendida { background: var(--verde-s); color: #3f7a38; }
.chip.est-novino { background: var(--rojo-s); color: #a3413a; }
.chip.est-cancelada { background: #f1f2f4; color: var(--suave); }
@keyframes pulso { 50% { opacity: .35; } }

.libre { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 9px 10px; min-height: 52px; border-radius: 17px; border: 1.5px dashed rgba(77, 120, 166, .25); background: rgba(255, 255, 255, .45); }
.libre > span { font-size: 13px; font-weight: 800; color: var(--suave); margin-right: 2px; padding-left: 4px; }
.hueco { border: 0; height: 34px; padding: 0 11px; border-radius: 11px; background: var(--azul-s); color: var(--azul2); font-weight: 900; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; transition: transform 160ms var(--ease-out), background-color 160ms ease; }
.hueco:active { transform: scale(.93); }
@media (hover: hover) and (pointer: fine) { .hueco:hover { background: #dbe6f2; } .cita:hover { box-shadow: 0 1px 2px rgba(36,54,75,.06), 0 14px 30px -14px rgba(36,54,75,.3); } }

.ahora { position: relative; height: 0; margin: 2px 0 2px 64px; }
.ahora::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--rojo), rgba(207, 93, 84, .1)); }
.ahora::after { content: ""; position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--rojo); box-shadow: 0 0 0 4px rgba(207, 93, 84, .18); }
.ahora span { position: absolute; left: -64px; top: -9px; width: 52px; text-align: right; font-size: 11px; font-weight: 900; color: var(--rojo); }

.vacio { text-align: center; padding: 30px 20px; color: var(--mut); font-weight: 700; }
.vacio .dibujo { width: 92px; margin: 0 auto 10px; }
.vacio b { display: block; color: var(--tx); font-size: 17px; font-weight: 900; margin-bottom: 4px; }
.vacio .btn { margin-top: 14px; }
.pie-dia { display: flex; justify-content: center; margin-top: 20px; }

/* ── colores de motivo ── */
.m-verde { --m-barra: #8cc084; --m-bg: #e7f3e4; --m-tx: #3f7a38; }
.m-azul { --m-barra: #7d9fc9; --m-bg: #e6eef8; --m-tx: #3c5f8c; }
.m-durazno { --m-barra: #eab39c; --m-bg: #fbeae2; --m-tx: #95502f; }
.m-mantequilla { --m-barra: #ebc65e; --m-bg: #fbf2d8; --m-tx: #82621a; }
.m-lila { --m-barra: #b3a1d6; --m-bg: #efe9f7; --m-tx: #64508e; }
.m-rojo { --m-barra: #e58b84; --m-bg: #fbe5e3; --m-tx: #a13a33; }
.m-celeste { --m-barra: #8fcad6; --m-bg: #e2f2f5; --m-tx: #2f6f7c; }
.m-rosa { --m-barra: #e9a3bd; --m-bg: #fae7ee; --m-tx: #93405f; }
.motivo { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: 999px; background: var(--m-bg, #eef1f4); color: var(--m-tx, var(--mut)); font-weight: 900; font-size: 13px; }

/* ── hojas (bottom sheet) ── */
.velo { position: fixed; inset: 0; z-index: 40; background: rgba(28, 40, 56, .32); opacity: 0; transition: opacity 320ms ease; }
.velo.abierto { opacity: 1; }
.hoja {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: calc(100dvh - 40px); display: flex; flex-direction: column;
  background: var(--bg); border-radius: 26px 26px 0 0; box-shadow: var(--sombra2);
  transform: translateY(100%); transition: transform 420ms var(--ease-drawer);
  padding-bottom: var(--abajo);
}
.hoja.abierta { transform: translateY(0); }
.hoja.arrastrando { transition: none; }
.hoja-cab { flex: none; padding: 8px 18px 6px; touch-action: none; cursor: grab; }
.agarre { width: 42px; height: 5px; border-radius: 5px; background: rgba(36, 54, 75, .16); margin: 0 auto 10px; }
.hoja-tit { display: flex; align-items: center; gap: 10px; }
.hoja-tit h3 { flex: 1; margin: 0; font-size: 20px; font-weight: 900; letter-spacing: -.01em; }
.hoja-tit .x { width: 38px; height: 38px; border-radius: 12px; border: 0; background: rgba(36, 54, 75, .06); display: grid; place-items: center; color: var(--mut); transition: transform 160ms var(--ease-out); }
.hoja-tit .x:active { transform: scale(.92); }
.hoja-cuerpo { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 6px 18px 18px; -webkit-overflow-scrolling: touch; }
.hoja-pie { flex: none; padding: 10px 18px 14px; border-top: 1px solid var(--linea); background: rgba(248, 246, 242, .96); }
.sec { margin-top: 18px; }
.sec:first-child { margin-top: 4px; }
.sec-tit { font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: var(--suave); margin: 0 0 9px 2px; }
.caja { background: #fff; border-radius: 18px; box-shadow: var(--sombra); padding: 14px; }

/* buscar paciente */
.buscar { position: relative; }
.buscar .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--suave); pointer-events: none; }
.buscar input { padding-left: 44px; }
.resultados { display: grid; gap: 6px; margin-top: 8px; }
.persona {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: 15px; border: 1.5px solid transparent;
  background: #fff; text-align: left; box-shadow: var(--sombra); transition: transform 160ms var(--ease-out), border-color 160ms ease;
}
.persona:active { transform: scale(.98); }
.persona.elegida { border-color: var(--azul); }
.persona .info { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.persona .info b { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona .info span { font-size: 13px; color: var(--mut); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona .der { font-size: 12.5px; font-weight: 800; color: var(--mut); text-align: right; flex: none; line-height: 1.25; }
.persona .der b { display: block; color: var(--azul2); }
.persona.nuevo { box-shadow: none; border: 1.5px dashed rgba(77, 120, 166, .35); background: rgba(255, 255, 255, .6); color: var(--azul2); }
.persona .cambiar { color: var(--azul); font-weight: 900; font-size: 14px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 900; font-size: 17px; background: var(--m-bg); color: var(--m-tx); }
.avatar.grande { width: 58px; height: 58px; font-size: 23px; }

/* chips para elegir */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.opcion {
  border: 1.5px solid var(--linea2); background: #fff; min-height: 42px; padding: 0 14px; border-radius: 13px;
  font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; gap: 6px;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.opcion:active { transform: scale(.95); }
.opcion[aria-pressed="true"] { border-color: transparent; background: var(--azul); color: #fff; }
.opcion.motivo-op[aria-pressed="true"] { background: var(--m-bg); color: var(--m-tx); border-color: var(--m-barra); }
.opcion.motivo-op::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--m-barra); }
.carril { display: flex; gap: 7px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scroll-snap-type: x proximity; scrollbar-width: none; }
.carril::-webkit-scrollbar { display: none; }
.dia-op {
  flex: none; scroll-snap-align: start; width: 64px; border: 1.5px solid var(--linea2); background: #fff; border-radius: 15px; padding: 8px 0 7px;
  display: grid; justify-items: center; gap: 1px; transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease;
}
.dia-op:active { transform: scale(.94); }
.dia-op small { font-size: 11px; font-weight: 900; text-transform: uppercase; color: var(--suave); letter-spacing: .04em; }
.dia-op b { font-size: 19px; font-weight: 900; line-height: 1.15; }
.dia-op i { font-style: normal; font-size: 11px; font-weight: 800; color: var(--verde); }
.dia-op.lleno i, .dia-op:disabled i { color: var(--suave); }
.dia-op:disabled { opacity: .5; cursor: default; }
.dia-op[aria-pressed="true"] { background: var(--azul); border-color: transparent; color: #fff; }
.dia-op[aria-pressed="true"] small, .dia-op[aria-pressed="true"] i { color: rgba(255, 255, 255, .85); }
.horas { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 7px; }
.horas .opcion { justify-content: center; padding: 0 6px; }
.horas .opcion.otra { color: var(--azul); border-style: dashed; }
.otra-hora { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.otra-hora input { min-height: 44px; border-radius: 12px; border: 1.5px solid var(--linea2); padding: 6px 10px; font-weight: 800; background: #fff; }
.nota-suave { font-size: 13.5px; color: var(--mut); font-weight: 700; margin: 8px 2px 0; }

/* detalle de cita */
.cab-persona { display: flex; align-items: center; gap: 13px; }
.cab-persona .info { min-width: 0; flex: 1; }
.cab-persona h4 { margin: 0; font-size: 21px; font-weight: 900; line-height: 1.15; }
.cab-persona p { margin: 2px 0 0; color: var(--mut); font-weight: 700; font-size: 14px; }
.cuando { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.cuando .tiempo { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 15px; }
.estados { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.estado-op {
  border: 1.5px solid var(--linea2); background: #fff; border-radius: 15px; min-height: 66px; padding: 8px 4px;
  display: grid; place-items: center; gap: 3px; font-size: 12.5px; font-weight: 900; color: var(--mut);
  transition: transform 160ms var(--ease-out), background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}
.estado-op .ic { width: 22px; height: 22px; }
.estado-op:active { transform: scale(.94); }
.estado-op[aria-pressed="true"].e-confirmada { background: var(--azul-s); border-color: var(--azul); color: var(--azul2); }
.estado-op[aria-pressed="true"].e-llego { background: var(--ambar-s); border-color: var(--mant); color: #8a6417; }
.estado-op[aria-pressed="true"].e-atendida { background: var(--verde-s); border-color: var(--verde); color: #3f7a38; }
.estado-op[aria-pressed="true"].e-novino { background: var(--rojo-s); border-color: #e9a29c; color: #a3413a; }
.contacto { display: flex; align-items: center; gap: 10px; }
.contacto .info { flex: 1; min-width: 0; line-height: 1.3; }
.contacto .info b { display: block; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contacto .info span { font-size: 14px; color: var(--mut); font-weight: 700; }
.alergia { display: flex; gap: 9px; align-items: flex-start; padding: 11px 13px; border-radius: 14px; background: var(--rojo-s); color: #9b3b34; font-weight: 800; font-size: 14px; margin-top: 12px; }
.sugerencia { display: flex; align-items: center; gap: 11px; padding: 12px 13px; border-radius: 16px; background: var(--verde-s); color: #3a6f33; margin-top: 14px; animation: subir 420ms var(--ease-out) both; }
.sugerencia .txt { flex: 1; font-size: 14px; font-weight: 700; line-height: 1.3; }
.sugerencia .txt b { display: block; font-size: 15px; font-weight: 900; }
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.acciones .btn { width: 100%; }
.historial { display: grid; }
.hist { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--linea); width: 100%; border-left: 0; border-right: 0; border-top: 0; background: none; text-align: left; }
.hist:last-child { border-bottom: 0; }
.hist .f { width: 96px; flex: none; font-weight: 900; font-size: 14px; line-height: 1.2; }
.hist .f small { display: block; color: var(--suave); font-weight: 800; font-size: 12px; }
.hist .m { flex: 1; min-width: 0; font-size: 14px; color: var(--mut); font-weight: 700; }

/* recordatorios */
.rec { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--linea); }
.rec:last-child { border-bottom: 0; }
.rec .h { width: 52px; flex: none; font-weight: 900; text-align: right; line-height: 1.1; }
.rec .h small { display: block; font-size: 11px; color: var(--suave); font-weight: 800; text-transform: uppercase; }
.rec .info { flex: 1; min-width: 0; line-height: 1.3; }
.rec .info b { display: block; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec .info span { font-size: 13px; color: var(--mut); font-weight: 700; display: flex; align-items: center; gap: 4px; }
.rec .hecho { color: var(--verde); display: inline-flex; align-items: center; gap: 3px; font-weight: 900; }

/* pacientes */
.pac-cab { display: flex; align-items: center; gap: 10px; margin: 8px 0 10px; }
.pac-cab h2 { flex: 1; margin: 0; font-size: 24px; font-weight: 900; letter-spacing: -.01em; }
.pac-cab h2 small { font-size: 15px; color: var(--suave); font-weight: 800; margin-left: 4px; }
.pegajoso { position: sticky; top: 60px; z-index: 5; padding: 4px 0 10px; background: linear-gradient(var(--bg) 78%, rgba(248, 246, 242, 0)); }
.letra { font-size: 13px; font-weight: 900; color: var(--suave); margin: 14px 4px 6px; }

/* ajustes */
.aj { display: grid; gap: 14px; margin-top: 8px; }
.aj h2 { margin: 8px 2px 0; font-size: 24px; font-weight: 900; }
.aj .caja h3 { margin: 0 0 4px; font-size: 17px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.aj .caja > p { margin: 0 0 12px; color: var(--mut); font-weight: 700; font-size: 14px; line-height: 1.4; }
.aj .campos { display: grid; gap: 10px; }
.dia-hor { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--linea); }
.dia-hor:last-child { border-bottom: 0; }
.dia-hor .nombre { display: flex; align-items: center; gap: 8px; font-weight: 900; padding-top: 6px; }
.bloques { display: grid; gap: 7px; }
.bloque { display: flex; align-items: center; gap: 6px; }
.bloque input { min-height: 40px; padding: 6px 8px; border-radius: 11px; border: 1.5px solid var(--linea2); background: #fff; font-weight: 800; font-size: 15px; min-width: 0; flex: 1; }
.bloque .quitar { border: 0; background: none; color: var(--suave); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; flex: none; }
.agregar { border: 0; background: none; color: var(--azul); font-weight: 900; font-size: 14px; justify-self: start; padding: 4px 2px; }
.cerrado-txt { color: var(--suave); font-weight: 800; padding-top: 9px; }
.interruptor { position: relative; width: 46px; height: 28px; flex: none; display: inline-block; }
.interruptor input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; width: 100%; height: 100%; }
.interruptor span { position: absolute; inset: 0; border-radius: 999px; background: #dfe3e8; transition: background-color 200ms ease; }
.interruptor span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 240ms var(--ease-out); }
.interruptor input:checked + span { background: var(--verde); }
.interruptor input:checked + span::after { transform: translateX(18px); }
.interruptor input:focus-visible + span { outline: 3px solid rgba(77, 120, 166, .45); outline-offset: 2px; }
.linea-aj { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.linea-aj + .linea-aj { border-top: 1px solid var(--linea); }
.linea-aj .txt { flex: 1; font-weight: 800; line-height: 1.3; }
.linea-aj .txt small { display: block; font-weight: 700; color: var(--mut); font-size: 13px; }
.linea-aj select { min-height: 40px; border-radius: 11px; border: 1.5px solid var(--linea2); background: #fff; font-weight: 800; padding: 0 8px; }
.motivos-ed { display: flex; flex-wrap: wrap; gap: 7px; }
.motivos-ed .motivo { gap: 4px; padding-right: 4px; height: 34px; }
.motivos-ed .motivo button { border: 0; background: none; color: inherit; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; opacity: .7; }
.motivo-nuevo { display: flex; gap: 8px; margin-top: 10px; }
.motivo-nuevo input { flex: 1; min-height: 42px; border-radius: 12px; border: 1.5px solid var(--linea2); padding: 0 12px; font-weight: 700; min-width: 0; }
.estado-av { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 15px; margin-bottom: 12px; }
.estado-av i { width: 10px; height: 10px; border-radius: 50%; background: var(--suave); }
.estado-av.si i { background: var(--verde); box-shadow: 0 0 0 4px rgba(111, 174, 102, .2); }
.paso-ios { margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--ambar-s); color: #6f5113; font-weight: 700; font-size: 14px; line-height: 1.45; }
.botones { display: flex; flex-wrap: wrap; gap: 8px; }
.firma { text-align: center; color: var(--suave); font-size: 12.5px; font-weight: 700; margin: 10px 0 0; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--abajo) + 92px); z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; transition: transform 300ms var(--ease-out), opacity 220ms ease;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 28px); width: max-content;
  padding: 10px 10px 10px 14px; border-radius: 16px; background: #24364b; color: #fff; font-weight: 800; font-size: 14.5px;
  box-shadow: 0 18px 40px -16px rgba(20, 30, 45, .6);
}
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
.toast .ic { color: #9fd897; }
.toast button { border: 0; border-radius: 11px; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 900; min-height: 36px; padding: 0 12px; white-space: nowrap; }
.toast.solo { padding-right: 18px; }

/* pregunta */
.pregunta { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: rgba(28, 40, 56, .35); opacity: 0; transition: opacity 200ms ease; }
.pregunta.abierta { opacity: 1; }
.pregunta .caja { width: 100%; max-width: 360px; padding: 20px; transform: scale(.96); transition: transform 240ms var(--ease-out); box-shadow: var(--sombra2); }
.pregunta.abierta .caja { transform: scale(1); }
.pregunta p { margin: 0 0 16px; font-weight: 800; font-size: 16px; line-height: 1.4; }
.pregunta .botones { justify-content: flex-end; }

/* ── escritorio ── */
@media (min-width: 900px) {
  .app { padding-bottom: 0; padding-left: 96px; }
  .tabs { top: 0; bottom: 0; right: auto; width: 96px; height: auto; grid-template-columns: 1fr; grid-auto-rows: 80px; align-content: start; padding: 92px 0 0; border-top: 0; border-right: 1px solid var(--linea); }
  .tab-pastilla { top: 92px; left: 0; width: 96px; height: 80px; }
  .tab-pastilla::before { width: 70px; height: 62px; }
  .fab { display: none; }
  .nueva-escritorio { display: inline-flex; }
  .barra { padding-left: 24px; padding-right: 24px; }
  .vista { max-width: 720px; padding-top: 14px; }
  .hoja { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; max-height: min(86dvh, 860px); border-radius: 26px; transform: translate(-50%, -46%) scale(.97); opacity: 0; transition: transform 300ms var(--ease-out), opacity 220ms ease; padding-bottom: 0; }
  .hoja.abierta { transform: translate(-50%, -50%); opacity: 1; }
  .hoja-cab { cursor: default; }
  .agarre { display: none; }
  .toast { bottom: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; transition-delay: 0ms !important; }
}
