/* ═══════════════════════════════════════════
   OLIVIO ROMANO - Design System v2
   ═══════════════════════════════════════════ */

:root {
    --primary: #8B1A1A;
    --primary-dark: #6B1414;
    --primary-light: #B83030;
    --primary-subtle: rgba(139,26,26,0.06);
    --primary-glow: rgba(139,26,26,0.12);
    --olive: #5C6B3C;
    --olive-subtle: rgba(92,107,60,0.08);
    --gold: #C5A028;
    --bg: #F4F4F6;
    --bg-warm: #FAF9F7;
    --white: #FFFFFF;
    --text: #1A1A1A;
    --text-body: #444;
    --text-muted: #888;
    --text-faint: #B0B0B0;
    --border: #E5E5E8;
    --border-light: #F0F0F2;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.07);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.10);
    --shadow-xl: 0 24px 60px rgba(0,0,0,0.14);
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-full: 9999px;
    --ease: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --header-h: 80px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--bg);
    color: var(--text-body);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─── HEADER ─── */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 100;
}

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

.header-left .logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.header-left .logo img {
    height: 58px;
    width: 58px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.header-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary-dark);
    white-space: nowrap;
}

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

.header-contributo-wrapper {
    border-left: 1px solid var(--border);
    padding-left: 1rem;
    display: flex;
    align-items: center;
}

.contributo-label {
    display: none;
}

.header-contributo {
    height: 54px;
    width: auto;
    display: block;
    object-fit: contain;
}

.logo img { height: 34px; display: block; }
.logo-fallback { font-weight: 700; font-size: 0.9rem; color: var(--primary); }
.logo-fallback strong { font-weight: 800; }

.header-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 500;
    transition: var(--ease);
}
.header-link:hover { color: var(--primary); }

/* ─── MAIN ─── */

main {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* ═══════════════════════════════════════════
   LEFT PANEL
   ═══════════════════════════════════════════ */

.olivio-panel {
    width: 370px;
    flex-shrink: 0;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ─── Static view ─── */

.panel-static {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.panel-static::-webkit-scrollbar { width: 4px; }
.panel-static::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.olivio-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 2.5;
    overflow: hidden;
    flex-shrink: 0;
    max-height: 280px;
}

.olivio-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.olivio-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.35) 0%, transparent 50%);
    display: flex;
    align-items: flex-end;
    padding: 1rem 1.25rem;
}

.olivio-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    padding: 0.35rem 0.8rem;
    border-radius: var(--r-full);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.pulse-dot {
    width: 8px; height: 8px;
    background: #34C759;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}
.pulse-dot.small { width: 6px; height: 6px; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* ─── Info section ─── */

.olivio-info {
    padding: 0.9rem 1.25rem 0;
}

.olivio-info h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.olivio-role {
    font-size: 0.82rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.olivio-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-top: 0.6rem;
}

.olivio-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.9rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--olive-subtle);
    color: var(--olive);
    padding: 0.35rem 0.7rem;
    border-radius: var(--r-full);
    font-size: 0.72rem;
    font-weight: 600;
}

.panel-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0.75rem 1.25rem 0;
}

/* ─── Upgrade section ─── */

.upgrade-section {
    padding: 0.75rem 1.25rem 1rem;
}

.upgrade-banner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: linear-gradient(135deg, #fef7f0 0%, #fdf2f2 100%);
    border: 1.5px solid var(--primary-glow);
    padding: 1rem 1.1rem;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: var(--ease);
}
.upgrade-banner:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(139,26,26,0.1);
}

.upgrade-icon {
    width: 42px; height: 42px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upgrade-text { flex: 1; min-width: 0; }
.upgrade-text strong { display: block; font-size: 0.85rem; color: var(--text); }
.upgrade-text span { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

.upgrade-chevron {
    color: var(--primary);
    flex-shrink: 0;
    transition: var(--ease);
}
.upgrade-banner:hover .upgrade-chevron { transform: translateX(3px); }

/* ─── Email form ─── */

.email-form {
    display: none;
    flex-direction: column;
    gap: 0.6rem;
    animation: slideUp 0.3s ease;
}

.email-back {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    transition: var(--ease);
}
.email-back:hover { color: var(--text); }

.email-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 0.2rem;
}

.email-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.email-form input[type="text"],
.email-form input[type="email"] {
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg);
    transition: var(--ease);
}
.email-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.76rem;
    color: var(--text-muted);
    cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px; height: 15px;
}

.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.75rem;
    border-radius: var(--r-sm);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--ease);
    margin-top: 0.3rem;
}
.btn-submit:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(139,26,26,0.25);
}

/* ═══════════════════════════════════════════
   AVATAR PAGE (full-screen)
   ═══════════════════════════════════════════ */

.avatar-page {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    bottom: 36px;
    z-index: 50;
    background: var(--bg);
    align-items: center;
    justify-content: center;
    gap: 4rem;
    padding: 2rem 4rem;
    overflow-y: auto;
}

.avatar-page-left {
    flex: 1;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.avatar-page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1.5px solid var(--border);
    color: var(--text-body);
    padding: 0.5rem 1rem;
    border-radius: var(--r-full);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--ease);
    align-self: flex-start;
}
.avatar-page-back:hover { border-color: var(--primary); color: var(--primary); }

.avatar-page-hero {
    display: flex;
    align-items: center;
    gap: 0;
}

.avatar-page-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white);
    box-shadow: var(--shadow-md);
}

.avatar-page-left h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.15;
    letter-spacing: -0.02em;
}
.avatar-page-left h2 span { color: var(--primary); }

.avatar-page-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.avatar-page-features {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.5rem;
}

.avatar-feature {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
}
.avatar-feature svg {
    flex-shrink: 0;
    color: var(--primary);
    margin-top: 0.15rem;
}
.avatar-feature strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.1rem;
}
.avatar-feature span {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.avatar-page-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--ease);
    margin-top: 0.5rem;
}
.avatar-page-link:hover { color: var(--primary); }

#olivio-frame {
    width: 320px;
    height: 520px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--white);
    box-shadow: var(--shadow-xl);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   CHAT AREA
   ═══════════════════════════════════════════ */

.chat-area {
    flex: 1;
    display: flex;
    min-width: 0;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-warm);
}

.chat-mobile-header { display: none; }

/* ─── Messages ─── */

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.85rem;
    scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.date-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0 0.5rem;
}
.date-sep span {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 0.2rem 0.8rem;
    border-radius: var(--r-full);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.message {
    display: flex;
    gap: 0.6rem;
    max-width: 72%;
    align-items: flex-end;
}
.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-xs);
}

.msg-bubble {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.msg-content {
    padding: 0.8rem 1rem;
    border-radius: var(--r-lg);
    line-height: 1.55;
    font-size: 0.88rem;
}

.message.assistant .msg-content {
    background: var(--white);
    color: var(--text-body);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-xs);
}

.message.user .msg-content {
    background: var(--primary);
    color: var(--white);
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 10px rgba(139,26,26,0.2);
}

.msg-time {
    font-size: 0.65rem;
    color: var(--text-faint);
    padding: 0 0.25rem;
}
.message.user .msg-time { text-align: right; }

/* ─── Typing ─── */

.typing-bubble { padding: 0; }

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.9rem 1.1rem;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--r-lg);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-xs);
}
.typing-dots span {
    width: 7px; height: 7px;
    background: var(--text-faint);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ─── Quick questions ─── */

.quick-questions {
    padding: 0.75rem 2rem;
    border-top: 1px solid var(--border-light);
    background: var(--white);
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
    max-height: 120px;
    overflow: hidden;
}
.quick-questions.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.quick-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.5rem;
}

.quick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.quick-row button {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-body);
    padding: 0.4rem 0.8rem;
    border-radius: var(--r-full);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--ease);
    white-space: nowrap;
}
.quick-row button:hover {
    background: var(--primary-subtle);
    border-color: var(--primary);
    color: var(--primary);
}
.quick-row button svg {
    color: var(--text-faint);
    transition: var(--ease);
}
.quick-row button:hover svg { color: var(--primary); }

/* ─── Input ─── */

.input-bar {
    display: flex;
    gap: 0.6rem;
    padding: 0.8rem 2rem 1rem;
    background: var(--white);
    border-top: 1px solid var(--border-light);
}

.input-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-full);
    font-size: 0.88rem;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    transition: var(--ease);
    min-width: 0;
}
.input-bar input::placeholder { color: var(--text-faint); }
.input-bar input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.send-btn {
    width: 44px; height: 44px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--ease);
    box-shadow: 0 2px 8px rgba(139,26,26,0.2);
}
.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.06);
}
.send-btn:active { transform: scale(0.94); }

/* ─── FOOTER ─── */

footer {
    background: #8b1a1a;
    text-align: center;
    padding: 0.6rem 1rem;
    flex-shrink: 0;
}

footer p {
    margin: 0;
    font-size: 0.7rem;
    color: #fff;
    line-height: 1.3;
    white-space: normal;
}

footer a {
    color: #fff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ─── SURVEY MODAL ─── */

.survey-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.survey-modal.active {
    display: flex;
}

.survey-content {
    background: #fff;
    border-radius: 20px;
    max-width: 420px;
    width: 100%;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.survey-header {
    text-align: center;
    margin-bottom: 24px;
}

.survey-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-bottom: 12px;
    border: 3px solid var(--primary);
}

.survey-header h2 {
    font-size: 1.4rem;
    color: var(--primary-dark);
    margin: 0 0 6px;
}

.survey-header p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.survey-question {
    margin-bottom: 20px;
}

.survey-question > label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.survey-options {
    display: flex;
    gap: 10px;
}

.survey-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    text-align: center;
}

.survey-option:hover {
    border-color: var(--primary);
    background: rgba(122,185,40,0.05);
}

.survey-option input {
    display: none;
}

.survey-option:has(input:checked) {
    border-color: var(--primary);
    background: rgba(122,185,40,0.1);
    color: var(--primary-dark);
    font-weight: 600;
}

.survey-email {
    margin-bottom: 20px;
}

.survey-email label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.survey-email input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.survey-email input:focus {
    outline: none;
    border-color: var(--primary);
}

.survey-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.survey-skip {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: #f0f0f0;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.survey-skip:hover {
    background: #e0e0e0;
}

.survey-submit {
    flex: 2;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.survey-submit:hover {
    background: var(--primary-dark);
}

.survey-contact-btn {
    background: var(--primary);
    color: #fff !important;
    text-decoration: none;
    text-align: center;
}

.survey-contact-btn:hover {
    background: var(--primary-dark);
}

.survey-no-btn {
    background: #f0f0f0;
    border: none;
    cursor: pointer;
}

.survey-no-btn:hover {
    background: #e0e0e0;
}

.survey-no-btn.selected {
    background: #ddd;
    border-color: #999;
}

/* ─── Mobile Avatar CTA (visible only on mobile, inside chat) ─── */

.mobile-avatar-cta {
    display: none;
}

.mobile-avatar-cta button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    background: linear-gradient(135deg, #fef7f0 0%, #fdf2f2 100%);
    border: 1.5px solid var(--primary-glow);
    padding: 0.85rem 1rem;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: var(--ease);
    text-align: left;
    font-family: inherit;
}

.mobile-avatar-cta button:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(139,26,26,0.1);
}

.mobile-avatar-cta button svg {
    flex-shrink: 0;
    color: var(--primary);
}

.mobile-avatar-cta button strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text);
}

.mobile-avatar-cta button span {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* ─── ANIMATIONS ─── */

.animate-in { animation: slideUp 0.3s ease-out; }

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

/* ─── MOBILE OVERLAY ─── */

.panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.panel-backdrop.active { opacity: 1; pointer-events: all; }

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET (≤960px)
   ═══════════════════════════════════════════ */

@media (max-width: 960px) {
    :root { --header-h: 70px; }

    header { padding: 0 0.75rem; }
    .header-left .logo img { height: 44px; width: 44px; }
    .header-left { gap: 0.6rem; }
    .header-contributo-wrapper { padding-left: 0.6rem; }
    .header-contributo { height: 38px; }
    .contributo-label { font-size: 0.45rem; }
    .header-title { font-size: 0.85rem; }

    .avatar-page {
        flex-direction: column;
        gap: 2rem;
        padding: 1.5rem;
    }
    .avatar-page-left { text-align: center; align-items: center; }
    .avatar-page-left h2 { font-size: 1.5rem; }
    .avatar-page-back { align-self: center; }
    #olivio-frame { width: 280px; height: 440px; }

    .olivio-panel {
        position: fixed;
        top: var(--header-h); left: 0; bottom: 0;
        z-index: 200;
        width: 340px;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    .olivio-panel.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .panel-backdrop { display: block; }

    .chat-mobile-header {
        display: flex;
        align-items: center;
        gap: 0.7rem;
        padding: 0.65rem 1rem;
        background: var(--white);
        border-bottom: 1px solid var(--border);
    }

    .mobile-toggle {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
    }
    .mobile-thumb {
        width: 38px; height: 38px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid var(--border);
    }

    .mobile-info { flex: 1; }
    .mobile-info strong { display: block; font-size: 0.88rem; color: var(--text); }
    .mobile-info span {
        display: flex; align-items: center; gap: 0.3rem;
        font-size: 0.7rem; color: var(--text-muted);
    }

    .mobile-video-btn {
        background: var(--primary-subtle);
        border: 1.5px solid var(--primary-glow);
        color: var(--primary);
        width: 38px; height: 38px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: var(--ease);
    }
    .mobile-video-btn:hover { background: var(--primary); color: var(--white); }

    .messages { padding: 1rem; }
    .quick-questions { padding: 0.7rem 1rem; position: relative; }
    .input-bar { padding: 0.7rem 1rem; }
    .message { max-width: 85%; }

    .header-link { display: none; }

    /* Fix 1: Show mobile avatar CTA in chat */
    .mobile-avatar-cta { display: block; margin-top: 0.5rem; }

    /* Fix 5: Fade hint on quick questions scroll */
    .quick-questions::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 2.5rem;
        background: linear-gradient(to right, transparent, var(--white));
        pointer-events: none;
        z-index: 1;
    }

    footer p { font-size: 0.6rem; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — PHONE (≤480px)
   ═══════════════════════════════════════════ */

@media (max-width: 480px) {
    :root { --header-h: 62px; }

    header { padding: 0 0.5rem; }
    .header-left { gap: 0.5rem; }
    .header-left .logo img { height: 38px; width: 38px; }
    .header-contributo-wrapper {
        padding-left: 0.5rem;
        gap: 1px;
        border-left-width: 1px;
    }
    .header-contributo { height: 28px; }
    .contributo-label { font-size: 0.35rem; }

    /* Fix 3: Hide title on phone to save space */
    .header-right { display: none; }

    .olivio-panel { width: 100%; top: var(--header-h); }

    .chat-mobile-header { padding: 0.5rem 0.75rem; gap: 0.5rem; }
    .mobile-thumb { width: 32px; height: 32px; }
    .mobile-info strong { font-size: 0.82rem; }
    .mobile-video-btn { width: 32px; height: 32px; }
    .mobile-video-btn svg { width: 14px; height: 14px; }

    .messages { padding: 0.75rem; gap: 0.6rem; }
    .message { max-width: 90%; }
    .msg-avatar { width: 28px; height: 28px; }
    .msg-content { font-size: 0.84rem; padding: 0.65rem 0.8rem; }
    .msg-time { font-size: 0.6rem; }

    .quick-questions { padding: 0.5rem 0.75rem; }
    .quick-label { font-size: 0.6rem; margin-bottom: 0.35rem; }
    .quick-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0.35rem;
    }
    .quick-row::-webkit-scrollbar { display: none; }
    .quick-row button { font-size: 0.72rem; padding: 0.3rem 0.65rem; }

    .input-bar { padding: 0.5rem 0.75rem 0.6rem; gap: 0.4rem; }
    .input-bar input { padding: 0.6rem 0.8rem; font-size: 0.84rem; }
    .send-btn { width: 38px; height: 38px; }
    .send-btn svg { width: 16px; height: 16px; }

    footer { padding: 0.5rem 0.5rem; }
    footer p { font-size: 0.55rem; line-height: 1.4; }

    .avatar-page { padding: 1rem; gap: 1.5rem; top: var(--header-h); }
    .avatar-page-left h2 { font-size: 1.3rem; }
    .avatar-page-subtitle { font-size: 0.88rem; }
    #olivio-frame { width: 100%; max-width: 280px; height: 400px; border-radius: 12px; }

    .survey-content { padding: 20px; border-radius: 16px; }
    .survey-header h2 { font-size: 1.2rem; }
    .survey-avatar { width: 48px; height: 48px; }
    .survey-option { padding: 10px 8px; font-size: 0.8rem; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — SMALL PHONE (≤360px)
   ═══════════════════════════════════════════ */

@media (max-width: 360px) {
    :root { --header-h: 50px; }

    .header-left .logo img { height: 28px; width: 28px; }
    .header-contributo { height: 16px; }
    .contributo-label { display: none; }
    .header-title { font-size: 0.6rem; }

    .msg-content { font-size: 0.8rem; padding: 0.55rem 0.7rem; }
    .message { max-width: 92%; }
}
