:root {
    --bba-primary: #0073aa;
    --bba-primary-dark: #005177;
    --bba-primary-rgb: 0, 115, 170;
    --bba-success: #28a745;
    --bba-success-rgb: 40, 167, 69;
    --bba-surface: #ffffff;
    --bba-text: #212529;
    --bba-muted: #6c757d;
    --bba-border: #e9ecef;
    --bba-input-border: #ced4da;
    --bba-bg-subtle: #f8f9fa;
    --bba-error-bg: #f8d7da;
    --bba-error-text: #721c24;
}

#bba-booking-wizard {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    background: var(--bba-surface);
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    overflow: hidden;
}

.bba-wizard-header {
    background: var(--bba-header-bg, linear-gradient(135deg, var(--bba-primary) 0%, var(--bba-primary-dark) 100%));
    color: var(--bba-header-text, #fff);
    padding: 32px 28px;
    text-align: center;
}

#bba-booking-wizard .bba-wizard-header .bba-wizard-title {
    margin: 0 0 8px;
    font-size: 1.6em;
    font-weight: 600;
    color: var(--bba-title-color, inherit);
}

#bba-booking-wizard .bba-wizard-header .bba-wizard-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95em;
    color: var(--bba-subtitle-color, inherit);
}

.bba-wizard-body {
    display: flex;
    min-height: 480px;
}

.bba-stepper {
    width: 260px;
    background: var(--bba-bg-subtle);
    border-right: 1px solid var(--bba-border);
    padding: 24px 16px;
    flex-shrink: 0;
}

.bba-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    opacity: 0.55;
    transition: all 0.2s ease;
}

.bba-step.active {
    background: var(--bba-surface);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    opacity: 1;
}

.bba-step.completed {
    opacity: 1;
}

.bba-step-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bba-border);
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bba-step.active .bba-step-icon {
    background: var(--bba-primary);
    color: #fff;
}

.bba-step.completed .bba-step-icon {
    background: var(--bba-success);
    color: #fff;
}

.bba-step-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bba-step-label {
    font-weight: 600;
    font-size: 0.95em;
    color: var(--bba-text);
}

.bba-step-desc {
    font-size: 0.82em;
    color: var(--bba-muted);
}

.bba-step-summary {
    font-size: 0.78em;
    color: var(--bba-primary);
    font-weight: 500;
    margin-top: 2px;
    min-height: 1.2em;
}

.bba-wizard-content {
    flex: 1;
    padding: 28px;
}

.bba-step-panel {
    display: none;
}

.bba-step-panel.active {
    display: block;
    animation: bbaFadeIn 0.25s ease;
}

@keyframes bbaFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.bba-panel-title {
    margin: 0 0 20px;
    font-size: 1.25em;
    color: var(--bba-text);
}

.bba-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.bba-card {
    border: 1px solid var(--bba-border);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bba-surface);
}

.bba-card:hover {
    border-color: var(--bba-primary);
    box-shadow: 0 4px 12px rgba(var(--bba-primary-rgb), 0.10);
}

.bba-card.selected {
    border-color: var(--bba-primary);
    background: rgba(var(--bba-primary-rgb), 0.08);
}

.bba-card-title {
    font-weight: 600;
    font-size: 1.05em;
    margin-bottom: 6px;
    color: var(--bba-text);
}

.bba-card-desc {
    font-size: 0.88em;
    color: var(--bba-muted);
    margin-bottom: 10px;
    line-height: 1.4;
}

.bba-card-meta {
    font-size: 0.85em;
    color: var(--bba-primary);
    font-weight: 500;
}

#bba-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#bba-calendar-header button {
    background: var(--bba-bg-subtle);
    border: none;
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 1em;
    color: #495057;
}

#bba-calendar-header button:hover {
    background: var(--bba-border);
}

#bba-month-label {
    font-weight: 600;
    font-size: 1.1em;
    text-transform: capitalize;
}

#bba-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.bba-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.8em;
    color: var(--bba-muted);
    padding: 8px 0;
}

.bba-day-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.9em;
    background: var(--bba-surface);
    border: 1px solid var(--bba-border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.bba-day-cell.empty {
    border: none;
    background: transparent;
    cursor: default;
}

.bba-day-cell.disabled {
    color: var(--bba-input-border);
    background: var(--bba-bg-subtle);
    cursor: not-allowed;
}

.bba-day-cell.has-slots {
    background: rgba(var(--bba-primary-rgb), 0.08);
    border-color: var(--bba-primary);
    color: var(--bba-primary);
    font-weight: 600;
}

.bba-day-cell.has-slots:hover {
    background: var(--bba-primary);
    color: #fff;
}

.bba-day-cell.selected {
    background: var(--bba-primary);
    color: #fff;
}

.bba-modal-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.bba-slot-btn {
    padding: 12px;
    border: 1px solid var(--bba-border);
    background: var(--bba-surface);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.15s ease;
}

.bba-slot-btn:hover {
    border-color: var(--bba-primary);
    background: rgba(var(--bba-primary-rgb), 0.08);
}

.bba-slot-btn.selected {
    background: var(--bba-primary);
    color: #fff;
    border-color: var(--bba-primary);
}

.bba-time-ampm {
    font-size: 0.85em;
    color: var(--bba-text);
    font-weight: 500;
    margin-left: 2px;
}

#bba-booking-form label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 500;
    font-size: 0.9em;
    color: #495057;
}

#bba-booking-form input,
#bba-booking-form textarea,
#bba-booking-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bba-input-border);
    border-radius: 6px;
    font-size: 0.95em;
    box-sizing: border-box;
}

#bba-booking-form input:focus,
#bba-booking-form textarea:focus,
#bba-booking-form select:focus {
    outline: none;
    border-color: var(--bba-primary);
    box-shadow: 0 0 0 3px rgba(var(--bba-primary-rgb), 0.08);
}

.bba-policy-wrap {
    margin-top: 16px;
    padding: 12px;
    background: var(--bba-bg-subtle);
    border-radius: 6px;
}

.bba-policy-label {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    margin: 0 !important;
    font-weight: 400 !important;
    cursor: pointer;
}

.bba-policy-label input {
    width: auto !important;
    margin-top: 3px;
}

.bba-policy-label a {
    color: var(--bba-primary);
    text-decoration: underline;
}

.bba-panel-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
}

.bba-btn-primary,
.bba-btn-back {
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}

.bba-btn-primary {
    background: var(--bba-primary);
    color: #fff;
}

.bba-btn-primary:hover {
    background: var(--bba-primary-dark);
}

.bba-btn-primary:disabled {
    background: var(--bba-muted);
    cursor: not-allowed;
}

.bba-btn-back {
    background: var(--bba-border);
    color: #495057;
}

.bba-btn-back:hover {
    background: var(--bba-input-border);
}

.bba-error {
    background: var(--bba-error-bg);
    color: var(--bba-error-text);
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9em;
}

.bba-loading {
    text-align: center;
    padding: 40px;
    color: var(--bba-muted);
}

.bba-success-screen {
    animation: bbaFadeIn 0.3s ease;
}

.bba-success-screen h2 {
    color: var(--bba-success);
    margin-bottom: 12px;
}

.bba-transfer-box {
    background: var(--bba-bg-subtle);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.bba-account-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.bba-account-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--bba-border);
}

.bba-calendar-links {
    margin-top: 24px;
}

.bba-calendar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.bba-order-summary {
    background: var(--bba-bg-subtle);
    border: 1px solid var(--bba-border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
}

.bba-order-summary h4 {
    margin: 0 0 16px;
    font-size: 1.05em;
    color: var(--bba-text);
}

.bba-summary-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 16px;
    margin: 0;
}

.bba-summary-list dt {
    font-weight: 500;
    color: var(--bba-muted);
    font-size: 0.88em;
}

.bba-summary-list dd {
    margin: 0;
    color: var(--bba-text);
    font-size: 0.95em;
}

.bba-summary-list dt.bba-summary-total,
.bba-summary-list dd.bba-summary-total {
    padding-top: 10px;
    border-top: 1px solid var(--bba-border);
    font-weight: 600;
    color: var(--bba-primary);
    font-size: 1.05em;
}

.bba-payment-title {
    margin: 0 0 14px;
    font-size: 1.05em;
    color: var(--bba-text);
}

.bba-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.bba-payment-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--bba-border);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bba-surface);
    transition: all 0.15s ease;
}

.bba-payment-option:hover {
    border-color: var(--bba-primary);
}

.bba-payment-option input {
    width: auto;
    margin: 0;
}

.bba-payment-option span {
    font-weight: 500;
    color: #495057;
}

.bba-payment-option:has(input:checked) {
    border-color: var(--bba-primary);
    background: rgba(var(--bba-primary-rgb), 0.08);
}

#bba-price-display {
    display: none;
}

.bba-currency-selector {
    margin-bottom: 20px;
    padding: 14px;
    background: var(--bba-bg-subtle);
    border: 1px solid var(--bba-border);
    border-radius: 10px;
}

.bba-currency-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--bba-text);
}

.bba-currency-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.bba-currency-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--bba-border);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bba-surface);
    transition: all 0.15s ease;
}

.bba-currency-option:hover {
    border-color: var(--bba-primary);
}

.bba-currency-option input {
    width: auto;
    margin: 0;
}

.bba-currency-option span {
    font-weight: 500;
    color: var(--bba-text);
}

.bba-currency-option.selected {
    border-color: var(--bba-primary);
    background: rgba(var(--bba-primary-rgb), 0.08);
}

@media (max-width: 768px) {
    .bba-wizard-body {
        flex-direction: column;
    }

    .bba-stepper {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--bba-border);
        padding: 16px;
        display: flex;
        overflow-x: auto;
    }

    .bba-step {
        min-width: 140px;
        margin-bottom: 0;
        margin-right: 8px;
    }

    .bba-wizard-content {
        padding: 18px;
    }

    .bba-summary-list {
        grid-template-columns: 110px 1fr;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   Resumen de cita — [bariatric_resumen_cita]
   El estado se lee como posición en el recorrido, y la fecha manda.
   Hereda la tipografía del tema y el color primario del panel.
   ══════════════════════════════════════════════════════════════════════ */
.bba-appt {
    --appt-accent: var(--bba-primary, #0073aa);
    --appt-line: #e4e7eb;
    --appt-ink: var(--bba-text, #1a1d21);
    --appt-muted: #6b7280;

    max-width: 620px;
    margin: 0 auto;
    padding: 40px 40px 32px;
    background: var(--bba-surface, #fff);
    border: 1px solid var(--appt-line);
    border-radius: 14px;
    color: var(--appt-ink);
    font-family: inherit;
    line-height: 1.55;
}

.bba-appt--confirmed,
.bba-appt--completed { --appt-accent: #16794f; }
.bba-appt--pending_payment,
.bba-appt--pending_transfer { --appt-accent: #b45309; }
.bba-appt--cancelled,
.bba-appt--unknown { --appt-accent: #9ca3af; }
.bba-appt--rejected { --appt-accent: #b91c1c; }

.bba-appt__title {
    margin: 0 0 6px;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    color: var(--appt-ink);
}

.bba-appt__intro {
    margin: 0;
    color: var(--appt-muted);
    font-size: .97rem;
}

/* ── Recorrido de la cita ─────────────────────────────────────────── */
.bba-appt__track {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: none;
}

.bba-appt__step {
    position: relative;
    padding-top: 20px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #9ca3af;
    text-align: center;
}

/* Línea de unión: se dibuja hacia la izquierda, salvo en el primer paso. */
.bba-appt__step::before {
    content: "";
    position: absolute;
    top: 5px;
    right: 50%;
    left: -50%;
    height: 2px;
    background: var(--appt-line);
}

.bba-appt__step:first-child::before { display: none; }

.bba-appt__dot {
    position: absolute;
    top: 0;
    left: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border: 2px solid var(--appt-line);
    border-radius: 50%;
    background: var(--bba-surface, #fff);
}

.bba-appt__step.is-done { color: var(--appt-muted); }
.bba-appt__step.is-done::before { background: var(--appt-accent); }
.bba-appt__step.is-done .bba-appt__dot {
    border-color: var(--appt-accent);
    background: var(--appt-accent);
}

.bba-appt__step.is-current { color: var(--appt-accent); }
.bba-appt__step.is-current::before { background: var(--appt-accent); }
.bba-appt__step.is-current .bba-appt__dot {
    border-color: var(--appt-accent);
    background: var(--bba-surface, #fff);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, .06);
}

/* ── La fecha: el dato que el paciente vino a ver ─────────────────── */
.bba-appt__when {
    margin: 32px 0 0;
    padding: 24px 0;
    border-top: 1px solid var(--appt-line);
    border-bottom: 1px solid var(--appt-line);
}

.bba-appt__weekday {
    margin: 0;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--appt-accent);
}

.bba-appt__date {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 4px 0 0;
}

.bba-appt__daynum {
    font-size: 3.4rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.04em;
    font-variant-numeric: tabular-nums;
}

.bba-appt__month {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--appt-muted);
    text-transform: lowercase;
}

.bba-appt__time {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.bba-appt__duration {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--appt-muted);
    padding: 3px 9px;
    border: 1px solid var(--appt-line);
    border-radius: 999px;
}

/* ── Datos de la cita ─────────────────────────────────────────────── */
.bba-appt__facts {
    margin: 0;
    padding: 24px 0 0;
}

.bba-appt__fact {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 16px;
    padding: 9px 0;
}

.bba-appt__fact dt {
    margin: 0;
    font-size: .82rem;
    font-weight: 600;
    color: var(--appt-muted);
}

.bba-appt__fact dd {
    margin: 0;
    font-size: .95rem;
    font-weight: 500;
}

.bba-appt__sub {
    display: block;
    font-size: .82rem;
    font-weight: 400;
    color: var(--appt-muted);
}

/* ── Bloques de acción ────────────────────────────────────────────── */
.bba-appt__panel {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--appt-line);
}

.bba-appt__panel-title {
    margin: 0 0 10px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--appt-muted);
}

.bba-appt__panel p { margin: 0 0 10px; }

.bba-appt__accounts {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.bba-appt__accounts li {
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--bba-bg-subtle, #f8f9fa);
    border-radius: 8px;
}

.bba-appt__bank {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--appt-muted);
}

.bba-appt__number {
    display: block;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
}

.bba-appt__cta {
    display: inline-block;
    padding: 13px 26px;
    background: var(--appt-accent);
    color: #fff;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: opacity .15s ease;
}

.bba-appt__cta:hover,
.bba-appt__cta:focus { opacity: .88; color: #fff; }

.bba-appt__cta:focus-visible,
.bba-appt__calendar a:focus-visible {
    outline: 2px solid var(--appt-accent);
    outline-offset: 3px;
}

.bba-appt__calendar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bba-appt__calendar a {
    padding: 7px 15px;
    border: 1px solid var(--appt-line);
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--appt-ink);
}

.bba-appt__calendar a:hover { border-color: var(--appt-accent); color: var(--appt-accent); }

@media (prefers-reduced-motion: reduce) {
    .bba-appt__cta { transition: none; }
}

@media (max-width: 560px) {
    .bba-appt { padding: 28px 22px 24px; border-radius: 10px; }
    .bba-appt__title { font-size: 1.3rem; }
    .bba-appt__daynum { font-size: 2.8rem; }
    .bba-appt__step { font-size: .62rem; letter-spacing: .03em; }
    .bba-appt__fact { grid-template-columns: 1fr; gap: 2px; }
}

.bba-appt__error {
    margin: 0 0 12px;
    padding: 11px 14px;
    background: var(--bba-error-bg, #f8d7da);
    color: var(--bba-error-text, #721c24);
    border-radius: 8px;
    font-size: .9rem;
}

button.bba-appt__cta {
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

button.bba-appt__cta:disabled { opacity: .6; cursor: progress; }
