/* =====================================================================
   GinecoCare · App de la paciente (complementa app.css + mobile.css)
   Solo variables del tema: funciona en claro y oscuro.
   ===================================================================== */

/* ---------- utilidades ---------- */
.m-choice .grow, .ap-lab .grow, .ap-values .grow { flex: 1; min-width: 0; }
.text-left { text-align: left; }
.ap-chev { color: var(--faint) !important; font-size: 18px !important; flex-shrink: 0; align-self: center; }
.ap-spin { animation: ap-spin 1s linear infinite; display: inline-block; }
@keyframes ap-spin { to { transform: rotate(360deg); } }
.m-content :where(h2) { letter-spacing: -.01em; }

/* ---------- íconos redondeados ---------- */
.ap-ico {
  width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-500); font-size: 20px;
}
.ap-ico .ti { font-size: 21px; }
.ap-ico-wa { background: color-mix(in srgb, #25d366 16%, transparent); color: #1faa55; }
.ap-ico-rose { background: var(--rose-soft); color: var(--rose); }
.ap-ico-green { background: var(--green-soft); color: var(--green); }

/* ---------- login ---------- */
.ap-login { padding-top: calc(24px + env(safe-area-inset-top)); }
.ap-login .m-brand p { margin-top: 6px; }
.ap-login .m-brand h1 { letter-spacing: -.02em; }
.ap-pass { position: relative; }
.ap-pass .input { padding-right: 52px; }
.ap-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border: 0; background: none; border-radius: 12px; cursor: pointer;
  color: var(--muted); display: grid; place-items: center;
}
.ap-eye:hover, .ap-eye:focus-visible { background: var(--surface-3); color: var(--text); outline: none; }
.ap-eye .ti { position: static; transform: none; font-size: 20px; color: inherit; pointer-events: none; }
.ap-help {
  margin-top: 22px; padding: 16px; border-radius: 16px; background: var(--surface);
  border: 1px dashed var(--border-strong); text-align: center; color: var(--text-2); font-weight: 500;
}
.ap-help .ti-key { color: var(--primary-500); }

/* ---------- inicio ---------- */
.ap-greet { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ap-greet h2 { font-size: 22px; line-height: 1.2; }
.ap-greet-date { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ap-avatar { --av: 46px; background: var(--primary); color: #fff; font-weight: 700; flex-shrink: 0; }
.avatar-lg.ap-avatar { --av: 58px; font-size: 20px; }

.ap-hero-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: rgba(255,255,255,.85); text-transform: uppercase; letter-spacing: .04em; }
.ap-hero-badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; background: rgba(255,255,255,.16); color: #fff; }
.m-hero h2 { font-size: 24px; }
.ap-hero-time { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; display: flex; align-items: center; gap: 8px; }
.ap-hero-time .ti { font-size: 24px; opacity: .8; }
.ap-hero-meta { margin-top: 10px; display: grid; gap: 4px; font-size: 14px; color: rgba(255,255,255,.9); }
.ap-hero-meta .ti { opacity: .75; margin-right: 4px; }
.ap-hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.ap-hero-actions form { grid-column: 1 / -1; }
.ap-hero-actions .btn { width: 100%; height: 44px; border-radius: 13px; }
.m-hero .btn-light { box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.ap-hero-empty .btn-light { width: 100%; }
.ap-more { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; margin-top: 10px !important; }

.ap-preg-week { font-size: 26px; font-weight: 800; line-height: 1; color: var(--rose); }
.ap-preg-week small { font-size: 13px; font-weight: 700; }
.ap-preg .progress { height: 10px; }
.ap-preg .progress > span { background: linear-gradient(90deg, var(--rose), var(--primary-500)); }
.ap-preg-fpp { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--surface-2); font-size: 13.5px; }
.ap-preg-fpp .ti { font-size: 20px; color: var(--rose); margin-top: 1px; }

.ap-install { border-color: var(--primary-soft-2); background: var(--primary-soft); }
.m-install.show { display: block; }

.m-quick a { transition: transform .1s; }
.m-quick a:active { transform: scale(.97); }

/* ---------- listas y tarjetas ---------- */
.m-list > a:active { background: var(--surface-2); }
.m-list .badge { vertical-align: 1px; margin-left: 4px; }
.ap-seg { position: sticky; top: calc(61px + env(safe-area-inset-top)); z-index: 5; padding: 6px 0; background: var(--bg); margin: -6px 0 0; }
.ap-seg button { display: inline-flex; align-items: center; gap: 6px; }
.ap-count { font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.ap-seg .active .ap-count { background: rgba(255,255,255,.22); color: #fff; }
.tab-panel > * + * { margin-top: 12px; }
.tab-panel { margin-top: 12px; }

.ap-appt-card .m-appt { align-items: center; }
.ap-appt-card .m-info .s .ti { font-size: 14px; vertical-align: -2px; }
.ap-appt-card.is-muted .m-date { background: var(--surface-3); color: var(--muted); }
.ap-appt-card.is-muted .m-info .t { color: var(--text-2); }

/* ---------- detalle de cita ---------- */
.ap-when { display: grid; gap: 10px; }
.ap-when > div { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.ap-when .ti { font-size: 20px; color: var(--primary-500); width: 22px; flex-shrink: 0; }
.ap-note { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.ap-checklist { list-style: none; margin: 0; padding: 6px 16px; }
.ap-checklist li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.ap-checklist li:last-child { border-bottom: 0; }
.ap-checklist .ti { color: var(--green); font-size: 19px; flex-shrink: 0; }

/* ---------- asistente de reserva ---------- */
.ap-step-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.ap-step-head h2 { font-size: 20px; outline: none; }
.ap-step { animation: ap-in .22s var(--ease); }
@keyframes ap-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ap-group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 4px 8px; display: flex; align-items: center; gap: 6px; }
.ap-step > .ap-group-title:first-child { margin-top: 0; }
.ap-step .m-choice { min-height: 64px; }
.ap-doc-av {
  --doc: var(--primary-500);
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--doc) 16%, transparent); color: var(--doc); font-weight: 800; font-size: 15px;
}
.ap-doc-any { background: var(--primary-soft); color: var(--primary-500); }
.ap-doc-any .ti { color: inherit !important; }
.m-dates button { min-height: 86px; justify-content: center; }
.m-dates button:focus-visible, .slot:focus-visible, .m-choice:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.ap-step .slots { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
.ap-step .slot { min-height: 44px; }
.ap-summary { margin: 0; display: grid; gap: 12px; }
.ap-summary > div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: baseline; }
.ap-summary dt { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ap-summary dt .ti { color: var(--primary-500); margin-right: 3px; }
.ap-summary dd { margin: 0; font-weight: 700; }
.ap-success { text-align: center; padding-top: 12px; }
.ap-success-icon { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); animation: ap-pop .35s var(--ease); }
.ap-success-icon .ti { font-size: 48px; }
@keyframes ap-pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.ap-success h2 { font-size: 22px; }

/* ---------- resultados ---------- */
.ap-details summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--primary-500); padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
.ap-details summary::-webkit-details-marker { display: none; }
.ap-details summary::before { content: '\203A'; font-size: 20px; line-height: 1; transition: transform .15s; }
.ap-details[open] summary::before { transform: rotate(90deg); }
.ap-values { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.ap-values li { display: flex; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: center; }
.ap-values li:last-child { border-bottom: 0; }
.ap-values li.is-flag { background: color-mix(in srgb, var(--red) 6%, transparent); }
.ap-values .ap-val { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ap-values li.is-flag .ap-val { color: var(--red); }
.ap-values .badge { margin-top: 3px; }
.ap-prep { margin: 6px 0 0; padding-left: 18px; }
.ap-thumbs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.ap-thumbs .thumb > a { display: block; }
.ap-thumbs .thumb-cap .sub { font-size: 11.5px; gap: 4px; flex-wrap: nowrap; }
.ap-dl { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary-500); flex-shrink: 0; }
.ap-link-card .ap-ico { margin-right: 4px; }

/* ---------- recetas ---------- */
.ap-meds { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ap-meds li { display: flex; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.ap-meds .ti-pill { color: var(--primary-500); font-size: 20px; margin-top: 1px; flex-shrink: 0; }

/* ---------- perfil ---------- */
.ap-profile { background: linear-gradient(135deg, var(--primary-soft), var(--surface) 70%); }
.ap-kv { grid-template-columns: minmax(110px, 38%) 1fr; }
.m-list .theme-switch { flex-shrink: 0; }
.m-list .theme-switch button { width: 36px; height: 32px; }
.m-section-title h3 { display: flex; align-items: center; gap: 6px; }
.m-section-title h3 .ti { color: var(--primary-500); }
.field .input, .field .select, .field .textarea { font-size: 16px; } /* evita zoom en iOS */

/* ---------- diálogos como hoja inferior en móvil ---------- */
@media (max-width: 600px) {
  .m-body dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .m-body dialog.modal .modal-foot .btn { flex: 1; height: 46px; }
}

@media (max-width: 360px) {
  .ap-hero-actions { grid-template-columns: 1fr; }
  .ap-summary > div { grid-template-columns: 1fr; gap: 2px; }
  .ap-greet h2 { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-step, .ap-success-icon, .ap-spin { animation: none; }
}
.ap-wizard [hidden] { display: none !important; }
.m-actions > * { min-width: 0; }
.m-actions .btn { white-space: normal; line-height: 1.2; padding: 0 10px; text-align: center; }
