:root {
    --background: #f7f7f8;
    --surface: #ffffff;
    --surface-secondary: #f4f4f5;
    --text-primary: #18181b;
    --text-secondary: #71717a;
    --border: #e4e4e7;
    --border-focus: #18181b;
    --primary: #18181b;
    --primary-hover: #27272a;
    --danger: #dc2626;
    --danger-background: #fef2f2;
    --success: #15803d;
    --success-background: #f0fdf4;
    --radius-small: 8px;
    --radius-medium: 12px;
    --radius-large: 20px;
    --shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 12px 40px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: var(--text-primary);
    background: var(--background);
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

/* Authentication */

.auth-page {
    min-height: 100vh;
}

.auth-layout {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 38px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    color: #ffffff;
    font-weight: 700;
    background: var(--primary);
    border-radius: 10px;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.auth-heading {
    margin: 42px 0 28px;
}

.auth-heading h1 {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.auth-heading p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    outline: none;
    transition:
        border-color 150ms ease,
        box-shadow 150ms ease;
}

.form-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}

.code-input {
    text-align: center;
    font-size: 24px !important;
    font-weight: 700;
    letter-spacing: 0.35em;
}

.primary-button {
    display: inline-flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    margin-top: 18px;
    padding: 12px 18px;
    color: #ffffff;
    font-weight: 600;
    background: var(--primary);
    border: 0;
    border-radius: var(--radius-medium);
    transition:
        background 150ms ease,
        opacity 150ms ease;
}

.primary-button:hover:not(:disabled) {
    background: var(--primary-hover);
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.auth-actions {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
}

.text-button {
    padding: 4px 0;
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    font-size: 14px;
}

.text-button:hover:not(:disabled) {
    color: var(--text-primary);
}

.text-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.form-message {
    margin-top: 20px;
    padding: 12px 14px;
    color: var(--danger);
    background: var(--danger-background);
    border: 1px solid #fecaca;
    border-radius: var(--radius-small);
    font-size: 14px;
    line-height: 1.5;
}

.form-message.success {
    color: var(--success);
    background: var(--success-background);
    border-color: #bbf7d0;
}

.development-code {
    margin-top: 14px;
    padding: 12px 14px;
    color: #854d0e;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: var(--radius-small);
    font-size: 14px;
    text-align: center;
}

.development-code strong {
    font-size: 18px;
    letter-spacing: 0.12em;
}

.auth-footer {
    margin: 28px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

/* Temporary chat page */

.chat-placeholder {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.chat-placeholder-card {
    width: 100%;
    max-width: 640px;
    padding: 36px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow);
}

.chat-placeholder-card h1 {
    margin: 24px 0 10px;
}

.chat-placeholder-card p {
    color: var(--text-secondary);
}

.user-email {
    font-weight: 600;
}

.secondary-button {
    min-height: 44px;
    margin-top: 18px;
    padding: 10px 18px;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
}

.secondary-button:hover {
    background: var(--surface-secondary);
}

@media (max-width: 560px) {
    .auth-layout {
        align-items: start;
        padding: 0;
    }

    .auth-card {
        min-height: 100vh;
        padding: 28px 22px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-heading {
        margin-top: 50px;
    }
}

/* =========================================================
   Chat application
   ========================================================= */

.chat-page {
    height: 100vh;
    overflow: hidden;
    background: #f7f7f8;
}

.app-shell {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */

.sidebar {
    position: relative;
    z-index: 30;
    display: flex;
    width: 280px;
    min-width: 280px;
    height: 100vh;
    flex-direction: column;
    background: #111113;
    border-right: 1px solid #27272a;
    color: #ffffff;
}

.sidebar-header {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
}

.sidebar-brand {
    color: #ffffff;
}

.sidebar-brand .brand-mark {
    color: #111113;
    background: #ffffff;
}

.sidebar-actions {
    padding: 0 12px 16px;
}

.new-chat-button {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: #ffffff;
    font-weight: 600;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 12px;
    transition:
        background 150ms ease,
        border-color 150ms ease;
}

.new-chat-button:hover {
    background: #3f3f46;
    border-color: #52525b;
}

.button-icon {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    font-size: 20px;
    line-height: 1;
}

.conversation-section {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    padding: 0 10px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 10px;
    color: #a1a1aa;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.small-icon-button,
.icon-button {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 9px;
}

.small-icon-button {
    width: 30px;
    height: 30px;
    color: #a1a1aa;
    font-size: 18px;
}

.small-icon-button:hover,
.icon-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.conversation-state {
    padding: 14px 10px;
    color: #a1a1aa;
    font-size: 13px;
    line-height: 1.5;
}

.conversation-state-error {
    color: #fca5a5;
}

.conversation-list {
    min-height: 0;
    overflow-y: auto;
    padding-right: 3px;
}

.conversation-item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    padding: 10px 12px;
    color: #d4d4d8;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 10px;
}

.conversation-item:hover {
    color: #ffffff;
    background: #27272a;
}

.conversation-item.active {
    color: #ffffff;
    background: #3f3f46;
}

.conversation-item-title {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer {
    position: relative;
    padding: 12px;
    border-top: 1px solid #27272a;
}

.account-button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 9px;
    color: #ffffff;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 12px;
}

.account-button:hover {
    background: #27272a;
}

.user-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    color: #18181b;
    font-weight: 700;
    background: #e4e4e7;
    border-radius: 11px;
}

.account-details {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}

.account-email {
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-label {
    color: #a1a1aa;
    font-size: 12px;
}

.account-chevron {
    color: #a1a1aa;
    font-size: 18px;
}

.account-menu {
    position: absolute;
    right: 12px;
    bottom: calc(100% - 4px);
    left: 12px;
    z-index: 50;
    padding: 6px;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 12px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.account-menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    min-height: 40px;
    padding: 8px 10px;
    color: #f4f4f5;
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 8px;
}

.account-menu-item:hover {
    background: #3f3f46;
}

.account-menu-item-danger {
    color: #fca5a5;
}

.account-menu-divider {
    height: 1px;
    margin: 6px 4px;
    background: #3f3f46;
}

/* Main chat area */

.chat-main {
    display: flex;
    min-width: 0;
    height: 100vh;
    flex: 1;
    flex-direction: column;
    background: #ffffff;
}

.chat-header {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid #e4e4e7;
    backdrop-filter: blur(12px);
}

.chat-header-left {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.conversation-title-wrapper {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.conversation-title-button {
    max-width: 480px;
    padding: 0;
    overflow: hidden;
    color: #18181b;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
    border: 0;
}

.conversation-title-button:hover {
    color: #52525b;
}

.conversation-status {
    color: #71717a;
    font-size: 12px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-action-button {
    min-height: 38px;
    padding: 8px 12px;
    color: #3f3f46;
    font-size: 13px;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 9px;
}

.header-action-button:hover:not(:disabled) {
    background: #f4f4f5;
}

.header-action-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.header-action-button-danger {
    color: #dc2626;
}

.chat-content {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    background:
        radial-gradient(
            circle at top center,
            rgba(244, 244, 245, 0.75),
            transparent 380px
        ),
        #ffffff;
}

/* Welcome screen */

.welcome-view {
    display: flex;
    width: min(860px, calc(100% - 40px));
    min-height: 100%;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 56px 0 190px;
    flex-direction: column;
    text-align: center;
}

.welcome-mark {
    display: grid;
    width: 56px;
    height: 56px;
    place-items: center;
    margin-bottom: 22px;
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
    background: #18181b;
    border-radius: 17px;
    box-shadow: 0 14px 35px rgba(24, 24, 27, 0.18);
}

.welcome-view h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.1;
    letter-spacing: -0.045em;
}

.welcome-view > p {
    max-width: 620px;
    margin: 16px auto 34px;
    color: #71717a;
    font-size: 16px;
    line-height: 1.7;
}

.suggestion-grid {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.suggestion-card {
    display: flex;
    min-height: 118px;
    align-items: flex-start;
    padding: 18px;
    flex-direction: column;
    gap: 8px;
    color: #18181b;
    text-align: left;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e4e4e7;
    border-radius: 16px;
    box-shadow: 0 5px 18px rgba(24, 24, 27, 0.03);
    transition:
        transform 150ms ease,
        border-color 150ms ease,
        box-shadow 150ms ease;
}

.suggestion-card:hover {
    transform: translateY(-2px);
    border-color: #a1a1aa;
    box-shadow: 0 12px 28px rgba(24, 24, 27, 0.07);
}

.suggestion-card strong {
    font-size: 14px;
}

.suggestion-card span {
    color: #71717a;
    font-size: 13px;
    line-height: 1.55;
}

/* Messages */

.message-list {
    width: min(900px, calc(100% - 40px));
    margin: 0 auto;
    padding: 34px 0 220px;
}

.message {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 26px;
}

.message-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    background: #18181b;
    border-radius: 11px;
}

.message.user .message-avatar {
    color: #18181b;
    background: #e4e4e7;
}

.message-content {
    min-width: 0;
    padding-top: 4px;
}

.message-author {
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 700;
}

.message-body {
    color: #27272a;
    font-size: 15px;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.message-body p {
    margin: 0 0 12px;
}

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

/* Composer */

.composer-area {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 280px;
    z-index: 20;
    padding: 14px 24px 18px;
    background:
        linear-gradient(
            to top,
            #ffffff 75%,
            rgba(255, 255, 255, 0)
        );
}

.provider-selector {
    width: min(900px, 100%);
    margin: 0 auto 10px;
    padding: 10px 12px;
    background: rgba(250, 250, 250, 0.96);
    border: 1px solid #e4e4e7;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(24, 24, 27, 0.05);
}

.provider-selector-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    color: #71717a;
    font-size: 12px;
    font-weight: 700;
}

.provider-toggle-button {
    padding: 3px 6px;
    color: #52525b;
    background: transparent;
    border: 0;
    border-radius: 6px;
    font-size: 12px;
}

.provider-toggle-button:hover {
    color: #18181b;
    background: #e4e4e7;
}

.provider-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.provider-option {
    position: relative;
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    color: #52525b;
    font-size: 13px;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 9px;
    cursor: pointer;
    user-select: none;
}

.provider-option:hover {
    border-color: #a1a1aa;
}

.provider-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.provider-checkbox {
    display: grid;
    width: 16px;
    height: 16px;
    place-items: center;
    background: #ffffff;
    border: 1px solid #a1a1aa;
    border-radius: 5px;
}

.provider-option input:checked + .provider-checkbox {
    background: #18181b;
    border-color: #18181b;
}

.provider-option input:checked + .provider-checkbox::after {
    content: "✓";
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
}

.provider-option:has(input:checked) {
    color: #18181b;
    border-color: #a1a1aa;
}

.prompt-form {
    width: min(900px, 100%);
    margin: 0 auto;
}

.prompt-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 10px 10px 16px;
    background: #ffffff;
    border: 1px solid #d4d4d8;
    border-radius: 18px;
    box-shadow:
        0 4px 16px rgba(24, 24, 27, 0.06),
        0 20px 50px rgba(24, 24, 27, 0.06);
}

.prompt-input-wrapper:focus-within {
    border-color: #71717a;
    box-shadow:
        0 0 0 3px rgba(24, 24, 27, 0.06),
        0 20px 50px rgba(24, 24, 27, 0.07);
}

.prompt-input-wrapper textarea {
    width: 100%;
    min-height: 28px;
    max-height: 220px;
    padding: 4px 0;
    resize: none;
    color: #18181b;
    background: transparent;
    border: 0;
    outline: none;
    font-size: 15px;
    line-height: 1.5;
}

.prompt-input-wrapper textarea::placeholder {
    color: #a1a1aa;
}

.send-button {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    padding: 0;
    color: #ffffff;
    background: #18181b;
    border: 0;
    border-radius: 11px;
    font-size: 21px;
}

.send-button:hover:not(:disabled) {
    background: #27272a;
}

.send-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.composer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 7px 4px 0;
    color: #71717a;
    font-size: 11px;
}

.composer-disclaimer {
    width: min(900px, 100%);
    margin: 7px auto 0;
    color: #a1a1aa;
    font-size: 11px;
    text-align: center;
}

/* Modal */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(24, 24, 27, 0.55);
    backdrop-filter: blur(4px);
}

.modal {
    width: min(460px, 100%);
    padding: 22px;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 18px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.02em;
}

.modal-header .icon-button {
    color: #71717a;
}

.modal-header .icon-button:hover {
    background: #f4f4f5;
}

.modal-description {
    margin: -4px 0 22px;
    color: #71717a;
    font-size: 14px;
    line-height: 1.65;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.modal-actions .secondary-button,
.modal-actions .primary-button,
.danger-button {
    width: auto;
    min-height: 42px;
    margin: 0;
}

.modal-primary-button {
    padding-inline: 20px;
}

.danger-button {
    padding: 10px 16px;
    color: #ffffff;
    font-weight: 600;
    background: #dc2626;
    border: 0;
    border-radius: 10px;
}

.danger-button:hover {
    background: #b91c1c;
}

/* Toast */

.toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 150;
    display: grid;
    width: min(360px, calc(100% - 36px));
    gap: 10px;
}

.toast {
    padding: 13px 15px;
    color: #18181b;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(24, 24, 27, 0.14);
    font-size: 13px;
    line-height: 1.5;
}

.toast-error {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.toast-success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

/* Sidebar overlay */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(24, 24, 27, 0.5);
}

/* Scrollbars */

.conversation-list,
.chat-content {
    scrollbar-width: thin;
    scrollbar-color: #d4d4d8 transparent;
}

.conversation-list {
    scrollbar-color: #52525b transparent;
}

.conversation-list::-webkit-scrollbar,
.chat-content::-webkit-scrollbar {
    width: 8px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: #52525b;
    border-radius: 999px;
}

.chat-content::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 999px;
}

/* Responsive */

.mobile-only {
    display: none;
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-only {
        display: inline-grid;
    }

    .chat-header {
        padding-inline: 16px;
    }

    .composer-area {
        left: 0;
        padding-inline: 16px;
    }

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

@media (max-width: 640px) {
    .welcome-view {
        width: min(100% - 28px, 860px);
        justify-content: flex-start;
        padding-top: 52px;
    }

    .welcome-view h1 {
        font-size: 31px;
    }

    .welcome-view > p {
        font-size: 14px;
    }

    .suggestion-grid {
        grid-template-columns: 1fr;
    }

    .suggestion-card {
        min-height: 96px;
    }

    .provider-selector {
        overflow-x: auto;
    }

    .provider-list {
        width: max-content;
        flex-wrap: nowrap;
    }

    .composer-area {
        padding: 10px 10px 12px;
    }

    .composer-meta {
        display: none;
    }

    .composer-disclaimer {
        display: none;
    }

    .message-list {
        width: calc(100% - 28px);
        padding-bottom: 190px;
    }

    .message {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 10px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 11px;
        border-radius: 9px;
    }
}

.messages-state {
    display: flex;
    min-height: 240px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted, #6b7280);
    text-align: center;
}

.messages-state p {
    margin: 0;
}

.messages-state-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(15, 23, 42, 0.12);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: messages-state-spin 0.8s linear infinite;
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
}

.message-time {
    flex: 0 0 auto;
    color: var(--text-muted, #6b7280);
    font-size: 0.75rem;
}

@keyframes messages-state-spin {
    to {
        transform: rotate(360deg);
    }
}
.provider-option-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.provider-option-disabled input {
    cursor: not-allowed;
}

/* Live provider responses */
.provider-response-group {
    display: grid;
    gap: 14px;
    width: min(900px, calc(100% - 58px));
    margin: -2px 0 12px 58px;
}

.provider-response-card {
    overflow: hidden;
    border: 1px solid var(--border-color, #dfe3ea);
    border-radius: 16px;
    background: var(--surface-color, #ffffff);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.provider-response-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-color, #e8ebf0);
}

.provider-response-identity {
    display: flex;
    align-items: baseline;
    gap: 9px;
    min-width: 0;
}

.provider-response-name {
    font-weight: 700;
    color: var(--text-primary, #111827);
}

.provider-response-model {
    overflow: hidden;
    color: var(--text-secondary, #6b7280);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.provider-response-status {
    flex: 0 0 auto;
    padding: 4px 9px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.provider-response-card.status-processing .provider-response-status,
.provider-response-card.status-streaming .provider-response-status {
    background: #e8f1ff;
    color: #2457a7;
}

.provider-response-card.status-completed .provider-response-status {
    background: #e8f8ee;
    color: #237a42;
}

.provider-response-card.status-failed .provider-response-status,
.provider-response-card.status-cancelled .provider-response-status {
    background: #fdecec;
    color: #b42318;
}

.provider-response-body {
    padding: 16px;
    color: var(--text-primary, #1f2937);
    line-height: 1.65;
}

.provider-response-body p {
    margin: 0 0 12px;
    white-space: pre-wrap;
}

.provider-response-body p:last-child {
    margin-bottom: 0;
}

.provider-response-pending {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary, #6b7280);
}

.provider-response-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: provider-response-spin 0.8s linear infinite;
}

.provider-response-error {
    color: #b42318;
}

@keyframes provider-response-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 720px) {
    .provider-response-group {
        width: 100%;
        margin-left: 0;
    }

    .provider-response-header {
        align-items: flex-start;
    }

    .provider-response-identity {
        flex-direction: column;
        gap: 2px;
    }
}

.account-information {
    display: grid;
    gap: 16px;
    margin-top: 8px;
}

.account-information-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 14px;
}

.account-information-label {
    color: var(--muted-text-color, #777985);
    font-size: 0.875rem;
}

.account-information-row strong {
    overflow-wrap: anywhere;
}

.danger-zone {
    padding: 18px;
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 14px;
}

.danger-zone h3 {
    margin: 0 0 8px;
}

.danger-zone .danger-button {
    margin-top: 16px;
}

.provider-response-status-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.provider-response-latency,
.provider-response-time {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.provider-response-latency::before,
.provider-response-time::before {
    content: '·';
    margin-right: 8px;
}