:root {
    --izzie-bg-primary: #ffffff;
    --izzie-bg-secondary: #f8fafc;
    --izzie-bg-tertiary: #2e4f81;
    --izzie-bg-message-bot: #f1f5f9;
    --izzie-bg-message-user: #2e4f81;
    --izzie-text-primary: #213759;
    --izzie-text-secondary: #475569;
    --izzie-text-user: #ffffff;
    --izzie-border: #d9e2ec;
    --izzie-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.22);
    --izzie-input-bg: #ffffff;
    --izzie-accent: #ea7139;
    --izzie-status-online: #22c55e;
    --izzie-status-offline: #ef4444;
    --color-header-from: #1e3a5f;
    --color-header-to: #2c5384;
    --color-header-text: #ffffff;
}

body[data-izzie-theme="dark"] {
    --izzie-bg-primary: #1c1c1c;
    --izzie-bg-secondary: #1c1c1c;
    --izzie-bg-message-bot: #334155;
    --izzie-bg-message-user: #eb7236;
    --izzie-text-primary: #f8fafc;
    --izzie-text-secondary: #cbd5e1;
    --izzie-text-user: #ffffff;
    --izzie-border: #48617f;
    --izzie-input-bg: #0f172a;
    --color-header-from: #1e293b;
    --color-header-to: #213759;
    background: #1c1c1c;
}

* {
    box-sizing: border-box;
    scrollbar-color: #444 rgb(244, 248, 251);
    scrollbar-width: thin;
}

html,
body {
    margin: 0;
    height: 100%;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    background:
        radial-gradient(
            circle at top right,
            rgba(46, 79, 129, 0.12),
            transparent 32%
        ),
        linear-gradient(180deg, #f7fafc 0%, #e8eef5 100%);
    color: #444;
    overflow: hidden;
    scrollbar-gutter: stable;
    border-radius: 1rem !important;
}
html {
    background: rgba(255, 255, 255, 0) !important;
}

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: rgb(244, 248, 251);
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #333;
}

.agent-chat-page {
    display: flex;
    min-height: 100vh;
    background: rgb(244, 248, 251) !important;
    border-radius: 1rem !important;
}

.agent-chat-shell {
    display: flex;
    flex: 1;
    align-items: stretch;
    justify-content: center;
    margin: 0 auto !important;
    width: 100%;
    border-radius: 1rem !important;
}

.agent-chat-shell--centered {
    align-items: center;
}

.block_izziechat_container {
    width: min(100vw, 1080px) !important;
    height: 100vh;
    background: var(--izzie-bg-primary);
    border-radius: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: var(--izzie-shadow);
    color: #444;
    border: 1px solid var(--izzie-border);
    overflow: hidden;
    all: unset;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box;
}

.block_izziechat_container > div {
    padding: 0.5rem !important;
}

#agentChatWindow {
    /* all: unset; */
    min-height: 100vh;
    margin: 0 auto !important;
    padding: 0 !important;
    width: 100%;
}

.izzie-chat-header {
    background: rgba(244, 248, 251, 1) !important;
    color: #333 !important;
    border-bottom: solid 1px #ddd;
    border-radius: 1rem 1rem 0 0 !important;
}

.izzie-chat-chat-header-gradient {
    background: linear-gradient(
        to right,
        var(--color-header-from),
        var(--color-header-to)
    );
    color: var(--color-header-text);
}

.izzie-chat-p-4 {
    padding: 16px 18px;
}

.izzie-chat-flex {
    display: flex;
}

.izzie-chat-items-center {
    align-items: center;
}

.izzie-chat-justify-between {
    justify-content: space-between;
}

.izziechat-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.izziechat-title {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.01em;
}

.izziechat-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.izziechat-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--izzie-status-offline);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.18);
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.izziechat-status-indicator.is-online {
    background: var(--izzie-status-online);
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.18);
}

.izziechat-status-indicator.is-offline {
    background: var(--izzie-status-offline);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.18);
}

.izziechat-theme-toggle {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    cursor: pointer;
    position: relative;
}

.izziechat-theme-toggle::before {
    content: "";
    position: absolute;
    inset: 9px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ffffff 0%, #ffe9b5 55%, #d7e3ff 100%);
}

.izziechat-log {
    flex: 1;
    overflow-y: auto;
    background: rgb(244, 248, 251) !important;
    padding: 28px 22px 28px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border: 0;
    scrollbar-gutter: stable;
    min-height: 0;
}

.izziechat-message {
    max-width: min(82%, 760px);
    border-radius: 18px;
    padding: 14px 16px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.izziechat-message--assistant {
    align-self: flex-start;
    background: none;
    color: #444;
    border-top-left-radius: 6px;
    padding: 0;
    box-shadow: none;
}

.izziechat-message--assistant p {
    margin: 0 0 10px;
}

.izziechat-message--assistant p:last-child {
    margin-bottom: 0;
}

.izziechat-message--assistant ul,
.izziechat-message--assistant ol {
    margin: 8px 0 10px 22px;
    padding: 0;
}

.izziechat-message--assistant li {
    margin: 4px 0;
}

.izziechat-message--assistant table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    table-layout: fixed;
}

.izziechat-message--assistant th,
.izziechat-message--assistant td {
    border: 1px solid #cbd5e1;
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.izziechat-message--assistant th {
    background: #e2e8f0;
    font-weight: 700;
}

.izziechat-message--user {
    align-self: flex-end;
    background: var(--izzie-bg-message-user);
    color: var(--izzie-text-user);
    border-top-right-radius: 6px;
    padding: 0.65rem 1.5rem;
}

.izziechat-message--status {
    align-self: center;
    background: none;
    border: 0;
    color: #444;
    box-shadow: none;
    text-align: left;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border-radius: 0;
    line-height: 1;
}

.izziechat-message--status,
.izziechat-message--status p {
    margin: 0 !important;
    padding: 0 !important;
    white-space: unset;
}

.izziechat-message--typing {
    align-self: flex-start;
    background: none;
    color: #444;
    border-radius: 0px;
    box-shadow: none;
    padding: 0 !important;
}

.izziechat-message--typing::after {
    content: "";
    animation: typing-dots 1.4s steps(4, end) infinite;
}

@keyframes typing-dots {
    0%,
    20% {
        content: "";
    }
    40% {
        content: ".";
    }
    60% {
        content: "..";
    }
    80%,
    100% {
        content: "...";
    }
}

.izziechat-input-area {
    padding: 16px 18px 0;
    border-top: 1px solid var(--izzie-border);
    background: rgb(244, 248, 251) !important;
    flex-shrink: 0;
    border: 0;
    border-radius: 0 0 1rem 1rem !important;
}

.izziechat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--izzie-input-bg);
    border: 1px solid var(--izzie-border);
    border-radius: 16px;
    padding: 8px 8px 8px 16px;
}

.izziechat-input-wrapper input {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    color: #444;
    font: inherit;
    min-width: 0;
}

.izziechat-input-wrapper button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: var(--izzie-accent);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        transform 0.18s ease,
        opacity 0.18s ease;
}

.izziechat-input-wrapper button:hover {
    transform: translateY(-1px);
}

.izziechat-input-wrapper button:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

.izziechat-access-page {
    width: 100%;
    display: flex;
    justify-content: center;
}

.izziechat-access-card {
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid var(--izzie-border);
    border-radius: 16px;
    background: var(--izzie-bg-secondary);
}

.izziechat-access-card--page {
    width: min(100%, 520px);
    margin-bottom: 0;
    padding: 28px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--izzie-shadow);
}

.izziechat-access-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--izzie-accent);
    margin-bottom: 10px;
}

.izziechat-access-heading {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.1;
}

.izziechat-access-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 6px;
}

.izziechat-access-copy {
    font-size: 13px;
    line-height: 1.5;
    color: #444;
}

.izziechat-access-fields {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.izziechat-access-fields input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--izzie-border);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--izzie-input-bg);
    color: #444;
    font: inherit;
}

.izziechat-access-fields button {
    border: 0;
    border-radius: 12px;
    padding: 0 16px;
    min-height: 44px;
    background: var(--izzie-accent);
    color: #444;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.izziechat-access-fields button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.izziechat-recaptcha-slot {
    margin-top: 18px;
    min-height: 78px;
    display: flex;
    justify-content: center;
}

.izziechat-access-feedback {
    min-height: 18px;
    margin-top: 10px;
    font-size: 12px;
    color: #444;
}

.izziechat-access-feedback[data-tone="danger"] {
    color: #dc2626;
}

.izziechat-footnote {
    margin: 0.5rem 0;
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    color: #444;
}

body[data-izzie-theme="dark"] * {
    scrollbar-color: #f8fafc #1c1c1c;
}

body[data-izzie-theme="dark"] ::-webkit-scrollbar-track {
    background: #1c1c1c;
}

body[data-izzie-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #f8fafc;
    border-radius: 6px;
}

body[data-izzie-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #ffffff;
}

body[data-izzie-theme="dark"] .agent-chat-page {
    background: rgba(34, 34, 34, 1) !important;
}

body[data-izzie-theme="dark"] .block_izziechat_container {
    background: var(--izzie-bg-primary);
}

body[data-izzie-theme="dark"] .izzie-chat-header {
    background: rgba(34, 34, 34, 1) !important;
    border-bottom: solid 1px #333;
}

body[data-izzie-theme="dark"] .izzie-chat-chat-header-gradient {
    background: rgba(34, 34, 34, 1);
    color: rgba(39, 39, 39, 1);
    border-color: #333;
}

body[data-izzie-theme="dark"] .izzie-chat-p-4 {
    padding: 16px 18px;
}

body[data-izzie-theme="dark"] .izziechat-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

body[data-izzie-theme="dark"] .izziechat-title {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.01em;
    color: #ffffff;
}

body[data-izzie-theme="dark"] .izziechat-controls {
    color: #ffffff;
}

body[data-izzie-theme="dark"] .izziechat-theme-toggle::before {
    background: linear-gradient(135deg, #111827 0%, #334155 45%, #d3d3d3 100%);
}

body[data-izzie-theme="dark"] .izziechat-status-indicator {
    background: var(--izzie-status-offline);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.18);
}

body[data-izzie-theme="dark"] .izziechat-log {
    background: rgba(34, 34, 34, 1) !important;
}

body[data-izzie-theme="dark"] .izziechat-message--assistant {
    color: var(--izzie-text-primary);
}

body[data-izzie-theme="dark"] .izziechat-message--assistant th,
body[data-izzie-theme="dark"] .izziechat-message--assistant td {
    border-color: #48617f;
}

body[data-izzie-theme="dark"] .izziechat-message--assistant th {
    background: #1e293b;
}

body[data-izzie-theme="dark"] .izziechat-message--user {
    background: #555;
    color: var(--izzie-text-user);
}

body[data-izzie-theme="dark"] .izziechat-message--status {
    color: #fff;
}

body[data-izzie-theme="dark"] .izziechat-message--typing {
    color: #fff;
}

body[data-izzie-theme="dark"] .izziechat-input-area {
    background: rgba(34, 34, 34, 1) !important;
    border-top-color: var(--izzie-border);
    border-top: solid 1px #333;
}

body[data-izzie-theme="dark"] .izziechat-input-wrapper {
    background: rgba(34, 34, 34, 1);
    border-color: rgba(34, 34, 34, 1);
}

body[data-izzie-theme="dark"] .izziechat-input-wrapper input {
    color: var(--izzie-text-primary);
    background: rgba(34, 34, 34, 1);
}

body[data-izzie-theme="dark"] .izziechat-input-wrapper button {
    background: #555;
}

body[data-izzie-theme="dark"] .izziechat-access-card,
body[data-izzie-theme="dark"] .izziechat-access-card--page {
    background: var(--izzie-bg-secondary);
    border-color: var(--izzie-border);
}

body[data-izzie-theme="dark"] .izziechat-access-card--page {
    background: rgba(34, 34, 34, 1) !important;
}

body[data-izzie-theme="dark"] .izziechat-access-fields input {
    background: var(--izzie-input-bg);
    color: var(--izzie-text-primary);
    border-color: var(--izzie-border);
}

body[data-izzie-theme="dark"] .izziechat-footnote {
    color: #fff;
}

@media (max-width: 1100px) {
    .agent-chat-shell {
        padding: 0;
    }

    .block_izziechat_container {
        border: 0;
    }

    .izziechat-message,
    .izzie-chat-header,
    .izziechat-input-area {
        max-width: 97%;
        margin: 0 auto;
        width: 100%;
    }

    .izziechat-access-fields {
        flex-direction: column;
    }
}

.izziechat-title-group {
    padding-left: 0.5rem;
}

.chat-message--user .chat-timeline__content {
    text-align: right !important;
}
