:root {
    --bg-main: #0f172a;
    --bg-glass: rgba(30, 41, 59, 0.7);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --user-msg: #2563eb;
    --agent-msg: rgba(51, 65, 85, 0.8);
    --accent: #a78bfa;
    --success: #10b981;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
    /* 100dvh accounts for iOS Safari's collapsing URL bar — vh would lock to
       the larger viewport and clip the bottom 80px of the chat. Standalone
       PWA mode also benefits: the bar is gone but layout doesn't shift. */
    height: 100dvh;
    overflow: hidden;
    /* `overscroll-behavior: none` stops iOS rubber-band scrolling outside the
       chat surface — feels native when installed as a PWA. */
    overscroll-behavior: none;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #020617, #0f172a, #1e1b4b);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Respect the home indicator / notch when running as installed PWA. */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.muted { color: var(--text-muted); font-weight: 400; }

/* ========== Intake gate ========== */
.gate {
    width: 100%;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}
.gate-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 40px 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}
.gate-card h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 4px;
}
.gate-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 28px;
}
#gateForm label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
#gateForm input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 12px 14px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
#gateForm input:focus { outline: none; border-color: var(--primary); }

#gateBtn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s, transform 0.1s;
}
#gateBtn:hover { opacity: 0.92; }
#gateBtn:active { transform: scale(0.99); }
#gateBtn:disabled { opacity: 0.5; cursor: not-allowed; }

.gate-error {
    color: #f87171;
    font-size: 0.85rem;
    min-height: 1.2em;
}

/* ========== Chat container ========== */
.app-container {
    width: 100%;
    max-width: 900px;
    /* 100dvh leaves no gap on mobile (where the gradient gap looked broken).
       Desktop gets 92dvh so the glass card still feels like a centered panel. */
    height: 100dvh;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
@media (min-width: 720px) {
    .app-container {
        height: 92dvh;
        border-radius: 20px;
    }
}

.header {
    padding: 18px 28px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.5);
}
.header-info h1 {
    font-size: 1.1rem;
    font-weight: 600;
}
.status {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}
.dot {
    width: 7px;
    height: 7px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
}
.user-config {
    display: flex;
    align-items: center;
    gap: 12px;
}
#resetBtn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
#resetBtn:hover { background: rgba(255, 255, 255, 0.1); }
#resetBtn svg { display: block; }
/* Hidden via the [hidden] attribute set by JS for anon trial users.
   Needed because the `display: inline-flex` above (ID specificity 100)
   overrides the user-agent stylesheet's display:none for [hidden]. */
#resetBtn[hidden] { display: none !important; }

.chat-container {
    flex: 1;
    padding: 24px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.chat-container::-webkit-scrollbar { width: 6px; }
.chat-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* L5: cap the bubble width in absolute pixels so chat doesn't span a 5K
   ultrawide monitor edge-to-edge. 720px keeps lines comfortable to read. */
.message { display: flex; max-width: min(82%, 720px); animation: fadeIn 0.3s ease-in-out; gap: 8px; }
.message.user-message { align-self: flex-end; }
.message.agent-message { align-self: flex-start; align-items: flex-end; }
.message.system-message { align-self: center; max-width: 95%; }

/* Agent avatar — 🤖 chip to the left of every agent bubble (matches the
   AI Agents card icon for a consistent visual identity). */
.agent-avatar {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(167, 139, 250, 0.25));
    border: 1px solid rgba(167, 139, 250, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.15);
    user-select: none;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.55;
    font-size: 0.95rem;
}
.user-message .message-content {
    background: var(--user-msg);
    border-bottom-right-radius: 4px;
}
.agent-message .message-content {
    background: var(--agent-msg);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-glass);
}
.system-message .message-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border-glass);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.message-content p { margin-bottom: 0.5rem; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul, .message-content ol { margin: 6px 0 6px 20px; }
.message-content li { margin-bottom: 4px; }
.message-content strong { color: #c4b5fd; font-weight: 600; }
.message-content code {
    font-family: monospace;
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ========== Process card ========== */
.process-card {
    align-self: stretch;
    max-width: 100%;
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.12), rgba(167, 139, 250, 0.08));
    border: 1px solid rgba(167, 139, 250, 0.25);
    border-radius: 16px;
    padding: 22px 24px;
    animation: fadeIn 0.4s ease-in-out;
}
.process-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #93c5fd, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.process-step {
    display: flex;
    gap: 14px;
    margin-bottom: 12px;
    align-items: flex-start;
}
.process-step:last-child { margin-bottom: 0; }
.process-step-num {
    flex: 0 0 28px;
    height: 28px;
    width: 28px;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.18);
    border: 1px solid rgba(167, 139, 250, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #c4b5fd;
}
.process-step-body { flex: 1; }
.process-step-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2px;
}
.process-step-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* ========== Services card ========== */
.services-card .service-row {
    display: flex;
    gap: 14px;
    margin-bottom: 12px;
    align-items: flex-start;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-glass);
    transition: background 0.18s, border-color 0.18s, transform 0.1s;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
}
.services-card .service-row:active { transform: scale(0.99); }
.services-card .service-row:last-of-type { margin-bottom: 0; }
.services-card .service-row:hover {
    background: rgba(167, 139, 250, 0.08);
    border-color: rgba(167, 139, 250, 0.3);
}
.services-card .service-row-highlight {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(167, 139, 250, 0.10));
    border-color: rgba(167, 139, 250, 0.45);
    box-shadow: 0 0 18px rgba(167, 139, 250, 0.12);
}
.services-card .service-row-chosen {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(99, 102, 241, 0.10));
    border-color: rgba(16, 185, 129, 0.55);
    cursor: default;
}
.services-card.services-locked .service-row { cursor: default; }
.services-card .service-row-highlight:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.26), rgba(167, 139, 250, 0.16));
    border-color: rgba(167, 139, 250, 0.65);
}
.services-card .service-icon {
    flex: 0 0 32px;
    height: 32px;
    width: 32px;
    border-radius: 8px;
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    line-height: 1;
}
.services-card .service-body { flex: 1; min-width: 0; }
.services-card .service-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: #f8fafc;
    margin-bottom: 3px;
}
.services-card .service-text {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.services-card .services-question {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(167, 139, 250, 0.22);
    font-size: 0.88rem;
    color: #c4b5fd;
    font-weight: 500;
    line-height: 1.5;
}

/* ========== Slots card ========== */
.slots-card { padding: 14px 16px; }
.slots-card .process-card-title { font-size: 0.95rem; margin-bottom: 6px; }
.slots-card .slots-tz {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.slots-day {
    margin-bottom: 8px;
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 8px;
    align-items: start;
}
.slots-day:last-child { margin-bottom: 0; }
.slots-day-label {
    font-weight: 600;
    font-size: 0.74rem;
    color: #c4b5fd;
    line-height: 1.6;
    padding-top: 2px;
}
.slots-day-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.slot-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.slot-chip:hover {
    background: rgba(167, 139, 250, 0.18);
    border-color: rgba(167, 139, 250, 0.5);
}
.slot-chip:active { transform: scale(0.97); }

/* ========== Booking confirmation card ========== */
.booking-card {
    align-self: stretch;
    max-width: 100%;
    background: linear-gradient(160deg, rgba(16, 185, 129, 0.18), rgba(59, 130, 246, 0.10));
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 16px;
    padding: 20px 22px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    animation: fadeIn 0.4s ease-in-out;
}
.booking-check {
    flex: 0 0 40px;
    height: 40px;
    width: 40px;
    border-radius: 50%;
    background: var(--success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
}
.booking-body { flex: 1; }
.booking-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #6ee7b7;
}
.booking-time {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #f8fafc;
}
.booking-service {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.booking-service strong { color: #c4b5fd; font-weight: 600; }
.booking-foot {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 12px;
}
.wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #25D366;
    color: white !important;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}
.wa-btn:hover {
    background: #1fb855;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
}
.wa-btn:active { transform: translateY(0); }
.wa-btn svg { flex-shrink: 0; }

/* Contact card — reuses .booking-card layout but with a cyan accent (Xyphor
   brand teal) instead of the green "confirmed" wash. WhatsApp is the primary
   button; Instagram and Email sit below as smaller secondary chips. */
.booking-card.contact-card {
    background: linear-gradient(160deg, rgba(26, 170, 212, 0.18), rgba(99, 102, 241, 0.10));
    border-color: rgba(26, 170, 212, 0.4);
}
.contact-secondary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.contact-mini {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary) !important;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.18s, transform 0.15s, border-color 0.18s;
}
.contact-mini:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(26, 170, 212, 0.45);
    transform: translateY(-1px);
}
.contact-mini svg { flex-shrink: 0; opacity: 0.85; }
.contact-mini-sub {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 4px;
}

/* ========== Input ========== */
.input-area {
    padding: 16px 24px;
    /* Add iPhone home-indicator clearance so the send button never sits under
       the gesture bar in installed-PWA mode. Calc keeps the existing 16px
       baseline when there's no inset (Android / desktop). */
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-glass);
    background: rgba(15, 23, 42, 0.5);
}
#chatForm {
    display: flex;
    gap: 12px;
    position: relative;
}
#messageInput {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 14px 18px;
    padding-right: 56px;
    border-radius: 14px;
    /* 16px on mobile prevents iOS Safari from auto-zooming the input on focus,
       which would otherwise shrink the chat surface unrecoverably. */
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.3s;
}
@media (min-width: 720px) {
    #messageInput { font-size: 0.95rem; }
}
#messageInput:focus { outline: none; border-color: var(--primary); }

#sendBtn {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: 6px;
    background: var(--primary);
    border: none;
    color: white;
    width: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, transform 0.1s;
}
#sendBtn:hover { background: var(--primary-hover); }
#sendBtn:active { transform: scale(0.95); }
#sendBtn:disabled { background: var(--text-muted); cursor: not-allowed; }

.typing-indicator { display: inline-flex; gap: 4px; padding: 4px 8px; }
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== Gate: tabs + login panel + skip ========== */
.gate-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    padding: 4px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    border: 1px solid var(--border-glass);
}
.gate-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 7px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.gate-tab.active {
    background: rgba(255,255,255,0.06);
    color: var(--text-main);
    box-shadow: 0 1px 0 rgba(255,255,255,0.04);
}
.gate-panel { display: none; flex-direction: column; gap: 16px; }
.gate-panel.active { display: flex; }
.gate-panel label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.gate-panel input[type="text"],
.gate-panel input[type="email"],
.gate-panel input[type="tel"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 12px 14px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    width: 100%;
}
.gate-panel input:focus { outline: none; border-color: var(--primary); }
.gate-panel button[type="submit"] {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s, transform 0.1s;
}
.gate-panel button[type="submit"]:hover { opacity: 0.92; }
.gate-panel button[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; }

.gate-skip {
    text-align: center;
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px dashed rgba(255,255,255,0.08);
}
.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    padding: 0;
}
.link-btn:hover { color: #c4b5fd; }
.link-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== Phone row + country picker ========== */
.phone-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.country-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 0 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    min-width: 92px;
    transition: border-color 0.2s, background 0.18s;
}
.country-btn:hover { background: rgba(255,255,255,0.08); }
.country-btn span:first-child { font-size: 1.1rem; line-height: 1; }
.country-btn span:nth-child(2) { font-weight: 600; color: var(--text-muted); font-size: 0.88rem; }
.country-btn svg { color: var(--text-muted); margin-left: 2px; }

.phone-row input[type="tel"] { flex: 1; min-width: 0; }

/* The label wraps phone-row + dropdown — anchor the dropdown to the label */
.gate-panel label,
#upgradeForm label { position: relative; }

.country-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 8px;
    max-height: 280px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 30;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.country-dropdown[hidden] { display: none; }
.country-dropdown input[type="search"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 10px 12px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 6px;
}
.country-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}
.country-dropdown li {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: background 0.15s;
}
.country-dropdown li:hover { background: rgba(255,255,255,0.06); }
.cc-flag { font-size: 1.15rem; line-height: 1; }
.cc-name { color: var(--text-main); }
.cc-dial { color: var(--text-muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }

/* ========== OTP screen ========== */
.otp-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 16px 0 18px 0;
}
.otp-cell {
    width: 44px;
    height: 52px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    transition: border-color 0.15s, background 0.15s;
}
.otp-cell:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
}
#otpBtn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    padding: 13px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}
#otpBtn:disabled { opacity: 0.5; cursor: not-allowed; }
.otp-foot {
    margin-top: 14px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.otp-foot .link-btn { font-size: 0.82rem; }

/* ========== Trial banner ========== */
/* :not([hidden]) is critical — without it, `display: flex` would override the
   browser-default `[hidden] { display: none }` and the banner would stay
   visible for verified users even after JS set .hidden = true. */
.trial-banner:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(99, 102, 241, 0.10));
    border-bottom: 1px solid rgba(167, 139, 250, 0.25);
    font-size: 0.82rem;
    color: var(--text-main);
}
.trial-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}
#trialText { flex: 1; font-weight: 500; }
#trialUpgradeBtn { font-weight: 600; }

/* ========== Modal (mid-chat upgrade) ========== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    padding: 16px;
    animation: fadeIn 0.18s ease-out;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    width: 100%;
    max-width: 440px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 28px 28px 26px 28px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6);
    max-height: 92vh;
    overflow-y: auto;
}
/* L6: keep the modal's country dropdown above the modal's own border
   shadow, and let JS clamp its height to whatever fits below the trigger. */
.modal .country-dropdown { z-index: 100; }
.modal { position: relative; }
.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.modal-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}
.modal h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding-right: 36px;
}
.gate-cta-card {
    align-self: stretch;
    max-width: 100%;
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.18), rgba(167, 139, 250, 0.10));
    border: 1px solid rgba(167, 139, 250, 0.35);
    border-radius: 16px;
    padding: 18px 20px;
    animation: fadeIn 0.3s ease-in-out;
}

/* ========== First-time starter chips ========== */
.starter-chips {
    align-self: stretch;
    max-width: 100%;
    animation: fadeIn 0.35s ease-in-out;
    margin-top: 4px;
}
.starter-chips-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 10px;
    padding-left: 2px;
}
.starter-chips-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
@media (max-width: 820px) {
    .starter-chips-row { grid-template-columns: repeat(2, 1fr); }
}
.starter-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.10), rgba(167, 139, 250, 0.06));
    border: 1px solid rgba(167, 139, 250, 0.22);
    color: var(--text-main);
    padding: 12px 14px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    line-height: 1.35;
    transition: background 0.18s, border-color 0.18s, transform 0.1s;
}
.starter-chip:hover {
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.22), rgba(167, 139, 250, 0.14));
    border-color: rgba(167, 139, 250, 0.5);
}
.starter-chip:active { transform: scale(0.98); }
.starter-chip-icon { font-size: 1.15rem; line-height: 1; }
.starter-chip-text { display: block; }
@media (max-width: 560px) {
    .starter-chips-row { grid-template-columns: 1fr; }
    .starter-chip { flex-direction: row; align-items: center; gap: 10px; }
}
.gate-cta-title {
    font-size: 0.98rem;
    font-weight: 600;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #93c5fd, #c4b5fd);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.gate-cta-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
}
.gate-cta-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.gate-cta-actions button {
    flex: 1;
    min-width: 130px;
    padding: 10px 14px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.gate-cta-signup {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
}
.gate-cta-signup:hover { opacity: 0.92; }
.gate-cta-login {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
}
.gate-cta-login:hover { background: rgba(255, 255, 255, 0.1); }
.modal p { margin-bottom: 16px; font-size: 0.88rem; line-height: 1.5; }
.modal-tabs { margin-bottom: 16px; }
.upgrade-panel { display: none; flex-direction: column; gap: 14px; }
.upgrade-panel.active { display: flex; }
#upgradeForm { display: none; flex-direction: column; gap: 14px; }
#upgradeForm.active { display: flex; }
#upgradeLoginForm { display: none; }
#upgradeLoginForm.active { display: flex; flex-direction: column; gap: 14px; }
#upgradeLoginForm label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}
#upgradeLoginForm input[type="email"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 11px 13px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.93rem;
    width: 100%;
}
#upgradeLoginForm input:focus { outline: none; border-color: var(--primary); }
#uLoginBtn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    padding: 13px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}
#uLoginBtn:disabled { opacity: 0.5; cursor: not-allowed; }
#upgradeForm label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}
#upgradeForm input[type="text"],
#upgradeForm input[type="email"],
#upgradeForm input[type="tel"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 11px 13px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.93rem;
    width: 100%;
}
#upgradeForm input:focus { outline: none; border-color: var(--primary); }
#upgradeBtn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    padding: 13px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}
#upgradeBtn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== Rate-limit card ========== */
.limit-card {
    align-self: stretch;
    max-width: 100%;
    background: linear-gradient(160deg, rgba(245, 158, 11, 0.12), rgba(245, 101, 101, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 16px;
    padding: 22px 24px;
    text-align: center;
    animation: fadeIn 0.3s ease-in-out;
}
.limit-icon { font-size: 2rem; margin-bottom: 6px; }
.limit-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #fbbf24;
}
.limit-sub {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--text-main);
}
.limit-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}
.call-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 11px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.15s, transform 0.1s;
}
.call-btn:hover { background: rgba(255,255,255,0.14); }
.call-btn:active { transform: scale(0.98); }

/* ========== Socials card ========== */
.socials-card {
    align-self: flex-start;
    max-width: min(82%, 720px);
    margin: 4px 0;
    padding: 16px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.socials-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--accent);
}
.socials-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.social-btn {
    flex: 1 1 140px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
    transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
}
.social-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.social-btn:active { transform: scale(0.98); }
.social-ig {
    background: linear-gradient(135deg, #f58529, #dd2a7b 55%, #8134af 90%);
    box-shadow: 0 6px 18px rgba(221, 42, 123, 0.32);
}
.social-tt {
    background: linear-gradient(135deg, #25F4EE 0%, #000 50%, #FE2C55 100%);
    box-shadow: 0 6px 18px rgba(254, 44, 85, 0.28);
}
.social-text { display: flex; flex-direction: column; line-height: 1.2; }
.social-net { font-size: 0.78rem; opacity: 0.85; font-weight: 500; }
.social-handle { font-size: 0.92rem; font-weight: 700; }

/* ========== Review FAB + panel ========== */
.review-fab {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(167, 139, 250, 0.35);
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.85), rgba(99, 102, 241, 0.85));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
    z-index: 50;
}
.review-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(99, 102, 241, 0.45); }
.review-fab:active { transform: scale(0.97); }

/* Hover tooltip rendered above the FAB — pulls its text from data-tooltip. */
.review-fab::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-main);
    border: 1px solid var(--border-glass);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.review-fab::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    right: 18px;
    border: 6px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.review-fab:hover::before, .review-fab:focus-visible::before { opacity: 1; transform: translateY(0); }
.review-fab:hover::after,  .review-fab:focus-visible::after  { opacity: 1; }

.review-panel:not([hidden]) {
    position: fixed;
    bottom: 80px;
    right: 22px;
    width: min(360px, calc(100vw - 44px));
    background: rgba(15, 23, 42, 0.97);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 16px 16px 14px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
    z-index: 51;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.review-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.review-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.review-close:hover { color: var(--text-main); }
.review-sub { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }
#reviewForm { display: flex; flex-direction: column; gap: 10px; }
.review-rating { display: flex; gap: 4px; }
.rate-star {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.25);
    font-size: 1.35rem;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.1s;
}
.rate-star:hover, .rate-star.active { color: #fbbf24; }
#reviewContent {
    width: 100%;
    min-height: 90px;
    resize: vertical;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.45;
}
#reviewContent:focus { outline: none; border-color: rgba(167, 139, 250, 0.5); }
.review-actions { display: flex; justify-content: flex-end; }
.review-submit {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.review-submit:hover { background: var(--primary-hover); }
.review-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.review-status { font-size: 0.78rem; color: var(--text-muted); min-height: 1.1em; }
.review-status.ok { color: var(--success); }
.review-status.err { color: #f87171; }
