/* ============================================================
   Medico — App movil look & feel
   ============================================================ */

[x-cloak] { display: none !important; }

* { -webkit-tap-highlight-color: transparent; }

html, body {
  background: #f3f4f6 !important;
  color: #0f172a;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}
input, select, textarea, button { font-family: inherit; font-size: 16px; }
.font-display { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; letter-spacing: -0.01em; }

/* ============================================================
   Phone shell — encuadra la app como un movil tambien en desktop
   ============================================================ */
.phone-shell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: #ffffff;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 600px) {
  body { padding: 24px 0; background: #e2e8f0 !important; }
  .phone-shell {
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15,23,42,0.05);
    min-height: calc(100vh - 48px);
  }
}

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #f1f5f9;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  box-shadow: 0 6px 16px -6px rgba(124,58,237,0.6);
  flex-shrink: 0;
}
.brand-logo-img {
  width: 40px; height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: 0 6px 16px -6px rgba(124,58,237,0.6);
}
.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: #f1f5f9;
  color: #334155;
  border: none;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.icon-btn:hover { background: #e2e8f0; }
.icon-btn:active { transform: scale(0.94); }
.dot-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #7c3aed;
  border: 2px solid #f1f5f9;
}

/* ============================================================
   Chips pacientes (scroll horizontal)
   ============================================================ */
.chips-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px 4px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 9999px;
  background: #f1f5f9;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background .15s ease, transform .08s ease, border-color .15s ease;
}
.chip:active { transform: scale(0.96); }
.chip__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.chip__txt { display: flex; flex-direction: column; line-height: 1.05; text-align: left; }
.chip__nombre { font-weight: 700; font-size: 0.85rem; color: #0f172a; }
.chip__sub { font-size: 0.65rem; color: #64748b; }
.chip--activa { border-color: #7c3aed; background: #faf5ff; }
.chip--activa .chip__nombre { color: #6d28d9; }

.avatar-todos   { background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%); }
.avatar-rose    { background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%); }
.avatar-sky     { background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%); }
.avatar-amber   { background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%); }
.avatar-emerald { background: linear-gradient(135deg, #34d399 0%, #047857 100%); }
.avatar-indigo  { background: linear-gradient(135deg, #818cf8 0%, #4338ca 100%); }
.avatar-violet  { background: linear-gradient(135deg, #a78bfa 0%, #6d28d9 100%); }
.avatar-teal    { background: linear-gradient(135deg, #2dd4bf 0%, #0f766e 100%); }
.avatar-pink    { background: linear-gradient(135deg, #f472b6 0%, #be185d 100%); }
.avatar-slate   { background: linear-gradient(135deg, #94a3b8 0%, #475569 100%); }

.chip__avatar-img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.badge-avatar {
  width: 14px; height: 14px;
  object-fit: cover;
  border-radius: 50%;
}
.seg-opt__avatar {
  width: 18px; height: 18px;
  object-fit: cover;
  border-radius: 50%;
}

.bg-rose-soft  { background: #fff1f2; color: #9f1239; }
.bg-sky-soft   { background: #f0f9ff; color: #075985; }
.bg-amber-soft { background: #fffbeb; color: #92400e; }
.bg-neutral-soft { background: #f1f5f9; color: #334155; }

/* ============================================================
   Resumen (stats row)
   ============================================================ */
.resumen {
  margin: 12px 16px 8px;
  padding: 14px 8px;
  background: linear-gradient(135deg, #faf5ff 0%, #ecfeff 100%);
  border: 1px solid #ede9fe;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.resumen__col { flex: 1; text-align: center; min-width: 0; }
.resumen__num {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  color: #0f172a;
  display: flex; justify-content: center; align-items: baseline; gap: 4px;
}
.resumen__lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-top: 2px;
  font-weight: 600;
}
.resumen__sep {
  width: 1px;
  align-self: stretch;
  background: #e2e8f0;
  margin: 4px 0;
}

/* ============================================================
   Feed
   ============================================================ */
.feed { padding: 8px 16px 16px; flex: 1; }
.feed__list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.estado { text-align: center; padding: 64px 16px; }
.estado-vacio {
  text-align: center;
  padding: 56px 24px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}
.estado-vacio__icono {
  width: 64px; height: 64px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #ede9fe;
  color: #7c3aed;
}

.entrada {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .15s ease, border-color .15s ease;
  align-items: stretch;
}
.entrada:active { transform: scale(0.985); }
.entrada:hover { border-color: #c4b5fd; box-shadow: 0 6px 18px -10px rgba(124,58,237,0.25); }

.entrada__fecha {
  width: 56px;
  flex-shrink: 0;
  border-radius: 12px;
  padding: 8px 4px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.entrada__fecha-dia {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}
.entrada__fecha-mes {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-top: 4px;
  opacity: 0.85;
}

.entrada__cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.entrada__head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.entrada__titulo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  color: #0f172a;
  margin: 2px 0 0 0;
}
.entrada__estrellas { display: flex; gap: 2px; align-items: center; }
.entrada__desc {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}
.entrada__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #6d28d9;
  background: #f5f3ff;
  border-radius: 8px;
  padding: 3px 8px;
  margin-top: 4px;
  max-width: 100%;
}
.entrada__tag span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Badges paciente (chips dentro de la card) */
.paciente-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
}
.pb-rose    { background: #fff1f2; color: #9f1239; }
.pb-sky     { background: #f0f9ff; color: #075985; }
.pb-amber   { background: #fffbeb; color: #92400e; }
.pb-emerald { background: #ecfdf5; color: #065f46; }
.pb-indigo  { background: #eef2ff; color: #3730a3; }
.pb-violet  { background: #f5f3ff; color: #5b21b6; }
.pb-teal    { background: #f0fdfa; color: #115e59; }
.pb-pink    { background: #fdf2f8; color: #9d174d; }
.pb-slate   { background: #f1f5f9; color: #334155; }

/* ============================================================
   Bottom nav
   ============================================================ */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid #f1f5f9;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  z-index: 25;
}
@media (min-width: 600px) { .bottom-nav { border-radius: 0 0 32px 32px; } }

.bn-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: 12px;
  cursor: pointer;
  transition: color .15s ease, background .15s ease, transform .08s ease;
  text-decoration: none;
}
.bn-btn:hover { color: #7c3aed; }
.bn-btn:active { transform: scale(0.92); }

.bn-fab {
  width: 60px; height: 60px;
  margin: 0 auto;
  margin-top: -28px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  color: #fff;
  border-radius: 50%;
  border: 4px solid #ffffff;
  box-shadow: 0 12px 28px -8px rgba(124,58,237,0.55);
  cursor: pointer;
  transition: transform .12s ease;
}
.bn-fab:active { transform: scale(0.93); }

/* ============================================================
   Page push (editor / filtros) — fullscreen slide-up
   ============================================================ */
.page {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32,.72,.27,1);
  overflow: hidden;
  pointer-events: none;
}
.page--abierta { transform: translateY(0); pointer-events: auto; }

@media (min-width: 600px) {
  .page {
    inset: 24px auto 24px 50%;
    transform: translate(-50%, 100%);
    width: 480px;
    height: calc(100vh - 48px);
    border-radius: 32px;
    box-shadow: 0 30px 80px -20px rgba(15,23,42,0.4);
  }
  .page--abierta { transform: translate(-50%, 0); }
}

.page__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px 12px 12px;
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff;
  position: sticky; top: 0; z-index: 1;
}
.page__titulo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  flex: 1;
  text-align: center;
  color: #0f172a;
}
.btn-guardar {
  background: #7c3aed;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background .15s ease, transform .08s ease;
  min-width: 80px;
  min-height: 40px;
}
.btn-guardar:hover { background: #6d28d9; }
.btn-guardar:active { transform: scale(0.96); }
.btn-guardar:disabled { opacity: 0.6; cursor: not-allowed; }

.page__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(40px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

/* ============================================================
   Campos formulario
   ============================================================ */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: #64748b;
  padding: 0 4px;
}
.input-app {
  width: 100%;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  color: #0f172a;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.input-app:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124,58,237,0.15);
}
.input-app--area { resize: vertical; min-height: 90px; line-height: 1.45; font-family: inherit; }
select.input-app { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }

/* Search wrap (input con icono) */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: #0f172a;
}

/* Segmented control (paciente picker) */
.seg-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 14px;
}
.seg-opt {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 6px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  background: transparent;
  color: #475569;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
  min-height: 44px;
}
.seg-opt:active { transform: scale(0.97); }
.seg-rose.seg-opt--activa  { background: #ffffff; color: #e11d48; box-shadow: 0 2px 6px -2px rgba(225,29,72,0.4), 0 0 0 1.5px #fecdd3; }
.seg-sky.seg-opt--activa   { background: #ffffff; color: #0284c7; box-shadow: 0 2px 6px -2px rgba(2,132,199,0.4),  0 0 0 1.5px #bae6fd; }
.seg-amber.seg-opt--activa { background: #ffffff; color: #d97706; box-shadow: 0 2px 6px -2px rgba(217,119,6,0.4),  0 0 0 1.5px #fde68a; }

/* Estrellas grandes (editor) */
.estrellas-grandes {
  display: flex;
  gap: 4px;
  padding: 14px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  justify-content: space-between;
}
.estrellas-filtro {
  display: flex;
  gap: 4px;
  padding: 14px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  justify-content: space-around;
}
.estrella-btn {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  transition: transform .08s ease;
}
.estrella-btn:active { transform: scale(0.85); }

/* Botón borrar/limpiar */
.btn-borrar {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, transform .08s ease;
}
.btn-borrar:hover { background: #fee2e2; }
.btn-borrar:active { transform: scale(0.98); }

/* ============================================================
   Action sheet (borrar)
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 60;
}
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 100%);
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(28px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px -10px rgba(15,23,42,0.25);
  z-index: 61;
  transition: transform .28s cubic-bezier(.32,.72,.27,1);
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
}
.sheet--abierta { transform: translate(-50%, 0); }
.sheet__handle {
  width: 40px; height: 4px;
  background: #cbd5e1;
  border-radius: 9999px;
  margin-bottom: 10px;
}
.sheet__icono {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #fef2f2;
  display: flex; align-items: center; justify-content: center;
}
.sheet__titulo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  margin: 0;
}
.sheet__msg { text-align: center; margin: 0 0 6px 0; line-height: 1.4; }
.btn-sheet {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-size: 0.95rem;
  transition: transform .08s ease, background .15s ease;
  min-height: 50px;
}
.btn-sheet:active { transform: scale(0.98); }
.btn-sheet--rojo { background: #dc2626; color: #ffffff; }
.btn-sheet--rojo:hover { background: #b91c1c; }
.btn-sheet--cancel { background: #f1f5f9; color: #334155; }
.btn-sheet--cancel:hover { background: #e2e8f0; }

/* ============================================================
   Toast
   ============================================================ */
.toast-app {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
}
.toast-app__inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #ffffff;
  border-radius: 9999px;
  box-shadow: 0 10px 32px -8px rgba(15,23,42,0.25);
  font-weight: 600;
  font-size: 0.85rem;
  border: 1px solid #e2e8f0;
}
.toast-success { color: #047857; }
.toast-error   { color: #b91c1c; }
.toast-warning { color: #b45309; }
.toast-info    { color: #075985; }

/* ============================================================
   Login (estetica app movil)
   ============================================================ */
.login-shell {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}
.login-hero {
  position: relative;
  padding: 56px 24px 28px;
  text-align: center;
  overflow: hidden;
}
.login-hero__halo {
  position: absolute;
  inset: -40px -40px auto -40px;
  height: 240px;
  background:
    radial-gradient(circle at 30% 30%, rgba(124,58,237,0.18) 0%, transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(6,182,212,0.16)  0%, transparent 55%);
  z-index: 0;
}
.login-logo {
  position: relative;
  z-index: 1;
  width: 88px;
  height: 88px;
  border-radius: 24px;
  box-shadow: 0 18px 40px -16px rgba(124,58,237,0.55);
  margin: 0 auto 18px;
  display: block;
}
.login-titulo {
  position: relative; z-index: 1;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 2.1rem;
  letter-spacing: -0.02em;
  color: #0f172a;
  margin: 0;
}
.login-subtitulo {
  position: relative; z-index: 1;
  font-size: 0.9rem;
  color: #64748b;
  margin-top: 4px;
}

.login-card {
  margin: 0 20px;
  padding: 22px 20px 24px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  box-shadow: 0 14px 40px -18px rgba(15,23,42,0.18);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.login-input-wrap:focus-within {
  border-color: #7c3aed;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(124,58,237,0.15);
}
.login-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: #0f172a;
  min-height: 24px;
}

.login-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 12px 28px -10px rgba(124,58,237,0.55);
  transition: transform .08s ease, filter .15s ease;
  min-height: 50px;
}
.login-btn:hover { filter: brightness(1.04); }
.login-btn:active { transform: scale(0.98); }

.login-alert {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
}
.login-alert--error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.login-alert--warn  { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

.login-pie {
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 16px 24px 24px;
}

/* ============================================================
   Pull-to-refresh indicator
   ============================================================ */
.ptr-indicator {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: 50%;
  transform: translate(-50%, -100%);
  z-index: 35;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 8px 24px -8px rgba(15,23,42,0.25);
  color: #7c3aed;
  opacity: 0;
  transition: none;
}
.ptr-indicator.listo { color: #06b6d4; }
.ptr-indicator.refrescando .ptr-spin { animation: ptr-spin 0.8s linear infinite; }
@keyframes ptr-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ============================================================
   Adjuntos: foto medicamento + grid fotos
   ============================================================ */
.med-wrap { position: relative; }
.sugerencias {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  margin-top: 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 12px 28px -10px rgba(15,23,42,0.18);
  z-index: 5;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}
.sugerencia {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
}
.sugerencia:hover { background: #f8fafc; }
.sugerencia__nombre { flex: 1; color: #0f172a; font-weight: 500; }
.sugerencia__count { font-size: 0.7rem; color: #94a3b8; font-weight: 700; }

.med-foto { margin-top: 10px; }
.med-foto__add {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  background: #f5f3ff;
  border: 1px dashed #c4b5fd;
  border-radius: 14px;
  color: #6d28d9;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.med-foto__add:hover { background: #ede9fe; }
.med-foto__add:disabled { opacity: 0.6; cursor: not-allowed; }

.med-foto__preview {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}
.med-foto__preview img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  cursor: zoom-in;
}
.med-foto__del {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(15,23,42,0.7);
  color: #ffffff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.med-foto__cambiar {
  position: absolute;
  bottom: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.95);
  color: #0f172a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.fotos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px;
}
.foto-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f5f9;
}
.foto-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}
.foto-thumb__del {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(15,23,42,0.75);
  color: #ffffff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.foto-add {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  color: #64748b;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.foto-add:hover { background: #f5f3ff; color: #7c3aed; border-color: #c4b5fd; }
.foto-add:disabled { opacity: 0.6; cursor: not-allowed; }

/* Fotos en card de la lista */
.entrada__fotos {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  align-items: center;
}
.entrada__foto-mini {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  flex-shrink: 0;
}
.entrada__foto-mini img { width: 100%; height: 100%; object-fit: cover; }
.entrada__foto-pill {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 16px; height: 16px;
  background: #7c3aed;
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #ffffff;
}
.entrada__foto-mas {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  padding: 0 6px;
}

/* ============================================================
   Lightbox
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.92);
  z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.lightbox__cerrar {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 12px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: none;
  color: #0f172a;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

/* ============================================================
   Estadisticas
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat-tile {
  padding: 14px 10px;
  border-radius: 16px;
  text-align: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.stat-tile--violeta { background: linear-gradient(135deg, #faf5ff 0%, #ffffff 100%); border-color: #ede9fe; }
.stat-tile--cyan    { background: linear-gradient(135deg, #ecfeff 0%, #ffffff 100%); border-color: #cffafe; }
.stat-tile--ambar   { background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%); border-color: #fde68a; }
.stat-tile__num {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: #0f172a;
  line-height: 1.1;
}
.stat-tile__lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-top: 4px;
  font-weight: 600;
}

.card-stat {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px;
}
.card-stat__titulo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  margin: 0 0 12px 0;
}

.bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  align-items: end;
}
.bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar {
  width: 100%;
  height: 80px;
  background: #f1f5f9;
  border-radius: 6px 6px 2px 2px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.bar__fill {
  width: 100%;
  background: linear-gradient(180deg, #7c3aed 0%, #06b6d4 100%);
  border-radius: 6px 6px 2px 2px;
  min-height: 2px;
  transition: height .3s ease;
}
.bar__num {
  font-size: 0.65rem;
  font-weight: 700;
  color: #475569;
  height: 12px;
}
.bar__lbl {
  font-size: 0.55rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.hbar {
  display: grid;
  grid-template-columns: 90px 1fr 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.hbar__lbl {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.med-lbl span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar__rail {
  height: 8px;
  background: #f1f5f9;
  border-radius: 9999px;
  overflow: hidden;
}
.hbar__fill {
  height: 100%;
  background: #7c3aed;
  border-radius: 9999px;
  min-width: 4px;
  transition: width .3s ease;
}
.hbar__num {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
  text-align: right;
}

.bg-paciente-rose    { background: linear-gradient(90deg, #fb7185, #e11d48); }
.bg-paciente-sky     { background: linear-gradient(90deg, #38bdf8, #0284c7); }
.bg-paciente-amber   { background: linear-gradient(90deg, #fbbf24, #d97706); }
.bg-paciente-emerald { background: linear-gradient(90deg, #34d399, #047857); }
.bg-paciente-indigo  { background: linear-gradient(90deg, #818cf8, #4338ca); }
.bg-paciente-violet  { background: linear-gradient(90deg, #a78bfa, #6d28d9); }
.bg-paciente-teal    { background: linear-gradient(90deg, #2dd4bf, #0f766e); }
.bg-paciente-pink    { background: linear-gradient(90deg, #f472b6, #be185d); }
.bg-paciente-slate   { background: linear-gradient(90deg, #94a3b8, #475569); }

/* ============================================================
   Calendario
   ============================================================ */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-mes {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: capitalize;
  color: #0f172a;
}
.cal-grid-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dia {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  padding: 0;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
.cal-dia:active { transform: scale(0.94); }
.cal-dia--off { color: #cbd5e1; background: #f8fafc; }
.cal-dia--hoy { border-color: #7c3aed; color: #6d28d9; font-weight: 800; }
.cal-dia--evt { background: linear-gradient(180deg, #faf5ff 0%, #ffffff 100%); }
.cal-dia--sel { background: #7c3aed; color: #ffffff; border-color: #7c3aed; }
.cal-dia--sel.cal-dia--evt { background: #7c3aed; }
.cal-dia__num {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
}
.cal-dia__puntos { display: flex; gap: 2px; margin-top: 4px; }
.cal-pt {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #7c3aed;
}
.cal-pt--rose { background: #f43f5e; }
.cal-pt--sky  { background: #0ea5e9; }
.cal-pt--amber{ background: #f59e0b; }
.cal-pt--emerald { background: #10b981; }
.cal-pt--indigo { background: #6366f1; }
.cal-pt--violet { background: #8b5cf6; }
.cal-pt--teal   { background: #14b8a6; }
.cal-pt--pink   { background: #ec4899; }
.cal-pt--slate  { background: #64748b; }
.cal-dia--sel .cal-pt { background: #ffffff; }

.cal-eventos {
  margin-top: 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px;
}
.cal-eventos__head {
  display: flex; align-items: center; gap: 6px;
  font-weight: 700;
  color: #0f172a;
  padding: 4px 4px 10px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 8px;
  text-transform: capitalize;
}
.cal-evento {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 10px;
  background: transparent;
  border: none;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.cal-evento:hover { background: #f8fafc; }
.cal-evento__titulo { flex: 1; font-weight: 600; color: #0f172a; }

/* ============================================================
   Pacientes (lista)
   ============================================================ */
.pac-row {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.pac-row:hover { border-color: #c4b5fd; background: #faf5ff; }
.pac-row__avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.pac-row__avatar-img { width: 100%; height: 100%; object-fit: cover; }
.pac-row__txt { flex: 1; min-width: 0; text-align: left; }
.pac-row__nombre {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
}
.pac-row__sub {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}

/* ============================================================
   Editor paciente
   ============================================================ */
.avatar-edit {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 4px;
}
.avatar-edit__big {
  width: 110px; height: 110px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #ffffff;
  margin-bottom: 12px;
  box-shadow: 0 12px 28px -12px rgba(15,23,42,0.35);
  overflow: hidden;
  position: relative;
}
.avatar-edit__big img { width: 100%; height: 100%; object-fit: cover; }
.avatar-edit__btns { display: flex; gap: 8px; }
.btn-mini {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  border: none;
  cursor: pointer;
  transition: background .12s ease;
}
.btn-mini:hover { background: #e2e8f0; }
.btn-mini:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-mini--rojo { background: #fef2f2; color: #b91c1c; }
.btn-mini--rojo:hover { background: #fee2e2; }

.color-picker {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px;
}
.color-opt {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #ffffff;
  transition: transform .08s ease;
}
.color-opt:active { transform: scale(0.9); }
.color-opt--activo { border-color: #0f172a; box-shadow: 0 0 0 2px #ffffff inset; }

.icon-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px;
}
.icon-opt {
  aspect-ratio: 1;
  border-radius: 10px;
  background: #f8fafc;
  border: 1.5px solid transparent;
  display: flex; align-items: center; justify-content: center;
  color: #475569;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.icon-opt:hover { background: #ede9fe; color: #6d28d9; }
.icon-opt--activo { background: #ede9fe; border-color: #7c3aed; color: #6d28d9; }

/* Variantes del confirm sheet */
.sheet__icono--violeta { background: #f5f3ff; color: #6d28d9; }
.sheet__icono--rojo    { background: #fef2f2; color: #b91c1c; }
.btn-sheet--primario {
  background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  color: #ffffff;
}
.btn-sheet--primario:hover { filter: brightness(1.05); }
.bg-warning { background: #f59e0b; }
.bg-primary { background: linear-gradient(90deg, #7c3aed, #06b6d4); }
