﻿:root {
    --page-background: #0d0d0d;
    --sidebar-background: #171717;
    --sidebar-hover: #252525;
    --panel-background: #1c1c1c;
    --assistant-background: #121212;
    --border-color: #303030;
    --primary-text: #f4f4f4;
    --secondary-text: #9b9b9b;
    --muted-text: #707070;
    --accent: #ffffff;
    --success: #5fce82;
    --sidebar-width: 280px;
    --assistant-width: 420px;
}

* {
    box-sizing: border-box;
}

/* Dark application scrollbars */

* {
    scrollbar-width: thin;
    scrollbar-color: #454545 #151515;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #151515;
}

::-webkit-scrollbar-thumb {
    min-height: 40px;
    border: 2px solid #151515;
    border-radius: 999px;
    background: #454545;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #5c5c5c;
    }

    ::-webkit-scrollbar-thumb:active {
        background: #707070;
    }

::-webkit-scrollbar-corner {
    background: #151515;
}

html,
body,
form {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    background: var(--page-background);
    color: var(--primary-text);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    color: inherit;
}

.app-shell {
    display: flex;
    width: 100%;
    height: 100vh;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex: 0 0 var(--sidebar-width);
    flex-direction: column;
    width: var(--sidebar-width);
    height: 100%;
    padding: 14px;
    background: var(--sidebar-background);
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    display: flex;
    align-items: center;
    min-height: 54px;
    padding: 6px 8px 14px;
}

.brand-icon {
    display: block;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    margin-right: 12px;
    border-radius: 11px;
    object-fit: cover;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brand-name {
    font-size: 15px;
    font-weight: 700;
}

.brand-status {
    margin-top: 3px;
    color: var(--secondary-text);
    font-size: 12px;
}

.assistant-selector {
    margin-bottom: 12px;
}

.assistant-selector-label {
    display: block;
    margin: 0 0 7px 2px;
    color: var(--secondary-text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.assistant-select {
    width: 100%;
    min-height: 42px;
    padding: 0 38px 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    outline: none;
    background-color: var(--panel-background);
    color: var(--primary-text);
    cursor: pointer;
}

    .assistant-select:hover {
        border-color: #444444;
    }

    .assistant-select:focus {
        border-color: #5d9cff;
        box-shadow: 0 0 0 3px rgba(93, 156, 255, 0.12);
    }

.new-chat-button {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

    .new-chat-button:hover {
        background: var(--sidebar-hover);
    }

    .new-chat-button:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

.new-chat-icon {
    display: inline-block;
    width: 24px;
    font-size: 22px;
    line-height: 1;
}

.sidebar-section {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    margin-top: 24px;
}

.sidebar-section-title {
    padding: 0 10px 10px;
    color: var(--secondary-text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.conversation-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.empty-conversations {
    padding: 12px 10px;
    color: var(--muted-text);
    font-size: 13px;
}

.conversation-row {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 38px;
    margin: 0 0 4px;
    border-radius: 8px;
}

    .conversation-row:hover,
    .conversation-row:focus-within {
        background: var(--sidebar-hover);
    }

    .conversation-row:has(.conversation-item[aria-current="true"]) {
        background: #2a2a2a;
    }

.conversation-item {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 38px;
    padding: 8px 38px 8px 10px;
    overflow: hidden;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--primary-text);
    cursor: pointer;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

    .conversation-item:hover,
    .conversation-item[aria-current="true"] {
        background: transparent;
    }

    .conversation-item:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
    }

.conversation-menu-button {
    position: absolute;
    top: 50%;
    right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    opacity: 0;
    transform: translateY(-50%);
}

    .conversation-row:hover .conversation-menu-button,
    .conversation-row:focus-within .conversation-menu-button,
    .conversation-menu-button[aria-expanded="true"] {
        opacity: 1;
    }

    .conversation-menu-button:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--primary-text);
    }

    .conversation-menu-button:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 1px;
    }

.conversation-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% - 2px);
    right: 4px;
    display: flex;
    min-width: 126px;
    padding: 6px;
    flex-direction: column;
    gap: 2px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: var(--panel-background);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

    .conversation-menu.is-hidden {
        display: none;
    }

.conversation-menu-action {
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--primary-text);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

    .conversation-menu-action:hover,
    .conversation-menu-action:focus-visible {
        background: var(--sidebar-hover);
        outline: none;
    }

    .conversation-menu-action.is-danger {
        color: #ff8d8d;
    }

.conversation-row.is-editing {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
    padding: 5px;
    background: #2a2a2a;
}

.conversation-rename-input {
    min-width: 0;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--page-background);
    color: var(--primary-text);
    font: inherit;
}

    .conversation-rename-input:focus {
        outline: none;
        box-shadow: 0 0 0 2px rgba(111, 139, 255, 0.18);
    }

.conversation-rename-save,
.conversation-rename-cancel {
    height: 30px;
    padding: 0 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--secondary-text);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.conversation-rename-save {
    color: var(--accent);
}

    .conversation-rename-save:hover,
    .conversation-rename-cancel:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .conversation-rename-save:disabled,
    .conversation-rename-cancel:disabled {
        cursor: pointer;
        opacity: 0.55;
    }


.sidebar-footer {
    flex: 0 0 auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer-button {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

    .sidebar-footer-button:hover {
        background: var(--sidebar-hover);
    }

    .sidebar-footer-button:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

.sidebar-footer-button-danger {
    margin-top: 4px;
    color: #f0a2a2;
}

    .sidebar-footer-button-danger:hover {
        background: rgba(185, 55, 55, 0.18);
        color: #ffc0c0;
    }

    .sidebar-footer-button-danger:disabled {
        cursor: wait;
        opacity: 0.65;
    }

.main-content {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    background: var(--page-background);
    overflow: hidden;
}

.workspace-panel {
    display: flex;
    flex: 1 1 auto;
    align-items: stretch;
    justify-content: center;
    min-width: 0;
    height: 100%;
    padding: 20px;
    overflow: hidden;
}

.welcome-panel {
    width: min(520px, calc(100% - 40px));
    padding: 42px;
    text-align: center;
}

.welcome-brand-icon {
    display: block;
    width: 96px;
    height: 96px;
    margin: 0 auto 22px;
    border-radius: 24px;
    object-fit: cover;
}

.welcome-panel h1 {
    margin: 0;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.welcome-panel p {
    margin: 14px 0 0;
    color: var(--secondary-text);
    font-size: 16px;
    line-height: 1.6;
}

.assistant-stage {
    display: flex;
    flex: 0 0 var(--assistant-width);
    flex-direction: column;
    width: var(--assistant-width);
    height: 100%;
    background: var(--assistant-background);
    border-left: 1px solid var(--border-color);
    transition: width 0.22s ease, flex-basis 0.22s ease;
}

.assistant-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.assistant-stage-identity {
    min-width: 0;
}

.assistant-stage-title {
    font-size: 16px;
    font-weight: 700;
}

.assistant-stage-status {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 5px;
    color: var(--secondary-text);
    font-size: 12px;
}

.assistant-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(95, 206, 130, 0.35);
}

.assistant-collapse-button {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

    .assistant-collapse-button:hover {
        background: var(--sidebar-hover);
        border-color: #444444;
    }

    .assistant-collapse-button:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }

.assistant-collapse-icon {
    display: block;
    font-size: 25px;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform 0.22s ease;
}

.assistant-visual-container {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;
}

    .assistant-visual-container::before {
        position: absolute;
        top: 10%;
        right: 10%;
        bottom: 10%;
        left: 10%;
        border: 1px solid rgba(255, 255, 255, 0.025);
        border-radius: 50%;
        content: "";
    }

.assistant-placeholder {
    position: relative;
    width: 210px;
    height: 410px;
    opacity: 0.72;
    animation: assistant-idle 4.5s ease-in-out infinite;
}

.assistant-placeholder-head {
    position: absolute;
    z-index: 2;
    top: 15px;
    left: 50%;
    width: 112px;
    height: 132px;
    border: 2px solid var(--border-color);
    border-radius: 48% 48% 44% 44%;
    background: var(--panel-background);
    transform: translateX(-50%);
}

    .assistant-placeholder-head::before,
    .assistant-placeholder-head::after {
        position: absolute;
        top: 58px;
        width: 8px;
        height: 3px;
        border-radius: 999px;
        background: var(--secondary-text);
        content: "";
        opacity: 0.55;
    }

    .assistant-placeholder-head::before {
        left: 31px;
    }

    .assistant-placeholder-head::after {
        right: 31px;
    }

.assistant-placeholder-body {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 210px;
    height: 275px;
    border: 2px solid var(--border-color);
    border-radius: 90px 90px 24px 24px;
    background: var(--panel-background);
    transform: translateX(-50%);
}

    .assistant-placeholder-body::before {
        position: absolute;
        top: 52px;
        left: 50%;
        width: 72px;
        height: 1px;
        background: var(--border-color);
        content: "";
        transform: translateX(-50%);
    }

.assistant-visual-message {
    position: absolute;
    right: 20px;
    bottom: 20px;
    left: 20px;
    color: var(--muted-text);
    font-size: 12px;
    text-align: center;
}

.assistant-stage.is-collapsed {
    flex-basis: 64px;
    width: 64px;
}

    .assistant-stage.is-collapsed .assistant-stage-header {
        justify-content: center;
        padding-right: 10px;
        padding-left: 10px;
    }

    .assistant-stage.is-collapsed .assistant-stage-identity,
    .assistant-stage.is-collapsed .assistant-visual-container {
        display: none;
    }

    .assistant-stage.is-collapsed .assistant-collapse-icon {
        transform: rotate(180deg);
    }

@keyframes assistant-idle {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

.profile-wizard {
    display: flex;
    flex-direction: column;
    width: min(920px, 100%);
    height: 100%;
    min-height: 0;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--panel-background);
    overflow: hidden;
}

.wizard-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 20px;
    padding: 24px 32px 20px;
    border-bottom: 1px solid var(--border-color);
}

.wizard-logo {
    display: block;
    flex: 0 0 auto;
    width: 68px;
    height: 68px;
    border-radius: 18px;
    object-fit: cover;
}

.wizard-header-text {
    min-width: 0;
}

.wizard-eyebrow,
.wizard-step-kicker {
    color: #71b7ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.wizard-header h1 {
    margin: 6px 0 0;
    font-size: 26px;
}

.wizard-header p {
    margin: 9px 0 0;
    color: var(--secondary-text);
    line-height: 1.55;
}

.wizard-progress {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.12);
}

.wizard-progress-step {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted-text);
    cursor: default;
}

.wizard-progress-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--assistant-background);
    font-size: 12px;
    font-weight: 700;
}

.wizard-progress-label {
    font-size: 13px;
    font-weight: 700;
}

.wizard-progress-step.is-active {
    color: var(--primary-text);
}

    .wizard-progress-step.is-active .wizard-progress-number {
        border-color: #5d9cff;
        background: #1d4f85;
    }

.wizard-progress-step.is-complete {
    color: var(--secondary-text);
}

    .wizard-progress-step.is-complete .wizard-progress-number {
        border-color: var(--success);
        background: rgba(95, 206, 130, 0.14);
        color: var(--success);
    }

.wizard-progress-line {
    flex: 1 1 auto;
    height: 1px;
    margin: 0 14px;
    background: var(--border-color);
}

.wizard-content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 26px 32px 30px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.wizard-step {
    display: none;
}

    .wizard-step.is-active {
        display: block;
    }

.wizard-step-heading {
    margin-bottom: 26px;
}

    .wizard-step-heading h2 {
        margin: 7px 0 0;
        font-size: 23px;
    }

    .wizard-step-heading p {
        margin: 9px 0 0;
        color: var(--secondary-text);
        line-height: 1.55;
    }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.form-field {
    min-width: 0;
}

.form-field-full {
    grid-column: 1 / -1;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--secondary-text);
    font-size: 13px;
    font-weight: 700;
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    outline: none;
    background: #151515;
    color: var(--primary-text);
}

.form-field input,
.form-field select {
    min-height: 44px;
    padding: 0 12px;
}

.form-field textarea {
    min-height: 110px;
    padding: 12px;
    resize: vertical;
    line-height: 1.5;
}

    .form-field input::placeholder,
    .form-field textarea::placeholder {
        color: #656565;
    }

    .form-field input:focus,
    .form-field textarea:focus,
    .form-field select:focus {
        border-color: #5d9cff;
        box-shadow: 0 0 0 3px rgba(93, 156, 255, 0.12);
    }

.trait-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.trait-option {
    display: flex !important;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    margin: 0 !important;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #151515;
    color: var(--primary-text) !important;
    cursor: pointer;
}

    .trait-option:hover {
        border-color: #444444;
    }

    .trait-option input {
        width: 16px;
        height: 16px;
        min-height: 0;
        margin: 0;
        padding: 0;
        accent-color: #5d9cff;
    }

.wizard-footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    padding: 16px 32px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.12);
}

.wizard-footer-spacer {
    flex: 1 1 auto;
}

.wizard-button {
    min-width: 112px;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 10px;
    cursor: pointer;
}

    .wizard-button:disabled {
        cursor: default;
        opacity: 0.4;
    }

.wizard-button-secondary {
    border: 1px solid var(--border-color);
    background: transparent;
}

    .wizard-button-secondary:not(:disabled):hover {
        background: var(--sidebar-hover);
    }

.wizard-button-primary {
    border: 1px solid #5d9cff;
    background: #2e74bb;
    color: #ffffff;
}

    .wizard-button-primary:hover {
        background: #3582d1;
    }

.wizard-complete-message {
    padding: 40px;
    text-align: center;
}

    .wizard-complete-message h2 {
        margin: 0;
        font-size: 26px;
    }

    .wizard-complete-message p {
        margin: 12px 0 0;
        color: var(--secondary-text);
        line-height: 1.6;
    }

.form-field .number-control {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #151515;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

    .form-field .number-control:focus-within {
        border-color: #5d9cff;
        box-shadow: 0 0 0 3px rgba(93, 156, 255, 0.12);
    }

    .form-field .number-control .number-control-input {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        margin: 0;
        padding: 0 10px;
        border: 0;
        border-radius: 0;
        outline: none;
        background: transparent;
        color: var(--primary-text);
        text-align: center;
        box-shadow: none;
        appearance: textfield;
        -moz-appearance: textfield;
    }

        .form-field .number-control .number-control-input:focus {
            border: 0;
            outline: none;
            box-shadow: none;
        }

        .form-field .number-control .number-control-input::-webkit-inner-spin-button,
        .form-field .number-control .number-control-input::-webkit-outer-spin-button {
            margin: 0;
            appearance: none;
            -webkit-appearance: none;
        }

    .form-field .number-control .number-control-button {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        min-width: 44px;
        min-height: 42px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        outline: none;
        background: #202020;
        color: var(--secondary-text);
        font-size: 20px;
        line-height: 1;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
    }

        .form-field .number-control .number-control-button:first-child {
            border-right: 1px solid var(--border-color);
        }

        .form-field .number-control .number-control-button:last-child {
            border-left: 1px solid var(--border-color);
        }

        .form-field .number-control .number-control-button:hover {
            background: var(--sidebar-hover);
            color: var(--primary-text);
        }

        .form-field .number-control .number-control-button:active {
            background: #303030;
        }

        .form-field .number-control .number-control-button:focus-visible {
            position: relative;
            z-index: 1;
            outline: 2px solid #5d9cff;
            outline-offset: -3px;
        }

@media (max-width: 1100px) {
    :root {
        --sidebar-width: 240px;
        --assistant-width: 340px;
    }

    .assistant-placeholder {
        width: 180px;
        height: 360px;
    }

    .assistant-placeholder-head {
        width: 98px;
        height: 116px;
    }

    .assistant-placeholder-body {
        width: 180px;
        height: 245px;
    }
}

@media (max-width: 860px) {
    :root {
        --assistant-width: 280px;
    }

    .sidebar {
        flex-basis: 220px;
        width: 220px;
    }

    .welcome-panel {
        padding: 32px 24px;
    }

        .welcome-panel h1 {
            font-size: 30px;
        }
}

@media (max-width: 760px) {
    html,
    body,
    form {
        min-height: 100%;
        height: auto;
    }

    body {
        overflow: auto;
    }

    .app-shell {
        min-height: 100vh;
        height: auto;
    }

    .sidebar {
        display: none;
    }

    .main-content {
        flex-direction: column-reverse;
        min-height: 100vh;
        height: auto;
        overflow: visible;
    }

    .workspace-panel {
        flex: 1 1 auto;
        min-height: 55vh;
        height: auto;
        overflow: visible;
    }

    .welcome-panel {
        padding: 28px 20px;
    }

        .welcome-panel h1 {
            font-size: 29px;
        }

    .assistant-stage {
        flex: 0 0 auto;
        width: 100%;
        height: 45vh;
        min-height: 320px;
        border-bottom: 1px solid var(--border-color);
        border-left: 0;
    }

    .assistant-stage-header {
        min-height: 62px;
        padding: 12px 16px;
    }

    .assistant-placeholder {
        width: 130px;
        height: 220px;
    }

    .assistant-placeholder-head {
        top: 8px;
        width: 72px;
        height: 82px;
        border-width: 1px;
    }

        .assistant-placeholder-head::before,
        .assistant-placeholder-head::after {
            top: 36px;
            width: 6px;
            height: 2px;
        }

        .assistant-placeholder-head::before {
            left: 20px;
        }

        .assistant-placeholder-head::after {
            right: 20px;
        }

    .assistant-placeholder-body {
        width: 130px;
        height: 150px;
        border-width: 1px;
        border-radius: 55px 55px 18px 18px;
    }

        .assistant-placeholder-body::before {
            top: 31px;
            width: 48px;
        }

    .assistant-visual-message {
        right: 12px;
        bottom: 10px;
        left: 12px;
    }

    .assistant-stage.is-collapsed {
        width: 100%;
        height: 62px;
        min-height: 62px;
    }

        .assistant-stage.is-collapsed .assistant-stage-header {
            min-height: 62px;
        }

        .assistant-stage.is-collapsed .assistant-collapse-button {
            margin-left: auto;
        }

    .profile-wizard {
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;
        margin: 0;
        border-radius: 14px;
    }

    .wizard-header {
        align-items: flex-start;
        padding: 22px 20px;
    }

    .wizard-logo {
        width: 52px;
        height: 52px;
        border-radius: 14px;
    }

    .wizard-header h1 {
        font-size: 22px;
    }

    .wizard-progress {
        padding: 16px 20px;
    }

    .wizard-progress-label {
        display: none;
    }

    .wizard-progress-line {
        margin: 0 8px;
    }

    .wizard-content {
        flex: 0 0 auto;
        min-height: 0;
        padding: 24px 20px 28px;
        overflow: visible;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field-full {
        grid-column: auto;
    }

    .trait-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wizard-footer {
        padding: 16px 20px;
    }

    .workspace-panel {
        display: block;
        padding: 12px;
        overflow: visible;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Login page */

.login-page {
    min-height: 100vh;
    overflow: auto;
    background: radial-gradient( circle at 50% 18%, rgba(93, 156, 255, 0.08), transparent 34% ), var(--page-background);
}

.login-shell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 32px 20px;
    overflow: hidden;
}

.login-panel {
    position: relative;
    z-index: 2;
    width: min(440px, 100%);
    padding: 34px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: linear-gradient( 180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0) ), var(--panel-background);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42), 0 1px 0 rgba(255, 255, 255, 0.025) inset;
}

.login-brand {
    display: flex;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.login-brand-icon {
    display: block;
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    margin-right: 14px;
    border-radius: 15px;
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
}

.login-brand-copy {
    min-width: 0;
}

.login-brand-name {
    color: var(--primary-text);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.login-brand-status {
    margin-top: 5px;
    color: var(--secondary-text);
    font-size: 12px;
    line-height: 1.4;
}

.login-heading {
    padding: 30px 0 25px;
}

.login-eyebrow {
    color: #71b7ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.login-heading h1 {
    margin: 7px 0 0;
    color: var(--primary-text);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.035em;
}

.login-heading p {
    margin: 11px 0 0;
    color: var(--secondary-text);
    font-size: 14px;
    line-height: 1.6;
}

.login-form {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
}

.login-field {
    margin-bottom: 18px;
}

    .login-field label {
        display: block;
        margin-bottom: 8px;
        color: var(--secondary-text);
        font-size: 13px;
        font-weight: 700;
    }

    .login-field input {
        width: 100%;
        min-height: 48px;
        padding: 0 14px;
        border: 1px solid var(--border-color);
        border-radius: 11px;
        outline: none;
        background: #151515;
        color: var(--primary-text);
        transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    }

        .login-field input::placeholder {
            color: #626262;
        }

        .login-field input:hover {
            border-color: #444444;
        }

        .login-field input:focus {
            border-color: #5d9cff;
            background: #171717;
            box-shadow: 0 0 0 3px rgba(93, 156, 255, 0.12);
        }

.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    margin-top: 6px;
    padding: 0 18px;
    border: 1px solid #5d9cff;
    border-radius: 11px;
    background: #2e74bb;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

    .login-button:hover:not(:disabled) {
        border-color: #71b7ff;
        background: #3582d1;
    }

    .login-button:active:not(:disabled) {
        transform: translateY(1px);
    }

    .login-button:focus-visible {
        outline: 2px solid #8cc5ff;
        outline-offset: 3px;
    }

    .login-button:disabled {
        cursor: wait;
        opacity: 0.65;
    }

.login-message {
    margin: 0 0 16px;
    padding: 11px 12px;
    border: 1px solid rgba(240, 103, 103, 0.35);
    border-radius: 10px;
    background: rgba(240, 103, 103, 0.08);
    color: #ff9d9d;
    font-size: 13px;
    line-height: 1.45;
}

    .login-message[hidden] {
        display: none;
    }

.login-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 26px;
    padding-top: 21px;
    border-top: 1px solid var(--border-color);
    color: var(--muted-text);
    font-size: 12px;
    text-align: center;
}

.login-status-indicator {
    display: inline-block;
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px rgba(95, 206, 130, 0.36);
}

.login-background-mark {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    width: 740px;
    height: 740px;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    isolation: isolate;
}

    /* Very soft atmospheric bloom behind the eclipse. */
    .login-background-mark::before {
        position: absolute;
        z-index: -4;
        inset: 8%;
        border-radius: 50%;
        background: radial-gradient( circle, transparent 0 46%, rgba(43, 117, 163, 0.055) 54%, rgba(77, 79, 150, 0.05) 61%, rgba(116, 48, 107, 0.028) 67%, transparent 76% );
        filter: blur(34px) saturate(0.85);
        content: "";
        animation: login-bloom-pulse 8s ease-in-out infinite;
    }

    /* Broken outer corona with only a few restrained highlights. */
    .login-background-mark::after {
        position: absolute;
        z-index: -3;
        inset: 5%;
        border-radius: 47% 53% 50% 50% / 52% 47% 53% 48%;
        background: radial-gradient(circle at 51% 3%, rgba(255, 231, 179, 0.28) 0 1.5%, transparent 6%), radial-gradient(circle at 84% 27%, rgba(116, 103, 180, 0.16) 0 2%, transparent 8%), radial-gradient(circle at 18% 63%, rgba(52, 142, 172, 0.18) 0 2.5%, transparent 9%), conic-gradient( from 18deg, rgba(37, 144, 167, 0.18) 0deg, transparent 45deg, rgba(73, 88, 151, 0.14) 88deg, rgba(124, 57, 125, 0.12) 132deg, transparent 178deg, rgba(150, 102, 61, 0.09) 220deg, transparent 258deg, rgba(46, 132, 120, 0.16) 312deg, rgba(37, 144, 167, 0.18) 360deg );
        -webkit-mask: radial-gradient(circle, transparent 0 60%, #000 64% 68%, transparent 74%);
        mask: radial-gradient(circle, transparent 0 60%, #000 64% 68%, transparent 74%);
        opacity: 0.58;
        filter: blur(18px) saturate(0.82) brightness(0.82);
        content: "";
        animation: login-corona-spin 28s linear infinite;
        will-change: transform;
    }

.login-aurora {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    transform-origin: center;
    will-change: transform;
}

/* Thin, broken aurora ribbon with muted color. */
.login-aurora-primary {
    z-index: -2;
    width: 82%;
    height: 82%;
    border-radius: 48% 52% 46% 54% / 54% 48% 52% 46%;
    background: radial-gradient(circle at 52% 2%, rgba(255, 235, 194, 0.34) 0 1.2%, transparent 5%), radial-gradient(circle at 89% 37%, rgba(111, 71, 140, 0.16) 0 1.5%, transparent 6%), radial-gradient(circle at 24% 78%, rgba(36, 128, 148, 0.19) 0 2%, transparent 7%), conic-gradient( from 4deg, rgba(43, 154, 174, 0.28) 0deg, rgba(53, 96, 151, 0.18) 42deg, transparent 76deg, rgba(94, 66, 139, 0.2) 112deg, rgba(133, 54, 111, 0.16) 148deg, transparent 190deg, rgba(157, 108, 60, 0.12) 224deg, transparent 266deg, rgba(53, 137, 117, 0.22) 314deg, rgba(43, 154, 174, 0.28) 360deg );
    -webkit-mask: radial-gradient(circle, transparent 0 59%, #000 63% 66%, transparent 71%);
    mask: radial-gradient(circle, transparent 0 59%, #000 63% 66%, transparent 71%);
    filter: blur(8px) saturate(0.82) brightness(0.78);
    opacity: 0.64;
    animation: login-aurora-spin 22s linear infinite;
}

/* Broader, barely visible counter-rotating veil. */
.login-aurora-secondary {
    z-index: -1;
    width: 91%;
    height: 86%;
    border-radius: 53% 47% 56% 44% / 44% 57% 43% 56%;
    background: conic-gradient( from 104deg, transparent 0 9%, rgba(43, 131, 159, 0.13) 15%, transparent 26%, rgba(86, 65, 138, 0.12) 35%, rgba(119, 50, 105, 0.09) 44%, transparent 57%, rgba(142, 101, 62, 0.07) 67%, transparent 78%, rgba(43, 124, 105, 0.12) 89%, transparent 100% );
    -webkit-mask: radial-gradient(ellipse at center, transparent 0 59%, #000 64% 68%, transparent 76%);
    mask: radial-gradient(ellipse at center, transparent 0 59%, #000 64% 68%, transparent 76%);
    filter: blur(18px) saturate(0.72) brightness(0.72);
    opacity: 0.48;
    animation: login-aurora-counterspin 34s linear infinite;
}

/* Dark eclipsed globe. */
.login-eclipse-core {
    position: absolute;
    z-index: -1;
    top: 50%;
    left: 50%;
    display: block;
    width: 60%;
    height: 60%;
    border: 1px solid rgba(154, 185, 214, 0.045);
    border-radius: 50%;
    background: radial-gradient( circle at 42% 35%, rgba(25, 34, 46, 0.27), rgba(7, 9, 13, 0.985) 58%, #020304 80% );
    box-shadow: 0 -3px 12px rgba(255, 226, 174, 0.10), 0 0 26px rgba(62, 127, 173, 0.10), 0 0 64px rgba(77, 52, 126, 0.08);
    transform: translate(-50%, -50%);
}

@keyframes login-aurora-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1, 0.975);
    }

    50% {
        transform: translate(-50%, -50%) rotate(180deg) scale(1.015, 0.99);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1, 0.975);
    }
}

@keyframes login-aurora-counterspin {
    0% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1.01, 0.97);
    }

    50% {
        transform: translate(-50%, -50%) rotate(180deg) scale(0.985, 1.015);
    }

    100% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1.01, 0.97);
    }
}

@keyframes login-corona-spin {
    0% {
        transform: rotate(0deg) scale(0.995, 1.015);
    }

    50% {
        transform: rotate(180deg) scale(1.015, 0.99);
    }

    100% {
        transform: rotate(360deg) scale(0.995, 1.015);
    }
}

@keyframes login-bloom-pulse {
    0%, 100% {
        opacity: 0.42;
        transform: scale(0.99);
    }

    50% {
        opacity: 0.58;
        transform: scale(1.015);
    }
}

@media (max-width: 520px) {
    .login-shell {
        align-items: flex-start;
        padding: 18px 12px;
    }

    .login-panel {
        margin-top: 4vh;
        padding: 26px 22px;
        border-radius: 16px;
    }

    .login-brand-icon {
        width: 48px;
        height: 48px;
        border-radius: 13px;
    }

    .login-heading {
        padding: 26px 0 22px;
    }

        .login-heading h1 {
            font-size: 25px;
        }

    .login-background-mark {
        width: 540px;
        height: 540px;
    }
}

/* Workspace states, assistant initialization, and chat */

.is-hidden {
    display: none !important;
}

.workspace-panel {
    position: relative;
}

.initialization-panel {
    position: fixed;
    inset: 0;
    z-index: 10000;
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 24px;
    background: rgba(8, 8, 8, 0.34);
    -webkit-backdrop-filter: blur(7px);
    backdrop-filter: blur(7px);
}

.chat-panel {
    width: 100%;
    min-height: 0;
    margin: 0;
}

.initialization-panel {
    height: 100%;
}

.chat-panel {
    align-self: stretch;
    height: auto;
}

.initialization-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

    .initialization-panel.is-leaving {
        opacity: 0;
        transform: translateY(-8px);
    }

.initialization-card {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    padding: 42px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--panel-background);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.initialization-logo {
    display: block;
    width: 72px;
    height: 72px;
    margin-bottom: 22px;
    border-radius: 18px;
}

.initialization-card h1 {
    margin: 7px 0 0;
    font-size: 28px;
}

.initialization-card > p {
    margin: 12px 0 0;
    color: var(--secondary-text);
    line-height: 1.55;
}

.initialization-progress {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.initialization-item {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    padding: 0 13px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #151515;
    color: var(--muted-text);
    transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.initialization-check {
    color: transparent;
    font-weight: 700;
}

.initialization-item.is-complete {
    border-color: rgba(95, 206, 130, 0.38);
    background: rgba(95, 206, 130, 0.07);
    color: var(--primary-text);
}

    .initialization-item.is-complete .initialization-check {
        color: var(--success);
    }

.chat-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--panel-background);
}

    .chat-panel.is-entering {
        animation: chat-enter 0.35s ease both;
    }

@keyframes chat-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.chat-title {
    font-size: 16px;
    font-weight: 700;
}

.chat-subtitle {
    margin-top: 5px;
    color: var(--secondary-text);
    font-size: 12px;
}

.chat-messages {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 28px 24px;
    overflow-y: auto;
}

    .chat-messages > .chat-message:first-child {
        margin-top: auto;
    }


.chat-history-loading-dock {
    position: sticky;
    top: 10px;
    z-index: 8;
    display: flex;
    height: 0;
    justify-content: center;
    overflow: visible;
    pointer-events: none;
}

    .chat-history-loading-dock.is-hidden {
        display: none;
    }

.chat-history-loading-panel {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: rgba(21, 21, 21, 0.96);
    color: var(--secondary-text);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
}

.chat-empty-state {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--secondary-text);
    text-align: center;
}

.chat-empty-logo {
    width: 78px;
    height: 78px;
    border-radius: 20px;
}

.chat-empty-state h2 {
    margin: 18px 0 0;
    color: var(--primary-text);
    font-size: 25px;
}

.chat-empty-state p {
    margin: 9px 0 0;
}

.chat-message {
    display: flex;
    width: 100%;
    max-width: none;
    margin: 0 0 18px;
}

    .chat-message-user,
    .chat-message.user {
        justify-content: flex-end;
    }

    .chat-message-assistant,
    .chat-message.assistant {
        justify-content: flex-start;
    }

.chat-message-bubble,
.chat-bubble {
    width: 88%;
    max-width: none;
    padding: 13px 16px;
    border-radius: 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.55;
}

.chat-message-user .chat-message-bubble,
.chat-message.user .chat-bubble,
.chat-message.user .chat-message-bubble {
    background: #2e74bb;
    color: #ffffff;
}

.chat-message-assistant .chat-message-bubble,
.chat-message.assistant .chat-bubble,
.chat-message.assistant .chat-message-bubble {
    border: 1px solid var(--border-color);
    background: #151515;
    color: var(--primary-text);
}

.chat-message.is-pending .chat-message-bubble,
.chat-message.is-pending .chat-bubble {
    color: var(--secondary-text);
}

.generated-image-card {
    display: grid;
    gap: 10px;
    margin: 0;
}

.generated-image-button {
    display: block;
    width: fit-content;
    max-width: 100%;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: transparent;
    line-height: 0;
    cursor: zoom-in;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

    .generated-image-button:hover {
        border-color: #5d9cff;
        transform: translateY(-1px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    }

    .generated-image-button:focus-visible {
        outline: 2px solid #5d9cff;
        outline-offset: 3px;
    }

.generated-chat-image {
    display: block;
    width: auto;
    max-width: min(100%, 360px);
    height: auto;
    max-height: 280px;
    object-fit: contain;
    border-radius: 12px;
}

.generated-image-caption {
    white-space: pre-wrap;
    color: var(--secondary-text);
    font-size: 13px;
    line-height: 1.45;
}

.chat-message-link {
    color: #7db7ff;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

    .chat-message-link:hover {
        color: #acd2ff;
    }

    .chat-message-link:focus-visible {
        outline: 2px solid #5d9cff;
        outline-offset: 2px;
        border-radius: 3px;
    }

.chat-message-link {
    display: inline-block;
    max-width: min(100%, 72ch);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.chat-bubble-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
    padding-top: 7px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.chat-bubble-action-button {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #5d9cff;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

    .chat-bubble-action-button svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
        pointer-events: none;
    }

    .chat-bubble-action-button:hover:not(:disabled) {
        background: rgba(93, 156, 255, 0.13);
        color: #82b3ff;
        transform: scale(1.05);
    }

    .chat-bubble-action-button:focus-visible {
        outline: 2px solid #5d9cff;
        outline-offset: 2px;
    }

    .chat-bubble-action-button.is-confirmed {
        background: rgba(95, 206, 130, 0.14);
        color: var(--success);
    }

    .chat-bubble-action-button:disabled {
        cursor: default;
        opacity: 0.58;
        transform: none;
    }

.image-viewer-open {
    overflow: hidden;
}

.image-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(8, 8, 8, 0.48);
    -webkit-backdrop-filter: blur(9px);
    backdrop-filter: blur(9px);
}

.image-viewer-panel {
    display: flex;
    width: min(1100px, 96vw);
    max-height: 92vh;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--panel-background);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

.image-viewer-header {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 14px 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

    .image-viewer-header h2 {
        margin: 0;
        font-size: 16px;
    }

.image-viewer-close {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #151515;
    color: var(--primary-text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

    .image-viewer-close:hover {
        border-color: #5d9cff;
        background: #1d1d1d;
    }

    .image-viewer-close:focus-visible {
        outline: 2px solid #5d9cff;
        outline-offset: 2px;
    }

.image-viewer-body {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
    background: #0d0d0d;
}

.image-viewer-image {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 130px);
    object-fit: contain;
    border-radius: 10px;
}

.image-viewer-caption {
    margin: 0;
    padding: 13px 20px 16px;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-text);
    font-size: 13px;
    line-height: 1.45;
}


.chat-request-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 24px;
    color: var(--secondary-text);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.chat-request-spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #5d9cff;
    border-radius: 50%;
    animation: chat-request-spin 0.75s linear infinite;
}

@keyframes chat-request-spin {
    to {
        transform: rotate(360deg);
    }
}


/* ===========================================
   Chat action strip, resource tools, and emojis
   =========================================== */

.chat-action-strip {
    position: relative;
    z-index: 4;
    display: flex;
    flex: 0 0 auto;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
    padding: 10px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.12);
}

.chat-tool-bar {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
}

.chat-tool-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    outline: none;
    background: #171717;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

    .chat-tool-button:hover {
        border-color: #4a4a4a;
        background: #252525;
        color: var(--primary-text);
    }

    .chat-tool-button:active {
        transform: translateY(1px);
    }

    .chat-tool-button:focus-visible {
        border-color: #5d9cff;
        box-shadow: 0 0 0 3px rgba(93, 156, 255, 0.14);
    }

    .chat-tool-button.is-active,
    .chat-tool-button[aria-pressed="true"] {
        border-color: #5d9cff;
        background: rgba(46, 116, 187, 0.24);
        color: #ffffff;
        box-shadow: inset 0 0 0 1px rgba(93, 156, 255, 0.18);
    }

.chat-emoji-region {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    margin-left: auto;
}

.chat-emoji-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.chat-emoji-favorites {
    display: grid;
    grid-template-columns: repeat(5, 34px);
    gap: 6px;
}

.chat-emoji-button,
.chat-emoji-expand-button,
.chat-emoji-collapse-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    outline: none;
    background: #171717;
    color: var(--primary-text);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    text-align: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.chat-emoji-expand-button,
.chat-emoji-collapse-button {
    font-size: 14px;
    font-weight: 700;
}

    .chat-emoji-button:hover,
    .chat-emoji-expand-button:hover,
    .chat-emoji-collapse-button:hover {
        border-color: #4a4a4a;
        background: #292929;
    }

    .chat-emoji-button:active,
    .chat-emoji-expand-button:active,
    .chat-emoji-collapse-button:active {
        transform: translateY(1px);
    }

    .chat-emoji-button:focus-visible,
    .chat-emoji-expand-button:focus-visible,
    .chat-emoji-collapse-button:focus-visible {
        border-color: #5d9cff;
        box-shadow: 0 0 0 3px rgba(93, 156, 255, 0.14);
    }

.chat-emoji-button.is-current-favorite {
    border-color: rgba(93, 156, 255, 0.68);
    background: rgba(46, 116, 187, 0.2);
}

.chat-emoji-more {
    display: grid;
    grid-template-columns: repeat(10, 34px);
    gap: 6px;
    width: max-content;
    max-width: calc(100vw - 48px);
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #111111;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

    .chat-emoji-more.is-hidden {
        display: none;
    }

.chat-emoji-region.is-expanded {
    width: max-content;
    max-width: 100%;
}

    .chat-emoji-region.is-expanded .chat-emoji-bar {
        width: 100%;
    }

    .chat-emoji-region.is-expanded .chat-emoji-more {
        align-self: flex-end;
    }

.chat-emoji-collapse-button {
    display: none;
}

.chat-emoji-region.is-expanded .chat-emoji-collapse-button {
    display: inline-flex;
}

.chat-composer {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
    padding: 10px 16px 12px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.12);
}

    .chat-composer textarea {
        width: 100%;
        box-sizing: border-box;
        max-height: 180px;
        min-height: 48px;
        height: 48px;
        padding: 12px;
        overflow-y: hidden;
        resize: none;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        outline: none;
        background: #151515;
        color: var(--primary-text);
        line-height: 1.35;
    }

        .chat-composer textarea:focus {
            border-color: #5d9cff;
            box-shadow: 0 0 0 3px rgba(93, 156, 255, 0.12);
        }

.chat-send-button {
    min-width: 80px;
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid #5d9cff;
    border-radius: 10px;
    background: #2e74bb;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

    .chat-send-button:hover:not(:disabled) {
        background: #3582d1;
    }

    .chat-send-button:disabled {
        cursor: default;
        opacity: 0.42;
    }

.chat-send-spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.42);
    border-top-color: #fff;
    border-radius: 50%;
    animation: chat-send-spinner-rotation 0.75s linear infinite;
}

.chat-send-button.is-warming-up {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0.72;
}

    .chat-send-button.is-warming-up .chat-send-spinner {
        display: inline-block;
    }

@keyframes chat-send-spinner-rotation {
    to {
        transform: rotate(360deg);
    }
}

.initialization-requirements {
    margin: 22px 0 0;
    padding-left: 22px;
    color: var(--secondary-text);
    text-align: left;
}

@media (max-width: 760px) {
    .initialization-panel {
        height: 70vh;
        min-height: 520px;
    }

    .chat-panel {
        align-self: stretch;
        width: 100%;
        height: 70vh;
        min-height: 520px;
        margin: 0;
        border-radius: 14px;
    }

    .initialization-card {
        padding: 28px 22px;
    }

    .chat-messages {
        padding: 20px 14px;
    }

    .chat-action-strip {
        align-items: flex-start;
        gap: 10px;
        padding: 10px 12px;
    }

    .chat-tool-bar {
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .chat-tool-button {
        min-height: 32px;
        padding: 5px 8px;
    }

        .chat-tool-button span {
            display: none;
        }

    .chat-emoji-favorites {
        grid-template-columns: repeat(5, 32px);
        gap: 4px;
    }

    .chat-emoji-button,
    .chat-emoji-expand-button,
    .chat-emoji-collapse-button {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }

    .chat-emoji-more {
        grid-template-columns: repeat(10, 32px);
        gap: 4px;
        max-width: calc(100vw - 24px);
        overflow-x: auto;
    }

    .chat-composer {
        gap: 7px;
        padding: 9px 10px 10px;
    }

    .chat-message {
        margin-bottom: 14px;
    }

    .chat-message-bubble,
    .chat-bubble {
        width: 92%;
        max-width: none;
        padding: 12px 14px;
        border-radius: 13px;
    }
}


/* Phase 5: clickable wizard navigation */
.wizard-progress-step:hover,
.wizard-progress-step:focus-visible {
    color: var(--primary-text);
}

.wizard-progress-step:focus-visible {
    outline: 2px solid #5d9cff;
    outline-offset: 5px;
    border-radius: 8px;
}

@media (max-width: 720px) {
    .image-viewer-overlay {
        padding: 12px;
    }

    .image-viewer-panel {
        width: 100%;
        max-height: 96vh;
        border-radius: 14px;
    }

    .image-viewer-body {
        padding: 10px;
    }

    .image-viewer-image {
        max-height: calc(96vh - 124px);
    }
}
