/* =========================================================
   XPERT AI CHATBOT DESIGN SYSTEM (From bot.html)
   MicroMerger / XpertERP
========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root {
    --blue-900: #082e70;
    --blue-800: #083b8c;
    --blue-700: #0756b8;
    --blue-600: #1769e8;
    --blue-500: #2584f4;

    --cyan: #45e5fb;
    --violet: #6549e8;

    --text: #17233d;
    --text-soft: #405473;
    --muted: #748297;

    --border: #dce5f0;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;

    --user-bg: #e3f8ef;
    --user-border: #c9ecdf;

    --green: #16b876;
    --green-soft: #ebf9f3;

    --red: #d94a56;
    --red-soft: #fff1f2;

    --shadow:
        0 22px 60px rgba(14, 40, 85, 0.17),
        0 3px 10px rgba(14, 40, 85, 0.08);
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    height: 100%;
    height: 100dvh;
    -webkit-text-size-adjust: 100%;
}

#root {
    width: 100%;
    height: 100%;
    min-height: 100%;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(circle at 85% 12%, #dbeaff 0%, transparent 29%),
        linear-gradient(135deg, #eef3f8, #f7f9fc);
    color: var(--text);
    overflow: hidden;
}

/* =========================================================
   CHAT WINDOW CONTAINER
========================================================= */

.xpert-chat {
    width: min(960px, calc(100vw - 40px));
    height: min(850px, calc(100vh - 40px));
    height: min(850px, calc(100dvh - 40px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(209, 220, 235, 0.95);
    border-radius: 22px;
    box-shadow: var(--shadow);
    position: relative;
    transition: width .2s ease, height .2s ease, transform .2s ease;
}

.xpert-chat.expanded {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
    height: calc(100dvh - 20px);
}

.xpert-chat.minimized {
    height: 62px;
}

.xpert-chat.minimized .ai-intro,
.xpert-chat.minimized .chat-body,
.xpert-chat.minimized .composer-wrap,
.xpert-chat.minimized .disclaimer {
    display: none;
}

.xpert-chat.closed {
    display: none;
}

/* Iframe Host Adaptation */
body.in-iframe {
    display: block;
    background: transparent;
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
}

body.in-iframe #root {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.xpert-chat.in-iframe {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* =========================================================
   HEADER
========================================================= */

.chat-header {
    position: relative;
    height: 62px;
    min-height: 62px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 82% 10%, rgba(66, 225, 255, 0.26), transparent 29%),
        radial-gradient(circle at 64% 125%, rgba(139, 86, 255, 0.34), transparent 45%),
        linear-gradient(112deg, #082f72 0%, #0757b9 53%, #3c3bd6 100%);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    z-index: 10;
}

.chat-header::before {
    content: "✦";
    position: absolute;
    right: 140px;
    top: -27px;
    font-size: 82px;
    color: rgba(84, 226, 255, .08);
    transform: rotate(10deg);
    pointer-events: none;
}

.chat-header::after {
    content: "";
    position: absolute;
    width: 145px;
    height: 145px;
    right: -40px;
    top: -94px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .10);
    pointer-events: none;
}

.header-left {
    position: relative;
    z-index: 2;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.xpert-ai-icon {
    position: relative;
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255,255,255,.99), rgba(215,238,255,.92));
    border: 1px solid rgba(255,255,255,.72);
    box-shadow: 0 5px 14px rgba(0,0,0,.19), inset 0 0 9px rgba(255,255,255,.75);
}

.xpert-ai-icon svg {
    width: 31px;
    height: 31px;
    filter: drop-shadow(0 2px 2px rgba(9,54,125,.12));
}

.logo-sparkle {
    position: absolute;
    line-height: 1;
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(67,231,255,.90);
}

.sparkle-one {
    font-size: 11px;
    top: -5px;
    right: -5px;
}

.sparkle-two {
    font-size: 6px;
    top: 5px;
    right: -9px;
    color: #bc83ff;
}

.header-info {
    min-width: 0;
}

.header-inline {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.brand-name {
    font-size: 17px;
    line-height: 1;
    font-weight: 760;
    letter-spacing: -.25px;
    color: white;
}

.brand-name span {
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(72,228,250,.28);
}

.header-divider {
    color: rgba(255,255,255,.36);
    font-size: 9px;
}

.header-subtitle {
    font-size: 11.5px;
    color: rgba(255,255,255,.76);
}

.online-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    color: rgba(255,255,255,.94);
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.16);
    backdrop-filter: blur(6px);
}

.online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #21df8d;
    box-shadow: 0 0 0 2px rgba(33,223,141,.14), 0 0 8px rgba(33,223,141,.55);
}

.header-actions {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.header-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255,255,255,.90);
    font-family: inherit;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}

.header-btn:hover {
    background: rgba(255,255,255,.14);
}

.header-btn:active {
    transform: scale(.93);
}

.header-btn.close:hover {
    background: rgba(255,86,103,.25);
}

/* =========================================================
   AI CONTEXT STRIP
========================================================= */

.ai-intro {
    margin: 9px 12px 2px;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 12px;
    border: 1px solid #e1e9f7;
    background: linear-gradient(120deg, #f5f8ff, #eff3ff);
}

.ai-intro-copy {
    min-width: 0;
    font-size: 11.5px;
    color: #405473;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-intro-copy strong {
    color: #1d5fca;
}

.ai-badge {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 9px;
    border: 1px solid #cddcf8;
    background: #fff;
    color: #1d63d5;
    font-size: 9.5px;
    font-weight: 750;
}

/* =========================================================
   CHAT BODY & DOTTED PATTERN
========================================================= */

.chat-body {
    flex: 1;
    min-height: 0;
    padding: 16px 20px;
    overflow-y: auto;
    scroll-behavior: smooth;
    background:
        linear-gradient(rgba(247,249,252,.965), rgba(247,249,252,.965)),
        radial-gradient(circle, #dbe3ed 1px, transparent 1.2px);
    background-size: auto, 19px 19px;
    position: relative;
}

.chat-body::-webkit-scrollbar {
    width: 5px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #ccd7e6;
    border-radius: 8px;
}

/* Date Separator Pill */
.date-separator {
    display: flex;
    justify-content: center;
    margin: 14px 0 8px 0;
    width: 100%;
    clear: both;
}

.date-pill {
    background: #ffffff;
    color: #556987;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(14, 40, 85, 0.06);
    border: 1px solid var(--border);
    letter-spacing: 0.2px;
}

/* History Loading Indicator */
.history-loader {
    display: none;
    text-align: center;
    padding: 6px 14px;
    font-size: 11px;
    color: var(--blue-600);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    width: fit-content;
    margin: 0 auto 10px auto;
    box-shadow: 0 2px 8px rgba(14, 40, 85, 0.08);
    border: 1px solid var(--border);
}

/* Floating Scroll Down Button */
.scroll-down-btn {
    position: absolute;
    right: 20px;
    bottom: 85px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--blue-600);
    border: 1px solid var(--border);
    box-shadow: 0 4px 14px rgba(14, 40, 85, 0.15);
    cursor: pointer;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 13px;
    z-index: 25;
    transition: all 0.2s ease;
}

.scroll-down-btn:hover {
    background: #ffffff;
    color: var(--blue-800);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(14, 40, 85, 0.22);
}

/* =========================================================
   MESSAGE ROWS & BUBBLES
========================================================= */

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 14px;
    animation: fadeIn 0.25s ease-out forwards;
}

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

.message-row.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 33px;
    height: 33px;
    flex: 0 0 33px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 13px;
    background-size: cover;
    background-position: center;
}

.user-avatar {
    border: 1px solid #d5e2f2;
    background: #fff;
    color: var(--blue-600);
    box-shadow: 0 3px 10px rgba(25,60,110,.07);
}

.ai-avatar {
    position: relative;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(circle at 75% 20%, rgba(69,229,251,.45), transparent 32%),
        linear-gradient(140deg, #0877da, #1552cc 57%, #6636dc);
    box-shadow: 0 5px 14px rgba(35,80,185,.25);
}

.ai-avatar::after {
    content: "✦";
    position: absolute;
    right: 3px;
    top: 1px;
    font-size: 7px;
    color: #89edff;
}

.agent-avatar {
    color: #fff;
    background: linear-gradient(140deg, #059669, #047857);
    box-shadow: 0 5px 14px rgba(5,150,105,.25);
}

.message {
    max-width: 82%;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

.user .message {
    color: #153249;
    background: linear-gradient(140deg, #dcf7ec, #e9faf4);
    border: 1px solid var(--user-border);
    border-bottom-right-radius: 5px;
}

.assistant .message {
    max-width: 85%;
    background: rgba(255,255,255,.98);
    border: 1px solid #dfe7f1;
    border-bottom-left-radius: 5px;
    box-shadow: 0 5px 17px rgba(25,50,85,.07);
}

.agent .message {
    max-width: 85%;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-bottom-left-radius: 5px;
    box-shadow: 0 5px 17px rgba(5,150,105,.07);
}

.message-meta {
    margin-top: 6px;
    color: #8491a3;
    font-size: 9.5px;
}

.user .message-meta {
    text-align: right;
}

.assistant-header {
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.assistant-name {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--blue-600);
    font-size: 11.5px;
    font-weight: 750;
}

.agent .assistant-name {
    color: #047857;
}

.assistant-name .spark {
    color: var(--violet);
}

.source-chip {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 9px;
    background: #f6f8fb;
    border: 1px solid #e1e7ef;
    color: #607086;
    font-size: 10px;
}

/* Button Chips / Options */
.button-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.chip-btn {
    padding: 6px 12px;
    border-radius: 17px;
    border: 1px solid #d8e4f3;
    background: #f7faff;
    color: #29476f;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chip-btn:hover {
    color: var(--blue-600);
    border-color: #abc7ef;
    background: #eef5ff;
    transform: translateY(-1px);
}

/* =========================================================
   COMPOSER
========================================================= */

.composer-wrap {
    padding: 10px 14px 8px;
    background: #fff;
    border-top: 1px solid #e1e8f0;
    position: relative;
}

.composer {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    border-radius: 16px;
    border: 1px solid #d6e3f1;
    background: #f8faff;
    transition: border .15s ease, box-shadow .15s ease, background .15s ease;
}

.composer:focus-within {
    background: #ffffff;
    border-color: #8eb8f2;
    box-shadow: 0 0 0 3px rgba(23,105,232,.08);
}

.composer input[type="text"],
.composer-input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #263e5e;
    font-family: inherit;
    font-size: 14px;
    padding: 0 4px;
}

.composer input[type="text"]::placeholder,
.composer-input::placeholder {
    color: #8998aa;
    font-size: 13.5px;
}

.composer-btn {
    border: 0;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s ease, transform .12s ease;
}

.attach-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    color: #5b708c;
    font-size: 16px;
    border-radius: 8px;
}

.attach-btn:hover {
    background: rgba(23,105,232,.08);
    color: var(--blue-600);
}

.attach-btn:active {
    transform: scale(0.94);
}

.ai-mode-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    color: var(--blue-600);
    background: linear-gradient(145deg, #eef5ff, #edf1ff);
    font-size: 15px;
    border: 1px solid #e1e8fb;
}

.ai-mode-btn:hover {
    background: #e4efff;
}

.send-btn {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 0;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(140deg, #1878ed, #0754c8);
    box-shadow: 0 6px 14px rgba(16,98,216,.27);
    transition: transform .15s ease, box-shadow .15s ease;
}

.send-btn:hover:not(:disabled) {
    box-shadow: 0 7px 17px rgba(16,98,216,.34);
    transform: translateY(-1px);
}

.send-btn:active:not(:disabled) {
    transform: scale(.95);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

/* Emoji Picker Popup */
.emoji-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 12px;
    background: #ffffff;
    border: 1px solid #dce4f0;
    border-radius: 16px;
    padding: 10px;
    width: 310px;
    max-width: calc(100vw - 32px);
    height: 210px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(14, 40, 85, 0.14);
    z-index: 100;
}

.emoji-picker::-webkit-scrollbar {
    width: 5px;
}

.emoji-picker::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

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

.emoji-item {
    cursor: pointer;
    font-size: 20px;
    padding: 3px;
    border-radius: 6px;
    transition: transform 0.1s;
    user-select: none;
}

.emoji-item:hover {
    transform: scale(1.22);
}

/* Quick Prompts Popup */
.ai-prompts-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 14px;
    background: #ffffff;
    border: 1px solid #dce4f0;
    border-radius: 16px;
    padding: 10px;
    width: 290px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 10px 30px rgba(14, 40, 85, 0.16);
    z-index: 110;
}

.ai-prompts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: var(--blue-700);
    padding: 4px 6px 8px;
    border-bottom: 1px solid #edf2f7;
    margin-bottom: 6px;
}

.ai-prompt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 7px 9px;
    border-radius: 10px;
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: 12px;
    color: #27374d;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ai-prompt-item:hover {
    background: #f1f5f9;
    color: var(--blue-600);
}

.disclaimer {
    padding: 5px 10px 8px;
    background: #fff;
    color: #7b899a;
    text-align: center;
    font-size: 10.5px;
}

.disclaimer span {
    color: #5177b7;
}

/* =========================================================
   MODAL GUEST INTAKE
========================================================= */

.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(8, 46, 112, 0.4);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.intake-card {
    background: #ffffff;
    border: 1px solid rgba(209, 220, 235, 0.95);
    border-radius: 22px;
    padding: 32px 28px 24px 28px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}

.intake-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    background:
        radial-gradient(circle at 82% 10%, rgba(66, 225, 255, 0.26), transparent 29%),
        radial-gradient(circle at 64% 125%, rgba(139, 86, 255, 0.34), transparent 45%),
        linear-gradient(112deg, #082f72 0%, #0757b9 53%, #3c3bd6 100%);
    color: #fff;
    margin: -32px -28px 18px -28px;
    padding: 24px;
    border-radius: 22px 22px 0 0;
}

.intake-avatar {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(112deg, #082f72 0%, #0757b9 53%, #3c3bd6 100%);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 5px 14px rgba(8, 47, 114, 0.25);
    margin-bottom: 12px;
}

.intake-logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    line-height: 1;
    margin-bottom: 6px;
    font-weight: 800;
    color: var(--blue-900);
}

.intake-header p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 12px;
}

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

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
}

.styled-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.styled-input-group i {
    position: absolute;
    left: 14px;
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}

.form-input-theme {
    width: 100%;
    background: #f8faff;
    border: 1px solid #d6e3f1;
    padding: 11px 14px 11px 38px;
    border-radius: 12px;
    color: var(--text);
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s ease;
}

.form-input-theme:focus {
    border-color: var(--blue-600);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(23,105,232,.10);
}

.submit-btn-theme {
    background: linear-gradient(140deg, #1878ed, #0754c8);
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(16, 98, 216, 0.25);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.submit-btn-theme:hover {
    box-shadow: 0 6px 16px rgba(16, 98, 216, 0.35);
    transform: translateY(-1px);
}

.theme-copyright {
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

/* =========================================================
   COMPREHENSIVE RESPONSIVE DESIGN FOR ALL DEVICES
========================================================= */

@media (max-width: 960px) {
    .xpert-chat {
        width: min(100%, calc(100vw - 20px));
        height: min(100%, calc(100dvh - 20px));
    }
}

@media (max-width: 768px) {
    html, body, #root {
        width: 100%;
        height: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    body {
        background: #f7f9fc;
        display: block;
    }

    #root {
        display: block;
    }

    .xpert-chat {
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    .chat-header {
        padding: 0 12px;
        height: 56px;
        min-height: 56px;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .header-subtitle, .header-divider {
        display: none;
    }

    #expandButton {
        display: none !important;
    }

    .ai-intro {
        margin: 6px 8px 2px;
        padding: 7px 10px;
    }

    .chat-body {
        padding: 10px 12px;
    }

    .message {
        font-size: 13.5px;
        max-width: 88%;
        padding: 10px 12px;
    }

    .assistant .message,
    .agent .message {
        max-width: 88%;
    }

    .composer-wrap {
        padding: 8px 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    }

    .composer {
        min-height: 44px;
    }

    .composer input[type="text"],
    .composer-input {
        font-size: 15px; /* prevents unwanted auto-zoom on iOS */
    }

    .emoji-picker,
    .ai-prompts-popup {
        left: 8px;
        right: 8px;
        width: auto;
        max-width: calc(100vw - 16px);
    }

    .modal-overlay {
        padding: 14px;
    }

    .intake-card {
        padding: 24px 18px 20px 18px;
        max-width: 100%;
        border-radius: 16px;
        gap: 14px;
    }
}

@media (max-width: 480px) {
    .brand-name {
        font-size: 15px;
    }

    .online-pill {
        padding: 2px 6px;
        font-size: 9.5px;
    }

    .ai-intro-copy {
        font-size: 11px;
    }

    .message {
        max-width: 90%;
    }

    .assistant .message,
    .agent .message {
        max-width: 90%;
    }
}

@media (max-width: 360px) {
    .brand-name {
        font-size: 13.5px;
    }

    .online-pill span:last-child {
        display: none;
    }

    .online-pill {
        padding: 4px;
        border-radius: 50%;
    }

    .header-btn {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }

    .composer {
        padding: 3px 4px 3px 8px;
        gap: 4px;
    }

    .attach-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .send-btn {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
    }
}

@media (max-height: 520px) and (orientation: landscape) {
    .chat-header {
        height: 44px;
        min-height: 44px;
    }

    .ai-intro {
        margin: 3px 8px 1px;
        padding: 4px 8px;
    }

    .chat-body {
        padding: 6px 10px;
    }

    .composer-wrap {
        padding: 4px 8px;
    }

    .emoji-picker,
    .ai-prompts-popup {
        height: 140px;
        bottom: calc(100% + 4px);
    }
}