/* ========================================================= */
/* MEMORIAVIVA MOBILE & TABLET COMPREHENSIVE STYLES (V4.2)   */
/* Diseñado exclusivamente para ergonomía táctil y pulgar    */
/* ========================================================= */

:root {
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --color-bg: #0F172A;
  --color-surface: #1E293B;
  --color-surface-card: #1E293B;
  --color-surface-hover: #334155;
  --color-border: #334155;

  --color-primary: #0D9488;
  --color-primary-glow: rgba(13, 148, 136, 0.4);
  --color-accent: #10B981;
  --color-gold: #F59E0B;
  --color-danger: #EF4444;

  --color-text-main: #F8FAFC;
  --color-text-muted: #94A3B8;
  --color-text-bright: #FFFFFF;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset y Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body.mobile-body {
  font-family: var(--font-base);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Header Móvil Superior */
.mobile-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + var(--safe-top)) 16px 10px 16px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.mobile-logo-img {
  height: 36px;
  width: auto;
}

.mobile-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-marco-directo {
  background: linear-gradient(135deg, #10B981, #0D9488);
  color: #FFFFFF;
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transition: transform 0.15s;
}

.btn-marco-directo:active {
  transform: scale(0.95);
}

.btn-desktop-switch {
  background: rgba(255, 255, 255, 0.1);
  color: #94A3B8;
  border: 1px solid var(--color-border);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
}

/* PWA Install Banner */
.pwa-install-banner {
  background: linear-gradient(135deg, #1E293B, #0F172A);
  border-bottom: 1px solid var(--color-primary);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-icon { font-size: 1.5rem; }
.pwa-text strong { font-size: 0.88rem; color: #FFFFFF; }
.pwa-text p { font-size: 0.75rem; color: #94A3B8; }

.pwa-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-pwa-install {
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
}

.btn-pwa-close {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 1rem;
  padding: 4px;
}

/* Contenedor Principal de Vistas */
.mobile-main-views {
  flex: 1;
  padding: 14px 14px calc(80px + var(--safe-bottom)) 14px;
  display: flex;
  flex-direction: column;
}

.mobile-view {
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: fadeInView 0.22s ease-out;
}

.mobile-view.active {
  display: flex;
}

@keyframes fadeInView {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header-sticky {
  margin-bottom: 2px;
}

.view-header-sticky h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: #FFFFFF;
}

.view-header-sticky p {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.btn-add-pill-action {
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

/* Segmented Subview Switcher (Recuerdos) */
.segmented-nav-tabs {
  display: flex;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  margin-bottom: 12px;
}

.subview-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #94A3B8;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.subview-tab-btn.active {
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.subview-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.subview-panel.active {
  display: flex;
}

/* Tarjetas Táctiles Generales */
.card-orientation-mobile,
.card-patient-summary,
.card-medication-alert,
.card-biografo-chat-mobile,
.card-emergency-quick,
.card-mood-logger,
.settings-section-card,
.camera-mobile-wrapper {
  background: var(--color-surface-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Tarjeta de Orientación Temporal */
.card-orientation-mobile {
  background: linear-gradient(135deg, #1E293B, #0F172A);
  border: 1px solid #334155;
  text-align: center;
}

.orientation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.day-highlight {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-gold);
  letter-spacing: 1px;
}

.date-highlight {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.clock-display {
  font-family: var(--font-display);
  font-size: 3.8rem;
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1;
  margin: 4px 0 10px 0;
  letter-spacing: -2px;
}

.moment-pill {
  display: inline-flex;
  background: rgba(13, 148, 136, 0.2);
  border: 1px solid rgba(13, 148, 136, 0.4);
  color: #2DD4BF;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 700;
}

/* Tarjeta Resumen Paciente */
.card-patient-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.patient-avatar-box {
  width: 52px;
  height: 52px;
  background: rgba(245, 158, 11, 0.15);
  border: 2px solid var(--color-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.patient-emoji { font-size: 1.8rem; }
.patient-details h3 { font-family: var(--font-display); font-size: 1.1rem; color: #FFFFFF; }
.patient-details p { font-size: 0.8rem; color: var(--color-text-muted); }

.badge-calm {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-top: 4px;
}

/* Tarjeta Medicación Rápida */
.card-medication-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 4px solid var(--color-gold);
}

.med-alert-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.med-icon { font-size: 1.6rem; }
.med-alert-header strong { font-size: 0.88rem; color: #FFFFFF; }
.med-alert-header p { font-size: 0.76rem; color: var(--color-text-muted); }

.btn-med-check {
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.btn-med-check.checked { background: #059669; }

/* ============================================== */
/* CHAT INTERACTIVO DEL BIÓGRAFO IA MULTI-API     */
/* ============================================== */
.card-biografo-chat-mobile {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: #FFFFFF;
}

.ai-status-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
}

.ai-vault-tag {
  font-size: 0.72rem;
  background: rgba(56, 189, 248, 0.15);
  color: #38BDF8;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.quick-pills-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.quick-pills-row::-webkit-scrollbar { display: none; }

.btn-quick-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--color-border);
  color: #CBD5E1;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-messages-scroll {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 0;
}

.chat-msg {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: 90%;
}

.bot-msg {
  background: #1E293B;
  border: 1px solid #334155;
  color: #F8FAFC;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.user-msg {
  background: var(--color-primary);
  color: #FFFFFF;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.btn-msg-speak {
  background: transparent;
  border: none;
  color: #38BDF8;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
  display: block;
}

.chat-input-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.btn-mic-stt {
  width: 44px;
  height: 44px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--color-accent);
  color: #FFFFFF;
  border-radius: var(--radius-md);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-mic-stt.listening {
  background: #EF4444;
  animation: pulseBadge 1s infinite;
}

.chat-input-text {
  flex: 1;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: #FFFFFF;
  padding: 0 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.btn-chat-send {
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* Tarjeta Emergencia */
.card-emergency-quick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.emergency-info strong { font-size: 0.88rem; color: #F87171; }
.emergency-info p { font-size: 0.76rem; color: var(--color-text-muted); }

.btn-call-emergency {
  background: #EF4444;
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: var(--radius-full);
}

/* ============================================== */
/* VISTA 2: FAMILIA DIRECTORY                     */
/* ============================================== */
.filter-pills-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0 4px 0;
  -webkit-overflow-scrolling: touch;
}

.filter-pills-scroll::-webkit-scrollbar { display: none; }

.filter-pill {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.filter-pill.active {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
}

.family-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mob-family-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mob-family-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-primary);
  flex-shrink: 0;
}

.mob-family-info { flex: 1; }
.mob-family-info h4 { font-family: var(--font-display); font-size: 0.98rem; color: #FFFFFF; }
.mob-family-relation { font-size: 0.78rem; color: var(--color-primary); font-weight: 600; }
.mob-family-note { font-size: 0.75rem; color: var(--color-text-muted); }

.mob-family-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.btn-mob-voice, .btn-mob-call {
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
}

.btn-mob-voice { background: rgba(16, 185, 129, 0.2); color: #34D399; }
.btn-mob-call { background: rgba(59, 130, 246, 0.2); color: #60A5FA; text-decoration: none; }

/* ============================================== */
/* VISTA 3: RECUERDOS (TIMELINE & DOCS & CÁMARA)  */
/* ============================================== */
.mobile-timeline-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mob-timeline-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.mob-timeline-img-box {
  position: relative;
  height: 160px;
  background: #000;
}

.mob-timeline-img-box img, .mob-timeline-img-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mob-timeline-year-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--color-gold);
  color: #0F172A;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.85rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.mob-timeline-card-body {
  padding: 12px;
}

.mob-timeline-card-body h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.mob-timeline-card-body p {
  font-size: 0.82rem;
  color: #CBD5E1;
  line-height: 1.35;
  margin-bottom: 10px;
}

/* Documentos Feed */
.mobile-docs-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mob-doc-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mob-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mob-doc-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mob-doc-type-badge {
  font-size: 0.72rem;
  background: rgba(13, 148, 136, 0.2);
  color: #2DD4BF;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.btn-mob-delete-item,
.btn-mob-edit-item {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-mob-delete-item {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #F87171;
}

.btn-mob-delete-item:active {
  background: #EF4444;
  color: #FFFFFF;
}

.btn-mob-edit-item {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60A5FA;
}

.btn-mob-edit-item:active {
  background: #3B82F6;
  color: #FFFFFF;
}

.mob-doc-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #FFFFFF;
}

.mob-doc-desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.mob-doc-player-box audio, .mob-doc-player-box video {
  width: 100%;
  margin-top: 6px;
  border-radius: var(--radius-sm);
}

.mob-doc-img-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-top: 6px;
}

/* Estados de Botones en Reproducción Activa */
.btn-msg-speak.speaking,
.btn-mob-voice.speaking,
.btn-narrate-milestone.speaking,
.btn-play-single-story.speaking,
.btn-test-voice-mob.speaking,
.btn-frame-voice-huge.speaking {
  background: #EF4444 !important;
  color: #FFFFFF !important;
  border-color: #EF4444 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.6) !important;
  animation: pulseSpeech 1.2s infinite;
}

@keyframes pulseSpeech {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.98); }
}

.ocr-transcript-box {
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid var(--color-gold);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #FCD34D;
  font-style: italic;
}

/* Cámara Viewfinder */
.viewfinder-box {
  position: relative;
  height: 260px;
  background: #000000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.viewfinder-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.face-target-frame {
  position: absolute;
  width: 160px;
  height: 190px;
  border: 1.5px dashed rgba(56, 189, 248, 0.6);
  border-radius: 20px;
  pointer-events: none;
}

.scan-laser-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #38BDF8;
  box-shadow: 0 0 10px #38BDF8;
  animation: scanLaser 2s infinite ease-in-out;
}

@keyframes scanLaser {
  0%, 100% { top: 0; }
  50% { top: 100%; }
}

.scan-status-pill {
  position: absolute;
  bottom: 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  color: #38BDF8;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.face-match-result-card {
  margin-top: 14px;
  background: rgba(16, 185, 129, 0.15);
  border: 1.5px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.face-match-result-card img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-accent);
}

.badge-match {
  font-size: 0.7rem;
  background: #10B981;
  color: #FFFFFF;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 800;
}

/* ============================================== */
/* VISTA 4: RELATOS & RADIO PLAYER                */
/* ============================================== */
.relatos-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-pautas-sheet {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.mobile-radio-player {
  background: linear-gradient(135deg, #1E293B, #0F172A);
  border: 1.5px solid var(--color-gold);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 800;
}

.live-pulse {
  color: #EF4444;
  animation: pulseBadge 1.5s infinite;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.radio-frequency { color: #93C5FD; }

.radio-track-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-radio-action {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--color-border);
  color: #FFFFFF;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-radio-play-master {
  flex: 1;
  background: var(--color-gold);
  color: #0F172A;
  border: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.88rem;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.stories-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mob-story-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.mob-story-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.mob-story-narrator { font-size: 0.78rem; color: var(--color-primary); font-weight: 700; }

.mob-story-type-badge {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: #94A3B8;
}

.mob-story-title { font-family: var(--font-display); font-size: 1rem; color: #FFFFFF; margin-bottom: 6px; }
.mob-story-excerpt { font-size: 0.82rem; color: #CBD5E1; line-height: 1.35; margin-bottom: 10px; }

.btn-play-single-story {
  width: 100%;
  background: rgba(13, 148, 136, 0.2);
  border: 1px solid var(--color-primary);
  color: #2DD4BF;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.fab-create-story {
  position: fixed;
  bottom: calc(75px + var(--safe-bottom));
  right: 16px;
  left: 16px;
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  border: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 14px;
  border-radius: var(--radius-full);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

/* ============================================== */
/* VISTA 5: PASTILLERO & CUIDADOS                */
/* ============================================== */
.pillbox-mobile-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mob-pill-slot {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mob-pill-time {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-gold);
}

.mob-pill-name { font-size: 0.88rem; color: #FFFFFF; margin-top: 2px; }
.mob-pill-desc { font-size: 0.75rem; color: var(--color-text-muted); }

.btn-pill-check-slot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--color-border);
  color: transparent;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-pill-check-slot.checked {
  background: #10B981;
  border-color: #10B981;
  color: #FFFFFF;
}

.mood-emojis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.btn-mood-emoji {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.btn-mood-emoji .emoji { font-size: 1.6rem; }
.btn-mood-emoji span:last-child { font-size: 0.68rem; color: var(--color-text-muted); }

.btn-mood-emoji.active {
  border-color: var(--color-primary);
  background: rgba(13, 148, 136, 0.15);
}

.mob-textarea {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.85rem;
  min-height: 80px;
  resize: none;
}

.saved-notes-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.saved-note-item {
  background: rgba(0, 0, 0, 0.25);
  border-left: 3px solid var(--color-primary);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #CBD5E1;
}

/* ============================================== */
/* VISTA 6: AJUSTES & VOCES                      */
/* ============================================== */
.settings-section-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #FFFFFF;
  margin-bottom: 2px;
}

.section-desc { font-size: 0.78rem; color: var(--color-text-muted); margin-bottom: 12px; }

.voices-mobile-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mob-voice-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mob-voice-card.active-master {
  border-color: var(--color-gold);
  background: rgba(245, 158, 11, 0.08);
}

.mob-voice-details h4 { font-size: 0.88rem; color: #FFFFFF; }
.mob-voice-details p { font-size: 0.74rem; color: var(--color-text-muted); }

.mob-voice-actions { display: flex; gap: 6px; }

.btn-test-voice-mob {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--color-border);
  color: #FFFFFF;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-set-master-mob {
  background: var(--color-primary);
  border: none;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.setting-toggle-row:last-child { border-bottom: none; }
.mob-toggle { width: 40px; height: 22px; accent-color: var(--color-primary); cursor: pointer; }

/* ============================================== */
/* MARCO DE RECUERDOS MÓVIL A PANTALLA COMPLETA   */
/* ============================================== */
.mobile-patient-frame {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: #020617;
  display: flex;
  flex-direction: column;
  padding: calc(10px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)) 16px;
  overflow: hidden;
}

.frame-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.btn-frame-exit, .btn-frame-ambient {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.frame-slide-indicator { font-size: 0.8rem; color: #94A3B8; font-weight: 600; }

.frame-clock-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #334155;
  border-radius: var(--radius-lg);
  text-align: center;
  padding: 10px;
  margin-bottom: 10px;
}

.frame-day-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-gold);
}

.frame-time-huge {
  font-family: var(--font-display);
  font-size: 3.8rem;
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1;
  margin: 2px 0;
}

.frame-moment-text { font-size: 0.85rem; color: #38BDF8; font-weight: 600; }

.frame-media-stage {
  flex: 1;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame-media-stage img { width: 100%; height: 100%; object-fit: cover; }

.frame-caption-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.92) 25%);
  padding: 24px 16px 14px 16px;
}

.frame-caption-overlay h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.frame-caption-overlay p {
  font-size: 0.88rem;
  color: #E2E8F0;
  line-height: 1.35;
}

.frame-bottom-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-frame-nav {
  flex: 1;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-frame-voice-huge {
  flex: 2;
  background: linear-gradient(135deg, #10B981, #059669);
  border: none;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.98rem;
  padding: 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* ============================================== */
/* BOTTOM SHEET MODAL (NATIVO DESLIZABLE)         */
/* ============================================== */
.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
}

.bottom-sheet {
  width: 100%;
  max-height: 88vh;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-radius: 24px 24px 0 0;
  padding: 12px 18px calc(24px + var(--safe-bottom)) 18px;
  overflow-y: auto;
  animation: slideUpSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.bottom-sheet-drag-handle {
  width: 40px;
  height: 4px;
  background: #64748B;
  border-radius: var(--radius-full);
  margin: 0 auto 12px auto;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.bottom-sheet-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #FFFFFF;
}

.btn-sheet-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #94A3B8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

/* ============================================== */
/* BARRA INFERIOR DE NAVEGACIÓN (BOTTOM TAB BAR)  */
/* ============================================== */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: #64748B;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 6px 8px;
  transition: all 0.15s ease;
  flex: 1;
}

.nav-tab-btn .tab-icon {
  font-size: 1.3rem;
  transition: transform 0.15s;
}

.nav-tab-btn .tab-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav-tab-btn.active {
  color: #2DD4BF;
}

.nav-tab-btn.active .tab-icon {
  transform: translateY(-2px);
}

/* Toast */
.mobile-toast {
  position: fixed;
  top: calc(70px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  background: #0F172A;
  border: 1px solid var(--color-primary);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  animation: fadeInToast 0.2s ease;
}

@keyframes fadeInToast {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Botones Comunes */
.btn {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  text-align: center;
}

.btn-primary { background: var(--color-primary); color: #FFFFFF; }
.btn-accent { background: var(--color-accent); color: #FFFFFF; }
.btn-secondary { background: #334155; color: #FFFFFF; }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: #FFFFFF; }
.btn-block { width: 100%; }

/* Form Controls */
.mob-form-input, .mob-form-select {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: #FFFFFF;
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  margin-top: 4px;
}

/* ============================================== */
/* MODOS DE ACCESIBILIDAD VISUAL (TEXTO & CONTRASTE) */
/* ============================================== */
body.big-text {
  font-size: 1.15rem !important;
}

body.big-text .day-highlight { font-size: 1.4rem !important; }
body.big-text .clock-display { font-size: 4.8rem !important; }
body.big-text .moment-pill { font-size: 1.05rem !important; }
body.big-text .view-header-sticky h2 { font-size: 1.65rem !important; }
body.big-text .mob-family-info h4,
body.big-text .mob-timeline-card-body h4,
body.big-text .mob-doc-title,
body.big-text .mob-story-title { font-size: 1.25rem !important; }
body.big-text .mob-family-note,
body.big-text .mob-timeline-card-body p,
body.big-text .mob-doc-desc,
body.big-text .mob-story-excerpt { font-size: 0.98rem !important; }
body.big-text .chat-msg { font-size: 1.05rem !important; line-height: 1.5 !important; }
body.big-text .btn,
body.big-text .btn-play-single-story,
body.big-text .btn-narrate-milestone { font-size: 1.05rem !important; padding: 14px !important; }
body.big-text .nav-tab-btn .tab-label { font-size: 0.8rem !important; font-weight: 800 !important; }

body.high-contrast {
  background-color: #000000 !important;
  color: #FFFFFF !important;
}

body.high-contrast .mobile-header,
body.high-contrast .mobile-bottom-nav {
  background: #000000 !important;
  border-color: #F59E0B !important;
  border-width: 2px !important;
}

body.high-contrast .card-orientation-mobile,
body.high-contrast .card-patient-summary,
body.high-contrast .card-medication-alert,
body.high-contrast .card-biografo-chat-mobile,
body.high-contrast .card-emergency-quick,
body.high-contrast .card-mood-logger,
body.high-contrast .settings-section-card,
body.high-contrast .mob-family-card,
body.high-contrast .mob-timeline-card,
body.high-contrast .mob-doc-card,
body.high-contrast .mob-story-card,
body.high-contrast .mob-pill-slot,
body.high-contrast .bottom-sheet {
  background: #000000 !important;
  border: 2px solid #F59E0B !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3) !important;
}

body.high-contrast .bot-msg {
  background: #111111 !important;
  border: 2px solid #38BDF8 !important;
  color: #FFFFFF !important;
}

body.high-contrast .user-msg {
  background: #0D9488 !important;
  border: 2px solid #FFFFFF !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
}

body.high-contrast .btn,
body.high-contrast .btn-marco-directo,
body.high-contrast .btn-play-single-story,
body.high-contrast .btn-quick-pill {
  border: 2px solid #FFFFFF !important;
  font-weight: 900 !important;
}

body.high-contrast .nav-tab-btn.active {
  color: #F59E0B !important;
}

/* ============================================== */
/* MODO CLARO (LIGHT THEME)                       */
/* ============================================== */
body.light-theme {
  background-color: #F1F5F9 !important;
  color: #0F172A !important;
}

body.light-theme .mobile-header {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid #E2E8F0 !important;
}

body.light-theme .btn-desktop-switch {
  background: #E2E8F0 !important;
  color: #475569 !important;
  border-color: #CBD5E1 !important;
}

body.light-theme .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.97) !important;
  border-top: 1px solid #E2E8F0 !important;
}

body.light-theme .nav-tab-btn {
  color: #64748B !important;
}

body.light-theme .nav-tab-btn.active {
  color: #0D9488 !important;
}

body.light-theme .card-orientation-mobile {
  background: linear-gradient(135deg, #FFFFFF, #F8FAFC) !important;
  border: 1px solid #E2E8F0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .clock-display {
  color: #0F172A !important;
}

body.light-theme .card-patient-summary,
body.light-theme .card-medication-alert,
body.light-theme .card-biografo-chat-mobile,
body.light-theme .card-mood-logger,
body.light-theme .settings-section-card,
body.light-theme .camera-mobile-wrapper,
body.light-theme .mob-family-card,
body.light-theme .mob-timeline-card,
body.light-theme .mob-doc-card,
body.light-theme .mob-story-card,
body.light-theme .mob-pill-slot,
body.light-theme .bottom-sheet {
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05) !important;
  color: #0F172A !important;
}

body.light-theme .view-header-sticky h2,
body.light-theme .patient-details h3,
body.light-theme .med-alert-header strong,
body.light-theme .chat-header-row,
body.light-theme .mob-family-info h4,
body.light-theme .mob-timeline-card-body h4,
body.light-theme .mob-doc-title,
body.light-theme .mob-story-title,
body.light-theme .mob-pill-name,
body.light-theme .settings-section-card h3,
body.light-theme .bottom-sheet-header h3 {
  color: #0F172A !important;
}

body.light-theme .view-header-sticky p,
body.light-theme .patient-details p,
body.light-theme .med-alert-header p,
body.light-theme .mob-family-note,
body.light-theme .mob-timeline-card-body p,
body.light-theme .mob-doc-desc,
body.light-theme .mob-story-excerpt,
body.light-theme .mob-pill-desc,
body.light-theme .section-desc {
  color: #475569 !important;
}

body.light-theme .bot-msg {
  background: #F1F5F9 !important;
  border: 1px solid #E2E8F0 !important;
  color: #0F172A !important;
}

body.light-theme .chat-input-text,
body.light-theme .mob-form-input,
body.light-theme .mob-form-select,
body.light-theme .mob-textarea {
  background: #F8FAFC !important;
  border: 1.5px solid #CBD5E1 !important;
  color: #0F172A !important;
}

body.light-theme .btn-quick-pill,
body.light-theme .filter-pill {
  background: #F1F5F9 !important;
  border: 1px solid #E2E8F0 !important;
  color: #334155 !important;
}

body.light-theme .filter-pill.active {
  background: #0D9488 !important;
  color: #FFFFFF !important;
  border-color: #0D9488 !important;
}

body.light-theme .segmented-nav-tabs {
  background: #E2E8F0 !important;
  border-color: #CBD5E1 !important;
}

body.light-theme .subview-tab-btn {
  color: #475569 !important;
}

body.light-theme .subview-tab-btn.active {
  background: #0D9488 !important;
  color: #FFFFFF !important;
}

body.light-theme .mobile-radio-player {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7) !important;
  border-color: #F59E0B !important;
}

body.light-theme .radio-track-title {
  color: #78350F !important;
}

body.light-theme .btn-radio-action {
  background: #FFFFFF !important;
  border-color: #FDE68A !important;
  color: #78350F !important;
}

body.light-theme .saved-note-item,
body.light-theme .ocr-transcript-box {
  background: #F8FAFC !important;
  border-color: #0D9488 !important;
  color: #1E293B !important;
}

body.light-theme .btn-mood-emoji {
  background: #F8FAFC !important;
  border-color: #E2E8F0 !important;
}

body.light-theme .btn-mood-emoji.active {
  background: rgba(13, 148, 136, 0.12) !important;
  border-color: #0D9488 !important;
}

body.light-theme .mob-voice-card {
  background: #F8FAFC !important;
  border-color: #E2E8F0 !important;
}

body.light-theme .mob-voice-details h4 {
  color: #0F172A !important;
}

/* ========================================================= */
/* PANTALLA DE LOGIN DE CLIENTE / FAMILIAS (MÓVIL)           */
/* ========================================================= */
.client-login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, #1E293B 0%, #0F172A 100%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.client-login-card {
  background: #1E293B;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  text-align: center;
}

.client-login-logo {
  height: 48px;
  margin-bottom: 12px;
}

.client-login-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: #FFFFFF;
  margin-bottom: 4px;
}

.client-login-subtitle {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.client-login-badge {
  display: inline-block;
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 20px;
}

.client-login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.client-login-form label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #E2E8F0;
}

.client-login-input {
  width: 100%;
  padding: 12px 14px;
  background: #0B1120;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: #FFFFFF;
  font-family: var(--font-base);
  font-size: 0.95rem;
  outline: none;
}

.client-login-input:focus {
  border-color: var(--color-primary);
}

.client-login-error {
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
  border: 1px solid #EF4444;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  text-align: center;
  margin-top: 4px;
}

/* Tarjeta de Cuenta de Usuario en Ajustes */
.account-profile-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
}

.account-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.account-profile-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
  color: #CBD5E1;
}

.account-profile-row strong {
  color: #FFFFFF;
}

.btn-client-logout {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  width: 100%;
  cursor: pointer;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}



