/* APP COBERTURA DENTAL — estilos v2 (30/09/2026): con cara de app (barra superior con título, barra inferior tipo
   Android con íconos propios, tarjetas, hojas que suben). Colores de la marca: azul #0d8fd6, marino #0a1f36. */
:root {
  color-scheme: light;
  --bg: #eef2f6; --card: #ffffff; --txt: #0b1a2b; --txt2: #5a6a7e; --txt3: #8b98a9; --bd: #e3e9f0; --chip: #eaf0f6;
  --acc: #0d8fd6; --acc-txt: #ffffff; --acc-suave: #dcefFB; --marino: #0a1f36; --marino2: #11325a;
  --ok: #17864a; --ok-suave: #e1f4e8; --mal: #c73b3b; --mal-suave: #fbe5e5; --warn: #9a6400; --warn-suave: #fdf0d5;
  --sombra: 0 1px 2px rgba(10, 31, 54, .05), 0 8px 24px rgba(10, 31, 54, .07);
  --radio: 18px;
  --barra: 68px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #07111c; --card: #111e2e; --txt: #edf2f7; --txt2: #a3b3c5; --txt3: #6f8296; --bd: #1e2f44; --chip: #18283b;
    --acc: #3aa6e8; --acc-txt: #04121f; --acc-suave: #123553; --marino: #0a1f36; --marino2: #11325a;
    --ok: #4cc485; --ok-suave: #0f2f22; --mal: #f07a7a; --mal-suave: #361616; --warn: #f0b64a; --warn-suave: #33260b;
    --sombra: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07111c; --card: #111e2e; --txt: #edf2f7; --txt2: #a3b3c5; --txt3: #6f8296; --bd: #1e2f44; --chip: #18283b;
  --acc: #3aa6e8; --acc-txt: #04121f; --acc-suave: #123553; --marino: #0a1f36; --marino2: #11325a;
  --ok: #4cc485; --ok-suave: #0f2f22; --mal: #f07a7a; --mal-suave: #361616; --warn: #f0b64a; --warn-suave: #33260b;
  --sombra: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--txt); }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; overscroll-behavior-y: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-user-select: none; user-select: none; }
svg.ico { width: 24px; height: 24px; flex: none; }
.oculto { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ── Barra superior (título de la sección) ── */
.cab { position: sticky; top: 0; z-index: 20; background: var(--marino); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 18px 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.cab .titulos { flex: 1; min-width: 0; }
.cab .titulos h1 { margin: 0; font-size: 21px; font-weight: 750; letter-spacing: -.01em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cab .titulos span { display: block; font-size: 12.5px; opacity: .72; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 38px; height: 38px; border-radius: 19px; background: linear-gradient(135deg, var(--acc), #29abe2); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 750; font-size: 14px; flex: none; border: 0; }

main { max-width: 760px; margin: 0 auto; padding: 14px 16px calc(var(--barra) + 26px + env(safe-area-inset-bottom)); }
main.entra { animation: aparece .16s ease-out; }
@keyframes aparece { from { opacity: .35; transform: translateY(6px); } to { opacity: 1; transform: none; } }
h2 { font-size: 19px; margin: 4px 2px 12px; letter-spacing: -.01em; }
h3 { font-size: 12.5px; margin: 22px 4px 8px; color: var(--txt2); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }

/* ── Barra inferior (estilo Android) ── */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--bd); display: flex; justify-content: center; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(10, 31, 54, .06); }
.tabs .fila { display: flex; width: 100%; max-width: 760px; }
.tabs button { flex: 1; min-width: 0; background: none; border: 0; padding: 4px 2px 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--txt2); font-size: 11.5px; font-weight: 550; position: relative; }
.tabs button .pildora { width: 58px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.tabs button .pildora svg { width: 22px; height: 22px; }
.tabs button.on { color: var(--txt); font-weight: 700; }
.tabs button.on .pildora { background: var(--acc-suave); color: var(--acc); }
.tabs .punto { position: absolute; top: 0; left: calc(50% + 8px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--mal); color: #fff; font-size: 10.5px; line-height: 17px; padding: 0 4px; font-weight: 700; }

/* ── Tarjetas y listas ── */
.card { background: var(--card); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; margin-bottom: 12px; }
.card.plano { box-shadow: none; border: 1px solid var(--bd); }
.lista { background: var(--card); border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.item { display: flex; gap: 12px; padding: 13px 16px; align-items: flex-start; position: relative; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--bd); }
.item.tocable { cursor: pointer; }
.item.tocable:active { background: var(--chip); }
.item .hora { width: 50px; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; position: relative; padding-left: 10px; }
.item .hora::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; background: var(--acc); }
.item[data-est="asistio"] .hora::before { background: var(--ok); }
.item[data-est="no_asistio"] .hora::before, .item[data-est="cancelada"] .hora::before { background: var(--mal); }
.item.gris .hora::before { background: var(--txt3); }
.item .hora small { display: block; font-weight: 400; color: var(--txt3); font-size: 12px; }
.item .cuerpo { flex: 1; min-width: 0; }
.item .cuerpo b { display: block; overflow-wrap: anywhere; font-weight: 650; }
.item .sub { color: var(--txt2); font-size: 13.5px; overflow-wrap: anywhere; }
.item .monto { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.item .monto small { display: block; font-weight: 400; color: var(--txt3); font-size: 12px; }
.item .flecha { color: var(--txt3); align-self: center; }
.item.tachado .cuerpo b, .item.tachado .hora { text-decoration: line-through; color: var(--txt3); }
.item.gris { opacity: .6; }
.etqs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.etq { font-size: 11.5px; padding: 2px 9px; border-radius: 10px; background: var(--chip); color: var(--txt2); white-space: nowrap; font-weight: 550; }
.etq.ok { background: var(--ok-suave); color: var(--ok); }
.etq.mal { background: var(--mal-suave); color: var(--mal); }
.etq.warn { background: var(--warn-suave); color: var(--warn); }
.etq.acc { background: var(--acc-suave); color: var(--acc); }
.vacio { text-align: center; color: var(--txt2); padding: 28px 12px; }
.nota { font-size: 12.5px; color: var(--txt3); margin: 12px 4px; }
.aviso-carga { color: var(--txt2); padding: 36px 4px; text-align: center; }
.aviso-carga::before { content: ""; display: block; width: 26px; height: 26px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid var(--bd); border-top-color: var(--acc); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.error { background: var(--mal-suave); color: var(--mal); border-radius: 12px; padding: 11px 13px; margin: 10px 0; }

/* ── Aviso "instala la app" ── */
.instalar { display: flex; gap: 12px; align-items: center; background: linear-gradient(135deg, var(--marino), var(--marino2)); color: #fff; border-radius: var(--radio); padding: 14px; margin-bottom: 14px; box-shadow: var(--sombra); }
.instalar img { width: 44px; height: 44px; border-radius: 12px; background: #fff; flex: none; }
.instalar .txt { flex: 1; min-width: 0; font-size: 13px; opacity: .92; }
.instalar .txt b { display: block; font-size: 15px; opacity: 1; }
.instalar button.si { border: 0; background: #fff; color: var(--marino); border-radius: 12px; padding: 9px 14px; font-weight: 750; font-size: 14px; flex: none; }
.instalar button.no { border: 0; background: none; color: #fff; opacity: .7; font-size: 18px; padding: 4px; flex: none; }

/* ── Selectores: fechas, meses, personas ── */
.nav-fecha { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.nav-fecha .titulo { flex: 1; text-align: center; font-weight: 700; font-size: 16px; }
.btn-red { width: 40px; height: 40px; border-radius: 20px; border: 0; background: var(--card); box-shadow: var(--sombra); font-size: 20px; line-height: 1; flex: none; color: var(--txt); display: flex; align-items: center; justify-content: center; }
.btn-red:disabled { opacity: .35; }
.dias { display: flex; gap: 4px; padding: 6px; margin-bottom: 10px; background: var(--card); border-radius: var(--radio); box-shadow: var(--sombra); }
.dia-btn { flex: 1 1 0; min-width: 0; border: 0; background: none; border-radius: 14px; padding: 6px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; color: var(--txt2); text-transform: capitalize; }
.dia-btn b { font-size: 16px; color: var(--txt); width: 34px; height: 34px; border-radius: 17px; display: flex; align-items: center; justify-content: center; }
.dia-btn.hoy b { color: var(--acc); box-shadow: inset 0 0 0 2px var(--acc); }
.dia-btn.on b { background: var(--acc); color: var(--acc-txt); box-shadow: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 0; background: var(--card); box-shadow: var(--sombra); border-radius: 18px; padding: 7px 14px; font-size: 13.5px; white-space: nowrap; font-weight: 550; }
.chip.on { background: var(--marino); color: #fff; }
.seg { display: inline-flex; background: var(--chip); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 14px; font-size: 13.5px; border-radius: 9px; font-weight: 600; color: var(--txt2); }
.seg button.on { background: var(--card); color: var(--txt); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ── Cifras grandes ── */
.hero { background: linear-gradient(135deg, var(--marino), var(--marino2) 70%, #155a8a); color: #fff; border-radius: 22px; padding: 18px 18px 16px; margin-bottom: 12px; box-shadow: var(--sombra); }
.hero .rotulo { font-size: 13px; opacity: .8; }
.hero .grande { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.hero .pie { font-size: 12.5px; opacity: .75; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { background: var(--card); border-radius: 14px; padding: 11px; min-width: 0; box-shadow: var(--sombra); }
.kpi span { display: block; font-size: 11.5px; color: var(--txt2); }
.kpi b { font-size: 17px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.desglose .linea { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--bd); }
.desglose .linea:first-child { border-top: 0; }
.desglose .linea.total { border-top: 2px solid var(--txt); font-weight: 800; font-size: 16.5px; }
.desglose .linea span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.barra { position: relative; height: 10px; background: var(--chip); border-radius: 5px; margin: 14px 0 24px; }
.barra .relleno { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--acc), #29abe2); border-radius: 5px; }
.barra .marca { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--txt3); }
.barra .marca span { position: absolute; top: 16px; left: -18px; font-size: 11px; color: var(--txt2); white-space: nowrap; }

/* ── Botones ── */
.btn { border: 0; border-radius: 14px; padding: 13px 16px; background: var(--acc); color: var(--acc-txt); font-weight: 700; width: 100%; font-size: 15.5px; }
.btn:active { filter: brightness(.95); }
.btn:disabled { opacity: .55; }
.btn.sec { background: var(--chip); color: var(--txt); }
.btn.peligro { background: var(--mal-suave); color: var(--mal); }
.btn.chico { width: auto; padding: 8px 14px; font-size: 13.5px; border-radius: 12px; }
.btn-aviso { border: 0; background: var(--chip); color: var(--txt2); border-radius: 10px; padding: 4px 10px; font-size: 12px; margin-top: 8px; font-weight: 550; }
.fila-btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.fila-btns .btn { flex: 1; }
a { color: var(--acc); }
details summary { cursor: pointer; font-weight: 650; }

/* ── Entrar ── */
.entrar { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 20px 24px; background: radial-gradient(900px 480px at 50% -10%, #1a4f80 0%, var(--marino) 62%); color: #fff; }
.entrar .marca { text-align: center; margin-bottom: 26px; }
.entrar .marca img { width: 84px; height: 84px; border-radius: 22px; background: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
.entrar .marca b { display: block; font-size: 24px; margin-top: 14px; letter-spacing: -.01em; }
.entrar .marca span { font-size: 14px; opacity: .75; }
.entrar .caja { width: 100%; max-width: 380px; background: var(--card); color: var(--txt); border-radius: 24px; padding: 22px 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.entrar label { display: block; font-size: 13px; color: var(--txt2); margin: 12px 0 6px; font-weight: 600; }
.campo { width: 100%; border: 1.5px solid var(--bd); background: var(--bg); border-radius: 14px; padding: 13px 14px; font-size: 17px; outline: none; }
.campo:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-suave); }
.campo.codigo { letter-spacing: .5em; text-align: center; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.entrar p { color: var(--txt2); font-size: 14px; margin: 0 0 4px; }
.entrar .btn { margin-top: 14px; }
.entrar .pie { margin-top: 18px; font-size: 12px; opacity: .6; text-align: center; }
.enlace { background: none; border: 0; color: var(--acc); padding: 8px 0; font-size: 14px; font-weight: 600; }

/* ── Hoja que sube (ficha, avisos) ── */
.velo { position: fixed; inset: 0; z-index: 50; background: rgba(4, 12, 22, .55); display: flex; align-items: flex-end; justify-content: center; animation: velo .15s ease-out; }
@keyframes velo { from { background: rgba(4, 12, 22, 0); } }
.hoja { width: 100%; max-width: 760px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); animation: sube .22s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain; }
@keyframes sube { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.hoja .asa { width: 44px; height: 5px; border-radius: 3px; background: var(--txt3); opacity: .5; margin: 4px auto 12px; }
.hoja .cerrar { float: right; border: 0; background: var(--chip); width: 36px; height: 36px; border-radius: 18px; font-size: 16px; }
.hoja h2 { margin-top: 2px; padding-right: 44px; font-size: 21px; }
textarea.campo { min-height: 110px; font-size: 15px; resize: vertical; }
.evol { white-space: pre-wrap; font-size: 13.5px; color: var(--txt2); }
.toast { position: fixed; left: 50%; bottom: calc(var(--barra) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--marino); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 14px; box-shadow: var(--sombra); max-width: calc(100% - 32px); animation: aparece .18s ease-out; }

@media (min-width: 700px) {
  .velo { align-items: center; }
  .hoja { border-radius: 24px; }
}
/* Instalada (sin barra del navegador): el aviso de instalar no aparece */
@media (display-mode: standalone) { .instalar { display: none !important; } }

/* ── Pacientes: aviso de seguridad al entrar y clave de 4 dígitos (30/09) ── */
.aviso-seg { background: var(--warn-suave); color: var(--txt); border-radius: 14px; padding: 12px 14px; margin: 14px 0 6px; font-size: 13px; max-height: 190px; overflow-y: auto; }
.aviso-seg b { display: block; margin-bottom: 4px; }
.aviso-seg p { margin: 6px 0 0; color: var(--txt2); font-size: 13px; }
label.acepto { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--txt); font-weight: 500; margin: 10px 0 2px; cursor: pointer; }
label.acepto input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--acc); }
.pin { width: 100%; max-width: 340px; text-align: center; color: #fff; }
.pin img { width: 64px; height: 64px; border-radius: 18px; background: #fff; box-shadow: 0 10px 26px rgba(0, 0, 0, .35); }
.pin > b { display: block; font-size: 21px; margin: 16px 0 6px; }
.pin-msg { font-size: 13.5px; opacity: .78; min-height: 38px; padding: 0 10px; }
.pin-puntos { display: flex; justify-content: center; gap: 18px; margin: 18px 0 26px; }
.pin-puntos span { width: 16px; height: 16px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, .75); }
.pin-puntos span.lleno { background: #fff; border-color: #fff; }
.teclado { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 26px; justify-content: center; }
.teclado button { width: 76px; height: 76px; border-radius: 38px; border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 28px; font-weight: 500; }
.teclado button:active { background: rgba(255, 255, 255, .28); }
.pin .enlace { color: #9fd3f5; margin-top: 18px; }
.temblor { animation: temblor .35s; }
@keyframes temblor { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ── Director: menú "Todo" y páginas del Panel dentro de la app (30/09) ── */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { border: 0; background: var(--card); border-radius: var(--radio); box-shadow: var(--sombra); padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 112px; color: var(--txt); }
.tile:active { transform: scale(.98); }
.tile .tile-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--acc-suave); color: var(--acc); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.tile b { font-size: 15px; }
.tile span:last-child { font-size: 12.5px; color: var(--txt2); line-height: 1.3; }
main.lleno { max-width: none; padding: 0 0 calc(var(--barra) + env(safe-area-inset-bottom)); }
.marco-ext { height: calc(100vh - 68px - var(--barra) - env(safe-area-inset-bottom)); height: calc(100dvh - 68px - var(--barra) - env(safe-area-inset-bottom)); }
.marco-ext iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }

/* ── "Ver la app como…" (Director mirando la app de otra persona) ── */
.viendo { position: relative; background: #f0b64a; color: #2b1d00; display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 13px; font-weight: 650; }
.viendo span { flex: 1; min-width: 0; }
.viendo button { border: 0; background: #2b1d00; color: #fff; border-radius: 10px; padding: 7px 10px; font-size: 12.5px; font-weight: 700; flex: none; }
