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

:root {
    --primary:      #1a4731;
    --verde:        #1a4731;
    --verde-medio:  #2d6a4f;
    --verde-suave:  #d8f3dc;
    --blanco:       #ffffff;
    --fondo:        #f4f7f5;
    --borde:        #e2e8e5;
    --texto:        #1f2937;
    --texto-suave:  #6b7280;
    --radio:        16px;
    --sombra:       0 1px 4px rgba(0,0,0,0.07);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--fondo);
    color: var(--texto);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ── Splash ────────────────────────────────────────────── */
.splash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--verde);
    gap: 36px;
}

.splash-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    width: 72px;
    height: 72px;
    background: white;
    color: var(--verde);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo-text {
    color: rgba(255,255,255,0.9);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.splash-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255,255,255,0.25);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Header ────────────────────────────────────────────── */
.header {
    background: linear-gradient(135deg, #1a4731 0%, #2d6a4f 100%);
    padding: 12px 20px;
    padding-top: calc(12px + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header-brand {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.header-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    border: 1.5px solid rgba(255,255,255,0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ── Main ──────────────────────────────────────────────── */
.main {
    padding: 24px 16px calc(120px + env(safe-area-inset-bottom));
    max-width: 500px;
    margin: 0 auto;
}

/* ── Saludo ────────────────────────────────────────────── */
.greeting {
    margin-bottom: 22px;
}

.greeting-name {
    font-size: 28px;
    font-weight: 800;
    color: var(--texto);
    margin-bottom: 5px;
    line-height: 1.2;
}

.greeting-sub {
    font-size: 14px;
    color: var(--texto-suave);
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--blanco);
    border-radius: var(--radio);
    padding: 22px;
    margin-bottom: 14px;
    box-shadow: var(--sombra);
}

/* ── Card Fase ─────────────────────────────────────────── */
.fase-badge {
    display: inline-block;
    padding: 4px 13px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: 0.3px;
}

.fase-nombre {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.2;
    color: var(--texto);
}

.fase-descripcion {
    font-size: 14px;
    color: var(--texto-suave);
    line-height: 1.65;
    margin-bottom: 22px;
}

/* Progress steps */
.progress-track {
    display: flex;
    gap: 6px;
}

.progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
}

.step-dot {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--borde);
    transition: background 0.3s;
}

.progress-step.done .step-dot   { background: var(--verde-medio); }
.progress-step.active .step-dot { background: var(--verde); }

.step-label {
    font-size: 10px;
    color: var(--texto-suave);
    text-align: center;
    line-height: 1.2;
}

.progress-step.done .step-label,
.progress-step.active .step-label {
    color: var(--verde);
    font-weight: 700;
}

/* ── Card Días ─────────────────────────────────────────── */
.card-dias {
    display: flex;
    align-items: center;
    gap: 18px;
}

.dias-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.dias-body {
    flex: 1;
}

.dias-numero {
    font-size: 42px;
    font-weight: 900;
    color: var(--verde);
    line-height: 1;
    letter-spacing: -1px;
}

.dias-label {
    font-size: 13px;
    color: var(--texto-suave);
    margin-top: 3px;
}

.dias-fecha {
    font-size: 12px;
    color: var(--texto-suave);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--borde);
}

/* ── Card Contacto ─────────────────────────────────────── */
.card-contacto {
    text-align: center;
}

.contacto-texto {
    font-size: 14px;
    color: var(--texto-suave);
    margin-bottom: 14px;
    line-height: 1.5;
}

.btn-contacto {
    display: block;
    background: var(--verde);
    color: white;
    padding: 14px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    transition: background 0.15s;
}

.btn-contacto:active { background: var(--verde-medio); }

/* ── Banner instalar ───────────────────────────────────── */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--verde);
    color: white;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
}

.install-banner span { flex: 1; font-size: 14px; font-weight: 500; }

.install-banner .btn-instalar {
    background: white;
    color: var(--verde);
    border: none;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.install-banner .btn-cerrar-banner {
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* ── Bottom Nav ────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--blanco);
    display: flex;
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 16px rgba(0,0,0,0.06);
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 0 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #b0b8b3;
    gap: 3px;
    transition: color 0.2s;
    position: relative;
}

.nav-btn.active { color: var(--verde); }

.nav-indicator {
    width: 20px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: transparent;
    transition: background 0.2s, width 0.2s;
    margin-bottom: 2px;
}

.nav-btn.active .nav-indicator {
    background: var(--verde);
    width: 24px;
}

.nav-icon {
    line-height: 1;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
}
.nav-icon svg {
    display: block;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.nav-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    background: #dc2626;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

/* ── Chat ───────────────────────────────────────────────── */
.chat-hilo {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: calc(100dvh - 250px);
}

.msg-wrap          { display: flex; }
.msg-wrap-paciente { justify-content: flex-end; }
.msg-wrap-clinica  { justify-content: flex-start; }

.msg-paciente,
.msg-clinica {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.msg-paciente {
    background: var(--verde);
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-clinica {
    background: var(--blanco);
    color: var(--texto);
    border: 1px solid var(--borde);
    border-bottom-left-radius: 4px;
    box-shadow: var(--sombra);
}

.msg-hora {
    font-size: 10px;
    margin-top: 5px;
    opacity: 0.65;
    text-align: right;
}

.chat-input-bar {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    display: flex;
    gap: 8px;
    padding: 10px calc(16px + env(safe-area-inset-right)) 10px calc(16px + env(safe-area-inset-left));
    background: var(--fondo);
    border-top: 1px solid var(--borde);
    z-index: 40;
    max-width: 500px;
    margin: 0 auto;
}

.chat-input-bar textarea {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--borde);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    background: var(--blanco);
    color: var(--texto);
    line-height: 1.4;
}

.btn-chat-enviar {
    background: var(--verde);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    align-self: stretch;
    transition: background 0.15s;
    white-space: nowrap;
}

.btn-chat-enviar:active   { background: var(--verde-medio); }
.btn-chat-enviar:disabled { opacity: 0.6; }
.btn-nueva-conv {
    background: none; border: 1px solid var(--borde);
    color: var(--texto-suave); font-size: 12px; font-weight: 600;
    padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.btn-nueva-conv:active { background: var(--borde); }

.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.chat-input-row textarea { flex: 1; }

.btn-chat-adjuntar {
    background: none;
    border: 1.5px solid var(--borde);
    border-radius: 10px;
    padding: 0 10px;
    color: var(--texto-suave);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: color 0.15s, border-color 0.15s;
}
.btn-chat-adjuntar:active { color: var(--verde); border-color: var(--verde); }

.chat-file-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 6px 10px;
    background: var(--fondo-tarjeta);
    border: 1px solid var(--borde);
    border-radius: 8px;
    font-size: 12px;
    color: var(--texto);
}
.chat-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-file-remove {
    background: none; border: none; color: #dc2626; font-size: 16px;
    cursor: pointer; padding: 0 4px; font-weight: 700;
}

.msg-archivo { margin-top: 6px; }
.msg-archivo-img { max-width: 200px; border-radius: 8px; display: block; margin-top: 4px; }
.msg-archivo-link {
    display: inline-flex; align-items: center; gap: 4px;
    color: inherit; text-decoration: underline; font-size: 12px;
    word-break: break-all;
}

/* ── Receta enviada en chat (V3.1.48 P1) ─────────────────── */
.msg-receta-card {
    margin-top: 6px;
    background: white;
    border: 1px solid #16a34a;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    color: #0f172a;
    transition: background 0.15s, transform 0.1s;
}
.msg-receta-card:active { transform: scale(0.98); background: #f0fdf4; }
.msg-receta-card .msg-receta-titulo {
    font-weight: 600; font-size: 14px; color: #065f46; line-height: 1.35;
}
.msg-receta-card .msg-receta-cta {
    font-size: 11px; color: #16a34a; margin-top: 3px; font-weight: 500;
}
.msg-receta-card .msg-receta-nota {
    margin-top: 6px; font-size: 13px; color: #334155; line-height: 1.45;
    padding-top: 6px; border-top: 1px dashed #d1fae5;
}

/* ── Pantalla de error ─────────────────────────────────── */
.error-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 28px;
    text-align: center;
}

.error-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 48px;
}

.error-logo .logo-mark {
    background: var(--verde);
    color: white;
}

.error-logo .logo-text {
    color: var(--texto);
    font-size: 16px;
    font-weight: 600;
}

.error-icon { font-size: 52px; margin-bottom: 20px; }

.error-msg {
    font-size: 17px;
    font-weight: 600;
    color: var(--texto);
    margin-bottom: 10px;
    line-height: 1.4;
}

.error-sub {
    font-size: 14px;
    color: var(--texto-suave);
    line-height: 1.5;
}

/* ── Pantalla de acceso (código 6 dígitos) ────────────── */
.acceso-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--fondo);
}

.acceso-header {
    background: linear-gradient(135deg, #1a4731 0%, #2d6a4f 100%);
    padding: 60px 24px 40px;
    padding-top: calc(60px + env(safe-area-inset-top));
    display: flex;
    justify-content: center;
    border-radius: 0 0 32px 32px;
}

.acceso-logo {
    height: 28px;
    width: auto;
    filter: brightness(0) invert(1);
}

.acceso-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.acceso-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--verde-suave);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.acceso-titulo {
    font-size: 22px;
    font-weight: 700;
    color: var(--texto);
    margin-bottom: 8px;
    text-align: center;
}

.acceso-sub {
    font-size: 14px;
    color: var(--texto-suave);
    text-align: center;
    line-height: 1.5;
    margin-bottom: 28px;
    max-width: 280px;
}

.acceso-code-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.acceso-digit {
    width: 44px;
    height: 56px;
    border: 2px solid var(--borde);
    border-radius: 12px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--texto);
    background: var(--blanco);
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
}

.acceso-digit:focus {
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(26, 71, 49, 0.1);
}

.acceso-sep {
    font-size: 18px;
    color: var(--borde);
    font-weight: 300;
}

.acceso-error {
    color: #dc2626;
    font-size: 13px;
    min-height: 20px;
    text-align: center;
    margin-bottom: 8px;
}

.acceso-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1a4731 0%, #2d6a4f 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: inherit;
}

.acceso-btn:disabled {
    opacity: 0.6;
}

.acceso-alt {
    margin-top: 20px;
    font-size: 13px;
    color: var(--texto-suave);
}

.acceso-alt a {
    color: var(--verde);
    font-weight: 600;
    text-decoration: none;
}

.acceso-link-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--borde);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    text-align: center;
    font-family: inherit;
}

.acceso-link-input:focus {
    border-color: var(--verde);
}

/* ── Tracking (Hoy) ────────────────────────────────────── */
.tracking-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--texto);
    margin-bottom: 14px;
}

.bienestar-row {
    display: flex;
    gap: 6px;
}

.bienestar-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border-radius: 12px;
    border: 2px solid var(--borde);
    background: var(--blanco);
    cursor: pointer;
    transition: all 0.15s;
}

.bienestar-btn.selected {
    border-color: var(--verde);
    background: var(--verde-suave);
}

.bienestar-emoji { font-size: 24px; line-height: 1; }
.bienestar-label { font-size: 10px; color: var(--texto-suave); font-weight: 600; }
.bienestar-btn.selected .bienestar-label { color: var(--verde); }

.sintomas-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sintoma-chip {
    padding: 7px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--borde);
    background: var(--blanco);
    font-size: 13px;
    color: var(--texto-suave);
    cursor: pointer;
    transition: all 0.15s;
}

.sintoma-chip.activo {
    border-color: #dc2626;
    background: #fef2f2;
    color: #dc2626;
    font-weight: 600;
}

.metrics-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.metric-field {
    flex: 1;
    min-width: 120px;
}
.metric-field label {
    display: block;
    font-size: 12px;
    color: var(--texto-suave);
    margin-bottom: 6px;
    font-weight: 600;
}
.metric-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.metric-input-wrap input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--borde);
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--texto);
    background: var(--blanco);
    text-align: center;
    -moz-appearance: textfield;
}
.metric-input-wrap input::-webkit-inner-spin-button,
.metric-input-wrap input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.metric-input-wrap input:focus { border-color: var(--verde); outline: none; }
.metric-unit {
    font-size: 12px;
    color: var(--texto-suave);
    white-space: nowrap;
    min-width: 36px;
}
.bienestar-row-sm { gap: 6px; }
.bienestar-btn-sm {
    padding: 6px 4px !important;
    min-width: 36px !important;
}
.bienestar-btn-sm .bienestar-emoji { font-size: 18px !important; }

.tracking-nota {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--borde);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    background: var(--fondo);
    color: var(--texto);
    line-height: 1.4;
}

.btn-guardar-tracking {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--verde);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s;
}

.btn-guardar-tracking:active { background: var(--verde-medio); }
.btn-guardar-tracking:disabled { opacity: 0.6; }

.tracking-guardado-msg {
    text-align: center;
    font-size: 12px;
    color: var(--verde-medio);
    margin-top: 8px;
}

.habito-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--borde, #e5e7eb);
    margin-bottom: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--texto);
}
.habito-item.completado {
    background: #f0fdf4;
    border-color: #22c55e;
    text-decoration: line-through;
    opacity: 0.7;
}
.habito-item input[type="checkbox"] {
    accent-color: #22c55e;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.card-recordatorio {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    background: #fefce8;
    border: 1.5px solid #fde68a;
    transition: background 0.15s;
}

.card-recordatorio:active { background: #fef9c3; }
.card-recordatorio span:first-child { font-size: 28px; flex-shrink: 0; }
.card-recordatorio strong { font-size: 14px; color: var(--texto); display: block; margin-bottom: 2px; }
.card-recordatorio p { font-size: 12px; color: var(--texto-suave); line-height: 1.4; margin: 0; }

.btn-evolucion {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--blanco);
    color: var(--verde);
    border: 2px solid var(--verde-suave);
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 12px;
    transition: all 0.15s;
}

.btn-evolucion:active { background: var(--verde-suave); }

/* ── Asistente IA ───────────────────────────────────────── */
.asistente-hilo {
    max-height: calc(100dvh - 260px);
}

.asistente-bienvenida {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 16px 24px;
    text-align: center;
}

.asistente-avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--verde) 0%, #2d6a4f 50%, #40916c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(26, 71, 49, 0.25);
}

.asistente-bienvenida-texto {
    font-size: 18px;
    font-weight: 700;
    color: var(--texto);
    margin-bottom: 8px;
    line-height: 1.35;
}

.asistente-bienvenida-sub {
    font-size: 14px;
    color: var(--texto-suave);
    line-height: 1.55;
    max-width: 300px;
    margin-bottom: 24px;
}

.asistente-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 320px;
}

.asistente-chip {
    background: var(--blanco);
    border: 1.5px solid var(--borde);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--verde);
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    font-family: inherit;
}

.asistente-chip:active {
    background: var(--verde-suave);
    border-color: var(--verde-medio);
}

.msg-wrap-asistente {
    justify-content: flex-start;
}

.msg-asistente {
    background: #f0faf4;
    color: var(--texto);
    border: 1px solid #c3e6cb;
    border-bottom-left-radius: 4px;
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    box-shadow: var(--sombra);
}

.msg-asistente-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--verde-medio);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* Typing indicator (tres puntos animados) */
.msg-typing {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 4px 2px;
}

.msg-typing span {
    width: 8px;
    height: 8px;
    background: var(--verde-medio);
    border-radius: 50%;
    animation: typing-bounce 1.1s infinite ease-in-out;
}

.msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0.55); opacity: 0.35; }
    40%            { transform: scale(1);    opacity: 1;    }
}

/* ── PSQI Cuestionario ────────────────────────────────────── */
.btn-primary-app {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--verde);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary-app:active { background: var(--verde-medio); }
.btn-primary-app:disabled { opacity: 0.6; }

.psqi-section {
    background: white;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: var(--sombra);
}

.psqi-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

.psqi-input {
    padding: 10px 12px;
    border: 1.5px solid var(--borde);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    background: var(--fondo);
}

.psqi-freq {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--fondo);
}
.psqi-freq:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.psqi-sublabel {
    display: block;
    font-size: 13px;
    color: var(--texto);
    margin-bottom: 6px;
}

.psqi-options {
    display: flex;
    gap: 4px;
}
.psqi-opt {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.psqi-opt input { display: none; }
.psqi-opt span {
    display: block;
    width: 100%;
    text-align: center;
    padding: 6px 2px;
    border-radius: 8px;
    font-size: 11px;
    background: var(--fondo);
    border: 1.5px solid var(--borde);
    transition: all 0.15s;
}
.psqi-opt input:checked + span {
    background: var(--verde-suave);
    border-color: var(--verde-medio);
    color: var(--verde);
    font-weight: 600;
}

.psqi-radio-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.psqi-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--fondo);
    border: 1.5px solid var(--borde);
    transition: all 0.15s;
    font-size: 13px;
}
.psqi-radio input { display: none; }
.psqi-radio:has(input:checked) {
    background: var(--verde-suave);
    border-color: var(--verde-medio);
    color: var(--verde);
    font-weight: 600;
}

/* ── Score Diario ─────────────────────────────────────── */
.card-score { padding: 16px !important; }
.score-row { display: flex; align-items: center; gap: 16px; }
.score-ring-wrap {
    width: 64px; height: 64px; position: relative; flex-shrink: 0;
}
.score-ring { width: 100%; height: 100%; }
.score-num {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800;
}
.score-body { flex: 1; }
.score-titulo { font-size: 12px; color: var(--texto-suave); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.score-nivel { font-size: 18px; font-weight: 800; margin: 2px 0; }
.score-rec { font-size: 13px; color: var(--texto-suave); }
.score-comps { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.score-comp {
    display: flex; align-items: center; gap: 8px; font-size: 12px;
}
.score-comp-icon { font-size: 14px; width: 20px; text-align: center; }
.score-comp-label { flex: 1; color: var(--texto-suave); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-comp-bar-wrap {
    width: 60px; height: 5px; background: var(--borde); border-radius: 3px; overflow: hidden; flex-shrink: 0;
}
.score-comp-bar { height: 100%; border-radius: 3px; transition: width 0.5s; }

/* ── Lección Diaria ──────────────────────────────────── */
.card-leccion {
    background: linear-gradient(135deg, #fefce8 0%, #fff 100%) !important;
    border-left: 4px solid #f59e0b !important;
}
.leccion-header { margin-bottom: 8px; }
.leccion-tag {
    font-size: 11px; font-weight: 700; color: #f59e0b;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.leccion-titulo {
    font-size: 16px; font-weight: 700; color: var(--texto);
    margin-bottom: 6px;
}
.leccion-texto {
    font-size: 14px; color: var(--texto-suave); line-height: 1.5;
}

/* ── Dolor ────────────────────────────────────────────── */
.dolor-row {
    display: flex; gap: 6px; justify-content: space-between;
}
.dolor-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 4px; border: 2px solid transparent; border-radius: 12px;
    background: none; cursor: pointer; flex: 1; transition: all 0.15s;
}
.dolor-btn.selected { border-color: #dc2626; background: #fef2f2; }
.dolor-emoji { display: block; }
.dolor-label { font-size: 10px; color: var(--texto-suave); text-align: center; line-height: 1.2; }
.dolor-btn.selected .dolor-label { color: #dc2626; font-weight: 600; }
.dolor-zonas-wrap { margin-top: 14px; }
.dolor-zonas-titulo { font-size: 13px; font-weight: 600; color: var(--texto); margin-bottom: 8px; }
.dolor-zonas-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.dolor-zona-chip {
    padding: 6px 12px; border-radius: 20px; font-size: 13px;
    border: 1.5px solid var(--borde, #d1d5db); background: none;
    color: var(--texto); cursor: pointer; transition: all 0.15s;
}
.dolor-zona-chip.activo { background: #fef2f2; border-color: #dc2626; color: #dc2626; font-weight: 600; }
.dolor-zona-otro {
    width: 100%; padding: 8px 12px; border-radius: 8px; font-size: 13px;
    border: 1.5px solid var(--borde, #d1d5db); background: var(--fondo-card, #fff);
    color: var(--texto);
}

/* ── Menú Diario IA ───────────────────────────────────── */
.card-menu-diario {
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%) !important;
    border-left: 4px solid #22c55e !important;
}
.menu-header { margin-bottom: 10px; }
.menu-tag {
    font-size: 11px; font-weight: 700; color: #16a34a;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.menu-comidas { display: flex; flex-direction: column; gap: 10px; }
.menu-comida {
    display: flex; flex-direction: column; gap: 2px;
}
.menu-momento {
    font-size: 11px; font-weight: 700; color: #16a34a;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.menu-plato {
    font-size: 14px; color: var(--texto); line-height: 1.45;
}
.menu-nota {
    margin-top: 12px; padding-top: 10px;
    border-top: 1px solid rgba(34, 197, 94, 0.2);
    font-size: 13px; color: var(--texto-suave); line-height: 1.4;
    font-style: italic;
}
.menu-comida-tap {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
    padding: 6px 8px; margin: -6px -8px;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.menu-comida-tap:active { background: rgba(34, 197, 94, 0.10); }
.menu-comida-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.menu-tap-hint {
    color: #16a34a; font-weight: 700; font-size: 22px; line-height: 1;
    flex-shrink: 0;
}

/* ── Detalle Receta (modal) ────────────────────────────── */
.receta-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: flex-end; justify-content: center;
    z-index: 1000;
    animation: recetaFadeIn 0.18s ease-out;
}
@keyframes recetaFadeIn { from { opacity: 0; } to { opacity: 1; } }
.receta-modal-content {
    background: white;
    width: 100%; max-width: 600px; max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding: 16px 18px 24px;
    overflow-y: auto;
    animation: recetaSlideUp 0.22s ease-out;
}
@keyframes recetaSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.receta-loading, .receta-error {
    padding: 40px 20px; text-align: center; color: #6b7280; font-size: 14px;
}
.receta-error { color: #991b1b; }
.receta-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    margin-bottom: 8px; padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}
.receta-head h3 {
    margin: 0; font-size: 19px; color: #065f46;
    line-height: 1.3; flex: 1;
}
.receta-cerrar {
    background: transparent; border: none;
    font-size: 28px; line-height: 1; color: #9ca3af;
    cursor: pointer; padding: 0 4px;
    flex-shrink: 0;
}
.receta-meta {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin: 10px 0 4px;
    font-size: 13px; color: #4b5563;
}
.receta-alertas { margin: 12px 0; }
.receta-alerta {
    padding: 10px 12px; border-radius: 8px; margin-bottom: 8px;
    font-size: 13px; line-height: 1.45;
    border-left: 4px solid #f59e0b;
    background: #fef3c7;
}
.receta-alerta-alta  { background: #fee2e2; border-color: #dc2626; color: #991b1b; }
.receta-alerta-media { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.receta-alerta-baja  { background: #dbeafe; border-color: #3b82f6; color: #1e40af; }
.receta-alerta strong {
    text-transform: capitalize; display: block; margin-bottom: 2px;
}
.receta-section { margin-top: 18px; }
.receta-section h4 {
    margin: 0 0 8px; font-size: 13px; font-weight: 700;
    color: #16a34a; text-transform: uppercase; letter-spacing: 0.4px;
}
.receta-ingredientes {
    list-style: none; padding: 0; margin: 0;
}
.receta-ingredientes li {
    padding: 6px 0; border-bottom: 1px solid #f3f4f6;
    font-size: 14px; line-height: 1.45; color: #1f2937;
}
.receta-ingredientes li:last-child { border-bottom: none; }
.receta-opcional {
    font-size: 11px; color: #6b7280; font-style: italic; margin-left: 4px;
}
.receta-sustitutos {
    font-size: 12px; color: #6b7280; margin-top: 2px;
}
.receta-pasos { padding-left: 22px; margin: 0; }
.receta-pasos li {
    padding: 6px 0; font-size: 14px; line-height: 1.5; color: #1f2937;
}
.receta-notas {
    background: #f0fdf4; padding: 10px 12px; border-radius: 8px;
    font-size: 13px; color: #374151; line-height: 1.5; margin: 0;
}
.receta-actions {
    margin-top: 18px; padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}
.receta-volver {
    width: 100%; padding: 12px;
    background: #16a34a; color: white;
    border: none; border-radius: 10px;
    font-size: 15px; font-weight: 600; cursor: pointer;
}
.receta-volver:active { background: #15803d; }

/* ── Logros / Gamificación ─────────────────────────────── */
.card-logros { padding: 0 !important; cursor: pointer; }
.logros-header {
    display: flex; align-items: center; gap: 14px; padding: 16px;
}
.logros-nivel-wrap {
    width: 48px; height: 48px; border-radius: 14px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 24px;
}
.logros-body { flex: 1; min-width: 0; }
.logros-nivel-nombre { font-weight: 700; font-size: 16px; }
.logros-sub { font-size: 13px; color: var(--texto-suave); margin: 2px 0 6px; }
.logros-barra-wrap {
    height: 6px; background: var(--borde); border-radius: 3px; overflow: hidden;
}
.logros-barra {
    height: 100%; background: linear-gradient(90deg, var(--verde), #16a34a);
    border-radius: 3px; transition: width 0.5s ease;
}
.logros-recientes {
    display: flex; gap: 6px; padding: 0 16px 14px;
    border-top: 1px solid var(--borde); padding-top: 10px; margin-top: -2px;
}
.logro-mini { font-size: 22px; }

/* Vista completa logros */
.logros-nivel-card { text-align: center; padding: 24px 16px !important; }
.logros-nivel-big { font-size: 48px; margin-bottom: 8px; }
.logros-nivel-titulo { font-size: 22px; font-weight: 800; }
.logros-nivel-stats { font-size: 14px; color: var(--texto-suave); margin-top: 4px; }

.logros-cat { margin-bottom: 12px; }
.logros-cat-titulo {
    font-size: 14px; font-weight: 700; margin-bottom: 12px;
}
.logros-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.logro-item {
    background: var(--fondo); border-radius: 12px; padding: 14px 12px;
    text-align: center; transition: transform 0.1s;
}
.logro-item.desbloqueado { background: #fefce8; }
.logro-item.bloqueado { opacity: 0.6; }
.logro-icono-wrap {
    width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 8px;
    background: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.logro-icono-wrap.locked { background: var(--borde); }
.logro-icono { font-size: 22px; }
.logro-nombre { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.logro-desc { font-size: 11px; color: var(--texto-suave); line-height: 1.3; }
.logro-prog-wrap {
    height: 4px; background: var(--borde); border-radius: 2px;
    overflow: hidden; margin-top: 8px;
}
.logro-prog {
    height: 100%; background: var(--verde-medio); border-radius: 2px;
}
.logro-prog-text {
    font-size: 10px; color: var(--texto-suave); margin-top: 3px;
}

/* ── Biomarcadores ────────────────────────────────────── */
.card-bio { padding: 0 !important; cursor: pointer; }
.bio-header {
    display: flex; align-items: center; gap: 14px; padding: 16px;
}
.bio-icon-wrap {
    width: 48px; height: 48px; border-radius: 14px;
    background: #eff6ff; color: #2563eb;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.bio-body { flex: 1; min-width: 0; }
.bio-titulo { font-weight: 700; font-size: 16px; }
.bio-sub { font-size: 13px; color: var(--texto-suave); margin-top: 2px; }

.bio-grupo { margin-bottom: 12px; }
.bio-grupo-titulo {
    font-size: 13px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 12px;
}
.bio-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.bio-item:last-child { border-bottom: none; }
.bio-item-left { flex: 1; min-width: 0; }
.bio-item-nombre { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.bio-item-valores { font-size: 13px; margin-bottom: 4px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.bio-val-group { display: inline-flex; align-items: baseline; gap: 4px; }
.bio-val { font-weight: 700; color: var(--texto); }
.bio-fecha-mini { font-size: 10px; color: var(--texto-suave); background: #f3f4f6; padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
.bio-arrow { color: var(--texto-suave); font-size: 12px; margin: 0 2px; }
.bio-unidad { font-size: 11px; color: var(--texto-suave); margin-left: 2px; }
.bio-item-estado { display: flex; align-items: center; gap: 4px; }
.bio-estado-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.bio-item-right {
    display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    flex-shrink: 0;
}
.bio-spark { display: block; }

/* ── Tracking Suplementos ─────────────────────────────── */
.card-sup { padding: 0 !important; cursor: pointer; }
.sup-header {
    display: flex; align-items: center; gap: 14px; padding: 16px;
}
.sup-ring-wrap {
    width: 48px; height: 48px; position: relative; flex-shrink: 0;
}
.sup-ring { width: 100%; height: 100%; }
.sup-ring-text {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: var(--texto);
}
.sup-body { flex: 1; min-width: 0; }
.sup-titulo { font-weight: 700; font-size: 16px; }
.sup-sub { font-size: 13px; color: var(--texto-suave); margin-top: 2px; }

/* Checklist */
.sup-resumen { margin-bottom: 12px; }
.sup-resumen-row {
    display: flex; justify-content: space-around; text-align: center;
}
.sup-stat-num { font-size: 24px; font-weight: 800; color: var(--verde); }
.sup-stat-label { font-size: 12px; color: var(--texto-suave); margin-top: 2px; }

.sup-grupo { margin-bottom: 10px; padding: 14px 16px !important; }
.sup-grupo-header {
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 10px; border-bottom: 1px solid var(--borde);
    margin-bottom: 8px;
}
.sup-grupo-icon { font-size: 20px; }
.sup-grupo-nombre { font-weight: 700; font-size: 15px; flex: 1; }
.sup-grupo-count {
    font-size: 13px; color: var(--texto-suave); font-weight: 600;
}

.sup-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: opacity 0.15s;
}
.sup-item:last-child { border-bottom: none; }
.sup-item:active { opacity: 0.7; }
.sup-done { opacity: 0.55; }

.sup-check {
    width: 28px; height: 28px; border-radius: 50%;
    border: 2px solid var(--borde);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s;
}
.sup-check.checked {
    background: var(--verde); border-color: var(--verde);
}
.sup-info { flex: 1; min-width: 0; }
.sup-nombre {
    font-weight: 600; font-size: 14px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sup-done .sup-nombre { text-decoration: line-through; }
.sup-dosis { font-size: 12px; color: var(--texto-suave); margin-top: 1px; }

.btn-historial-sup {
    display: block; width: 100%; padding: 14px;
    background: var(--verde-suave); color: var(--verde);
    border: none; border-radius: var(--radio);
    font-size: 14px; font-weight: 600;
    cursor: pointer; margin-top: 12px;
    text-align: center;
}
.btn-historial-sup:active { opacity: 0.8; }

/* Calendario adherencia */
.sup-calendario {
    display: flex; flex-wrap: wrap; gap: 4px;
    justify-content: flex-start;
}
.sup-cal-dia {
    display: flex; flex-direction: column; align-items: center;
    width: calc((100% - 24px) / 7); min-width: 36px;
}
.sup-cal-label { font-size: 10px; color: var(--texto-suave); margin-bottom: 2px; }
.sup-cal-dot {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; color: #fff;
}

/* ── Recomendaciones ──────────────────────────────────── */
.card-rec { padding: 0 !important; cursor: pointer; }
.rec-header {
    display: flex; align-items: center; gap: 14px; padding: 16px;
}
.rec-icon-wrap {
    width: 48px; height: 48px; border-radius: 14px;
    background: #fffbeb; color: #f59e0b;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; position: relative; font-size: 22px;
}
.rec-badge {
    position: absolute; top: -4px; right: -4px;
    background: #dc2626; color: #fff;
    font-size: 11px; font-weight: 700;
    min-width: 18px; height: 18px;
    border-radius: 9px; display: flex;
    align-items: center; justify-content: center;
    padding: 0 4px;
}
.rec-body { flex: 1; min-width: 0; }
.rec-titulo { font-weight: 700; font-size: 16px; }
.rec-sub { font-size: 13px; color: var(--texto-suave); margin-top: 2px; }

/* Página de recomendaciones */
.rec-page-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px;
}
.rec-back {
    background: none; border: none; color: var(--verde);
    padding: 4px; cursor: pointer; display: flex;
}
.rec-page-titulo {
    font-size: 20px; font-weight: 700;
}
.rec-card {
    margin-bottom: 12px; padding: 16px !important;
    transition: transform 0.1s;
}
.rec-card:active { transform: scale(0.98); }
.rec-nueva { background: #fffef5; }
.rec-card-top {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.rec-cat-badge {
    font-size: 12px; font-weight: 600;
    padding: 3px 10px; border-radius: 12px;
}
.rec-nueva-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #dc2626;
}
.rec-card-titulo {
    font-weight: 700; font-size: 16px; margin-bottom: 6px;
}
.rec-card-texto {
    font-size: 14px; color: var(--texto-suave);
    line-height: 1.5; white-space: pre-line;
    margin-bottom: 8px;
}
.rec-card-enlace {
    font-size: 13px; font-weight: 600; margin-bottom: 6px;
}
.rec-card-meta {
    font-size: 12px; color: var(--texto-suave); opacity: 0.7;
}

/* ── Mi Tratamiento (Infografía) ──────────────────────── */
.card-tratamiento {
    padding: 0 !important;
    overflow: hidden;
}
.tratamiento-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
}
.tratamiento-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--verde-suave);
    color: var(--verde);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.tratamiento-body { flex: 1; min-width: 0; }
.tratamiento-titulo {
    font-weight: 700;
    font-size: 16px;
    color: var(--texto);
}
.tratamiento-sub {
    font-size: 13px;
    color: var(--texto-suave);
    margin-top: 2px;
}
.tratamiento-arrow {
    flex-shrink: 0;
    color: var(--texto-suave);
    opacity: 0.5;
}
.tratamiento-sep {
    height: 1px;
    background: var(--borde);
    margin: 0 16px;
}
.tratamiento-otras {
    padding: 12px 16px 8px;
}
.tratamiento-otras-titulo {
    font-size: 12px;
    font-weight: 600;
    color: var(--texto-suave);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.infografia-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}
.infografia-item:hover, .infografia-item:active {
    background: var(--verde-suave);
}
.infografia-item.activa {
    background: var(--verde-suave);
    font-weight: 600;
}
.infografia-item-label {
    font-size: 14px;
    color: var(--texto);
}
.infografia-item-fecha {
    font-size: 12px;
    color: var(--texto-suave);
}
.tratamiento-toggle {
    text-align: center;
    padding: 10px 16px 14px;
    font-size: 13px;
    color: var(--verde-medio);
    font-weight: 600;
    cursor: pointer;
}

/* ── Visor Infografía Fullscreen ──────────────────────── */
.infografia-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #fff;
    display: flex;
    flex-direction: column;
}
.infografia-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    padding-top: calc(8px + env(safe-area-inset-top));
    background: var(--verde);
    color: #fff;
    flex-shrink: 0;
}
.infografia-toolbar-titulo {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
}
.infografia-btn-cerrar,
.infografia-btn-rotar {
    background: none;
    border: none;
    color: #fff;
    padding: 6px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.infografia-btn-cerrar:active,
.infografia-btn-rotar:active {
    background: rgba(255,255,255,0.15);
}
.infografia-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
}

/* ── Mi día — eventos puntuales (V3.1.34) ─────────────── */
.card-mi-dia { background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%); border: 1px solid #a7f3d0; }
.mi-dia-sub { font-size: 13px; color: #166534; margin: 4px 0 14px; }
.mi-dia-botones {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.mi-dia-btn {
    background: #ffffff;
    border: 2px solid #a7f3d0;
    border-radius: 14px;
    padding: 12px 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.1s, box-shadow 0.1s;
}
.mi-dia-btn:active { transform: scale(0.96); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.mi-dia-emoji { font-size: 26px; }
.mi-dia-label { font-size: 12px; font-weight: 600; color: #166534; }
.mi-dia-vacio { font-size: 13px; color: #6b7280; text-align: center; padding: 12px 0; margin: 0; }
.mi-dia-events { display: flex; flex-direction: column; gap: 8px; }
.mi-dia-evento {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: white;
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid #d1fae5;
}
.mi-dia-evento-hora { font-size: 13px; font-weight: 700; color: #065f46; min-width: 42px; padding-top: 2px; }
.mi-dia-evento-icono { font-size: 18px; padding-top: 1px; }
.mi-dia-evento-cuerpo { flex: 1; font-size: 14px; color: #1f2937; }
.mi-dia-evento-texto { line-height: 1.4; }
.mi-dia-evento-nota { font-size: 12px; color: #6b7280; margin-top: 4px; font-style: italic; }
.mi-dia-foto { display: block; margin-top: 6px; max-width: 100%; max-height: 120px; border-radius: 8px; }
.mi-dia-evento-borrar {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.mi-dia-evento-borrar:active { color: #dc2626; }
.mi-dia-tag {
    display: inline-block;
    background: #ecfdf5;
    color: #065f46;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 4px;
    text-transform: capitalize;
}
.mi-dia-tag-warn { background: #fef3c7; color: #92400e; }
.mi-dia-rescate {
    display: inline-block;
    background: #fee2e2;
    color: #991b1b;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 4px;
}

/* Modal */
.mi-dia-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    animation: miDiaFadeIn 0.18s ease-out;
}
@keyframes miDiaFadeIn { from { opacity: 0; } to { opacity: 1; } }
.mi-dia-modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
    padding: 16px 18px 24px;
    overflow-y: auto;
    animation: miDiaSlideUp 0.22s ease-out;
}
@keyframes miDiaSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.mi-dia-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.mi-dia-modal-head h3 { margin: 0; font-size: 18px; color: #065f46; }
.mi-dia-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
}
.mi-dia-form-section { margin-top: 14px; }
.mi-dia-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.mi-dia-form-section input[type="time"],
.mi-dia-form-section input[type="text"],
.mi-dia-form-section textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: white;
    box-sizing: border-box;
    font-family: inherit;
}
.mi-dia-form-section textarea { resize: vertical; min-height: 56px; }
.mi-dia-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.mi-dia-chip {
    background: #f3f4f6;
    border: 1.5px solid transparent;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}
.mi-dia-chip:active { transform: scale(0.96); }
.mi-dia-chip.activo {
    background: #d1fae5;
    border-color: #059669;
    color: #065f46;
    font-weight: 600;
}
.mi-dia-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 22px;
}
.mi-dia-modal-actions button { flex: 1; padding: 12px; font-size: 15px; }
.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

@media (max-width: 480px) {
    .mi-dia-botones { gap: 6px; }
    .mi-dia-btn { padding: 10px 4px; }
    .mi-dia-emoji { font-size: 22px; }
    .mi-dia-label { font-size: 11px; }
}

/* ── Staff (Bloque B — V3.1.34) ──────────────────────────── */
.staff-bandeja { display: flex; flex-direction: column; gap: 6px; padding: 0 12px 80px; }
.staff-paciente {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    transition: background 0.1s;
}
.staff-paciente:active { background: #f3f4f6; }
.staff-paciente.sin-leer { background: #f0fdf4; border-color: #86efac; }
.staff-pac-icono {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #1a4731;
    color: white;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.staff-pac-cuerpo { flex: 1; min-width: 0; }
.staff-pac-row1 {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3px;
}
.staff-pac-nombre { font-weight: 600; color: #1f2937; font-size: 15px; }
.staff-pac-hora { font-size: 11px; color: #9ca3af; flex-shrink: 0; margin-left: 8px; }
.staff-pac-row2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.staff-pac-msg {
    font-size: 13px;
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.staff-paciente.sin-leer .staff-pac-msg { color: #1f2937; font-weight: 500; }
.staff-pac-badge {
    background: #dc2626;
    color: white;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Vista chat staff */
.staff-chat-header {
    position: sticky;
    top: 0;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}
.staff-chat-back {
    background: transparent;
    border: none;
    color: #1a4731;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 8px;
    font-weight: 600;
}
.staff-chat-titulo { margin: 0; font-size: 16px; font-weight: 600; color: #1f2937; }
.staff-chat-mensajes {
    padding: 12px;
    padding-bottom: 90px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: calc(100vh - 200px);
}
.staff-msg {
    max-width: 78%;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
}
.staff-msg.mio {
    background: #1a4731;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.staff-msg.paciente {
    background: #f3f4f6;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.staff-msg-hora { font-size: 10px; opacity: 0.7; margin-top: 3px; text-align: right; }
.staff-msg.paciente .staff-msg-hora { text-align: left; }
.staff-chat-input {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.staff-chat-input textarea {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    max-height: 120px;
}
.staff-chat-input button {
    background: #1a4731;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 11px 18px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}
.staff-chat-input button:disabled { background: #9ca3af; }

/* ── V3.1.60: favoritos + "la hice" + lista de la compra ── */
.receta-fav {
    padding: 11px 16px; border-radius: 10px; border: 1px solid #fca5a5;
    background: white; color: #b91c1c; font-size: 14px; font-weight: 600; cursor: pointer;
}
.receta-fav.activo { background: #ef4444; border-color: #ef4444; color: white; }
.receta-hecha {
    padding: 11px 16px; border-radius: 10px; border: 1px solid #86efac;
    background: #f0fdf4; color: #166534; font-size: 14px; font-weight: 600; cursor: pointer;
}
.receta-hecha.hecha-ok { background: #16a34a; border-color: #16a34a; color: white; }
.receta-hecha:disabled { opacity: 0.85; }
.mi-dia-tag-receta { background: #dcfce7; color: #166534; cursor: pointer; }
.compra-sub { font-size: 12px; color: #64748b; margin: -4px 0 10px; }
.compra-cat h4 { margin: 14px 0 6px; font-size: 13px; color: #0f172a; }
.compra-lista { list-style: none; margin: 0; padding: 0; }
.compra-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 6px; border-bottom: 1px solid #f1f5f9; cursor: pointer;
}
.compra-check {
    width: 20px; height: 20px; min-width: 20px; border: 2px solid #cbd5e1;
    border-radius: 6px; display: inline-block; position: relative;
}
.compra-item.comprado .compra-check { background: #16a34a; border-color: #16a34a; }
.compra-item.comprado .compra-check::after {
    content: '✓'; color: white; position: absolute; top: -2px; left: 3px;
    font-size: 14px; font-weight: 700;
}
.compra-item.comprado .compra-nombre { text-decoration: line-through; color: #94a3b8; }
.compra-nombre { flex: 1; font-size: 14px; color: #0f172a; }
.compra-cant { font-size: 12px; color: #64748b; white-space: nowrap; }

/* ===== Front público (evalúa): pantallas de embudo ===== */

/* Contenedor raíz de cada pantalla del embudo */
.landing,
.teaser,
.gracias {
    max-width: 460px;
    margin: 0 auto;
    padding: 32px 20px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
}

/* Logo en landing */
.landing .logo {
    height: 36px;
    width: auto;
    margin-bottom: 8px;
}

/* Formulario de registro */
.form {
    max-width: 460px;
    margin: 0 auto;
    padding: 28px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--texto);
    margin-bottom: 4px;
}

.form input[type="email"],
.form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--borde);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    color: var(--texto);
    outline: none;
    transition: border-color 0.15s;
}

.form input:focus {
    border-color: var(--verde-medio);
}

/* Checkbox de consentimiento */
.consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--texto-suave);
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
}

.consent input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--verde);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.consent a {
    color: var(--verde-medio);
    text-decoration: underline;
}

/* Mensaje de error en formularios */
.err {
    color: #dc2626;
    font-size: 13px;
    min-height: 18px;
    text-align: center;
}

/* CTA principal del embudo (landing, teaser, paywall) */
.btn-primary {
    display: inline-block;
    width: 100%;
    max-width: 360px;
    padding: 16px 28px;
    background: var(--primary);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: var(--radio);
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    transition: background 0.15s, opacity 0.15s;
    box-shadow: 0 2px 8px rgba(26,71,49,0.18);
}

.btn-primary:active  { background: var(--verde-medio); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* Texto pequeño / disclaimer */
.mini {
    font-size: 12px;
    color: var(--texto-suave);
    line-height: 1.5;
    text-align: center;
    max-width: 360px;
}

/* ── Teaser (resultado post-cuestionario) ── */
.teaser .score {
    font-size: 64px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -2px;
}

.teaser .label {
    font-size: 18px;
    font-weight: 700;
    color: var(--texto);
}

.teaser .hallazgo {
    font-size: 15px;
    color: var(--texto-suave);
    line-height: 1.6;
    max-width: 380px;
}

/* ── Paywall (muro de pago) ── */
.paywall {
    background: var(--verde-suave);
    border: 1.5px solid var(--verde-medio);
    border-radius: var(--radio);
    padding: 24px 20px;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: var(--sombra);
}

.paywall h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.paywall p {
    font-size: 14px;
    color: var(--texto-suave);
    line-height: 1.5;
    margin: 0;
}

/* ── Pantalla de gracias ── */
.gracias h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
}

.gracias p {
    font-size: 15px;
    color: var(--texto-suave);
    line-height: 1.6;
    max-width: 320px;
}
