/* ============================================================
   cita-v2 — Asistente de agendamiento por voz (ALIEE)
   Paso 1: saludo. CSS portado y aislado del cita/ legacy.
   Las variables --primary / --primary-rgb se inyectan por tenant
   en un <style> inline de index.slm (override de :root).
   ============================================================ */

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

:root {
    --primary: #0066cc;
    --primary-rgb: 0, 102, 204;
    --bg: #080d1a;
    --surface: rgba(255, 255, 255, .045);
    --border: rgba(255, 255, 255, .07);
    --text: rgba(255, 255, 255, .9);
    --muted: rgba(255, 255, 255, .42);
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

#cita-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ── Layout ── */
.cita-layout {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar (info de la clínica) ── */
.cita-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 36px 28px 28px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.cita-clinic-logo {
    height: 52px;
    max-width: 160px;
    object-fit: contain;
    object-position: left center;
    margin-bottom: 18px;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, .5));
}

.cita-clinic-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 10px;
}

.cita-clinic-specialty {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--primary);
    background: rgba(var(--primary-rgb), .12);
    border: 1px solid rgba(var(--primary-rgb), .28);
    border-radius: 20px;
    padding: 4px 12px;
}

.cita-info-divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

.cita-info-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cita-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.cita-info-icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(var(--primary-rgb), .1);
    border: 1px solid rgba(var(--primary-rgb), .22);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.cita-info-icon svg {
    width: 15px;
    height: 15px;
    fill: var(--primary);
}

.cita-info-text {
    font-size: .85rem;
    color: rgba(255, 255, 255, .65);
    line-height: 1.55;
}

.cita-info-text strong {
    display: block;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-bottom: 3px;
}

.cita-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: .82rem;
    text-decoration: none;
    transition: color .2s;
}

.cita-back:hover {
    color: rgba(255, 255, 255, .72);
}

.cita-back svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ── Stage ── */
.cita-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 36px 16px;
    position: relative;
    overflow: hidden;
}

[data-state="connecting"] .cita-stage,
[data-state="listening"] .cita-stage,
[data-state="speaking"] .cita-stage {
    justify-content: flex-start;
    padding-top: 18px;
}

.cita-stage::before {
    content: '';
    position: absolute;
    width: 560px;
    height: 560px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), .07) 0%, transparent 68%);
    pointer-events: none;
}

.cita-bot-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: margin .42s, font-size .42s;
}

[data-state="connecting"] .cita-bot-label,
[data-state="listening"] .cita-bot-label,
[data-state="speaking"] .cita-bot-label {
    margin-bottom: 8px;
    font-size: .64rem;
}

.cita-bot-label::before,
.cita-bot-label::after {
    content: '';
    width: 32px;
    height: 1px;
    background: var(--border);
}

/* ── Orbe ── */
.cita-orb-wrap {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    transition: width .44s cubic-bezier(.4, 0, .2, 1), height .44s cubic-bezier(.4, 0, .2, 1), margin .44s;
}

[data-state="connecting"] .cita-orb-wrap,
[data-state="listening"] .cita-orb-wrap,
[data-state="speaking"] .cita-orb-wrap {
    width: 100px;
    height: 100px;
    margin-bottom: 8px;
}

.cita-ripple {
    position: absolute;
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1.5px solid rgba(var(--primary-rgb), .5);
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
    pointer-events: none;
}

[data-state="connecting"] .cita-ripple,
[data-state="listening"] .cita-ripple,
[data-state="speaking"] .cita-ripple {
    width: 72px;
    height: 72px;
}

.cita-orb {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 36% 30%, rgba(255, 255, 255, .28) 0%, var(--primary) 44%, rgba(0, 0, 0, .2) 100%);
    transition: background .55s, box-shadow .4s, width .44s cubic-bezier(.4, 0, .2, 1), height .44s cubic-bezier(.4, 0, .2, 1);
}

[data-state="connecting"] .cita-orb,
[data-state="listening"] .cita-orb,
[data-state="speaking"] .cita-orb {
    width: 72px;
    height: 72px;
}

.cita-orb::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2.5px solid transparent;
    opacity: 0;
    transition: opacity .3s;
}

.cita-orb-icon {
    width: 72px;
    height: 72px;
    fill: rgba(255, 255, 255, .92);
    filter: drop-shadow(0 2px 14px rgba(0, 0, 0, .4));
    position: relative;
    z-index: 1;
    transition: transform .3s, width .44s cubic-bezier(.4, 0, .2, 1), height .44s cubic-bezier(.4, 0, .2, 1);
}

[data-state="connecting"] .cita-orb-icon,
[data-state="listening"] .cita-orb-icon,
[data-state="speaking"] .cita-orb-icon {
    width: 26px;
    height: 26px;
}

.cita-orb-icon-check {
    display: none;
}

/* ── Estados del orbe ── */
@keyframes cita-breathe {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 38px 10px rgba(var(--primary-rgb), .22);
    }

    50% {
        transform: scale(1.06);
        box-shadow: 0 0 68px 22px rgba(var(--primary-rgb), .38);
    }
}

[data-state="idle"] .cita-orb {
    animation: cita-breathe 3.5s ease-in-out infinite;
    cursor: pointer;
}

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

@keyframes cita-pulse-fast {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 30px 8px rgba(var(--primary-rgb), .28);
    }

    50% {
        transform: scale(1.04);
        box-shadow: 0 0 55px 16px rgba(var(--primary-rgb), .45);
    }
}

[data-state="connecting"] .cita-orb {
    animation: cita-pulse-fast 1.2s ease-in-out infinite;
}

[data-state="connecting"] .cita-orb::after {
    opacity: 1;
    border-top-color: rgba(var(--primary-rgb), .9);
    border-right-color: rgba(var(--primary-rgb), .3);
    animation: cita-spin .85s linear infinite;
}

@keyframes cita-listen {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 48px 14px rgba(var(--primary-rgb), .35);
    }

    30% {
        transform: scale(1.05);
        box-shadow: 0 0 72px 24px rgba(var(--primary-rgb), .55);
    }

    70% {
        transform: scale(.97);
        box-shadow: 0 0 32px 6px rgba(var(--primary-rgb), .22);
    }
}

@keyframes cita-listen-icon {

    0%,
    100% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.09);
    }

    70% {
        transform: scale(.93);
    }
}

[data-state="listening"] .cita-orb {
    animation: cita-listen 1.65s ease-in-out infinite;
}

[data-state="listening"] .cita-orb-icon-mic {
    animation: cita-listen-icon 1.65s ease-in-out infinite;
}

@keyframes cita-speak-ripple {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: .58;
    }

    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

[data-state="speaking"] .cita-ripple-1 {
    animation: cita-speak-ripple 1.9s ease-out 0s infinite;
}

[data-state="speaking"] .cita-ripple-2 {
    animation: cita-speak-ripple 1.9s ease-out .63s infinite;
}

[data-state="speaking"] .cita-ripple-3 {
    animation: cita-speak-ripple 1.9s ease-out 1.26s infinite;
}

[data-state="speaking"] .cita-orb {
    box-shadow: 0 0 70px 24px rgba(var(--primary-rgb), .44);
    animation: cita-breathe 2.1s ease-in-out infinite;
}

@keyframes cita-success-breathe {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 50px 14px rgba(34, 197, 94, .32);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 80px 26px rgba(34, 197, 94, .5);
    }
}

[data-state="confirmed"] .cita-orb,
[data-state="done"] .cita-orb {
    background: radial-gradient(circle at 36% 30%, rgba(255, 255, 255, .28) 0%, #22c55e 44%, rgba(0, 0, 0, .2) 100%);
    animation: cita-success-breathe 2.6s ease-in-out infinite;
}

[data-state="confirmed"] .cita-orb-icon-mic,
[data-state="done"] .cita-orb-icon-mic {
    display: none;
}

[data-state="confirmed"] .cita-orb-icon-check,
[data-state="done"] .cita-orb-icon-check {
    display: block;
}

/* ── Status ── */
.cita-status {
    font-size: .92rem;
    color: var(--muted);
    letter-spacing: .02em;
    text-align: center;
    min-height: 1.4em;
    margin-bottom: 16px;
    transition: opacity .3s, margin .42s, font-size .42s;
}

[data-state="connecting"] .cita-status,
[data-state="listening"] .cita-status,
[data-state="speaking"] .cita-status {
    margin-bottom: 8px;
    font-size: .82rem;
}

/* ── Transcript ── */
.cita-transcript-wrap {
    width: 100%;
    max-width: 640px;
    height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    overflow: hidden;
}

[data-state="connecting"] .cita-transcript-wrap,
[data-state="listening"] .cita-transcript-wrap,
[data-state="speaking"] .cita-transcript-wrap {
    flex: 1;
    height: auto;
    overflow: hidden;
    min-height: 0;
}

[data-state="connecting"] .cita-transcript,
[data-state="listening"] .cita-transcript,
[data-state="speaking"] .cita-transcript {
    flex: 1;
    min-height: 0;
}

.cita-transcript {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 6px 2px 2px;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.cita-transcript::-webkit-scrollbar {
    display: none;
}

.cita-transcript-wrap::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, var(--bg), transparent);
    pointer-events: none;
    z-index: 1;
}

.cita-bubble {
    max-width: 85%;
    padding: 9px 14px 8px;
    border-radius: 16px;
    font-size: .88rem;
    line-height: 1.55;
    animation: cita-bubble-in .22s ease;
    word-break: break-word;
}

@keyframes cita-bubble-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cita-bubble-bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .09);
    color: rgba(255, 255, 255, .93);
    border-bottom-left-radius: 4px;
}

.cita-bubble-user {
    align-self: flex-end;
    background: rgba(var(--primary-rgb), .2);
    border: 1px solid rgba(var(--primary-rgb), .28);
    color: rgba(255, 255, 255, .78);
    font-style: italic;
    border-bottom-right-radius: 4px;
}

.cita-bubble-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .45;
    margin-bottom: 3px;
}

.cita-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    animation: cita-bubble-in .2s ease;
}

.cita-typing span {
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, .5);
    border-radius: 50%;
    animation: cita-dot 1.3s infinite ease-in-out;
}

.cita-typing span:nth-child(2) {
    animation-delay: .18s;
}

.cita-typing span:nth-child(3) {
    animation-delay: .36s;
}

@keyframes cita-dot {

    0%,
    80%,
    100% {
        transform: scale(.55);
        opacity: .35;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Hangup ── */
.cita-hangup-wrap {
    margin-top: 26px;
    min-height: 50px;
    display: flex;
    align-items: center;
}

.cita-hangup {
    background: rgba(239, 68, 68, .14);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, .3);
    border-radius: 50px;
    padding: 11px 28px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 8px;
    transition: background .2s, border-color .2s, transform .1s;
}

.cita-hangup:hover {
    background: rgba(239, 68, 68, .24);
    border-color: rgba(239, 68, 68, .5);
}

.cita-hangup:active {
    transform: scale(.97);
}

.cita-hangup svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

[data-state="connecting"] .cita-hangup,
[data-state="listening"] .cita-hangup,
[data-state="speaking"] .cita-hangup {
    display: flex;
}

/* ── WhatsApp fallback de soporte ── */
.cita-support-cta {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: #25d366;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 780px) {

    html,
    body {
        overflow: auto;
    }

    .cita-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .cita-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px 20px;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .cita-clinic-logo {
        height: 38px;
        margin-bottom: 0;
    }

    .cita-clinic-name {
        font-size: .9rem;
        margin-bottom: 0;
    }

    .cita-clinic-specialty {
        font-size: .68rem;
    }

    .cita-info-divider,
    .cita-info-list {
        display: none;
    }

    .cita-sidebar > :last-child {
        margin-left: auto;
    }

    .cita-stage {
        padding: 32px 20px 40px;
    }

    .cita-orb-wrap {
        width: 230px;
        height: 230px;
        margin-bottom: 22px;
    }

    .cita-orb {
        width: 170px;
        height: 170px;
    }

    .cita-orb-icon {
        width: 60px;
        height: 60px;
    }

    .cita-ripple {
        width: 170px;
        height: 170px;
    }

    .cita-transcript-wrap {
        max-width: 100%;
        height: 300px;
    }
}

/* ── Tarjetas de Planes / Catálogo (Paso 2) ── */
.cita-plan-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .035));
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
    animation: cita-plan-in .38s cubic-bezier(.34, 1.35, .64, 1) both;
}

.cita-plan-card::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), .16);
    pointer-events: none;
}

.cita-plan-card.is-featured {
    border-color: rgba(var(--primary-rgb), .48);
    background: linear-gradient(145deg, rgba(var(--primary-rgb), .16), rgba(255, 255, 255, .045));
}

.cita-plan-card.is-featured::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    border: 1px solid rgba(var(--primary-rgb), .16);
    pointer-events: none;
}

@keyframes cita-plan-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cita-plans-carousel {
    animation: cita-plan-in .3s cubic-bezier(.34, 1.2, .64, 1) both;
    width: 100%;
    max-width: 85%;
    align-self: flex-start;
    margin-bottom: 8px;
}

.cita-plans-carousel-header {
    margin-bottom: 8px;
}

.cita-plan-top {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.cita-plan-category {
    color: rgba(255, 255, 255, .58);
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.cita-plan-badge {
    color: #22c55e;
    background: rgba(34, 197, 94, .12);
    border: 1px solid rgba(34, 197, 94, .28);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: .65rem;
    font-weight: 800;
    white-space: nowrap;
}

.cita-plan-name {
    position: relative;
    color: #fff;
    font-size: 1rem;
    font-weight: 850;
    line-height: 1.3;
    margin-bottom: 8px;
}

.cita-plan-desc {
    position: relative;
    color: rgba(255, 255, 255, .58);
    font-size: .8rem;
    line-height: 1.55;
    margin-bottom: 12px;
}

.cita-plan-meta {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 12px;
}

.cita-plan-pill {
    color: rgba(255, 255, 255, .68);
    background: rgba(255, 255, 255, .065);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 999px;
    padding: 5px 9px;
    font-size: .72rem;
    font-weight: 650;
}

.cita-plan-prices {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.cita-plan-price {
    background: rgba(0, 0, 0, .16);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    padding: 10px;
}

.cita-plan-price-label {
    display: block;
    color: rgba(255, 255, 255, .42);
    font-size: .66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 4px;
}

.cita-plan-price-value {
    display: block;
    color: #fff;
    font-size: .94rem;
    font-weight: 850;
}

.cita-plan-footer {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, .44);
    font-size: .72rem;
    line-height: 1.45;
    margin-top: 12px;
}

.cita-plan-footer svg {
    width: 14px;
    height: 14px;
    fill: #fbbf24;
    flex-shrink: 0;
}

@media (max-width: 520px) {
    .cita-plan-prices {
        grid-template-columns: 1fr;
    }

    .cita-plan-top {
        flex-direction: column;
        align-items: flex-start;
    }
}

.cita-doctors-card {
    max-width: 88%;
    align-self: flex-start;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: .84rem;
    line-height: 1.5;
    animation: cita-bubble-in .22s ease;
    background: rgba(59, 130, 246, .12);
    border: 1px solid rgba(96, 165, 250, .35);
    color: #dbeafe;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cita-doctors-card-header {
    border-bottom: 1px solid rgba(96, 165, 250, 0.2);
    padding-bottom: 6px;
    font-size: 0.88rem;
}

.cita-doctors-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cita-doctor-row {
    padding: 4px 0;
}

.cita-doctor-row:not(:last-child) {
    border-bottom: 1px dashed rgba(96, 165, 250, 0.15);
}

.cita-doctor-main {
    font-weight: 500;
}

.cita-doctor-name {
    font-weight: 600;
    color: #eff6ff;
}

.cita-doctor-specialty {
    font-weight: normal;
    color: rgba(219, 234, 254, 0.75);
    font-size: 0.8rem;
}

.cita-doctor-locations {
    font-size: 0.72rem;
    color: rgba(219, 234, 254, 0.6);
    margin-top: 2px;
}

.cita-doctors-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    border-top: 1px solid rgba(96, 165, 250, 0.2);
    padding-top: 10px;
}

.cita-doctors-pag-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #dbeafe;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cita-doctors-pag-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.3);
}

.cita-doctors-pag-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.cita-doctors-page-indicator {
    font-size: 0.75rem;
    color: rgba(219, 234, 254, 0.7);
    font-weight: 500;
}

/* ── Calendario / Disponibilidad ── */
.cita-cal-card {
    max-width: 88%;
    align-self: flex-start;
    background: rgba(255, 255, 255, .045);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px 18px;
    width: 100%;
    animation: cita-cal-in .3s cubic-bezier(.34, 1.2, .64, 1) both;
}

@keyframes cita-cal-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cita-cal-selection {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    background: rgba(34, 197, 94, .12);
    border: 1px solid rgba(34, 197, 94, .3);
    color: #4ade80;
    border-radius: 20px;
    padding: 5px 13px;
    font-size: .8rem;
    font-weight: 700;
    animation: cita-bubble-in .22s ease;
}

.cita-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cita-cal-month-label {
    font-size: .88rem;
    font-weight: 700;
    color: #fff;
    text-transform: capitalize;
}

.cita-cal-nav {
    background: none;
    border: 1px solid rgba(255, 255, 255, .14);
    color: rgba(255, 255, 255, .6);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: .9rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.cita-cal-nav:hover {
    background: rgba(255, 255, 255, .1);
}

.cita-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.cita-cal-wd {
    text-align: center;
    font-size: .62rem;
    font-weight: 700;
    color: rgba(255, 255, 255, .32);
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.cita-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.cita-cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: .8rem;
    color: rgba(255, 255, 255, .22);
    cursor: default;
    position: relative;
    transition: background .15s;
    border: 1px solid transparent;
}

.cita-cal-day.current-month {
    color: rgba(255, 255, 255, .55);
}

.cita-cal-day.past {
    color: rgba(255, 255, 255, .16);
    background: rgba(255, 255, 255, .025);
    cursor: not-allowed;
}

.cita-cal-day.unknown {
    color: rgba(255, 255, 255, .34);
    background: rgba(255, 255, 255, .035);
}

.cita-cal-day.available {
    color: #4ade80;
    background: rgba(34, 197, 94, .13);
    border-color: rgba(34, 197, 94, .36);
    cursor: pointer;
    font-weight: 800;
}

.cita-cal-day.unavailable {
    color: #fca5a5;
    background: rgba(239, 68, 68, .10);
    border-color: rgba(239, 68, 68, .28);
    cursor: not-allowed;
    font-weight: 700;
}

.cita-cal-day.unavailable:hover {
    background: rgba(239, 68, 68, .14);
}

.cita-cal-day.selected {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
}

.cita-cal-day.today::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.cita-cal-day.selected.today::after {
    background: rgba(255, 255, 255, .7);
}

.cita-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    font-size: .7rem;
    color: rgba(255, 255, 255, .42);
}

.cita-cal-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cita-cal-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.cita-cal-legend-dot.available {
    background: #22c55e;
}

.cita-cal-legend-dot.unavailable {
    background: #ef4444;
}

.cita-cal-legend-dot.unknown {
    background: rgba(255, 255, 255, .26);
}

.cita-slots-section {
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding-top: 12px;
}

.cita-slots-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: rgba(255, 255, 255, .32);
    margin-bottom: 8px;
}

.cita-slots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cita-slot-chip {
    background: rgba(var(--primary-rgb), .1);
    border: 1px solid rgba(var(--primary-rgb), .28);
    color: var(--primary);
    border-radius: 20px;
    padding: 5px 13px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
}

.cita-slot-chip:hover {
    background: rgba(var(--primary-rgb), .22);
}

.cita-slot-chip.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.cita-slot-chip:active {
    transform: scale(.94);
}

.cita-cal-meta {
    font-size: .76rem;
    color: rgba(255, 255, 255, .38);
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Panel Deslizante de Contacto (Paso 5)
   ========================================================================== */

.cita-contact-panel {
    position: fixed;
    top: 0;
    right: -420px; /* Oculto inicialmente (400px + 20px shadow/padding) */
    width: 400px;
    height: 100%;
    background: rgba(18, 20, 26, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-sizing: border-box;
}

.cita-contact-panel.open {
    right: 0;
}

.cita-contact-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cita-contact-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.cita-contact-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s, transform 0.2s;
}

.cita-contact-close:hover {
    color: #ffffff;
    transform: scale(1.1);
}

.cita-contact-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-sizing: border-box;
}

.cita-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cita-form-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cita-form-group input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px 14px;
    color: #ffffff;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.cita-form-group input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.cita-form-group input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* Campo rellenado por ALIEE (estado persistente; reemplaza al destello inline en JS). */
.cita-form-group input.cita-cf-filled {
    border-color: rgba(var(--primary-rgb), 0.5);
    background: rgba(var(--primary-rgb), 0.08);
}

/* Mensaje de error del panel (sustituye a window.alert). */
.cita-contact-error {
    margin: 0;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #fca5a5;
}

.cita-contact-error.hidden {
    display: none !important;
}

.cita-conflict-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    padding: 14px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cita-conflict-alert.hidden {
    display: none !important;
}

.cita-conflict-alert .conflict-msg {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #fca5a5;
}

.cita-btn-save-contact {
    margin-top: auto;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    padding: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
}

.cita-btn-save-contact:hover {
    background: rgba(var(--primary-rgb), 0.85);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.cita-btn-save-contact:active {
    transform: scale(0.98);
}

/* Responsividad para móviles */
@media (max-width: 480px) {
    .cita-contact-panel {
        width: 100%;
        right: -100%;
    }
}

/* ── Modal de Pago (Paso 6a) ── */
.cita-payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 12, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.cita-payment-modal.hidden {
    display: none !important;
}

.cita-payment-content {
    background: linear-gradient(145deg, #1e2029 0%, #13151a 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(var(--primary-rgb), 0.1);
    display: flex;
    flex-direction: column;
    animation: cita-modal-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes cita-modal-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.cita-payment-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cita-payment-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.02em;
}

.cita-payment-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    padding: 0 4px;
}

.cita-payment-close:hover {
    color: #ffffff;
}

.cita-payment-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 85vh;
    overflow-y: auto;
}

.cita-payment-summary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.summary-row .label {
    color: rgba(255, 255, 255, 0.5);
}

.summary-row .value {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.summary-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 6px 0;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
}

.summary-total strong {
    color: var(--primary);
    font-size: 1.25rem;
}

.cita-payment-note {
    background: rgba(var(--primary-rgb), 0.08);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.82rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.8);
}

#payment-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Contenedor de Stripe Elements */
#payment-element {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
    min-height: 150px;
}

.cita-payment-error {
    margin: 0;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.82rem;
    line-height: 1.4;
    color: #fca5a5;
}

.cita-payment-error.hidden {
    display: none !important;
}

.cita-btn-submit-payment {
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    padding: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.cita-btn-submit-payment:hover:not(:disabled) {
    background: rgba(var(--primary-rgb), 0.85);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.cita-btn-submit-payment:active:not(:disabled) {
    transform: scale(0.98);
}

.cita-btn-submit-payment:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
    display: inline-block;
}

.btn-spinner.hidden {
    display: none !important;
}

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

/* ── Tarjeta de Confirmación / Preagenda (Paso 6b) ── */
.cita-confirm-card {
    max-width: 88%;
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 20px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    animation: cita-confirm-in 0.4s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}

@keyframes cita-confirm-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cita-confirm-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cita-confirm-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    background: rgba(34, 197, 94, 0.12);
    border: 1.5px solid rgba(34, 197, 94, 0.4);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.2);
}

.cita-confirm-header.is-pending .cita-confirm-icon-wrap {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

/* Estados de la card de consulta (checkCaseStatus): expirada/cancelada en rojo,
   completada/terminal neutro en azul grisáceo. Solo cambia el color del icono. */
.cita-confirm-header.is-expired .cita-confirm-icon-wrap,
.cita-confirm-header.is-cancelled .cita-confirm-icon-wrap {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.cita-confirm-header.is-done .cita-confirm-icon-wrap {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.4);
    box-shadow: 0 0 15px rgba(148, 163, 184, 0.2);
}

.cita-confirm-icon {
    width: 24px;
    height: 24px;
    fill: #22c55e;
}

.cita-confirm-header.is-pending .cita-confirm-icon {
    fill: #f59e0b;
}

.cita-confirm-header.is-expired .cita-confirm-icon,
.cita-confirm-header.is-cancelled .cita-confirm-icon {
    fill: #ef4444;
}

.cita-confirm-header.is-done .cita-confirm-icon {
    fill: #94a3b8;
}

/* Nota compacta de reenvío de correo (createResendNote): solo el aviso, sin grid. */
.cita-resend-note {
    padding: 10px 12px;
}

.cita-resend-note .cita-confirm-warning {
    margin-top: 0;
}

.cita-confirm-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 4px;
}

.cita-confirm-subtitle {
    font-size: 0.78rem;
    font-family: monospace;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.02em;
}

.cita-confirm-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cita-confirm-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cita-confirm-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.cita-confirm-label {
    color: rgba(255, 255, 255, 0.45);
}

.cita-confirm-value {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    text-align: right;
}

.cita-confirm-row.price-row {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.cita-confirm-row.price-row .cita-confirm-value.highlight {
    font-size: 1.05rem;
    color: #ffffff;
    font-weight: 800;
}

.cita-confirm-warning {
    display: flex;
    gap: 10px;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 4px;
    align-items: flex-start;
}

.cita-confirm-warning-icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}

.cita-confirm-warning-text {
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.75);
}

.cita-confirm-warning-text strong {
    color: #f59e0b;
    font-weight: 700;
}

.cita-confirm-actions {
    margin-top: 6px;
    display: flex;
}

.cita-confirm-pay-btn {
    width: 100%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    font-weight: 750;
    font-size: 0.88rem;
    padding: 11px;
    border-radius: 10px;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.cita-confirm-pay-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
    opacity: 0.95;
}

.cita-confirm-pay-btn:active {
    transform: translateY(1px);
}

/* ── Tarjeta de paquetes prepagados disponibles (Paso 9) ── */
.cita-package-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cita-package-item {
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.18);
    border-radius: 12px;
    padding: 12px 14px;
}

.cita-package-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2px;
}

.cita-package-sessions {
    font-size: 0.82rem;
    color: rgba(34, 197, 94, 0.95);
    font-weight: 600;
}

.cita-package-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.cita-package-pill {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 3px 9px;
}

/* ── Tarjeta de Resumen de Entrevista Clínica (Paso 7) ── */
.cita-interview-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .035));
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 20px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
    width: 100%;
    max-width: 85%;
    align-self: flex-start;
    animation: cita-cal-in .38s cubic-bezier(.34, 1.35, .64, 1) both;
}

.cita-interview-card::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), .12);
    pointer-events: none;
}

.cita-interview-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 16px 14px;
    border-bottom: 1px dashed rgba(255, 255, 255, .08);
    text-align: center;
    position: relative;
    z-index: 1;
}

.cita-interview-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), .16);
    border: 1.5px solid rgba(var(--primary-rgb), .35);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    color: rgba(var(--primary-rgb), 1);
}

.cita-interview-icon {
    width: 22px;
    height: 22px;
}

.cita-interview-title {
    font-size: 1rem;
    font-weight: 850;
    color: #ffffff;
    letter-spacing: .01em;
}

.cita-interview-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.cita-interview-qa {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cita-interview-qa:not(:last-child) {
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cita-interview-question {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
}

.cita-interview-answer {
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.45;
    padding-left: 8px;
    border-left: 2px solid rgba(var(--primary-rgb), 0.4);
}

