/* App de iPhone: estilo parecido al de Apple. Solo aplica con html.app-ios (tema.js lo pone en la app de iPhone).
   La web, la computadora y Android no cambian. El color del consultorio (--pri) se respeta. */

/* ---- Ajustes de pantalla del iPhone (antes en app.css; solo iPhone, la web queda como v100) */
/* fechas y horas: el iPhone les da un ancho propio y se salían de la pantalla */
html.app-ios input[type=date],html.app-ios input[type=time],html.app-ios input[type=datetime-local],html.app-ios input[type=month]{-webkit-appearance:none;appearance:none;max-width:100%;min-width:0;box-sizing:border-box;text-align:left;min-height:44px}
html.app-ios input::-webkit-date-and-time-value{text-align:left;margin:0}
/* en la app del teléfono, lo que pasa por debajo de la hora y la batería no se encima con ellas */
.app-android body::before{content:"";position:fixed;top:0;left:0;right:0;height:env(safe-area-inset-top,0px);background:var(--bg);z-index:50;pointer-events:none}
@media(max-width:520px){
 /* «Sincronizado» no cabe junto al nombre del consultorio; los avisos que piden algo sí se ven */
 html.app-ios #syn.sync-ok{display:none!important}
 /* botones y campos que bajan de renglón: que no queden pegados */
 html.app-ios .mini,html.app-ios .acts{gap:10px 8px}
 /* cantidades de las tarjetas en una sola línea */
 html.app-ios .stat strong{font-size:clamp(13px,4vw,1.35rem)!important;white-space:nowrap;overflow-wrap:normal}
 /* barra de Guardar de historia clínica, receta y fichas: un solo renglón */
 html.app-ios #hc .bar,html.app-ios #rx .bar,html.app-ios #nu .bar,html.app-ios .bar{flex-wrap:nowrap!important;gap:8px!important;padding:8px 12px calc(8px + env(safe-area-inset-bottom,0px))!important;justify-content:flex-end}
 html.app-ios .bar .m{flex:1 1 auto!important;min-width:0!important;font-size:12px!important;line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
 html.app-ios .bar button{flex:none;padding:9px 14px!important;min-height:40px;font-size:14px!important;white-space:nowrap}
}
/* pantallas completas (historia, receta, ficha, presupuesto, alta): solo se deslizan hacia abajo, nunca de lado */
html.app-ios #hc,html.app-ios #rx,html.app-ios #nu,html.app-ios #pz,html.app-ios #login,html.app-ios #alta{overflow-x:hidden}
/* acciones de cada cita (Agenda): en pantallas anchas se ven todas; en el teléfono, Confirmó, Mover y Eliminar van en «⋯» */
html.app-ios .cmas,html.app-ios .cmas-m{display:contents}html.app-ios .cmas-b{display:none}
@media(max-width:520px){
 html.app-ios .cmas-b{display:inline-flex;align-items:center;justify-content:center;min-width:44px;font-size:18px;font-weight:700;letter-spacing:1px;padding:6px 12px}
 html.app-ios .cmas.abierto>.cmas-b{background:var(--chip);color:var(--acc)}
 html.app-ios .cmas-m{display:none;flex-basis:100%;flex-wrap:wrap;gap:8px;justify-content:flex-end}
 html.app-ios .cmas.abierto>.cmas-m{display:flex}
}
/* fila de cada cita en el teléfono: WhatsApp (ícono), «⋯» y estado en un solo renglón; el menú abre abajo */
@media(max-width:520px){
 html.app-ios [data-row] .lado{display:flex!important;flex-wrap:wrap!important;align-items:center;gap:8px!important;justify-content:flex-start!important;width:100%;flex:1 1 100%!important}
 html.app-ios [data-row] .lado>.acts{display:contents!important}
 html.app-ios [data-row] .wa-i{order:1}html.app-ios [data-row] .cmas-b{order:2}html.app-ios [data-row] .estsel{order:3;flex:0 1 auto;min-width:0;max-width:calc(100% - 96px);margin-left:auto;padding-left:10px!important;padding-right:26px!important}html.app-ios [data-row] .cmas-m{order:5}
 html.app-ios .wa-i{width:40px;height:40px;padding:0!important;border-radius:50%!important;justify-content:center;position:relative;flex:none}
 html.app-ios .wa-i .i{width:20px;height:20px;margin:0}html.app-ios .wa-i .wa-t{display:none}
 html.app-ios .wa-i.ok::after{content:"✓";position:absolute;right:-3px;bottom:-3px;width:17px;height:17px;border-radius:50%;background:#12854e;color:#fff;font-size:11px;font-weight:800;display:grid;place-items:center;border:2px solid var(--card)}
 html.app-ios .cmas-b{width:40px;height:40px;min-width:40px;padding:0!important;border-radius:50%!important}
 html.app-ios .cmas-m{justify-content:flex-start;gap:6px}
 html.app-ios .cmas-m button{padding:5px 9px!important;font-size:12.5px!important;min-height:34px;gap:4px}html.app-ios .cmas-m button .i{width:15px;height:15px}
 html.app-ios #wapanel .wa-i{width:auto;height:auto;border-radius:16px!important;padding:7px 13px!important}html.app-ios #wapanel .wa-i .wa-t{display:inline}html.app-ios #wapanel .wa-i.ok::after{display:none}
}
@media(max-width:520px){
 html.app-ios [data-row] .estsel{font-size:12px!important}
 html.app-ios .cmas.abierto>.cmas-m{display:grid;grid-template-columns:repeat(auto-fit,minmax(0,1fr));gap:6px}
 html.app-ios .cmas-m button{padding:5px 6px!important;font-size:12px!important;justify-content:center;white-space:nowrap}
}
/* Nueva cita / Mover cita: horarios y duraciones en cuadrícula pareja (en el teléfono, 4 por renglón) */
html.app-ios #a-horas,html.app-ios #a-durs{display:grid!important;grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:6px!important}
html.app-ios #a-horas .chip,html.app-ios #a-durs .chip{width:100%;margin:0!important;justify-content:center;text-align:center;padding:8px 4px!important;white-space:nowrap}
@media(max-width:520px){html.app-ios #a-horas,html.app-ios #a-durs{grid-template-columns:repeat(4,minmax(0,1fr))}html.app-ios #a-horas .chip,html.app-ios #a-durs .chip{font-size:13px!important;min-height:38px}}
/* ---- espacio en el teléfono (3/11/2026): renglones parejos, botones que llenan el ancho y menos huecos */
@media(max-width:520px){
 /* título grande de cada sección: sin el hueco de arriba */
 html.app-ios .large{margin:12px 0 14px!important}
 /* Día/Semana/Mes/Lista y pestañas de sección: mismo ancho, llenan el renglón */
 html.app-ios .seg{display:grid!important;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);width:100%}
 html.app-ios .seg>button{width:100%;padding-left:6px!important;padding-right:6px!important;white-space:normal;line-height:1.15;min-height:40px}
 html.app-ios .subnav.seg>button{font-size:13.5px!important}
 /* Finanzas: ‹ mes › en un renglón */
 html.app-ios .fnav{flex-wrap:nowrap!important;width:100%}html.app-ios .fnav>button{flex:none}
 /* Hoy: acciones de la próxima cita en un renglón; el ícono no ocupa lo de un botón */
 html.app-ios .hs-acts{flex-wrap:nowrap!important}html.app-ios .hs-acts>*{min-width:0!important;padding-left:10px!important;padding-right:10px!important;white-space:nowrap}
 html.app-ios .hs-acts>.wa,html.app-ios .hs-acts>a:not(.btn):empty,html.app-ios .hs-acts>.wa-i{flex:0 0 46px!important;width:46px;padding:0!important}
 /* avisos con dos botones (respaldo: Descargar / Mañana) en un renglón */
 html.app-ios #bk-aviso{flex-wrap:wrap}html.app-ios #bk-aviso>span{flex:1 1 100%}html.app-ios #bk-aviso>button{flex:1 1 0;min-width:0}
 /* botones de acción que bajan de renglón: se reparten el ancho */
 html.app-ios .acts>button,html.app-ios .acts>a.btn,html.app-ios .acts>a.ghost,html.app-ios .acts>label.ghost,html.app-ios .mini>button,html.app-ios .fluidez-accesos>*{flex:1 1 auto}
 /* historia clínica: opciones (No/Derecha/Izquierda…, Sí/No) parejas */
 html.app-ios #hc .op{display:flex!important;flex-wrap:wrap;gap:6px}
 html.app-ios #hc .op button{flex:1 1 auto;padding:8px 10px!important}
 html.app-ios #hc .op.esc button{flex:1 1 34px;padding:8px 0!important;min-width:34px}
}

/* colores del sistema de Apple: fondo gris, tarjetas blancas, separadores finos */
html.app-ios{--bg:#F2F2F7;--card:#FFFFFF;--fill:#E9E9EE;--chip:#E9E9EE;--bd:#D1D1D6;--tx:#000000;--mut:#6C6C70;--r:14px;--sh:none;
 --fnt:-apple-system,"SF Pro Text",system-ui,sans-serif;--ios-barra:rgba(249,249,249,.88);--ios-linea:rgba(0,0,0,.18);--ios-sel:#FFFFFF;--ios-pista:rgba(118,118,128,.12)}
@media (prefers-color-scheme:dark){html.app-ios:not([data-theme="light"]){--bg:#000000;--card:#1C1C1E;--fill:#2C2C2E;--chip:#2C2C2E;--bd:#38383A;--tx:#FFFFFF;--mut:#98989F;
 --ios-barra:rgba(22,22,24,.86);--ios-linea:rgba(255,255,255,.14);--ios-sel:#636366;--ios-pista:rgba(118,118,128,.24)}}
html.app-ios[data-theme="dark"]{--bg:#000000;--card:#1C1C1E;--fill:#2C2C2E;--chip:#2C2C2E;--bd:#38383A;--tx:#FFFFFF;--mut:#98989F;
 --ios-barra:rgba(22,22,24,.86);--ios-linea:rgba(255,255,255,.14);--ios-sel:#636366;--ios-pista:rgba(118,118,128,.24)}
html.app-ios body{font-family:var(--fnt);background:var(--bg);-webkit-font-smoothing:antialiased}

/* títulos grandes a la izquierda, como en las apps de Apple */
html.app-ios .large{text-align:left!important;font-size:34px!important;font-weight:700!important;letter-spacing:-.02em!important;line-height:1.1!important;margin:8px 4px 12px!important}
html.app-ios .card h3{font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:.02em;color:var(--mut)}

/* tarjetas: sin borde ni sombra, esquinas de 14 px */
html.app-ios .card,html.app-ios .stat{border:0!important;box-shadow:none!important;border-radius:14px!important}

/* selectores (Día/Semana/Mes/Lista, pestañas de sección): control segmentado de Apple */
html.app-ios .seg{background:var(--ios-pista)!important;padding:2px!important;border-radius:9px!important;gap:0!important;border:0!important}
html.app-ios .seg>button{border:0!important;background:transparent!important;border-radius:7px!important;min-height:32px!important;font-size:13px!important;font-weight:500!important;color:var(--tx)!important;box-shadow:none!important}
html.app-ios .seg>button.on{background:var(--ios-sel)!important;font-weight:600!important;box-shadow:0 1px 3px rgba(0,0,0,.12),0 0 0 .5px rgba(0,0,0,.04)!important}

/* campos: gris de Apple, esquinas de 10 px */
html.app-ios input:not([type=checkbox]):not([type=radio]):not([type=color]),html.app-ios select,html.app-ios textarea{border-radius:10px!important;background-color:var(--fill)!important;border-color:transparent!important}
html.app-ios input:focus,html.app-ios select:focus,html.app-ios textarea:focus{background-color:var(--card)!important;border-color:var(--pri)!important}

/* botones: esquinas de 12 px en lugar de cápsula */
html.app-ios .btn,html.app-ios button.ghost,html.app-ios a.ghost,html.app-ios label.ghost{border-radius:12px!important}
html.app-ios .seg>button,html.app-ios .cmas-b,html.app-ios .wa-i,html.app-ios .pdh-b{border-radius:50%}
html.app-ios .seg>button{border-radius:7px!important}

/* barra de abajo: la de Apple, de lado a lado, translúcida y con línea fina arriba */
@media(max-width:820px){
html.app-ios nav{left:0!important;right:0!important;bottom:0!important;width:auto!important;max-width:none!important;transform:none!important;margin:0!important;border-radius:0!important;
 padding:6px 4px calc(env(safe-area-inset-bottom,0px) + 2px)!important;background:var(--ios-barra)!important;-webkit-backdrop-filter:blur(20px) saturate(180%)!important;backdrop-filter:blur(20px) saturate(180%)!important;
 border:0!important;border-top:.5px solid var(--ios-linea)!important;box-shadow:none!important}
html.app-ios nav .pill{background:none!important;box-shadow:none!important}
html.app-ios nav button[data-t]{color:#8E8E93!important;font-size:10px!important;font-weight:600!important}
html.app-ios nav button[data-t].on{color:var(--pri)!important}
}

/* barras de Guardar (historia, receta, fichas): translúcidas como las de Apple */
html.app-ios #hc .bar,html.app-ios #rx .bar,html.app-ios #nu .bar,html.app-ios .bar{background:var(--ios-barra)!important;-webkit-backdrop-filter:blur(20px) saturate(180%)!important;backdrop-filter:blur(20px) saturate(180%)!important;border-top:.5px solid var(--ios-linea)!important}

/* historia clínica: opciones como control segmentado */
html.app-ios #hc .op:not(.esc){background:var(--ios-pista);padding:2px;border-radius:9px;gap:0!important}
html.app-ios #hc .op:not(.esc) button{border:0!important;background:transparent!important;border-radius:7px!important;min-height:32px!important;font-size:13.5px!important;color:var(--tx)!important}
html.app-ios #hc .op:not(.esc) button.on{background:var(--ios-sel)!important;color:var(--tx)!important;font-weight:600;box-shadow:0 1px 3px rgba(0,0,0,.12)!important}
html.app-ios #hc .op:not(.esc) button.on.w{background:var(--bad)!important;color:#fff!important}

/* agenda: al deslizar una cita a la izquierda se abren sus acciones (ios.js) */
html.app-ios [data-row]{transition:transform .25s cubic-bezier(.2,.8,.2,1)}
html.app-ios [data-row].ios-desliza{transition:none}

@media (prefers-reduced-motion:reduce){html.app-ios [data-row]{transition:none}}
@media (prefers-reduced-transparency:reduce){html.app-ios nav,html.app-ios .bar{-webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:var(--card)!important}}

/* historia clínica, receta y expedientes: barra de arriba de Apple (Cerrar · título · Guardar) — imprimir.js */
html.app-ios .hh{display:block!important}
html.app-ios .ios-nav{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:6px;min-height:44px}
html.app-ios .ios-izq{justify-self:start;min-width:0}html.app-ios .ios-der{justify-self:end;min-width:0}
html.app-ios .ios-cen{text-align:center;min-width:0;max-width:200px}
html.app-ios .ios-cen h2{margin:0!important;font-size:17px!important;font-weight:600!important;letter-spacing:-.01em;line-height:1.2}
html.app-ios .ios-cen small{display:block;font-size:12px;color:var(--mut);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html.app-ios .ios-nav button{background:none!important;border:0!important;box-shadow:none!important;color:var(--pri)!important;font-size:17px!important;font-weight:400;padding:8px 2px!important;min-height:44px;white-space:nowrap}
html.app-ios .ios-der button{font-weight:600!important}
html.app-ios .ios-der button:disabled{opacity:.4}
html.app-ios .ios-izq button.arm{color:var(--bad)!important;font-size:15px!important}
/* barra de abajo delgada: compartir/imprimir · aviso · Modo paciente */
html.app-ios .bar{min-height:0;padding:4px 10px calc(4px + env(safe-area-inset-bottom,0px))!important;gap:4px!important;justify-content:space-between!important;flex-wrap:nowrap!important}
html.app-ios .bar .m{flex:1 1 auto!important;text-align:center;font-size:12px!important;color:var(--mut)}
html.app-ios .bar .ios-ico{width:44px;height:44px;flex:none;padding:0!important;min-height:44px;background:none!important;border:0!important;box-shadow:none!important;color:var(--pri)!important;display:grid;place-items:center;border-radius:10px!important}
/* el «+» de Nueva cita junto al título de Hoy y Agenda; sin botón flotante */
html.app-ios .fab,html.app-ios .navfab,html.app-ios #ag .vbar{display:none!important}
html.app-ios #ag > h1.large{display:flex;align-items:center;justify-content:space-between;gap:12px}
html.app-ios .ios-saludo{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:nowrap}
html.app-ios .ios-mas{flex:none;width:36px;height:36px;border-radius:50%!important;border:0;background:var(--pri);color:var(--pri-tx,#fff);display:grid;place-items:center;padding:0;cursor:pointer}

/* barra de abajo a la medida de Apple: 49 pt más la franja inferior del iPhone; sin la pastilla de color de la sección activa */
@media(max-width:820px){
html.app-ios nav .nav-pastilla{display:none!important}
html.app-ios nav{min-height:0!important;height:auto!important;align-items:center!important;padding-top:3px!important}
html.app-ios nav button[data-t]{height:46px!important;min-height:0!important;padding:0!important;background:none!important;box-shadow:none!important;border-radius:0!important;justify-content:center!important;gap:1px!important}
html.app-ios nav button[data-t] .pill{height:26px!important;padding:0!important;margin:0!important;width:auto!important}
html.app-ios nav button[data-t] .i{width:24px!important;height:24px!important}
html.app-ios nav .navmic,html.app-ios nav .navmic:not([hidden]){height:46px!important;margin:0!important;align-self:center!important;flex:0 0 56px!important}
html.app-ios nav .navmic svg{width:42px!important;height:42px!important;padding:10px!important;box-shadow:0 3px 10px color-mix(in srgb,var(--pri) 30%,transparent)!important}
}

/* ---- piezas nuevas (4–6/11/2026) con el estilo de Apple */
/* ficha del paciente: cada apartado en su grupo blanco, título chico en gris como en Ajustes */
html.app-ios #pdet .pd-sec{background:var(--card);border:0;border-radius:14px;padding:10px 14px 12px;margin-top:12px}
html.app-ios #pdet .pd-sec>.day{display:flex;align-items:center;gap:6px;margin:0 0 6px!important;font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:.02em;color:var(--mut)}
html.app-ios #pdet .pd-pre{background:var(--bg);border-radius:12px;padding:6px 10px 8px;margin-top:8px}
html.app-ios #pdet .pd-del{background:none;border:1px dashed var(--bd)}
html.app-ios #pdet .fluidez-det>summary{list-style:none;display:flex;align-items:center;justify-content:space-between;gap:10px}
html.app-ios #pdet .fluidez-det>summary::-webkit-details-marker{display:none}
/* menú «⋯» (presupuestos, recetas): menú contextual de Apple, translúcido, renglones con línea fina y el ícono a la derecha */
html.app-ios .m3>summary{width:36px;height:36px;border-radius:50%!important;background:var(--ios-pista)!important;color:var(--pri)!important}
html.app-ios .m3-m{border:0;border-radius:14px;padding:0;min-width:230px;overflow:hidden;background:var(--ios-barra);-webkit-backdrop-filter:blur(30px) saturate(180%);backdrop-filter:blur(30px) saturate(180%);box-shadow:0 12px 40px rgba(0,0,0,.22)}
html.app-ios .m3-m>button{border-radius:0!important;padding:12px 16px!important;min-height:44px;flex-direction:row-reverse;justify-content:space-between;font-size:16px!important;border-bottom:.5px solid var(--ios-linea)!important}
html.app-ios .m3-m>button:last-child{border-bottom:0!important}
html.app-ios .m3-m>button .i{color:var(--tx)}
html.app-ios .m3-m>.del-i,html.app-ios .m3-m>[data-del]{color:#FF3B30!important}
html.app-ios .m3-m>.del-i .i,html.app-ios .m3-m>[data-del] .i{color:#FF3B30}
/* tarjetas de arriba que filtran (Pacientes, Agenda, Cuentas): la elegida con el color del consultorio */
html.app-ios .stats>button.stat.on{box-shadow:inset 0 0 0 2px var(--pri)!important;background:var(--card)!important}
/* Finanzas › panel de análisis */
html.app-ios .fp-v{background:var(--bg)}
html.app-ios .fp-t,html.app-ios .fp-c{border:0!important;border-radius:14px!important;box-shadow:none!important;background:var(--card)}
html.app-ios .fp-top h2{font-size:17px;font-weight:600;letter-spacing:-.01em;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
html.app-ios .fp-top button{width:36px;height:36px}
html.app-ios .fp-top button{background:var(--ios-pista);color:var(--pri)}
html.app-ios #pdet .pd-sec>.day .i{width:15px;height:15px;margin:0;flex:none}

/* pantallas anchas (iPad, o iPhone de lado): el menú va a un lado, como en la barra lateral de las apps de Apple para iPad */
@media(min-width:821px){
 html.app-ios nav{background:var(--ios-barra)!important;-webkit-backdrop-filter:blur(20px) saturate(180%)!important;backdrop-filter:blur(20px) saturate(180%)!important;border:0!important;border-right:.5px solid var(--ios-linea)!important;box-shadow:none!important;border-radius:0!important}
 html.app-ios nav .nav-pastilla{background:var(--ios-pista)!important;box-shadow:none!important}
 html.app-ios nav button[data-t].on{color:var(--pri)!important}
}

/* buscadores: lupa gris a la izquierda y siempre visible, como en los buscadores de Apple (Ajustes, Contactos) */
html.app-ios input[type=search]:not(#bu-t){padding-left:34px!important;background-repeat:no-repeat!important;background-position:left 10px center!important;background-size:17px 17px!important;
 background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E")!important}
