/* ==========================================================================
   PsicoEquidad · Espacio entre sesiones
   Paleta estricta:
   - Fondo: #FFFFFF y #F6F3EE
   - Contenedores: #EFEAE1 y #FFFFFF con bordes #E2DCD0
   - Acento: #7A917B (hover #5D735E)
   - Texto: #1A1A1A y #59554E
   ========================================================================== */

:root {
  --bg-page: #F6F3EE;
  --bg-white: #FFFFFF;
  --bg-sand: #EFEAE1;
  --border-subtle: #E2DCD0;
  --border-strong: #D3CBB9;

  --sage: #7A917B;
  --sage-dark: #5D735E;
  --sage-soft: rgba(122, 145, 123, 0.12);
  --sage-soft-hover: rgba(122, 145, 123, 0.2);

  --text-main: #1A1A1A;
  --text-secondary: #59554E;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow-card: 0 2px 12px rgba(26, 26, 26, 0.035), 0 1px 2px rgba(26, 26, 26, 0.02);
  --shadow-float: 0 12px 32px rgba(26, 26, 26, 0.09), 0 2px 6px rgba(26, 26, 26, 0.04);

  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ease-calm: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html.font-large {
  font-size: 19.5px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2.5px solid var(--sage);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Cabecera Superior (Sticky y Serena)
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: rgba(246, 243, 238, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 740px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brand-emblem {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: var(--bg-sand);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.font-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-white);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.font-toggle-btn:hover {
  background-color: var(--bg-sand);
  border-color: var(--border-strong);
}

.font-toggle-btn[aria-pressed="true"] {
  background-color: var(--sage);
  border-color: var(--sage);
  color: var(--bg-white);
}

.font-toggle-icon {
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ==========================================================================
   Aviso discreto PWA ("Agregar a pantalla de inicio")
   ========================================================================== */
.pwa-banner {
  max-width: 740px;
  width: calc(100% - 2rem);
  margin: 0.85rem auto 0;
  padding: 0.75rem 1rem;
  background-color: var(--bg-sand);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.pwa-banner-content svg {
  flex-shrink: 0;
  color: var(--sage-dark);
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.pwa-link-btn {
  background: var(--bg-white);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius-pill);
  min-height: 36px;
  transition: background-color 0.2s ease;
}

.pwa-link-btn:hover {
  background-color: var(--sage-soft);
}

.icon-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-close-btn:hover {
  background-color: rgba(26, 26, 26, 0.06);
  color: var(--text-main);
}

/* ==========================================================================
   Contenedor Principal (Vista Paciente)
   ========================================================================== */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 740px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* Tarjeta Hero / Resumen de Tareas Faltantes */
.hero-card {
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.hero-copy {
  flex: 1;
  min-width: 0;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-pill);
  background-color: var(--bg-sand);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  margin-bottom: 0.55rem;
}

.mode-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--sage);
}

.hero-greeting {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text-main);
}

.hero-remaining {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.hero-remaining strong {
  color: var(--sage-dark);
  font-weight: 700;
}

/* Anillo de Progreso SVG */
.progress-ring-wrap {
  position: relative;
  width: 82px;
  height: 82px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring-svg {
  width: 82px;
  height: 82px;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--bg-sand);
  stroke-width: 7;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--sage);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s var(--ease-calm);
}

.progress-ring-label {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.progress-ring-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.progress-ring-sub {
  font-size: 0.66rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Barra lineal complementaria */
.progress-bar-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-sand);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 1.15rem;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--sage);
  border-radius: var(--radius-pill);
  width: 0%;
  transition: width 0.55s var(--ease-calm);
}

/* Nota del psicólogo y próxima sesión */
.therapist-note-box {
  margin-top: 1.1rem;
  padding: 0.9rem 1rem;
  background-color: var(--bg-page);
  border-left: 3px solid var(--sage);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.92rem;
  color: var(--text-main);
}

.therapist-note-author {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.hero-meta-row {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.next-session-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.next-session-badge strong {
  color: var(--text-main);
  font-weight: 600;
}

.days-chip {
  padding: 0.16rem 0.55rem;
  border-radius: var(--radius-pill);
  background-color: var(--sage-soft);
  color: var(--sage-dark);
  font-size: 0.76rem;
  font-weight: 600;
}

/* ==========================================================================
   Botones del Sistema de Diseño
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.14s ease, box-shadow 0.2s ease;
  line-height: 1.25;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background-color: var(--sage);
  color: var(--bg-white);
  border-color: var(--sage);
}

.btn-primary:hover {
  background-color: var(--sage-dark);
  border-color: var(--sage-dark);
}

.btn-secondary {
  background-color: var(--bg-white);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background-color: var(--bg-sand);
  border-color: var(--border-strong);
}

.btn-sand {
  background-color: var(--bg-sand);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-sand:hover {
  background-color: #E6DFD2;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: rgba(26, 26, 26, 0.05);
  color: var(--text-main);
}

.btn-sm {
  min-height: 38px;
  padding: 0.42rem 0.85rem;
  font-size: 0.84rem;
}

.btn-full {
  width: 100%;
}

/* ==========================================================================
   Barra de Filtros y Acciones Rápidas
   ========================================================================== */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filter-tabs {
  display: inline-flex;
  background-color: var(--bg-sand);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 4px;
  gap: 2px;
  max-width: 100%;
  overflow-x: auto;
}

.filter-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  min-height: 36px;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.filter-tab:hover {
  color: var(--text-main);
}

.filter-tab.active {
  background-color: var(--bg-white);
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(26, 26, 26, 0.07);
}

/* ==========================================================================
   Lista y Tarjetas de Tareas Terapéuticas
   ========================================================================== */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.task-card {
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.task-card.is-open {
  border-color: var(--sage);
  box-shadow: 0 6px 24px rgba(26, 26, 26, 0.055);
}

.task-card.is-completed {
  background-color: #FCFBF9;
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.15rem 1.2rem;
  cursor: pointer;
  user-select: none;
}

.task-card-header:hover {
  background-color: rgba(239, 234, 225, 0.32);
}

.task-check-btn {
  width: 28px;
  height: 28px;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background-color: var(--bg-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
  transition: background-color 0.25s var(--ease-calm), border-color 0.25s ease, transform 0.25s var(--ease-calm), color 0.2s ease;
}

.task-check-btn:hover {
  border-color: var(--sage);
  background-color: var(--sage-soft);
}

.task-check-btn.checked {
  background-color: var(--sage);
  border-color: var(--sage);
  color: var(--bg-white);
  animation: checkPop 0.36s var(--ease-calm);
}

@keyframes checkPop {
  0% { transform: scale(0.82); }
  50% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

.task-header-main {
  flex: 1;
  min-width: 0;
}

.task-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.task-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.58rem;
  border-radius: var(--radius-pill);
  background-color: var(--bg-sand);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
}

.task-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.14rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
}

.task-status-pill.done {
  background-color: var(--sage-soft);
  color: var(--sage-dark);
}

.task-status-pill.pending {
  background-color: var(--bg-page);
  color: var(--text-secondary);
}

.task-title {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 650;
  color: var(--text-main);
  line-height: 1.35;
}

.task-card.is-completed .task-title {
  color: var(--text-secondary);
}

.task-meta {
  margin-top: 0.3rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.task-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.task-chevron {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform 0.28s var(--ease-calm), background-color 0.2s ease;
}

.task-card.is-open .task-chevron {
  transform: rotate(180deg);
  background-color: var(--bg-sand);
  color: var(--text-main);
}

/* Cuerpo Interactivo Expandido de la Tarea */
.task-body {
  padding: 0 1.2rem 1.3rem;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-white);
  animation: fadeSlideIn 0.26s var(--ease-calm);
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.task-description {
  margin: 1rem 0 1.15rem;
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* Formularios dentro de las tareas */
.field-group {
  margin-bottom: 1rem;
}

.field-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.38rem;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.input, .textarea, .select {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-page);
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--sage);
  background-color: var(--bg-white);
  box-shadow: 0 0 0 3px var(--sage-soft);
}

.textarea {
  resize: vertical;
  min-height: 92px;
}

.textarea-journal {
  min-height: 138px;
}

.field-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.autosave-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--sage-dark);
  font-size: 0.78rem;
  font-weight: 500;
}

/* Chips de emociones sugeridas (TCC) */
.emotion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.chip-btn {
  padding: 0.28rem 0.68rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-white);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  border-color: var(--sage);
  color: var(--text-main);
}

.chip-btn.selected {
  background-color: var(--sage);
  border-color: var(--sage);
  color: var(--bg-white);
}

/* Deslizador de intensidad 1-10 */
.intensity-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 0.45rem;
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.9rem;
}

.intensity-slider {
  flex: 1;
  accent-color: var(--sage);
  height: 6px;
  cursor: pointer;
}

.intensity-value {
  min-width: 52px;
  text-align: center;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-pill);
  background-color: var(--sage);
  color: var(--bg-white);
  font-weight: 700;
  font-size: 0.86rem;
}

/* Registros TCC guardados */
.cbt-history {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-subtle);
}

.cbt-history-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 0.65rem;
}

.cbt-entry-card {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.6rem;
  font-size: 0.88rem;
}

.cbt-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.cbt-entry-line {
  margin: 0.22rem 0;
}

.cbt-entry-line strong {
  color: var(--text-main);
}

/* Selector visual de estado de ánimo (5 iconos minimalistas) */
.mood-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
}

.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.6rem 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-page);
  color: var(--text-secondary);
  transition: all 0.2s ease;
  min-height: 68px;
}

.mood-btn:hover {
  border-color: var(--sage);
  background-color: var(--bg-white);
  color: var(--text-main);
}

.mood-btn.selected {
  background-color: var(--sage-soft);
  border-color: var(--sage);
  color: var(--sage-dark);
  box-shadow: inset 0 0 0 1px var(--sage);
}

.mood-btn span {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.15;
}

/* Ejercicio Guiado con Temporizador / Respiración Consciente */
.timer-stage {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1rem;
}

.timer-duration-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}

.dur-pill {
  min-height: 36px;
  padding: 0.3rem 0.78rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-white);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.18s ease;
}

.dur-pill.active {
  background-color: var(--sage);
  border-color: var(--sage);
  color: var(--bg-white);
}

.breath-visual-wrap {
  position: relative;
  width: 196px;
  height: 196px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0 1rem;
}

.breath-aura {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background-color: rgba(122, 145, 123, 0.18);
  transform: scale(1);
  transition: transform 0.6s ease-in-out, opacity 0.6s ease;
}

.breath-circle {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background-color: var(--sage);
  color: var(--bg-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 26px rgba(93, 115, 94, 0.22);
  transform: scale(1);
  transition: transform 0.6s ease-in-out, background-color 0.4s ease;
}

.breath-phase-text {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.breath-phase-sec {
  font-size: 0.78rem;
  opacity: 0.9;
  margin-top: 0.1rem;
}

.timer-clock {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.timer-pattern-caption {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.timer-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.timer-sessions-badge {
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--sage-dark);
  font-weight: 600;
}

/* Fila de acciones al final del cuerpo de la tarea */
.task-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.task-action-left, .task-action-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Estado vacío amigable */
.empty-state {
  text-align: center;
  padding: 2.25rem 1.25rem;
  background-color: var(--bg-white);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
}

.empty-state h3 {
  margin: 0.5rem 0 0.3rem;
  color: var(--text-main);
  font-size: 1.05rem;
}

.empty-state p {
  margin: 0;
  font-size: 0.9rem;
}

/* ==========================================================================
   Sección de Cierre y Acciones de Sesión (Paciente)
   ========================================================================== */
.session-actions-card {
  margin-top: 1.75rem;
  background-color: var(--bg-sand);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.session-actions-text h2 {
  margin: 0 0 0.25rem;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-main);
}

.session-actions-text p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.session-actions-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

/* ==========================================================================
   Pie de Página Limpio y Discreto
   ========================================================================== */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-page);
  padding: 1.75rem 1rem 2.25rem;
  text-align: center;
}

.footer-inner {
  max-width: 740px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer-credentials {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.footer-privacy {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.footer-links {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
}

.footer-link-btn {
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.85;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.footer-link-btn:hover {
  opacity: 1;
  color: var(--sage-dark);
}

/* ==========================================================================
   Modales y Bottom Sheets Limpios
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(26, 26, 26, 0.36);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 0.2s ease;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 1.25rem;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
  background-color: var(--bg-white);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-float);
  padding: 1.4rem 1.35rem 1.75rem;
  animation: slideUp 0.28s var(--ease-calm);
}

@media (min-width: 640px) {
  .modal-sheet {
    border-radius: var(--radius-lg);
    padding: 1.65rem;
  }
}

.modal-sheet-wide {
  max-width: 880px;
}

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

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.modal-title {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
}

.modal-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* Previsualización de Resumen WhatsApp */
.summary-preview-box {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.86rem;
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
  color: var(--text-main);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.summary-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

@media (min-width: 520px) {
  .summary-actions-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Instrucciones PWA */
.pwa-steps-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pwa-step-card {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.pwa-step-card h4 {
  margin: 0 0 0.3rem;
  font-size: 0.92rem;
  color: var(--text-main);
}

.pwa-step-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* PIN de Acceso Terapeuta */
.pin-input-wrap {
  max-width: 240px;
  margin: 1rem auto;
  text-align: center;
}

.pin-input {
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.35em;
  font-weight: 700;
  padding: 0.75rem;
}

.error-msg {
  color: #9B3B3B;
  font-size: 0.84rem;
  font-weight: 500;
  margin-top: 0.45rem;
}

/* ==========================================================================
   Modo Terapeuta (Panel de Automatización Integrado)
   ========================================================================== */
.therapist-view {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.therapist-topbar {
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.therapist-topbar h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
}

.therapist-topbar p {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.therapist-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
}

.therapist-tab-btn {
  min-height: 40px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-white);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.18s ease;
}

.therapist-tab-btn.active {
  background-color: var(--sage);
  border-color: var(--sage);
  color: var(--bg-white);
}

.therapist-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 820px) {
  .therapist-grid {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }
}

.panel-card {
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-card);
}

.panel-card-sand {
  background-color: var(--bg-sand);
}

.panel-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.panel-desc {
  margin: 0 0 1.1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 520px) {
  .form-row-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Biblioteca de Plantillas (Tarjetas seleccionables con 1 clic) */
.template-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

@media (min-width: 560px) {
  .template-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.template-card {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.template-card:hover {
  border-color: var(--sage);
  background-color: var(--bg-white);
}

.template-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.template-card h4 {
  margin: 0.3rem 0 0.25rem;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main);
}

.template-card p {
  margin: 0;
  font-size: 0.81rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.template-card-footer .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Tareas seleccionadas en el generador de plan */
.selected-plan-tasks {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 1.15rem;
}

.plan-task-item {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
}

.plan-task-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.plan-task-item-title {
  font-weight: 650;
  font-size: 0.92rem;
  color: var(--text-main);
}

.plan-task-item-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.plan-task-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.mini-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-white);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.mini-icon-btn:hover {
  border-color: var(--sage);
  color: var(--text-main);
}

/* Resultado del Generador: Enlace Mágico + QR */
.magic-output-card {
  margin-top: 1.25rem;
  background-color: var(--bg-white);
  border: 1.5px solid var(--sage);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-card);
  animation: fadeSlideIn 0.3s var(--ease-calm);
}

.magic-output-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: center;
}

@media (min-width: 680px) {
  .magic-output-grid {
    grid-template-columns: 220px 1fr;
  }
}

.qr-frame {
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
}

.qr-svg-box {
  width: 190px;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-svg-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-caption {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.magic-url-box {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  font-size: 0.8rem;
  word-break: break-all;
  max-height: 92px;
  overflow-y: auto;
  color: var(--text-secondary);
  margin: 0.6rem 0 0.95rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.magic-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

/* ==========================================================================
   Toast de Retroalimentación Suave
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(20px);
  z-index: 200;
  background-color: var(--text-main);
  color: var(--bg-white);
  padding: 0.72rem 1.2rem;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s var(--ease-calm);
  max-width: calc(100vw - 2rem);
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Vista de Impresión / Exportación PDF Profesional
   ========================================================================== */
.print-report {
  display: none;
}

@media print {
  body {
    background: #FFFFFF !important;
    color: #1A1A1A !important;
    font-size: 11pt !important;
  }

  .app-header,
  .pwa-banner,
  .app-main,
  .therapist-view,
  .app-footer,
  .modal-backdrop,
  .toast {
    display: none !important;
  }

  .print-report {
    display: block !important;
    padding: 0;
    margin: 0;
    color: #1A1A1A;
  }

  .print-header {
    border-bottom: 2px solid #7A917B;
    padding-bottom: 12pt;
    margin-bottom: 16pt;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12pt;
  }

  .print-header h1 {
    margin: 0 0 3pt;
    font-size: 15pt;
    color: #1A1A1A;
  }

  .print-header p {
    margin: 0;
    font-size: 9.5pt;
    color: #59554E;
  }

  .print-meta-box {
    background: #F6F3EE;
    border: 1px solid #E2DCD0;
    border-radius: 8pt;
    padding: 10pt 12pt;
    margin-bottom: 16pt;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6pt 16pt;
    font-size: 10pt;
  }

  .print-task {
    border: 1px solid #E2DCD0;
    border-radius: 8pt;
    padding: 10pt 12pt;
    margin-bottom: 10pt;
    page-break-inside: avoid;
  }

  .print-task-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8pt;
    margin-bottom: 6pt;
  }

  .print-task-title {
    font-weight: 700;
    font-size: 11pt;
  }

  .print-task-status {
    font-size: 9pt;
    font-weight: 600;
    color: #5D735E;
  }

  .print-task-detail {
    margin: 4pt 0;
    font-size: 10pt;
    color: #1A1A1A;
    white-space: pre-wrap;
  }

  .print-task-muted {
    color: #59554E;
    font-style: italic;
    font-size: 9.5pt;
  }

  .print-footer {
    margin-top: 20pt;
    padding-top: 8pt;
    border-top: 1px solid #E2DCD0;
    font-size: 8.5pt;
    color: #59554E;
    text-align: center;
  }
}

/* Accesibilidad: reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* ==========================================================================
   Recursos Adjuntos (PDFs / Workbooks, Tests Psicométricos y Videos)
   ========================================================================== */
.resource-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.resource-card {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.resource-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.resource-card-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.resource-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background-color: var(--bg-sand);
  border: 1px solid var(--border-subtle);
  color: var(--sage-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.resource-meta {
  min-width: 0;
  flex: 1;
}

.resource-kind-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--sage-dark);
  margin-bottom: 0.1rem;
}

.resource-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 650;
  color: var(--text-main);
  word-break: break-word;
}

.video-embed-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-sand);
}

.video-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Paquetes / Protocolos Rápidos (Modo Terapeuta) */
.bundle-bar {
  margin-bottom: 1.1rem;
  padding: 0.9rem 1rem;
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.bundle-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
}

.bundle-bar-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
}

.bundle-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.bundle-chip-wrap {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  transition: border-color 0.18s ease;
}

.bundle-chip-wrap:hover {
  border-color: var(--sage);
}

.bundle-load-btn {
  border: none;
  background: transparent;
  padding: 0.36rem 0.78rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  min-height: 34px;
}

.bundle-load-btn:hover {
  background-color: var(--sage-soft);
  color: var(--sage-dark);
}

.bundle-del-btn {
  border: none;
  border-left: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  padding: 0 0.55rem;
  min-height: 34px;
  font-size: 0.85rem;
}

.bundle-del-btn:hover {
  background-color: var(--bg-sand);
  color: var(--text-main);
}

/* Sub-pestañas del selector rápido del terapeuta */
.picker-subtabs {
  display: inline-flex;
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
  margin-bottom: 0.9rem;
}

.picker-subtab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-pill);
  min-height: 34px;
  transition: all 0.18s ease;
}

.picker-subtab.active {
  background-color: var(--bg-white);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.06);
}

/* Lista de recursos adjuntos dentro de formularios */
.resource-draft-box {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.resource-draft-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.resource-draft-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.48rem 0.68rem;
  font-size: 0.82rem;
}

.resource-draft-item-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-add-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 520px) {
  .resource-add-grid {
    grid-template-columns: 150px 1fr;
  }
}

.info-tip-box {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--sage);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.75rem 0.9rem;
  font-size: 0.81rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}


/* Separación por categorías: PDFs, Links de Tests y Links de Videos */
.res-kind-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.res-kind-pill {
  min-height: 34px;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-white);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.16s ease;
}

.res-kind-pill:hover {
  border-color: var(--sage);
  color: var(--text-main);
}

.res-kind-pill.active {
  background-color: var(--sage);
  border-color: var(--sage);
  color: var(--bg-white);
}

.res-groups-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.res-group-block {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.res-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.res-group-title {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--sage-dark);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.res-group-count {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  padding: 0.08rem 0.5rem;
  border-radius: var(--radius-pill);
}


/* Guía breve de bienvenida en Modo Libre */
.welcome-guide-card {
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.welcome-guide-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
}

.welcome-guide-lead {
  margin: 0 0 1.15rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.welcome-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.welcome-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.welcome-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--sage);
  color: var(--bg-white);
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.welcome-step-body h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.welcome-step-body p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.welcome-guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}


/* ==========================================================================
   Pantalla de Acceso (Google + Usuario y Clave) y Sesión
   ========================================================================== */
.auth-view {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-card {
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.85rem 1.5rem;
  box-shadow: var(--shadow-card);
}

.auth-hero {
  text-align: center;
  margin-bottom: 1.4rem;
}

.auth-logo-wrap {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.85rem;
  border-radius: 14px;
  background-color: var(--bg-sand);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-hero h1 {
  margin: 0 0 0.3rem;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.auth-hero p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.btn-google {
  width: 100%;
  background-color: var(--bg-white);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.04);
}

.btn-google:hover {
  background-color: var(--bg-page);
  border-color: var(--sage);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.15rem 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--border-subtle);
}

.auth-switch-row {
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.auth-privacy-note {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.loading-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.calm-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--bg-sand);
  border-top-color: var(--sage);
  animation: calmSpin 0.85s linear infinite;
}

@keyframes calmSpin {
  to { transform: rotate(360deg); }
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.4rem 0.78rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-sand);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.logout-btn:hover {
  background-color: #E6DFD2;
  border-color: var(--border-strong);
}

/* ==========================================================================
   Panel Multi-Terapeuta: Lista de Pacientes + Seguimiento en Vivo
   ========================================================================== */
.patients-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 820px) {
  .patients-layout {
    grid-template-columns: 310px 1fr;
    align-items: start;
  }
}

.patient-roster-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 560px;
  overflow-y: auto;
}

.patient-list-item {
  width: 100%;
  text-align: left;
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.8rem 0.9rem;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.patient-list-item:hover {
  border-color: var(--sage);
  background-color: var(--bg-white);
}

.patient-list-item.active {
  background-color: var(--bg-white);
  border-color: var(--sage);
  box-shadow: inset 3px 0 0 var(--sage);
}

.patient-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.patient-item-name {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text-main);
}

.patient-item-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.18rem;
  word-break: break-all;
}

.patient-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.45rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.status-dot-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--border-strong);
}

.status-dot.online {
  background-color: var(--sage);
}

.patient-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.patient-detail-header h2 {
  margin: 0 0 0.18rem;
  font-size: 1.25rem;
  color: var(--text-main);
}

.patient-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.therapist-response-box {
  margin-top: 0.6rem;
  padding: 0.7rem 0.85rem;
  background-color: var(--bg-white);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--sage);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.84rem;
  color: var(--text-main);
}

.therapist-response-box p {
  margin: 0.25rem 0;
}

.therapist-response-box p:first-child {
  margin-top: 0;
}

.therapist-response-box p:last-child {
  margin-bottom: 0;
}

.credentials-box {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0.75rem 0 1rem;
}

.credentials-box strong {
  color: var(--text-main);
}

.workbook-summary-card {
  background-color: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.65rem;
}

.workbook-kv-list {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
