* {
    box-sizing: border-box;
}

body.app-body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(160deg, var(--ts-sky) 0%, var(--ts-gray-100) 45%, var(--ts-mint) 100%);
    color: var(--ts-text);
    min-height: 100dvh;
}

/* Contenedor tipo app en celular y centrado en desktop */
.app-shell {
    max-width: var(--app-shell-max);
    margin: 0 auto;
    min-height: 100dvh;
    background: var(--app-bg);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.06);
}

@media (min-width: 480px) {
    body.app-body {
        padding: 1rem 0;
    }

    .app-shell {
        min-height: calc(100dvh - 2rem);
        border-radius: 24px;
        overflow: hidden;
        box-shadow: var(--app-shadow-lg);
    }
}

/* Header */
.app-header {
    flex-shrink: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--ts-teal) 0%, var(--ts-blue) 100%);
    color: #fff;
    padding: 0.875rem 1.25rem;
    padding-top: calc(0.875rem + env(safe-area-inset-top));
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.app-header-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    opacity: 0.95;
}

.app-header-brand i {
    font-size: 1.15rem;
}

.app-header-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0.15rem 0 0;
    line-height: 1.2;
}

.app-header-subtitle {
    font-size: 0.8rem;
    opacity: 0.85;
    margin: 0;
}

.app-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

a.app-header-avatar {
    color: #fff;
    transition: background 0.15s ease, transform 0.15s ease;
}

a.app-header-avatar:hover {
    background: rgba(255, 255, 255, 0.32);
    color: #fff;
    transform: scale(1.03);
}

/* Main content */
.app-main {
    flex: 1;
    padding: 1.25rem 1rem;
    padding-bottom: calc(var(--app-nav-height) + env(safe-area-inset-bottom) + 1.25rem);
    overflow-y: auto;
}

/* Cards */
.app-card {
    background: var(--app-surface);
    border-radius: var(--app-radius);
    padding: 1.25rem;
    box-shadow: var(--app-shadow);
    border: 1px solid rgba(2, 132, 199, 0.06);
    margin-bottom: 1rem;
}

.app-card:last-child {
    margin-bottom: 0;
}

.app-card-highlight {
    background: linear-gradient(135deg, #ecfeff 0%, #ffffff 55%, #f0fdfa 100%);
    border-color: rgba(13, 148, 136, 0.12);
}

.app-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--ts-teal) 0%, var(--ts-blue) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.app-card-icon-sky {
    background: linear-gradient(135deg, var(--ts-blue) 0%, var(--ts-blue-light) 100%);
}

.app-card-icon-mint {
    background: linear-gradient(135deg, #14b8a6 0%, var(--ts-teal-light) 100%);
}

.app-card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ts-text-muted);
    margin-bottom: 0.15rem;
}

.app-card-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ts-text);
    margin: 0;
}

.app-card-meta {
    font-size: 0.8rem;
    color: var(--ts-text-muted);
    margin: 0.25rem 0 0;
}

/* CTA principal */
.app-cta-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    min-height: 54px;
    padding: 0.875rem 1.5rem;
    margin-bottom: 1rem;
    border: none;
    border-radius: var(--app-radius);
    background: linear-gradient(135deg, var(--ts-teal) 0%, var(--ts-blue) 100%);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-cta-primary:hover,
.app-cta-primary:focus {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(2, 132, 199, 0.35);
}

.app-cta-primary:active {
    transform: scale(0.98);
}

/* Card asistente IA */
.app-assistant-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: linear-gradient(135deg, #f0f9ff 0%, #ecfeff 100%);
    border: 1px solid rgba(2, 132, 199, 0.15);
    border-radius: var(--app-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-assistant-card:hover {
    color: inherit;
    transform: translateY(-2px);
    box-shadow: var(--app-shadow-lg);
}

.app-assistant-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--ts-blue);
    background: rgba(2, 132, 199, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    margin-bottom: 0.5rem;
}

.app-assistant-disclaimer {
    font-size: 0.72rem;
    color: var(--ts-text-muted);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(2, 132, 199, 0.2);
}

/* Accesos rápidos */
.app-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.app-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 88px;
    padding: 1rem 0.75rem;
    background: var(--app-surface);
    border-radius: var(--app-radius-sm);
    box-shadow: var(--app-shadow);
    text-decoration: none;
    color: var(--ts-text);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(2, 132, 199, 0.06);
    transition: transform 0.15s ease, background 0.15s ease;
}

.app-quick-action i {
    font-size: 1.4rem;
    color: var(--ts-teal);
}

.app-quick-action:hover {
    color: var(--ts-teal);
    background: var(--ts-sky);
    transform: translateY(-1px);
}

/* Sección */
.app-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ts-text-muted);
    margin: 0 0 0.75rem 0.25rem;
}

/* Botones Bootstrap override */
.app-btn {
    min-height: 48px;
    border-radius: var(--app-radius-sm);
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, var(--ts-teal) 0%, var(--ts-blue) 100%);
    border: none;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, var(--app-primary-dark) 0%, #0369a1 100%);
    border: none;
}

/* Bottom navigation — absolute dentro del shell (override Bootstrap fixed-bottom) */
.app-shell > .app-bottom-nav.fixed-bottom {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 200;
}
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: calc(var(--app-nav-height) + env(safe-area-inset-bottom));
    padding: 0 0.25rem env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(2, 132, 199, 0.08);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.06);
}

.app-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.5rem 0;
    text-decoration: none;
    color: var(--ts-gray-400);
    font-size: 0.62rem;
    font-weight: 600;
    min-height: 44px;
    transition: color 0.15s ease;
}

.app-nav-item i {
    font-size: 1.2rem;
}

.app-nav-item.active {
    color: var(--ts-teal);
}

.app-nav-item-primary {
    position: relative;
    top: -14px;
}

.app-nav-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ts-teal) 0%, var(--ts-blue) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
    border: 3px solid var(--app-surface);
}

.app-nav-item-primary.active .app-nav-fab,
.app-nav-item-primary .app-nav-fab {
    color: #fff;
}

.app-nav-item-primary span {
    margin-top: 0.15rem;
    color: var(--ts-teal);
}

/* Placeholder pages */
.app-placeholder-card {
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.app-placeholder-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--ts-sky);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-placeholder-icon i {
    font-size: 2rem;
    color: var(--ts-blue);
}

.app-badge-soon {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ts-blue);
    background: var(--ts-sky);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    margin-top: 0.75rem;
}

/* ========== Guest / Landing ========== */
body.guest-body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100dvh;
    background: linear-gradient(165deg, #e0f2fe 0%, #f0fdfa 40%, #f8fafc 100%);
    color: var(--ts-text);
}

.guest-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.guest-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    padding-top: calc(2rem + env(safe-area-inset-top));
    text-align: center;
}

.guest-logo-wrap {
    width: 88px;
    height: 88px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--ts-teal) 0%, var(--ts-blue) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 12px 32px rgba(2, 132, 199, 0.25);
}

.guest-logo-wrap i {
    font-size: 2.75rem;
    color: #fff;
}

.guest-title {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--ts-teal) 0%, var(--ts-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.guest-subtitle {
    font-size: 1.05rem;
    color: var(--ts-text-muted);
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 2rem;
    line-height: 1.5;
    text-align: center;
}

.guest-main-card .guest-features-row {
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
}

.guest-main-card .guest-features-row > [class*="col-"] {
    display: flex;
    justify-content: center;
}

.guest-main-card {
    background: rgba(255, 255, 255, 0.92);
}

.guest-features-row .guest-feature {
    height: 100%;
}

.guest-feature {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.75);
    border-radius: var(--app-radius-sm);
    border: 1px solid rgba(2, 132, 199, 0.08);
    font-size: 0.875rem;
    color: var(--ts-gray-600);
}

.guest-feature i {
    font-size: 1.25rem;
    color: var(--ts-teal);
    flex-shrink: 0;
}

.guest-actions {
    width: 100%;
    max-width: 400px;
}

.guest-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 54px;
    padding: 0.875rem 1.5rem;
    border-radius: var(--app-radius);
    background: linear-gradient(135deg, var(--ts-teal) 0%, var(--ts-blue) 100%);
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(2, 132, 199, 0.28);
    transition: transform 0.15s ease;
}

.guest-btn-primary:hover {
    color: #fff;
    transform: translateY(-2px);
}

.guest-btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 52px;
    padding: 0.875rem 1.5rem;
    border-radius: var(--app-radius);
    background: var(--ts-white);
    color: var(--ts-gray-800);
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(2, 132, 199, 0.15);
    transition: background 0.15s ease;
}

.guest-btn-secondary:hover {
    background: var(--ts-sky);
    color: var(--ts-blue);
}

.guest-footer {
    padding: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--ts-text-muted);
}

@media (min-width: 768px) {
    .guest-hero {
        padding: 3rem 2rem;
    }

    .guest-features {
        grid-template-columns: repeat(3, 1fr);
        max-width: 720px;
    }

    .guest-feature {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem 1rem;
    }
}

/* ========== Auth (login / registro) ========== */
.auth-body .auth-shell {
    min-height: 100dvh;
}

.auth-main {
    padding-bottom: 2rem;
}

.auth-card {
    background: var(--app-surface);
    max-width: 100%;
}

.auth-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--ts-gray-800);
    margin-bottom: 0.35rem;
}

.auth-input {
    border: 1px solid rgba(13, 148, 136, 0.15);
    padding: 0.75rem 1rem;
    font-size: 1rem;
}

.auth-input:focus {
    border-color: var(--ts-teal);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.15);
}

.auth-submit {
    min-height: 52px;
    font-weight: 700;
}

.auth-link {
    color: var(--ts-blue);
    font-weight: 600;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--ts-teal);
    text-decoration: underline;
}

.auth-link-muted {
    color: var(--ts-text-muted);
    text-decoration: none;
}

.auth-link-muted:hover {
    color: var(--ts-blue);
}

.app-alert {
    font-size: 0.9rem;
}

.profile-avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
}

/* ========== Turnos (Etapa 2) ========== */
.appointment-slot-card,
.appointment-item-card {
    background: var(--app-surface);
    border: 1px solid rgba(13, 148, 136, 0.08);
}

.appointment-slot-badge {
    background: var(--ts-sky);
    color: var(--ts-blue);
    font-weight: 600;
}

.appointment-slot-time {
    color: var(--ts-teal);
    font-size: 1.1rem;
}

.appointment-slot-date {
    font-weight: 700;
    color: var(--ts-text);
}

.appointment-item-cancelled {
    opacity: 0.75;
}

.appointment-confirm-list .list-group-item {
    background: transparent;
    border-color: rgba(13, 148, 136, 0.08);
}

/* Asistente IA — chat mobile first */
.assistant-shell {
    padding-bottom: 0.5rem;
}

.assistant-disclaimer {
    font-size: 0.75rem;
    color: var(--ts-text-muted);
    background: linear-gradient(135deg, #f0f9ff 0%, #ecfeff 100%);
    border: 1px solid rgba(2, 132, 199, 0.12);
    padding: 0.65rem 0.85rem;
}

.assistant-mode-badge {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--ts-blue);
    background: rgba(2, 132, 199, 0.1);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
}

.assistant-chat {
    display: flex;
    flex-direction: column;
    min-height: 420px;
    max-height: calc(100dvh - 280px);
    overflow: hidden;
}

.assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--ts-gray-50);
}

.assistant-msg {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 100%;
}

.assistant-msg-user {
    justify-content: flex-end;
}

.assistant-msg-bot {
    justify-content: flex-start;
}

.assistant-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(13, 148, 136, 0.12);
    color: var(--ts-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.assistant-msg-bubble {
    max-width: 85%;
    padding: 0.65rem 0.85rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    line-height: 1.45;
    box-shadow: var(--app-shadow);
}

.assistant-msg-user .assistant-msg-bubble {
    background: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.assistant-msg-bot .assistant-msg-bubble {
    background: #fff;
    color: var(--ts-text);
    border: 1px solid rgba(13, 148, 136, 0.08);
    border-bottom-left-radius: 0.25rem;
}

.assistant-msg-time {
    display: block;
    font-size: 0.65rem;
    opacity: 0.65;
    margin-top: 0.35rem;
    text-align: right;
}

.assistant-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    border-top: 1px solid rgba(13, 148, 136, 0.08);
    background: #fff;
}

.assistant-chip {
    border: 1px solid rgba(2, 132, 199, 0.2);
    background: #f0f9ff;
    color: var(--ts-blue);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.assistant-chip:hover,
.assistant-chip:focus {
    background: rgba(2, 132, 199, 0.15);
    outline: none;
}

.assistant-chip-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.assistant-chip-link:hover,
.assistant-chip-link:focus {
    color: var(--ts-blue);
    text-decoration: none;
}

.assistant-form {
    border-top: 1px solid rgba(13, 148, 136, 0.08);
    background: #fff;
}

.assistant-input {
    border-color: rgba(13, 148, 136, 0.15);
    font-size: 0.95rem;
}

.assistant-send {
    min-width: 48px;
}

.assistant-slot-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.assistant-slot-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #f0fdfa;
    border: 1px solid rgba(13, 148, 136, 0.15);
    border-radius: 0.65rem;
    padding: 0.55rem 0.65rem;
    transition: background 0.15s ease, transform 0.15s ease;
}

.assistant-slot-card:hover {
    background: #ccfbf1;
    color: inherit;
    transform: translateY(-1px);
}

.assistant-slot-date {
    display: block;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--ts-teal);
}

.assistant-slot-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--ts-text-muted);
}

.assistant-slot-action {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ts-blue);
    margin-top: 0.15rem;
}

.assistant-debug {
    background: #fffbeb;
    border: 1px dashed #f59e0b;
    color: #92400e;
    padding: 0.65rem 0.85rem;
}

.assistant-debug ul {
    padding-left: 1.1rem;
}
