/**
 * AI Ask Interface - CSS
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

button,
textarea,
input {
    font: inherit;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f8f9fa;
    color: #1a1a1a;
    overflow: hidden;
}

/* ============================================================
   主容器布局
   ============================================================ */

.ask-container {
    display: flex;
    height: calc(100vh - var(--atlas-nav-height, 52px));
    height: calc(100dvh - var(--atlas-nav-height, 52px));
    margin-top: 52px;
    min-height: 0;
    overflow: hidden;
}

/* ============================================================
   侧边栏
   ============================================================ */

.ask-sidebar {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    min-height: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ask-sidebar-close {
    display: none;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 1px solid var(--ask-border);
    border-radius: .6rem;
    background: transparent;
    color: var(--ask-muted);
    cursor: pointer;
}

.ask-sidebar-close svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.6;
}

.new-chat-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.chat-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
}

.chat-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.chat-item {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 0.875rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-align: left;
    font: inherit;
}

.chat-item:hover {
    background: #f3f4f6;
}

.chat-item.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left: 3px solid #667eea;
    padding-left: calc(0.875rem - 3px);
}

.chat-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chat-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.chat-preview {
    font-size: 0.8125rem;
    color: #6b7280;
}

.chat-delete {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s;
    opacity: 0.7;
    flex: 0 0 auto;
}

.chat-row:hover .chat-delete,
.chat-delete:focus-visible {
    opacity: 1;
}

.chat-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

.api-settings-btn {
    margin: 1rem 1.5rem;
    padding: 0.875rem 1rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    color: #4b5563;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.api-settings-btn:hover {
    background: #e5e7eb;
    color: #1a1a1a;
}

/* ============================================================
   主聊天区域
   ============================================================ */

.ask-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.ask-sidebar-toggle {
    display: none;
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2;
    width: 2.5rem;
    height: 2.5rem;
    place-items: center;
    border: 1px solid var(--ask-border);
    border-radius: .75rem;
    background: var(--ask-panel);
    color: var(--ask-cyan);
}

.ask-sidebar-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.6;
}

/* 欢迎屏幕 */
.welcome-screen {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overscroll-behavior: contain;
}

.welcome-content {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.welcome-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    margin-bottom: 2rem;
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 1.125rem;
    color: #6b7280;
    margin-bottom: 3rem;
}

.quick-suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.suggestion-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.suggestion-card:focus-visible,
.new-chat-btn:focus-visible,
.api-settings-btn:focus-visible,
.chat-item:focus-visible,
.chat-delete:focus-visible,
.model-btn:focus-visible,
.send-btn:focus-visible,
.modal-close:focus-visible,
.btn:focus-visible,
.api-link:focus-visible {
    outline: 2px solid var(--ask-cyan, #67e8f9);
    outline-offset: 3px;
}

.suggestion-card:hover {
    background: #f3f4f6;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.suggestion-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.suggestion-text {
    font-size: 0.9375rem;
    color: #4b5563;
    line-height: 1.5;
}

/* 聊天消息 */
.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    display: flex;
    gap: 1rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    background: #f3f4f6;
}

.message-user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.message-content {
    flex: 1;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    line-height: 1.6;
    font-size: 0.9375rem;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.message-user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-assistant .message-content {
    background: #f9fafb;
    color: #1a1a1a;
}

/* Typing 动画 */
.message.typing .message-content {
    display: flex;
    gap: 0.25rem;
    padding: 1rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ============================================================
   输入区域
   ============================================================ */

.input-area {
    flex: 0 0 auto;
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
    flex-shrink: 0;
}

.model-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.model-btn {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 980px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.model-btn:disabled,
.suggestion-card:disabled {
    cursor: wait;
    opacity: 0.65;
}

.model-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.model-btn.active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: #667eea;
    color: #667eea;
}

.model-icon {
    font-size: 1rem;
}

.model-name {
    font-weight: 600;
}

.input-box {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
    min-height: 44px;
}

#messageInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

/* ============================================================
   API 设置模态框
   ============================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overscroll-behavior: contain;
}

.modal-content {
    background: white;
    border-radius: 1.5rem;
    max-width: 600px;
    width: 100%;
    max-height: 90dvh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overscroll-behavior: contain;
}

.modal-header {
    padding: 2rem 2rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.modal-body {
    padding: 2rem;
}

.modal-description {
    color: #6b7280;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.api-config {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
}

.api-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.api-icon {
    font-size: 1.5rem;
}

.api-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    flex: 1;
}

.api-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 980px;
    background: #e5e7eb;
    color: #6b7280;
    font-weight: 600;
}

.api-status.active {
    background: #d1fae5;
    color: #065f46;
}

.api-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
    margin-bottom: 0.5rem;
}

.api-input:focus {
    outline: none;
    border-color: #667eea;
}

.api-field-label {
    display: block;
    margin: 0.75rem 0 0.35rem;
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 600;
}

.api-field-label:first-of-type {
    margin-top: 0;
}

.api-test-btn {
    margin: 0.5rem 0;
}

.api-test-btn:disabled {
    cursor: wait;
    opacity: 0.65;
}

.api-link {
    font-size: 0.875rem;
    color: #667eea;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.api-link:hover {
    text-decoration: underline;
}

.api-note {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.api-security-note {
    margin: -1rem 0 1.5rem;
    padding: .8rem 1rem;
    border: 1px solid rgba(103, 164, 255, .2);
    border-radius: .75rem;
    background: rgba(103, 164, 255, .06);
}

.modal-footer {
    padding: 1rem 2rem 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 768px) {
    .ask-sidebar {
        position: fixed;
        left: 0;
        top: var(--atlas-nav-height, 52px);
        bottom: 0;
        transform: translateX(-100%);
        z-index: 100;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

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

    .quick-suggestions {
        grid-template-columns: 1fr;
    }

    .model-selector {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
}

/* ATLAS command-center skin */
:root {
    --ask-bg: #070a12;
    --ask-panel: rgba(16, 22, 35, .78);
    --ask-panel-soft: rgba(255, 255, 255, .045);
    --ask-border: rgba(255, 255, 255, .1);
    --ask-text: #f5f7fb;
    --ask-muted: #8993a6;
    --ask-blue: #63a4ff;
    --ask-cyan: #67e8f9;
}

body {
    background:
        radial-gradient(circle at 18% 0, rgba(54, 104, 190, .22), transparent 30rem),
        radial-gradient(circle at 85% 70%, rgba(113, 63, 183, .14), transparent 28rem),
        var(--ask-bg);
    color: var(--ask-text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.ask-container {
    height: calc(100vh - var(--atlas-nav-height, 52px));
    height: calc(100dvh - var(--atlas-nav-height, 52px));
    margin-top: 0;
    min-width: 0;
}

.ask-sidebar {
    width: 292px;
    flex: 0 0 292px;
    background: rgba(9, 14, 24, .82);
    border-right: 1px solid var(--ask-border);
    backdrop-filter: blur(24px);
}

.sidebar-header {
    padding: 1.45rem;
    border-bottom-color: var(--ask-border);
}

.sidebar-header h2 {
    color: var(--ask-muted);
    letter-spacing: .16em;
    font-size: .7rem;
}

.new-chat-btn {
    background: linear-gradient(135deg, #2879ff, #6958e8);
    border-radius: .8rem;
    box-shadow: 0 10px 30px rgba(40, 121, 255, .2);
}

.chat-list { padding: 1rem; }
.chat-item { border: 1px solid transparent; color: var(--ask-text); }
.chat-item:hover { background: var(--ask-panel-soft); border-color: var(--ask-border); }
.chat-item.active {
    background: linear-gradient(135deg, rgba(40, 121, 255, .16), rgba(103, 232, 249, .06));
    border: 1px solid rgba(103, 164, 255, .34);
    border-left: 3px solid var(--ask-cyan);
}
.chat-title { color: var(--ask-text); }
.chat-preview { color: var(--ask-muted); }
.api-settings-btn {
    background: var(--ask-panel-soft);
    border-color: var(--ask-border);
    color: var(--ask-muted);
}
.api-settings-btn:hover { background: rgba(103, 232, 249, .08); color: var(--ask-text); }

.ask-main {
    min-width: 0;
    width: 0;
    flex: 1 1 auto;
    background: transparent;
}

.input-box,
#messageInput {
    min-width: 0;
}

.welcome-screen { padding: 2rem clamp(1rem, 4vw, 4rem); }
.welcome-content { max-width: 900px; }
.welcome-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 40px rgba(103, 232, 249, .16);
}
.welcome-title {
    color: var(--ask-text);
    background: linear-gradient(100deg, #fff 10%, var(--ask-blue) 65%, var(--ask-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: clamp(2.4rem, 5vw, 4.6rem);
    letter-spacing: -.06em;
}
.welcome-subtitle { color: var(--ask-muted); }
.quick-suggestions { gap: .8rem; }
.suggestion-card {
    padding: 1.15rem;
    background: var(--ask-panel-soft);
    border-color: var(--ask-border);
    border-radius: 1rem;
    color: var(--ask-text);
}
.suggestion-card:hover {
    background: rgba(103, 232, 249, .08);
    border-color: rgba(103, 232, 249, .5);
    box-shadow: 0 15px 35px rgba(0, 0, 0, .2);
}
.suggestion-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: grid;
    place-items: center;
    border: 1px solid rgba(103, 232, 249, .25);
    border-radius: .75rem;
    color: var(--ask-cyan);
    font-size: 0;
}
.suggestion-icon svg, .model-icon svg, .message-avatar svg, .api-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}
.suggestion-text { color: #c4ccda; }

.chat-messages {
    padding: 2rem clamp(1rem, 7vw, 7rem);
    scrollbar-color: rgba(255,255,255,.2) transparent;
}
.message-avatar {
    width: 38px;
    height: 38px;
    background: var(--ask-panel-soft);
    border: 1px solid var(--ask-border);
    color: var(--ask-cyan);
}
.message-user .message-avatar { background: linear-gradient(135deg, #2879ff, #6958e8); color: #fff; }
.message-content { border: 1px solid var(--ask-border); }
.message-user .message-content { background: linear-gradient(135deg, #2879ff, #6958e8); border: 0; }
.message-assistant .message-content { background: var(--ask-panel); color: #d6dce7; }
.input-area.is-busy { cursor: progress; }

.input-area {
    padding: 1rem clamp(1rem, 5vw, 5rem) 1.5rem;
    border-top-color: var(--ask-border);
    background: rgba(7, 10, 18, .72);
    backdrop-filter: blur(18px);
}
.model-selector { margin-bottom: .7rem; }
.model-btn {
    background: var(--ask-panel-soft);
    border-color: var(--ask-border);
    color: var(--ask-muted);
}
.model-btn:hover { background: rgba(255,255,255,.08); color: var(--ask-text); }
.model-btn.active {
    background: rgba(103, 232, 249, .1);
    border-color: rgba(103, 232, 249, .55);
    color: var(--ask-cyan);
}
.model-icon { display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; }
.model-icon-atlas { color: var(--ask-cyan); }
.model-dot, .model-icon i { display: block; width: .55rem; height: .55rem; border-radius: 50%; }
.model-dot-openai, .model-icon-openai i { background: #59d49a; box-shadow: 0 0 10px #59d49a; }
.model-dot-claude, .model-icon-claude i { background: #c084fc; box-shadow: 0 0 10px #c084fc; }
.model-dot-gemini, .model-icon-gemini i { background: #60a5fa; box-shadow: 0 0 10px #60a5fa; }
.model-dot-deepseek, .model-icon-deepseek i { background: #4ea1ff; box-shadow: 0 0 10px #4ea1ff; }
.model-dot-qwen, .model-icon-qwen i { background: #f5a623; box-shadow: 0 0 10px #f5a623; }
.model-dot-kimi, .model-icon-kimi i { background: #bd8cff; box-shadow: 0 0 10px #bd8cff; }
.model-dot-doubao, .model-icon-doubao i { background: #57d2e8; box-shadow: 0 0 10px #57d2e8; }
#messageInput {
    background: var(--ask-panel);
    border-color: var(--ask-border);
    color: var(--ask-text);
}
#messageInput::placeholder { color: #69758a; }
#messageInput:focus { border-color: var(--ask-cyan); box-shadow: 0 0 0 3px rgba(103, 232, 249, .1); }
.send-btn { background: linear-gradient(135deg, #2879ff, #6958e8); }

.modal { background: rgba(2, 5, 10, .72); backdrop-filter: blur(12px); }
.modal.is-open { display: flex; }
.modal-content { background: #101623; border: 1px solid var(--ask-border); }
.modal-header { border-bottom-color: var(--ask-border); }
.modal-description, .api-note { color: var(--ask-muted); }
.api-security-note { border-color: rgba(103, 164, 255, .22); }
.api-config { background: var(--ask-panel-soft); border-color: var(--ask-border); }
.api-header h3 { color: var(--ask-text); }
.api-field-label { color: var(--ask-muted); }
.api-input { background: #0a0f1b; border-color: var(--ask-border); color: var(--ask-text); }
.api-input:focus { border-color: var(--ask-cyan); }
.api-link { color: var(--ask-cyan); }
.btn-secondary { background: var(--ask-panel-soft); color: var(--ask-muted); }
.btn-secondary:hover { background: rgba(255,255,255,.1); color: var(--ask-text); }

@media (max-width: 768px) {
    .ask-container {
        margin-top: 0;
        height: calc(100vh - var(--atlas-nav-height, 52px));
        height: calc(100dvh - var(--atlas-nav-height, 52px));
    }
    .ask-sidebar { top: var(--atlas-nav-height, 52px); width: min(292px, 86vw); flex-basis: auto; }
    .ask-sidebar-close { display: grid; }
    .ask-sidebar-toggle { display: grid; }
    .welcome-screen { align-items: flex-start; padding-top: 4rem; overflow-y: auto; }
    .welcome-logo { width: 52px; height: 52px; }
    .welcome-title { font-size: 2.7rem; }
    .chat-messages { padding: 1.25rem 1rem; }
    .input-area { padding: .8rem .8rem 1rem; }
    .model-selector { margin-left: -.2rem; margin-right: -.2rem; }
    .model-btn { padding: .45rem .7rem; }
    .model-name { font-size: .78rem; }
    .welcome-screen { padding-bottom: 1rem; }
    .modal { padding: .75rem; }
    .modal-header { padding: 1.25rem 1.25rem .8rem; }
    .modal-body { padding: 1.25rem; }
    .modal-footer { padding: .8rem 1.25rem 1.25rem; }
    .api-config { padding: 1rem; }
}

.ask-toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    z-index: 10001;
    max-width: min(90vw, 32rem);
    padding: .8rem 1.1rem;
    border: 1px solid var(--ask-border);
    border-radius: 999px;
    background: #151d2c;
    color: var(--ask-text);
    box-shadow: 0 12px 36px rgba(0, 0, 0, .35);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, .6rem);
    transition: opacity .2s ease, transform .2s ease;
}

.ask-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
    .suggestion-card, .new-chat-btn, .message, .ask-toast { transition: none; animation: none; }
}

/* Focused conversation workspace */
:root {
    --ask-bg: #212121;
    --ask-panel: #303030;
    --ask-panel-soft: rgba(255, 255, 255, .055);
    --ask-border: rgba(255, 255, 255, .09);
    --ask-text: #ececec;
    --ask-muted: #a1a1aa;
    --ask-blue: #c4b5fd;
    --ask-cyan: #c4b5fd;
}

body {
    background: var(--ask-bg);
    color: var(--ask-text);
}

.ask-container {
    min-width: 0;
    background: var(--ask-bg);
}

.ask-sidebar {
    width: 276px;
    flex: 0 0 276px;
    padding: .5rem;
    background: #171717;
    border-right: 1px solid rgba(255, 255, 255, .04);
    backdrop-filter: none;
}

.sidebar-header {
    padding: .7rem .55rem 1rem;
    border-bottom: 0;
}

.sidebar-title-row {
    min-height: 2rem;
    margin: 0 .25rem .85rem;
}

.sidebar-header h2 {
    margin: 0;
    color: #a1a1aa;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: none;
}

.new-chat-btn {
    min-height: 2.65rem;
    justify-content: flex-start;
    padding: .65rem .8rem;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: .75rem;
    background: transparent;
    color: #e4e4e7;
    box-shadow: none;
    font-size: .84rem;
    font-weight: 500;
}

.new-chat-btn:hover {
    transform: none;
    background: rgba(255, 255, 255, .08);
    box-shadow: none;
}

.new-chat-btn svg,
.api-settings-btn svg {
    width: 1rem;
    height: 1rem;
}

.chat-list {
    padding: .25rem .45rem;
}

.chat-row {
    position: relative;
    gap: 0;
    margin: 0;
}

.chat-item {
    min-height: 2.55rem;
    margin: 0;
    padding: .55rem .7rem;
    border: 1px solid transparent;
    border-radius: .65rem;
    color: #d4d4d8;
    font-size: .82rem;
}

.chat-item:hover,
.chat-item.active {
    background: rgba(255, 255, 255, .075);
    border-color: transparent;
}

.chat-item.active {
    padding-left: .7rem;
    color: #fff;
}

.chat-info {
    min-width: 0;
}

.chat-title {
    margin: 0;
    color: inherit;
    font-size: .82rem;
    font-weight: 450;
}

.chat-preview {
    display: none;
}

.chat-delete {
    position: absolute;
    right: .25rem;
    padding: .4rem;
    background: #303030;
    color: #d4d4d8;
    opacity: 0;
}

.chat-row:hover .chat-delete,
.chat-delete:focus-visible {
    opacity: 1;
}

.chat-delete:hover {
    background: #454545;
    color: #fff;
}

.api-settings-btn {
    min-height: 2.6rem;
    margin: .75rem .5rem .4rem;
    justify-content: flex-start;
    padding: .65rem .8rem;
    border: 1px solid transparent;
    border-radius: .7rem;
    background: transparent;
    color: #a1a1aa;
    font-size: .82rem;
}

.api-settings-btn:hover {
    background: rgba(255, 255, 255, .075);
    color: #f4f4f5;
}

.ask-main {
    background: var(--ask-bg);
}

.chat-topbar {
    z-index: 3;
    display: flex;
    flex: 0 0 3.5rem;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .045);
    background: rgba(33, 33, 33, .92);
}

.chat-topbar-title {
    margin-right: auto;
    color: #e4e4e7;
    font-size: .9rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.ask-sidebar-toggle,
.chat-topbar-new {
    position: static;
    display: grid;
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: .65rem;
    background: transparent;
    color: #a1a1aa;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.ask-sidebar-toggle {
    display: none;
}

.ask-sidebar-toggle:hover,
.chat-topbar-new:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.ask-sidebar-toggle svg,
.chat-topbar-new svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.welcome-screen {
    min-height: 0;
    padding: 2.5rem 1.5rem 1rem;
}

.welcome-content {
    max-width: 720px;
}

.welcome-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 1.35rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .22);
}

.welcome-title {
    margin-bottom: .6rem;
    color: #f4f4f5;
    background: none;
    -webkit-text-fill-color: currentColor;
    font-size: clamp(1.8rem, 3.4vw, 2.35rem);
    font-weight: 600;
    letter-spacing: -.045em;
    line-height: 1.2;
}

.welcome-subtitle {
    margin-bottom: 2rem;
    color: #a1a1aa;
    font-size: .95rem;
}

.quick-suggestions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
    max-width: 650px;
    margin: 0 auto;
}

.suggestion-card {
    min-height: 4.4rem;
    padding: .8rem .95rem;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: .9rem;
    background: rgba(255, 255, 255, .035);
    gap: .75rem;
}

.suggestion-card:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, .17);
    background: rgba(255, 255, 255, .07);
    box-shadow: none;
}

.suggestion-icon {
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    border: 1px solid rgba(196, 181, 253, .18);
    border-radius: .65rem;
    background: rgba(196, 181, 253, .07);
    color: #c4b5fd;
}

.suggestion-icon svg {
    width: 1rem;
    height: 1rem;
}

.suggestion-text {
    color: #d4d4d8;
    font-size: .82rem;
    line-height: 1.45;
}

.chat-messages {
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem 2rem;
    gap: 1.75rem;
    scrollbar-width: thin;
}

.message {
    align-items: flex-start;
    gap: .85rem;
}

.message-avatar {
    width: 30px;
    height: 30px;
    margin-top: .1rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #d4d4d8;
}

.message-avatar svg {
    width: 1.1rem;
    height: 1.1rem;
}

.message-user .message-avatar {
    display: none;
}

.message-content {
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #e4e4e7;
    font-size: .95rem;
    line-height: 1.75;
}

.message-user {
    justify-content: flex-end;
}

.message-user .message-content {
    flex: 0 1 auto;
    max-width: min(78%, 620px);
    padding: .75rem 1rem;
    border: 1px solid rgba(255, 255, 255, .04);
    border-radius: 1.25rem;
    background: #303030;
    color: #f4f4f5;
}

.message-assistant .message-content {
    background: transparent;
    color: #e4e4e7;
}

.message.typing .message-content {
    padding: .55rem 0;
}

.input-area {
    width: min(100%, 850px);
    margin: 0 auto;
    padding: .75rem 1.5rem .8rem;
    border: 0;
    background: transparent;
    backdrop-filter: none;
}

.model-selector {
    justify-content: center;
    gap: .35rem;
    margin: 0 0 .6rem;
}

.model-btn {
    min-height: 2rem;
    padding: .35rem .7rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: #a1a1aa;
    font-size: .76rem;
}

.model-btn:hover {
    border-color: transparent;
    background: rgba(255, 255, 255, .07);
    color: #e4e4e7;
}

.model-btn.active {
    border-color: rgba(196, 181, 253, .2);
    background: rgba(196, 181, 253, .09);
    color: #ddd6fe;
}

.model-icon {
    width: .95rem;
    height: .95rem;
}

.input-box {
    align-items: flex-end;
    gap: .6rem;
    padding: .65rem .7rem .65rem 1.1rem;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 1.55rem;
    background: #303030;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .15);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.input-box:focus-within {
    border-color: rgba(196, 181, 253, .4);
    box-shadow: 0 0 0 3px rgba(196, 181, 253, .07), 0 8px 28px rgba(0, 0, 0, .15);
}

#messageInput {
    min-height: 2.25rem;
    max-height: 180px;
    padding: .48rem 0;
    border: 0;
    border-radius: .5rem;
    background: transparent;
    color: #f4f4f5;
    font-size: .93rem;
    line-height: 1.5;
}

#messageInput:focus {
    border: 0;
    outline: 0;
    box-shadow: none;
}

#messageInput::placeholder {
    color: #a1a1aa;
}

.send-btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: #f4f4f5;
    color: #18181b;
    transition: transform .15s ease, background .15s ease, opacity .15s ease;
}

.send-btn svg {
    width: 1.1rem;
    height: 1.1rem;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.04);
    background: #fff;
    box-shadow: none;
}

.send-btn:disabled {
    background: #52525b;
    color: #a1a1aa;
    opacity: 1;
}

.composer-note {
    margin-top: .55rem;
    color: #71717a;
    font-size: .68rem;
    line-height: 1.4;
    text-align: center;
}

.ask-sidebar-toggle:focus-visible,
.chat-topbar-new:focus-visible {
    outline: 2px solid #c4b5fd;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .ask-sidebar {
        top: var(--atlas-nav-height, 52px);
        width: min(290px, 86vw);
        padding: .5rem;
        background: #171717;
        box-shadow: 10px 0 40px rgba(0, 0, 0, .35);
    }

    .ask-sidebar-toggle {
        display: grid;
    }

    .chat-topbar {
        flex-basis: 3.25rem;
        padding: 0 .75rem;
    }

    .chat-topbar-title {
        font-size: .85rem;
    }

    .welcome-screen {
        align-items: center;
        padding: 1.5rem 1rem 1rem;
        overflow-y: auto;
    }

    .welcome-logo {
        width: 42px;
        height: 42px;
        margin-bottom: 1rem;
        border-radius: 13px;
    }

    .welcome-title {
        font-size: clamp(1.7rem, 7vw, 2.25rem);
    }

    .welcome-subtitle {
        margin-bottom: 1.5rem;
        font-size: .88rem;
    }

    .quick-suggestions {
        grid-template-columns: 1fr;
        gap: .55rem;
    }

    .suggestion-card {
        min-height: 3.6rem;
        padding: .65rem .8rem;
    }

    .chat-messages {
        padding: 1.25rem 1rem;
        gap: 1.25rem;
    }

    .message-user .message-content {
        max-width: 88%;
    }

    .input-area {
        padding: .55rem .75rem .65rem;
    }

    .model-selector {
        justify-content: flex-start;
        overflow-x: auto;
        margin-bottom: .4rem;
        scrollbar-width: none;
    }

    .model-selector::-webkit-scrollbar {
        display: none;
    }

    .model-btn {
        flex: 0 0 auto;
        padding: .35rem .58rem;
    }

    .composer-note {
        margin-top: .45rem;
        font-size: .63rem;
    }
}

@media (max-width: 380px) {
    .welcome-screen {
        padding-right: .7rem;
        padding-left: .7rem;
    }

    .suggestion-text {
        font-size: .77rem;
    }
}

@media (min-width: 769px) {
    body.page-ask.has-atlas-dock {
        padding-bottom: 0;
    }

    body.page-ask.has-atlas-dock .atlas-os-dock {
        display: none;
    }

    body.page-ask.has-atlas-dock .ask-main .input-area {
        padding-bottom: .8rem !important;
    }

    .ask-container .model-selector {
        gap: .45rem;
    }

    .ask-container .model-btn {
        min-height: 2.1rem;
        padding: .4rem .72rem;
        font-size: .79rem;
    }
}

.ask-container .message-content .atlas-gen-action-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem 1rem;
    margin: .9rem 0 0;
    padding: .9rem 1rem;
    border: 1px solid rgba(99, 164, 255, .24);
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(18, 31, 49, .98), rgba(22, 39, 61, .96));
    color: #e7eefb;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 10px 24px rgba(0, 0, 0, .2);
}

.ask-container .message-content .atlas-gen-action-copy {
    display: grid;
    min-width: 0;
    gap: .3rem;
}

.ask-container .message-content .atlas-gen-action-label {
    color: #7dd3fc;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.ask-container .message-content .atlas-gen-action-title {
    color: #f1f5f9;
    display: -webkit-box;
    font-size: .86rem;
    font-weight: 600;
    line-height: 1.45;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ask-container .message-content .atlas-gen-action-card button {
    min-height: 2.2rem;
    padding: .45rem .85rem;
    border: 1px solid rgba(147, 197, 253, .28);
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb, #0e7490);
    color: #fff;
    font: inherit;
    font-size: .76rem;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
    transition: filter .16s ease, transform .16s ease;
}

.ask-container .message-content .atlas-gen-action-card button:hover:not(:disabled) {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.ask-container .message-content .atlas-gen-action-card button:disabled {
    border-color: rgba(52, 211, 153, .22);
    background: rgba(16, 185, 129, .13);
    color: #a7f3d0;
    cursor: default;
}

@media (max-width: 480px) {
    .ask-container .message-content .atlas-gen-action-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .ask-container .message-content .atlas-gen-action-card button {
        justify-self: start;
    }
}

.chat-topbar-center {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    margin-right: auto;
}

.chat-topbar-label {
    color: #71717a;
    font-size: .68rem;
    white-space: nowrap;
}

.chat-mode-switch {
    display: inline-flex;
    align-items: center;
    gap: .18rem;
    padding: .2rem;
    border: 1px solid rgba(255, 255, 255, .075);
    border-radius: .82rem;
    background: rgba(15, 15, 15, .66);
}

.chat-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 2rem;
    padding: .4rem .7rem;
    border: 1px solid transparent;
    border-radius: .62rem;
    background: transparent;
    color: #a1a1aa;
    cursor: pointer;
    font: inherit;
    font-size: .75rem;
    font-weight: 550;
    white-space: nowrap;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.chat-mode-btn svg {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.45;
}

.chat-mode-btn:hover:not(:disabled) {
    color: #f4f4f5;
}

.chat-mode-btn.active {
    border-color: rgba(255, 255, 255, .09);
    background: #303030;
    color: #f4f4f5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .24);
}

.chat-mode-btn[data-chat-mode="agent"].active svg {
    color: #a5b4fc;
}

.chat-mode-btn:disabled {
    cursor: wait;
    opacity: .65;
}

.chat-mode-btn:focus-visible {
    outline: 2px solid #c4b5fd;
    outline-offset: 2px;
}

.agent-workflow-notice {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .75rem;
    padding: .7rem .8rem;
    border: 1px solid rgba(129, 140, 248, .2);
    border-radius: .85rem;
    background: rgba(49, 46, 129, .16);
    color: #c7d2fe;
}

.agent-workflow-notice[hidden],
.model-selector[hidden],
.atlas-xray-bar[hidden] {
    display: none !important;
}

.agent-workflow-notice-icon {
    display: grid;
    flex: 0 0 1.8rem;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border: 1px solid rgba(165, 180, 252, .18);
    border-radius: .6rem;
    background: rgba(99, 102, 241, .14);
    color: #a5b4fc;
}

.agent-workflow-notice-icon svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.45;
}

.agent-workflow-notice p {
    flex: 1;
    margin: 0;
    color: #c4c8db;
    font-size: .7rem;
    line-height: 1.5;
}

.agent-workflow-notice strong {
    margin-right: .25rem;
    color: #e0e7ff;
}

.agent-workflow-notice a {
    flex: 0 0 auto;
    color: #c7d2fe;
    font-size: .68rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.agent-workflow-notice a:hover {
    color: #fff;
    text-decoration: underline;
}

.message.typing .message-content {
    align-items: center;
}

.typing-label {
    margin-right: .35rem;
    color: #a1a1aa;
    font-size: .72rem;
}

.agent-workflow-result {
    display: grid;
    gap: .9rem;
    margin-top: .1rem;
    padding: 1rem;
    border: 1px solid rgba(129, 140, 248, .2);
    border-radius: .9rem;
    background: linear-gradient(145deg, rgba(30, 30, 48, .9), rgba(24, 24, 34, .94));
}

.agent-workflow-result-header {
    display: grid;
    gap: .4rem;
}

.agent-workflow-result-status {
    justify-self: start;
    padding: .22rem .5rem;
    border: 1px solid rgba(250, 204, 21, .18);
    border-radius: 999px;
    background: rgba(161, 98, 7, .14);
    color: #fde68a;
    font-size: .63rem;
    font-weight: 650;
}

.agent-workflow-result-status.is-executed {
    border-color: rgba(52, 211, 153, .2);
    background: rgba(6, 95, 70, .18);
    color: #a7f3d0;
}

.agent-workflow-result-status.is-deferred {
    border-color: rgba(148, 163, 184, .2);
    background: rgba(71, 85, 105, .2);
    color: #cbd5e1;
}

.agent-workflow-result-header h3 {
    margin: 0;
    color: #f4f4f5;
    font-size: .92rem;
    font-weight: 620;
    line-height: 1.45;
}

.agent-workflow-steps {
    display: grid;
    gap: .05rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.agent-workflow-steps li {
    position: relative;
    display: grid;
    grid-template-columns: 1.35rem minmax(0, 1fr);
    gap: .6rem;
    min-height: 2.65rem;
    padding-bottom: .55rem;
}

.agent-workflow-steps li:not(:last-child)::after {
    position: absolute;
    top: 1.3rem;
    bottom: -.05rem;
    left: .61rem;
    width: 1px;
    background: rgba(148, 163, 184, .2);
    content: "";
}

.agent-workflow-step-marker {
    display: grid;
    z-index: 1;
    width: 1.25rem;
    height: 1.25rem;
    place-items: center;
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 50%;
    background: #232330;
    color: #a1a1aa;
    font-size: .61rem;
    font-weight: 700;
}

.agent-workflow-steps .is-complete .agent-workflow-step-marker {
    border-color: rgba(52, 211, 153, .24);
    background: rgba(6, 95, 70, .2);
    color: #6ee7b7;
}

.agent-workflow-steps .is-current .agent-workflow-step-marker {
    border-color: rgba(129, 140, 248, .32);
    color: #c7d2fe;
}

.agent-workflow-steps .is-deferred .agent-workflow-step-marker {
    border-color: rgba(148, 163, 184, .24);
    color: #9ca3af;
}

.agent-workflow-steps li > div {
    display: grid;
    align-content: start;
    gap: .14rem;
}

.agent-workflow-steps strong {
    color: #e4e4e7;
    font-size: .72rem;
    font-weight: 600;
}

.agent-workflow-steps small {
    color: #8d8d98;
    font-size: .66rem;
    line-height: 1.45;
}

.agent-workflow-summary {
    margin: 0;
    padding: .75rem .8rem;
    border-left: 2px solid rgba(129, 140, 248, .55);
    border-radius: 0 .55rem .55rem 0;
    background: rgba(15, 15, 25, .48);
    color: #c4c4cc;
    font-size: .76rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.agent-workflow-decisions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.agent-workflow-decisions button {
    min-height: 2.25rem;
    padding: .45rem .8rem;
    border: 1px solid rgba(165, 180, 252, .2);
    border-radius: .65rem;
    color: #e0e7ff;
    cursor: pointer;
    font: inherit;
    font-size: .72rem;
    font-weight: 600;
    transition: background .16s ease, border-color .16s ease, opacity .16s ease;
}

.agent-workflow-confirm {
    background: rgba(79, 70, 229, .3);
}

.agent-workflow-confirm:hover:not(:disabled) {
    border-color: rgba(165, 180, 252, .45);
    background: rgba(79, 70, 229, .45);
}

.agent-workflow-defer {
    background: rgba(255, 255, 255, .035);
}

.agent-workflow-defer:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, .2);
    background: rgba(255, 255, 255, .08);
}

.agent-workflow-decisions button:disabled {
    cursor: wait;
    opacity: .6;
}

.agent-workflow-decision-feedback {
    margin: 0;
    color: #fca5a5;
    font-size: .7rem;
    line-height: 1.5;
}

.agent-workflow-decision-feedback:empty {
    display: none;
}

.agent-workflow-decisions button:focus-visible {
    outline: 2px solid #c4b5fd;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .chat-topbar-center {
        gap: .35rem;
    }

    .chat-topbar-label {
        display: none;
    }

    .chat-mode-btn {
        min-height: 1.9rem;
        padding: .35rem .55rem;
        font-size: .7rem;
    }

    .agent-workflow-notice {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        gap: .55rem;
        padding: .65rem;
    }

    .agent-workflow-notice p {
        font-size: .67rem;
    }

    .agent-workflow-notice a {
        grid-column: 2;
        justify-self: start;
    }
}

.input-area {
    position: relative;
}

.reasoning-control {
    position: relative;
    z-index: 4;
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 0 0 .45rem;
}

.reasoning-control[hidden] {
    display: none !important;
}

.reasoning-trigger {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 2rem;
    padding: .35rem .65rem;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: .72rem;
    background: rgba(38, 38, 42, .94);
    color: #d4d4d8;
    cursor: pointer;
    font: inherit;
    font-size: .72rem;
    list-style: none;
    transition: border-color .16s ease, background .16s ease;
}

.reasoning-trigger::-webkit-details-marker {
    display: none;
}

.reasoning-trigger::marker {
    content: "";
}

.reasoning-trigger:hover,
.reasoning-control[open] .reasoning-trigger {
    border-color: rgba(129, 140, 248, .34);
    background: #303036;
}

.reasoning-trigger > svg:first-child {
    width: .95rem;
    height: .95rem;
    fill: none;
    stroke: #a5b4fc;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.45;
}

.reasoning-trigger-label {
    color: #c4c4cc;
}

.reasoning-current {
    color: #f4f4f5;
    font-weight: 650;
}

.reasoning-chevron {
    width: .82rem;
    height: .82rem;
    margin-left: .05rem;
    fill: none;
    stroke: #a1a1aa;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
    transition: transform .16s ease;
}

.reasoning-control[open] .reasoning-chevron {
    transform: rotate(180deg);
}

.reasoning-popover {
    position: absolute;
    bottom: calc(100% + .55rem);
    left: 0;
    z-index: 20;
    display: none;
    width: min(340px, calc(100vw - 2rem));
    gap: .85rem;
    padding: 1rem 1rem .9rem;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 1rem;
    background: rgba(37, 37, 42, .98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .42);
}

.reasoning-control[open] .reasoning-popover {
    display: grid;
}

.reasoning-popover-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
}

.reasoning-popover-heading > div {
    display: grid;
    gap: .18rem;
}

.reasoning-popover-heading > div > span {
    color: #9ca3af;
    font-size: .66rem;
}

.reasoning-popover-heading strong {
    color: #f4f4f5;
    font-size: .9rem;
    font-weight: 650;
}

.reasoning-popover-badge {
    padding: .25rem .5rem;
    border: 1px solid rgba(129, 140, 248, .2);
    border-radius: 999px;
    background: rgba(79, 70, 229, .12);
    color: #c7d2fe;
    font-size: .62rem;
}

.reasoning-slider-wrap {
    position: relative;
    height: 1.35rem;
}

#reasoningDepthSlider {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 1.35rem;
    margin: 0;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

#reasoningDepthSlider::-webkit-slider-runnable-track {
    height: .36rem;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        #399bff 0,
        #399bff var(--reasoning-progress, 33.333%),
        #48484f var(--reasoning-progress, 33.333%),
        #48484f 100%
    );
}

#reasoningDepthSlider::-moz-range-track {
    height: .36rem;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        #399bff 0,
        #399bff var(--reasoning-progress, 33.333%),
        #48484f var(--reasoning-progress, 33.333%),
        #48484f 100%
    );
}

#reasoningDepthSlider::-webkit-slider-thumb {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: -.445rem;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}

#reasoningDepthSlider::-moz-range-thumb {
    width: 1.1rem;
    height: 1.1rem;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}

#reasoningDepthSlider:focus-visible {
    outline: none;
}

#reasoningDepthSlider:focus-visible::-webkit-slider-thumb {
    outline: 3px solid rgba(96, 165, 250, .45);
    outline-offset: 3px;
}

#reasoningDepthSlider:focus-visible::-moz-range-thumb {
    outline: 3px solid rgba(96, 165, 250, .45);
    outline-offset: 3px;
}

#reasoningDepthSlider:disabled {
    cursor: wait;
    opacity: .6;
}

.reasoning-slider-markers {
    position: absolute;
    top: 0;
    right: .7rem;
    bottom: 0;
    left: .7rem;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    pointer-events: none;
}

.reasoning-slider-markers span {
    justify-self: center;
    width: .28rem;
    height: .28rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .62);
}

.reasoning-level-labels {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .2rem;
    margin-top: -.5rem;
}

.reasoning-level-labels span {
    color: #8b8b95;
    font-size: .63rem;
    text-align: center;
}

.reasoning-control[data-level="fast"] .reasoning-level-labels span:nth-child(1),
.reasoning-control[data-level="balanced"] .reasoning-level-labels span:nth-child(2),
.reasoning-control[data-level="deep"] .reasoning-level-labels span:nth-child(3),
.reasoning-control[data-level="max"] .reasoning-level-labels span:nth-child(4) {
    color: #dbeafe;
    font-weight: 650;
}

.reasoning-help {
    margin: 0;
    color: #92929c;
    font-size: .66rem;
    line-height: 1.5;
}

.reasoning-control summary:focus-visible {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .reasoning-control {
        margin-bottom: .35rem;
    }

    .reasoning-trigger {
        min-height: 1.9rem;
    }

    .reasoning-popover {
        width: min(340px, calc(100vw - 1.5rem));
    }
}

.attachment-input {
    display: none !important;
}

.attachment-btn {
    display: grid;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #a1a1aa;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.attachment-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, .09);
    color: #f4f4f5;
}

.attachment-btn svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.7;
}

.attachment-btn:disabled {
    cursor: wait;
    opacity: .55;
}

.attachment-btn:focus-visible {
    outline: 2px solid #c4b5fd;
    outline-offset: 2px;
}

.attachment-tray {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    max-height: 7rem;
    margin: 0 0 .6rem;
    overflow-y: auto;
}

.attachment-tray[hidden] {
    display: none !important;
}

.attachment-chip {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    max-width: min(15rem, 100%);
    padding: .3rem .4rem;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: .72rem;
    background: #28282d;
    color: #d4d4d8;
}

.attachment-chip-preview {
    width: 2.15rem;
    height: 2.15rem;
    flex: 0 0 2.15rem;
    border-radius: .45rem;
    object-fit: cover;
}

.attachment-chip-type {
    display: grid;
    flex: 0 0 2.15rem;
    width: 2.15rem;
    height: 2.15rem;
    place-items: center;
    border-radius: .45rem;
    background: rgba(129, 140, 248, .16);
    color: #c7d2fe;
    font-size: .56rem;
    font-weight: 700;
}

.attachment-chip-copy {
    display: grid;
    min-width: 0;
    gap: .1rem;
}

.attachment-chip-name {
    overflow: hidden;
    max-width: 10.5rem;
    color: #e4e4e7;
    font-size: .67rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-chip-copy small {
    color: #8b8b95;
    font-size: .59rem;
}

.attachment-chip-remove {
    display: grid;
    flex: 0 0 1.35rem;
    width: 1.35rem;
    height: 1.35rem;
    place-items: center;
    margin-left: .1rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #a1a1aa;
    cursor: pointer;
    font: inherit;
    font-size: .9rem;
}

.attachment-chip-remove:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.attachment-chip-remove:disabled {
    cursor: wait;
    opacity: .5;
}

.attachment-note {
    margin: .35rem 0 0;
    color: #777782;
    font-size: .61rem;
    line-height: 1.45;
    text-align: center;
}

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .5rem;
}

.message-attachment-chip {
    max-width: 100%;
    overflow: hidden;
    padding: .22rem .45rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: .55rem;
    background: rgba(15, 15, 15, .16);
    color: inherit;
    font-size: .65rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-workflow-attachment-summary {
    display: grid;
    gap: .3rem;
    padding: .65rem .75rem;
    border: 1px solid rgba(125, 211, 252, .12);
    border-radius: .65rem;
    background: rgba(14, 116, 144, .08);
}

.agent-workflow-attachment-summary strong {
    color: #7dd3fc;
    font-size: .67rem;
}

.agent-workflow-attachment-summary p {
    margin: 0;
    color: #c4c4cc;
    font-size: .72rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    .attachment-note {
        font-size: .58rem;
    }

    .attachment-chip {
        max-width: min(13.5rem, 100%);
    }
}
