/* ==========================================================================
   AI Chat page — theme tokens (from the approved design mockup)
   Prefix: aichat-
   ========================================================================== */

:root {
    --aichat-background: #f8f8f6;
    --aichat-foreground: #1f1f1b;
    --aichat-primary: #2f2f2a;
    --aichat-primary-foreground: #ffffff;
    --aichat-secondary: #efefe9;
    --aichat-secondary-foreground: #2c2c28;
    --aichat-tertiary: #d9d8cf;
    --aichat-muted: #f3f2ec;
    --aichat-muted-foreground: #6b6a63;
    --aichat-accent: #e7e5dc;
    --aichat-accent-foreground: #1f1f1b;
    --aichat-card: #ffffff;
    --aichat-destructive: #c94f3d;
    --aichat-border: #dedcd2;
    --aichat-input: #d8d5ca;
    --aichat-ring: #b9b4a5;
    --aichat-radius: 1rem;
    --aichat-font-sans: "Inter", sans-serif;
    --aichat-font-mono: "JetBrains Mono", Consolas, ui-monospace, monospace;
    --aichat-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.12);
}

/* ---------- App shell (3-column layout) ---------- */

.aichat-app {
    height: 100vh;
    width: 100%;
    display: flex;
    background: var(--aichat-background);
    color: var(--aichat-foreground);
    font-family: var(--aichat-font-sans);
    overflow: hidden;
}

/* ---------- Sidebar ---------- */

.aichat-sidebar {
    width: 288px;
    flex-shrink: 0;
    border-right: 1px solid var(--aichat-border);
    background: color-mix(in srgb, var(--aichat-muted) 60%, transparent);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: margin-left 0.2s ease;
}

.aichat-sidebar-collapsed {
    margin-left: -288px;
}

.aichat-brand-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px;
    background: var(--aichat-card);
    border: 1px solid var(--aichat-border);
    padding: 14px;
    box-shadow: var(--aichat-shadow);
}

.aichat-brand-eyebrow {
    margin: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    color: var(--aichat-muted-foreground);
    font-weight: 600;
}

.aichat-brand-title {
    margin: 2px 0 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--aichat-foreground);
}

.aichat-icon-btn {
    height: 40px;
    width: 40px;
    border-radius: 10px;
    background: var(--aichat-secondary);
    color: var(--aichat-secondary-foreground);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 18px;
    transition: background 0.15s ease;
}

.aichat-icon-btn:hover {
    background: var(--aichat-tertiary);
}

.aichat-new-chat-btn {
    min-height: 44px;
    border-radius: 12px;
    background: var(--aichat-secondary);
    color: var(--aichat-secondary-foreground);
    border: none;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 10px -4px rgba(15, 23, 42, 0.15);
    cursor: pointer;
    font: inherit;
    font-weight: 500;
}

.aichat-new-chat-btn:hover {
    background: var(--aichat-tertiary);
}

.aichat-recent-panel {
    flex: 1;
    min-height: 0;
    border-radius: 12px;
    background: var(--aichat-card);
    border: 1px solid var(--aichat-border);
    padding: 10px;
    box-shadow: var(--aichat-shadow);
    display: flex;
    flex-direction: column;
}

.aichat-recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 10px;
}

.aichat-recent-header h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
}

.aichat-recent-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
}

.aichat-recent-item {
    width: 100%;
    text-align: left;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

.aichat-recent-item:hover {
    background: var(--aichat-secondary);
}

.aichat-recent-item-active {
    background: var(--aichat-secondary);
    border-color: var(--aichat-border);
}

.aichat-recent-item p {
    margin: 0;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--aichat-foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aichat-recent-empty {
    padding: 16px 8px;
    font-size: 12.5px;
    color: var(--aichat-muted-foreground);
}

/* ---------- Main column ---------- */

.aichat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.aichat-topbar {
    height: 64px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--aichat-border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aichat-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aichat-topbar-icon {
    height: 40px;
    width: 40px;
    border-radius: 10px;
    background: var(--aichat-secondary);
    border: 1px solid var(--aichat-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.aichat-topbar-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.aichat-topbar-sub {
    margin: 0;
    font-size: 12px;
    color: var(--aichat-muted-foreground);
}

.aichat-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aichat-pill-btn {
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--aichat-border);
    background: var(--aichat-card);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--aichat-foreground);
}

.aichat-pill-btn:hover {
    background: var(--aichat-secondary);
}

.aichat-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--aichat-muted-foreground);
    border: 1px solid var(--aichat-border);
    border-radius: 20px;
    padding: 6px 12px 6px 10px;
}

.aichat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #34c759;
    flex-shrink: 0;
}

/* ---------- Chat panel ---------- */

.aichat-panel-wrap {
    flex: 1;
    min-height: 0;
    padding: 16px 20px;
    overflow: hidden;
}

.aichat-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    border: 1px solid var(--aichat-border);
    background: var(--aichat-card);
    box-shadow: var(--aichat-shadow);
    overflow: hidden;
}

.aichat-thread-header {
    flex-shrink: 0;
    border-bottom: 1px solid var(--aichat-border);
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: color-mix(in srgb, var(--aichat-muted) 40%, transparent);
    gap: 12px;
}

.aichat-thread-eyebrow {
    margin: 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--aichat-muted-foreground);
    font-weight: 600;
}

.aichat-thread-title {
    margin: 2px 0 0;
    font-size: 15px;
    font-weight: 600;
}

.aichat-thread-tags {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.aichat-tag {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--aichat-secondary);
    color: var(--aichat-secondary-foreground);
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}

/* ---------- Body / transcript ---------- */

.aichat-thread {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
    background: var(--aichat-background);
    scroll-behavior: smooth;
}

.aichat-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--aichat-muted-foreground);
    text-align: center;
}

.aichat-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--aichat-foreground);
}

.aichat-empty-sub {
    font-size: 13px;
    max-width: 320px;
}

.aichat-msg {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 22px;
}

.aichat-msg-user {
    flex-direction: row-reverse;
}

.aichat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
}

.aichat-avatar-user {
    background: var(--aichat-secondary);
    color: var(--aichat-secondary-foreground);
}

.aichat-avatar-assistant {
    background: var(--aichat-primary);
    color: var(--aichat-primary-foreground);
}

.aichat-msg-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 72%;
    min-width: 0;
}

.aichat-msg-user .aichat-msg-col {
    align-items: flex-end;
}

.aichat-msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--aichat-muted-foreground);
    margin-bottom: 6px;
}

.aichat-msg-user .aichat-msg-meta {
    flex-direction: row-reverse;
}

.aichat-msg-name {
    font-weight: 600;
    color: var(--aichat-foreground);
    font-size: 12.5px;
}

/* ---------- Route badge ---------- */

.aichat-route-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--aichat-foreground);
    background: var(--aichat-secondary);
    border-radius: 6px;
    padding: 3px 8px;
    margin-bottom: 6px;
    width: fit-content;
}

/* ---------- Bubbles ---------- */

.aichat-bubble {
    padding: 13px 16px;
    border-radius: 20px;
    line-height: 1.65;
    font-size: 14.5px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.aichat-bubble-user {
    background: var(--aichat-secondary);
    color: var(--aichat-secondary-foreground);
    border-top-right-radius: 6px;
    border: 1px solid var(--aichat-border);
}

.aichat-bubble-assistant {
    background: var(--aichat-card);
    color: var(--aichat-foreground);
    border: 1px solid var(--aichat-border);
    border-top-left-radius: 6px;
}

.aichat-bubble-assistant pre.aichat-code {
    margin: 10px 0;
    padding: 12px 14px;
    background: var(--aichat-primary);
    color: #f3f2ec;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.55;
    font-family: var(--aichat-font-mono);
    white-space: pre;
}

.aichat-bubble-assistant code.aichat-inline-code {
    background: var(--aichat-muted);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 13px;
    font-family: var(--aichat-font-mono);
}

.aichat-caret {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: var(--aichat-primary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: aichat-blink 0.9s steps(1) infinite;
}

@keyframes aichat-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ---------- Inline artifact card (shown in the transcript in place of a fenced code block) ---------- */

.aichat-inline-artifact-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 460px;
    border-radius: 20px;
    border: 1px solid var(--aichat-border);
    background: var(--aichat-card);
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}

.aichat-inline-artifact-card:hover {
    background: var(--aichat-muted);
}

.aichat-inline-artifact-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--aichat-secondary);
    color: var(--aichat-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.aichat-inline-artifact-body {
    min-width: 0;
    flex: 1;
}

.aichat-inline-artifact-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.aichat-inline-artifact-title-row p {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--aichat-foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aichat-inline-artifact-badge {
    flex-shrink: 0;
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--aichat-secondary);
    color: var(--aichat-secondary-foreground);
}

.aichat-inline-artifact-desc {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--aichat-muted-foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aichat-inline-artifact-arrow {
    font-size: 17px;
    color: var(--aichat-muted-foreground);
    flex-shrink: 0;
}

/* ---------- Router status line (the "thinking" state) ---------- */

.aichat-status-line {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 16px;
    border-radius: 20px;
    border-top-left-radius: 6px;
    background: var(--aichat-card);
    border: 1px solid var(--aichat-border);
    font-size: 13px;
    color: var(--aichat-muted-foreground);
    font-family: var(--aichat-font-mono);
}

.aichat-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--aichat-tertiary);
    border-top-color: var(--aichat-primary);
    flex-shrink: 0;
    animation: aichat-spin 0.7s linear infinite;
}

.aichat-status-text {
    animation: aichat-fade-in 0.28s ease;
}

@keyframes aichat-fade-in {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ---------- Composer ---------- */

.aichat-composer-wrap {
    flex-shrink: 0;
    border-top: 1px solid var(--aichat-border);
    background: var(--aichat-card);
    padding: 14px 18px;
}

.aichat-composer {
    border-radius: 20px;
    border: 1px solid var(--aichat-border);
    background: var(--aichat-background);
    padding: 8px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.aichat-composer textarea {
    flex: 1;
    resize: none;
    border: none;
    background: transparent;
    padding: 10px 8px;
    font-size: 14.5px;
    line-height: 1.5;
    outline: none;
    font-family: inherit;
    max-height: 160px;
    color: var(--aichat-foreground);
}

.aichat-composer textarea::placeholder {
    color: var(--aichat-muted-foreground);
}

.aichat-send-btn {
    height: 42px;
    padding: 0 18px;
    border: none;
    border-radius: 14px;
    background: var(--aichat-primary);
    color: var(--aichat-primary-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-weight: 500;
    font-size: 13.5px;
    transition: opacity 0.15s ease;
}

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

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

.aichat-composer-hint {
    margin: 8px 4px 0;
    font-size: 11px;
    color: var(--aichat-muted-foreground);
}

/* ---------- Artifacts panel ---------- */

.aichat-artifacts {
    width: 460px;
    flex-shrink: 0;
    border-left: 1px solid var(--aichat-border);
    background: color-mix(in srgb, var(--aichat-muted) 40%, transparent);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: margin-right 0.2s ease;
}

.aichat-artifacts-collapsed {
    margin-right: -460px;
}

.aichat-artifacts-header {
    flex-shrink: 0;
    border-bottom: 1px solid var(--aichat-border);
    padding: 12px 16px;
    background: var(--aichat-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.aichat-artifacts-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.aichat-artifacts-count {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--aichat-muted-foreground);
}

.aichat-artifacts-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.aichat-artifacts-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 208px 1fr;
    overflow: hidden;
}

.aichat-artifact-list {
    border-right: 1px solid var(--aichat-border);
    background: var(--aichat-background);
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aichat-artifact-card {
    border-radius: 14px;
    border: 1px solid var(--aichat-border);
    background: var(--aichat-card);
    padding: 10px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.aichat-artifact-card:hover {
    background: var(--aichat-secondary);
}

.aichat-artifact-card-active {
    background: var(--aichat-secondary);
    border-color: var(--aichat-ring);
}

.aichat-artifact-card-inner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.aichat-artifact-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--aichat-background);
    border: 1px solid var(--aichat-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--aichat-foreground);
    flex-shrink: 0;
}

.aichat-artifact-card-body {
    min-width: 0;
    flex: 1;
}

.aichat-artifact-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.aichat-artifact-card p {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aichat-artifact-card-desc {
    margin: 4px 0 0 !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    color: var(--aichat-muted-foreground);
    white-space: normal !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aichat-artifact-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.aichat-artifact-card span {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--aichat-muted-foreground);
    background: var(--aichat-muted);
    border-radius: 6px;
    padding: 2px 6px;
    flex-shrink: 0;
}

.aichat-artifact-selected-tag {
    color: var(--aichat-primary-foreground) !important;
    background: var(--aichat-primary) !important;
}

.aichat-artifact-detail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.aichat-artifact-toolbar {
    flex-shrink: 0;
    padding: 10px 14px;
    border-bottom: 1px solid var(--aichat-border);
    background: var(--aichat-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.aichat-artifact-toolbar p {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--aichat-muted-foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.aichat-artifact-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.aichat-artifact-action-btn {
    height: 34px;
    width: 34px;
    border-radius: 9px;
    border: 1px solid var(--aichat-border);
    background: var(--aichat-card);
    color: var(--aichat-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
}

.aichat-artifact-action-btn:hover {
    background: var(--aichat-secondary);
}

.aichat-tab-group {
    display: flex;
    gap: 4px;
    background: var(--aichat-muted);
    border-radius: 10px;
    padding: 3px;
    flex-shrink: 0;
}

.aichat-tab-btn {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--aichat-muted-foreground);
}

.aichat-tab-btn-active {
    background: var(--aichat-card);
    color: var(--aichat-foreground);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.aichat-artifact-view {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 14px;
}

.aichat-artifact-code {
    margin: 0;
    background: var(--aichat-primary);
    color: #f3f2ec;
    border-radius: 16px;
    padding: 16px;
    font-family: var(--aichat-font-mono);
    font-size: 12.5px;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
    height: 100%;
    box-sizing: border-box;
}

.aichat-artifact-preview {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 16px;
    background: white;
}

.aichat-artifacts-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--aichat-muted-foreground);
    text-align: center;
    padding: 24px;
    grid-column: 1 / -1;
}

.aichat-artifacts-empty-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--aichat-foreground);
}

.aichat-artifacts-empty-sub {
    font-size: 12px;
    max-width: 240px;
}

/* ---------- Profile card + account menu ---------- */

.aichat-profile-card {
    position: relative;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--aichat-card);
    border: 1px solid var(--aichat-border);
    padding: 12px;
    box-shadow: var(--aichat-shadow);
}

.aichat-profile-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aichat-profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--aichat-primary);
    color: var(--aichat-primary-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.aichat-profile-info {
    min-width: 0;
    flex: 1;
}

.aichat-profile-name {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--aichat-foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aichat-profile-sub {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--aichat-muted-foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aichat-user-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: transparent;
    border: none;
    cursor: default;
    padding: 0;
}

.aichat-user-menu {
    position: absolute;
    right: 12px;
    bottom: calc(100% + 8px);
    width: 180px;
    border-radius: 12px;
    border: 1px solid var(--aichat-border);
    background: var(--aichat-card);
    box-shadow: 0 12px 30px -10px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    z-index: 31;
    display: flex;
    flex-direction: column;
}

.aichat-user-menu-item {
    min-height: 42px;
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--aichat-foreground);
    cursor: pointer;
    border-top: 1px solid var(--aichat-border);
}

.aichat-user-menu-item:first-child {
    border-top: none;
}

.aichat-user-menu-item:hover {
    background: var(--aichat-muted);
}

.aichat-user-menu-item-danger {
    color: var(--aichat-destructive);
}

/* ---------- Scrollbars ---------- */

.aichat-thread::-webkit-scrollbar,
.aichat-recent-list::-webkit-scrollbar,
.aichat-artifact-list::-webkit-scrollbar,
.aichat-artifact-view::-webkit-scrollbar {
    width: 8px;
}

.aichat-thread::-webkit-scrollbar-thumb,
.aichat-recent-list::-webkit-scrollbar-thumb,
.aichat-artifact-list::-webkit-scrollbar-thumb,
.aichat-artifact-view::-webkit-scrollbar-thumb {
    background: var(--aichat-input);
    border-radius: 8px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .aichat-artifacts {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        z-index: 20;
        box-shadow: -12px 0 30px -10px rgba(15, 23, 42, 0.25);
    }

    .aichat-artifacts-collapsed {
        margin-right: -460px;
    }
}

@media (max-width: 860px) {
    .aichat-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 20;
        box-shadow: 12px 0 30px -10px rgba(15, 23, 42, 0.25);
    }

    .aichat-msg-col {
        max-width: 85%;
    }

    .aichat-panel-wrap {
        padding: 10px;
    }

    .aichat-artifacts {
        width: 100%;
    }

    .aichat-artifacts-collapsed {
        margin-right: -100%;
    }
}
