:root {
    --ink: #16130f;
    --ink-soft: rgba(22, 19, 15, 0.7);
    --canvas-top: #fbf4ea;
    --canvas-bottom: #efdfcb;
    --panel: rgba(255, 252, 247, 0.76);
    --panel-strong: rgba(255, 253, 249, 0.9);
    --line: rgba(28, 24, 18, 0.08);
    --gold: #c58d34;
    --gold-soft: rgba(197, 141, 52, 0.14);
    --emerald: #1d5045;
    --emerald-soft: rgba(29, 80, 69, 0.12);
    --user-bubble: linear-gradient(160deg, #1f574a, #2c7464);
    --danger: #9d473a;
    --danger-soft: rgba(157, 71, 58, 0.12);
    --shadow: 0 30px 80px rgba(55, 34, 18, 0.16);
    --radius-xl: 34px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-pill: 999px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(197, 141, 52, 0.22), transparent 28%),
        radial-gradient(circle at bottom right, rgba(29, 80, 69, 0.18), transparent 32%),
        linear-gradient(180deg, var(--canvas-top) 0%, var(--canvas-bottom) 100%);
    color: var(--ink);
    font-family: "Manrope", sans-serif;
}

.ambient {
    position: fixed;
    border-radius: 999px;
    filter: blur(54px);
    opacity: 0.48;
    pointer-events: none;
}

.ambient-a {
    width: 26rem;
    height: 26rem;
    top: -9rem;
    right: -8rem;
    background: rgba(197, 141, 52, 0.24);
}

.ambient-b {
    width: 30rem;
    height: 30rem;
    bottom: -10rem;
    left: -10rem;
    background: rgba(29, 80, 69, 0.15);
}

.ambient-c {
    width: 20rem;
    height: 20rem;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(174, 122, 102, 0.14);
}

.chat-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 20px;
    display: grid;
    place-items: center;
}

.chat-frame {
    width: min(100%, 760px);
    min-height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border-radius: var(--radius-xl);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.16)),
        var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(22px);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 16px 18px;
    border-radius: 28px;
    background:
        linear-gradient(145deg, rgba(255, 251, 245, 0.96), rgba(244, 233, 214, 0.88));
    border: 1px solid rgba(255, 255, 255, 0.58);
}

.chat-identity {
    display: flex;
    gap: 14px;
    align-items: center;
    min-width: 0;
}

.chat-avatar {
    width: 64px;
    height: 64px;
    padding: 10px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(242, 223, 190, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.chat-title-block {
    min-width: 0;
}

.chat-eyebrow {
    margin: 0 0 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-weight: 800;
    color: #a26b1f;
}

.chat-title-block h1 {
    margin: 0;
    font-family: "Sora", sans-serif;
    font-size: clamp(1.28rem, 2vw, 1.72rem);
}

.chat-status-line {
    margin: 4px 0 0;
    color: var(--ink-soft);
    font-size: 0.94rem;
}

.chat-badges {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.status-badge,
.session-badge,
.icon-button,
.send-button {
    border-radius: var(--radius-pill);
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.status-badge,
.session-badge {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(28, 24, 18, 0.06);
    font-weight: 800;
    font-size: 0.82rem;
    white-space: nowrap;
}

.session-badge {
    color: var(--ink-soft);
}

.config-banner,
.recording-pill {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--danger-soft);
    border: 1px solid rgba(157, 71, 58, 0.18);
    color: #6f2e24;
    font-weight: 700;
}

.simulator-panel {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1.1fr) minmax(220px, 280px);
    align-items: center;
    padding: 16px 18px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(239, 247, 244, 0.8));
    border: 1px solid rgba(28, 24, 18, 0.08);
}

.simulator-copy {
    min-width: 0;
}

.simulator-kicker {
    margin: 0 0 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 800;
    color: var(--emerald);
}

.simulator-note {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.45;
}

.simulator-field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.simulator-field span {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--ink-soft);
}

.simulator-field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(28, 24, 18, 0.08);
    background: rgba(255, 255, 255, 0.94);
    color: var(--ink);
    font: inherit;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.simulator-field input:focus {
    border-color: rgba(29, 80, 69, 0.4);
    box-shadow: 0 0 0 4px rgba(29, 80, 69, 0.08);
}

.simulator-field input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.business-info-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(28, 24, 18, 0.08);
}

.business-info-panel[hidden] {
    display: none;
}

.business-info-item {
    min-width: 0;
}

.business-info-label {
    display: block;
    margin-bottom: 5px;
    color: var(--emerald);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.business-info-item strong {
    display: block;
    color: var(--ink);
    font-size: 0.9rem;
    line-height: 1.35;
}

.business-info-item p {
    margin: 6px 0 0;
    color: var(--ink-soft);
    font-size: 0.84rem;
    line-height: 1.42;
}

.business-info-link {
    display: inline-flex;
    margin-top: 8px;
    color: var(--emerald);
    font-size: 0.86rem;
    font-weight: 800;
    text-decoration: none;
}

.business-info-link:hover {
    text-decoration: underline;
}

.icon-button:hover,
.send-button:hover {
    transform: translateY(-1px);
}

.message-stream {
    flex: 1;
    overflow: auto;
    display: grid;
    gap: 12px;
    align-content: start;
    padding: 12px 4px 0;
}

.message-bubble {
    max-width: 86%;
    padding: 14px 16px;
    border-radius: 22px;
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(41, 28, 16, 0.05);
}

.message-bubble.is-assistant {
    justify-self: start;
    background: var(--panel-strong);
}

.message-bubble.is-user {
    justify-self: end;
    background: var(--user-bubble);
    color: #fff;
    border-color: transparent;
}

.message-bubble p {
    margin: 0;
    line-height: 1.52;
    color: var(--ink-soft);
}

.message-bubble.is-user p {
    color: rgba(255, 255, 255, 0.94);
}

.message-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.message-meta span {
    padding: 6px 9px;
    border-radius: var(--radius-pill);
    background: rgba(26, 20, 14, 0.05);
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--ink-soft);
}

.message-bubble.is-user .message-meta span {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.84);
}

.message-bubble audio {
    width: 100%;
    margin-top: 10px;
}

.message-card-grid {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.message-card {
    display: grid;
    grid-template-columns: minmax(110px, 132px) minmax(0, 1fr);
    gap: 14px;
    padding: 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 240, 230, 0.94));
    border: 1px solid rgba(28, 24, 18, 0.08);
    box-shadow: 0 18px 34px rgba(42, 27, 14, 0.08);
    overflow: hidden;
}

.message-card-media {
    min-height: 112px;
    border-radius: 16px;
    overflow: hidden;
}

.message-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.message-card-body {
    display: grid;
    gap: 8px;
    align-content: start;
}

.message-card-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.message-card-tag,
.message-card-action {
    border-radius: var(--radius-pill);
    font-weight: 800;
}

.message-card-tag {
    padding: 6px 10px;
    background: rgba(29, 80, 69, 0.08);
    color: var(--emerald);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.message-card-price {
    font-family: "Sora", sans-serif;
    font-size: 0.92rem;
    color: var(--ink);
}

.message-card h4 {
    margin: 0;
    font-family: "Sora", sans-serif;
    font-size: 1rem;
    color: var(--ink);
}

.message-card p {
    color: var(--ink-soft) !important;
    font-size: 0.92rem;
}

.message-card-action {
    justify-self: start;
    padding: 10px 14px;
    border: 0;
    background: linear-gradient(160deg, #1d5045, #2b6b5e);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 18px rgba(29, 80, 69, 0.18);
}

.message-card-action:hover {
    transform: translateY(-1px);
}

.typing-indicator {
    display: inline-flex;
    gap: 6px;
    align-self: flex-start;
    padding: 2px 6px;
}

.typing-indicator[hidden] {
    display: none !important;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--gold);
    animation: pulse 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.18s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.36s;
}

.composer {
    display: grid;
    gap: 10px;
    padding-top: 4px;
}

.composer-field {
    display: block;
    padding: 16px 18px;
    border-radius: 24px;
    border: 1px solid rgba(28, 24, 18, 0.08);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.composer textarea {
    width: 100%;
    min-height: 24px;
    border: 0;
    outline: none;
    resize: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
    line-height: 1.5;
}

.composer textarea::placeholder {
    color: rgba(22, 19, 15, 0.45);
}

.composer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.icon-button,
.send-button {
    border: 1px solid rgba(28, 24, 18, 0.08);
    padding: 12px 16px;
    font-family: "Sora", sans-serif;
    font-weight: 700;
    cursor: pointer;
}

.icon-button {
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.mic-icon {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.icon-button.is-recording {
    background: rgba(157, 71, 58, 0.12);
    color: var(--danger);
    border-color: rgba(157, 71, 58, 0.18);
}

.send-button {
    background: linear-gradient(160deg, #191611, #31251b);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 14px 28px rgba(25, 22, 17, 0.18);
}

.icon-button:disabled,
.send-button:disabled,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@keyframes pulse {
    0%,
    80%,
    100% {
        transform: scale(0.75);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 820px) {
    body {
        overflow: auto;
    }

    .chat-shell {
        min-height: 100vh;
        padding: 0;
    }

    .chat-frame {
        width: 100%;
        min-height: 100vh;
        max-height: none;
        border-radius: 0;
        padding: 14px;
    }

    .chat-header {
        padding: 14px;
        border-radius: 24px;
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-badges {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .message-bubble {
        max-width: 100%;
    }

    .message-card {
        grid-template-columns: 1fr;
    }

    .message-card-media {
        min-height: 180px;
    }

    .simulator-panel {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .business-info-panel {
        grid-template-columns: 1fr;
        padding: 14px;
    }
}
