/* Fanxing AI dark workspace refinement.
   A crisp graphite-black palette with restrained sapphire-blue accents. */

body.chat-shell:not(.theme-light) {
    color-scheme: dark;
    --bg-primary: #080a0f;
    --bg-secondary: #0d1118;
    --bg-sidebar: #0b0e14;
    --bg-input: #10141c;
    --bg-hover: #151a24;
    --bg-active: #1b2230;
    --border-color: rgba(200, 205, 220, 0.13);
    --border-light: rgba(200, 205, 220, 0.07);
    --text-primary: #f7f8fb;
    --text-secondary: #c3c8d1;
    --text-muted: #858c98;
    --accent: #4f8cff;
    --accent-hover: #76a7ff;
    --accent-light: rgba(79, 140, 255, 0.13);
    --fx-reference-bg: #0b0e14;
    --fx-reference-line: rgba(200, 205, 220, 0.12);
    --fx-reference-panel: #12151c;
    --fx-reference-text: #f4f5f8;
    --fx-reference-muted: #9299a8;
    --fx-brand-accent: #4f8cff;
    --fx-brand-accent-soft: rgba(79, 140, 255, 0.13);
    --fx-brand-accent-card: #0e1830;
    --fx-brand-accent-glow: rgba(79, 140, 255, 0.16);
    --fxc-accent: #4f8cff;
    --fxc-accent-strong: #9ebdff;
    --fxc-accent-soft: rgba(79, 140, 255, 0.12);
    --fxc-accent-ring: rgba(79, 140, 255, 0.36);
    --fxc-accent-glow: rgba(79, 140, 255, 0.07);
    --fxc-box-border: rgba(200, 205, 220, 0.14);
    --fxc-box-bg: #10141c;
    --fxc-box-shadow: 0 20px 52px rgba(0, 0, 0, 0.46);
    --fxc-popup-bg: rgba(15, 17, 23, 0.985);
    --fxc-popup-shadow: 0 24px 60px rgba(0, 0, 0, 0.58);
    font-family: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
    font-weight: 400;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    background: #080a0f;
}

body.chat-shell:not(.theme-light) #starCanvas {
    display: none !important;
}

body.chat-shell:not(.theme-light) .chat-page-shell,
body.chat-shell:not(.theme-light) .app-container {
    background: #080a0f !important;
}

body.chat-shell:not(.theme-light) .content-area {
    background: #080a0f !important;
}

body.chat-shell:not(.theme-light) .messages-container {
    background: transparent !important;
}

/* Left navigator: remove the inset-button and neon-card treatment. */
body.chat-shell:not(.theme-light) .sidebar {
    border-right-color: rgba(200, 205, 220, 0.105);
    background: #0b0e14;
    backdrop-filter: none;
}

body.chat-shell:not(.theme-light) .logo-mark-shell {
    background: #07080a;
}

body.chat-shell:not(.theme-light) .logo-img {
    filter: none;
}

body.chat-shell:not(.theme-light) .logo-text {
    color: #f8f8fb;
    background: none;
    -webkit-text-fill-color: currentColor;
}

body.chat-shell:not(.theme-light) .logo-subtitle {
    color: #7d8493;
}

body.chat-shell:not(.theme-light) .sidebar-mode-tabs {
    border-bottom-color: rgba(200, 205, 220, 0.09);
}

body.chat-shell:not(.theme-light) .sidebar-mode-tab {
    min-height: 48px;
    border: 1px solid transparent;
    color: #9399a7;
    background: #12151b;
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .sidebar-mode-tab:not([aria-disabled="true"]):hover {
    color: #e6e8ed;
    border-color: rgba(200, 205, 220, 0.14);
    background: #171a21;
}

body.chat-shell:not(.theme-light) .sidebar-mode-tab.active {
    color: #f6f4ff;
    border-color: rgba(79, 140, 255, 0.55);
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.22), rgba(79, 140, 255, 0.08));
    box-shadow: inset 0 0 0 1px rgba(158, 189, 255, 0.05);
}

body.chat-shell:not(.theme-light) .sidebar-mode-tab.active::after {
    display: none;
}

body.chat-shell:not(.theme-light) .sidebar-mode-tab.active .sidebar-mode-icon {
    color: #92b6ff;
}

body.chat-shell:not(.theme-light) .model-tabs {
    border-color: rgba(200, 205, 220, 0.105);
    background: #090b0f;
}

body.chat-shell:not(.theme-light) .model-tabs .model-type-tab.active {
    color: #9ebdff;
    border-color: rgba(79, 140, 255, 0.46);
    background: rgba(79, 140, 255, 0.16);
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .model-type-image {
    color: #88adff;
    border-color: rgba(79, 140, 255, 0.4);
    background: rgba(79, 140, 255, 0.12);
}

body.chat-shell:not(.theme-light) .model-type-video {
    color: #ff849b;
    border-color: rgba(255, 91, 126, 0.48);
    background: rgba(255, 74, 113, 0.12);
}

body.chat-shell:not(.theme-light) .model-type-chat {
    color: #73bfff;
    border-color: rgba(74, 158, 239, 0.48);
    background: rgba(66, 146, 226, 0.12);
}

body.chat-shell:not(.theme-light) .model-item:hover {
    background: #13161c;
}

body.chat-shell:not(.theme-light) .model-item.active {
    border: 1px solid rgba(79, 140, 255, 0.34);
    background: linear-gradient(90deg, rgba(79, 140, 255, 0.15), rgba(79, 140, 255, 0.04));
    box-shadow: inset 2px 0 0 #4f8cff;
}

body.chat-shell:not(.theme-light) .model-item.active::before {
    display: none;
}

body.chat-shell:not(.theme-light) .model-item {
    --model-icon-glow: rgba(79, 140, 255, 0.32);
}

body.chat-shell:not(.theme-light) .model-item[data-model-id*="gpt"],
body.chat-shell:not(.theme-light) .model-item[data-model-id*="openai"],
body.chat-shell:not(.theme-light) .model-item[data-model-id*="grok"] {
    --model-icon-glow: rgba(244, 248, 252, 0.28);
}

body.chat-shell:not(.theme-light) .model-item[data-model-id*="gemini"],
body.chat-shell:not(.theme-light) .model-item[data-model-id*="banana"] {
    --model-icon-glow: rgba(82, 168, 255, 0.36);
}

body.chat-shell:not(.theme-light) .model-item[data-model-id*="minimax"] {
    --model-icon-glow: rgba(255, 67, 120, 0.34);
}

body.chat-shell:not(.theme-light) .model-item[data-model-id*="claude"] {
    --model-icon-glow: rgba(224, 129, 78, 0.34);
}

body.chat-shell:not(.theme-light) .model-item[data-model-id*="seedance"],
body.chat-shell:not(.theme-light) .model-item[data-model-id*="doubao"] {
    --model-icon-glow: rgba(78, 211, 223, 0.34);
}

body.chat-shell:not(.theme-light) .model-item[data-model-id*="wan"],
body.chat-shell:not(.theme-light) .model-item[data-model-id*="qwen"] {
    --model-icon-glow: rgba(111, 91, 255, 0.34);
}

body.chat-shell:not(.theme-light) .model-item[data-model-id*="jimeng"],
body.chat-shell:not(.theme-light) .model-item[data-model-id*="seedream"] {
    --model-icon-glow: rgba(57, 220, 239, 0.34);
}

body.chat-shell:not(.theme-light) .model-icon-img {
    filter: drop-shadow(0 0 9px var(--model-icon-glow));
}

body.chat-shell:not(.theme-light) .model-item:hover .model-icon-img {
    filter: drop-shadow(0 0 14px var(--model-icon-glow));
}

body.chat-shell:not(.theme-light) .model-item.active .model-icon-img {
    filter: drop-shadow(0 0 17px var(--model-icon-glow));
}

body.chat-shell:not(.theme-light) .model-icon-img.is-openai-white,
body.chat-shell:not(.theme-light) .model-item:hover .model-icon-img.is-openai-white,
body.chat-shell:not(.theme-light) .model-item.active .model-icon-img.is-openai-white,
body.chat-shell:not(.theme-light) .model-selector-icon.is-openai-white,
body.chat-shell:not(.theme-light) .msg-avatar-img.is-openai-white {
    filter: brightness(0) invert(1) drop-shadow(0 0 11px rgba(244, 248, 252, 0.25));
}

/* GPT/OpenAI assistant avatars can come from restored history without the
   helper class. Match the actual icon URL as a fallback so the black source
   artwork never disappears against the dark conversation canvas. */
body.chat-shell:not(.theme-light).workspace-mode-chat .message.assistant .msg-avatar-img.is-openai-white,
body.chat-shell:not(.theme-light).workspace-mode-chat .message.assistant .msg-avatar-img[src*="icon-openai"] {
    opacity: 1;
    filter: brightness(0) invert(1) drop-shadow(0 0 7px rgba(134, 179, 255, 0.42)) !important;
}

body.chat-shell:not(.theme-light) .model-desc {
    color: #9ca3ae;
}

/* Center workspace: quiet surfaces and one controlled accent. */
body.chat-shell:not(.theme-light) .model-info-content::before {
    background: radial-gradient(circle, rgba(79, 140, 255, 0.11), transparent 68%);
    filter: blur(18px);
}

body.chat-shell:not(.theme-light) .model-info-icon {
    filter: drop-shadow(0 0 24px rgba(79, 140, 255, 0.28));
}

body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="gpt"] .model-info-icon,
body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="openai"] .model-info-icon,
body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="grok"] .model-info-icon {
    filter: brightness(0) invert(1) drop-shadow(0 0 24px rgba(244, 248, 252, 0.28));
}

body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="gemini"] .model-info-icon,
body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="banana"] .model-info-icon {
    filter: drop-shadow(0 0 25px rgba(82, 168, 255, 0.38));
}

body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="minimax"] .model-info-icon {
    filter: drop-shadow(0 0 25px rgba(255, 67, 120, 0.35));
}

body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="seedance"] .model-info-icon,
body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="doubao"] .model-info-icon {
    filter: drop-shadow(0 0 26px rgba(78, 211, 223, 0.38));
}

body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="wan"] .model-info-icon,
body.chat-shell:not(.theme-light) .model-info-screen[data-model-id*="qwen"] .model-info-icon {
    filter: drop-shadow(0 0 26px rgba(111, 91, 255, 0.38));
}

body.chat-shell:not(.theme-light) .model-info-name {
    color: #f5f4ff;
    background: none;
    -webkit-text-fill-color: currentColor;
    text-shadow: none;
}

body.chat-shell:not(.theme-light) .model-info-desc {
    color: #a2a9b4;
}

body.chat-shell:not(.theme-light) .console-btn {
    border-color: rgba(200, 205, 220, 0.13);
    color: #b8bdc8;
    background: #10141c;
    box-shadow: none;
    backdrop-filter: none;
}

body.chat-shell:not(.theme-light) .console-btn-primary {
    color: #ffffff;
    border-color: rgba(118, 167, 255, 0.56);
    background: linear-gradient(135deg, #6d9dff, #4f8cff);
    box-shadow: 0 9px 24px rgba(48, 101, 205, 0.28);
}

body.chat-shell:not(.theme-light) #consoleNewChatBtn:hover {
    border-color: rgba(139, 180, 255, 0.68);
    background: linear-gradient(135deg, #83adff, #5f98ff);
    box-shadow: 0 11px 28px rgba(48, 101, 205, 0.35);
}

body.chat-shell:not(.theme-light) #consoleHistoryBtn:hover,
body.chat-shell:not(.theme-light) .top-action-btn:hover {
    color: #eef0f4;
    border-color: rgba(200, 205, 220, 0.18);
    background: #171a21;
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .top-action-btn {
    border-color: rgba(200, 205, 220, 0.13);
    background: #10141c;
    box-shadow: none;
    backdrop-filter: none;
}

body.chat-shell:not(.theme-light).workspace-mode-chat .chat-input-box,
body.chat-shell:not(.theme-light).workspace-mode-image .chat-input-box,
body.chat-shell:not(.theme-light).workspace-mode-video .chat-input-box {
    border-color: rgba(200, 205, 220, 0.16);
    background: #10141c;
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.5);
    backdrop-filter: none;
}

body.chat-shell:not(.theme-light).workspace-mode-chat .chat-input-box:focus-within,
body.chat-shell:not(.theme-light).workspace-mode-image .chat-input-box:focus-within,
body.chat-shell:not(.theme-light).workspace-mode-video .chat-input-box:focus-within {
    border-color: rgba(79, 140, 255, 0.32);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.56);
}

/* Right rail: flatter hierarchy, shorter cards and no decorative glow. */
body.chat-shell:not(.theme-light) .workspace-rail {
    --rail-accent: #4f8cff;
    --rail-accent-strong: #9ebdff;
    width: 232px;
    flex-basis: 232px;
    gap: 10px;
    padding: 12px 10px;
    border-left-color: rgba(200, 205, 220, 0.105);
    color: #f3f4f8;
    background: #0b0e14;
}

body.chat-shell:not(.theme-light) .workspace-rail::before {
    display: none;
}

body.chat-shell:not(.theme-light) .workspace-rail-header {
    min-height: 48px;
    padding: 0 3px 9px;
    border-bottom-color: rgba(200, 205, 220, 0.09);
}

body.chat-shell:not(.theme-light) .workspace-rail-brand-icon {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
    border-color: rgba(79, 140, 255, 0.4);
    border-radius: 8px;
    color: #9ebdff;
    background: rgba(79, 140, 255, 0.12);
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .workspace-rail-brand-icon svg {
    width: 17px;
    height: 17px;
    filter: none;
}

body.chat-shell:not(.theme-light) .workspace-rail-brand-copy strong {
    color: #f6f7fa;
    font-size: 13px;
}

body.chat-shell:not(.theme-light) .workspace-rail-brand-copy small {
    color: #747b89;
}

body.chat-shell:not(.theme-light) .workspace-rail-online {
    background: #35d3ae;
    box-shadow: 0 0 0 3px rgba(53, 211, 174, 0.12);
}

body.chat-shell:not(.theme-light) .workspace-rail-card {
    border-color: rgba(200, 205, 220, 0.12);
    background: #10141c;
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .rail-account-card {
    padding: 10px;
    background: #12151c;
}

body.chat-shell:not(.theme-light) .rail-avatar {
    border-color: rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #76a7ff, #416fd1);
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .rail-wallet-row {
    border-top-color: rgba(200, 205, 220, 0.09);
}

body.chat-shell:not(.theme-light) .rail-primary-btn {
    color: #ffffff;
    border-color: rgba(118, 167, 255, 0.5);
    background: linear-gradient(135deg, #6d9dff, #4f8cff);
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .workspace-rail-section-title small {
    display: none;
}

body.chat-shell:not(.theme-light) .rail-quick-grid {
    gap: 2px;
}

body.chat-shell:not(.theme-light) .workspace-rail .rail-quick-action {
    height: 48px;
    padding: 0 8px;
    border-color: transparent;
    border-radius: 8px;
    color: #aeb4c0;
    background: transparent;
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .workspace-rail .rail-quick-action:hover {
    color: #f1f2f6;
    border-color: transparent;
    background: #14171e;
    box-shadow: none;
    transform: none;
}

body.chat-shell:not(.theme-light) .workspace-rail .rail-quick-icon,
body.chat-shell:not(.theme-light) .workspace-rail .rail-quick-action[data-rail-action="assets"] .rail-quick-icon,
body.chat-shell:not(.theme-light) .workspace-rail .rail-quick-action[data-rail-action="usage"] .rail-quick-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-color: rgba(200, 205, 220, 0.11);
    border-radius: 7px;
    color: #9ebdff;
    background: #151a24;
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .workspace-rail .rail-quick-copy strong {
    color: #e4e6ec;
}

body.chat-shell:not(.theme-light) .workspace-rail .rail-quick-copy small {
    color: #777e8d;
}

body.chat-shell:not(.theme-light) .rail-current-card {
    padding: 10px;
}

body.chat-shell:not(.theme-light) .rail-current-model {
    margin-top: 8px;
    padding: 8px;
    border-color: rgba(200, 205, 220, 0.095);
    background: #0b0d11;
}

body.chat-shell:not(.theme-light) .rail-model-orb {
    background: rgba(79, 140, 255, 0.14);
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .rail-model-orb i {
    background: #7ea9ff;
    box-shadow: none;
}

body.chat-shell:not(.theme-light) .rail-ready-badge {
    border-color: rgba(96, 186, 150, 0.16);
    color: #78bea4;
    background: rgba(72, 156, 124, 0.065);
}

body.chat-shell:not(.theme-light) .rail-notice-card {
    min-height: 0;
    flex: 0 0 auto;
    padding: 10px;
}

body.chat-shell:not(.theme-light) .rail-notice-card:hover {
    border-color: rgba(79, 140, 255, 0.28);
    background: #14171e;
}

body.chat-shell:not(.theme-light) .rail-notice-body {
    margin-top: 10px;
    gap: 5px;
}

body.chat-shell:not(.theme-light) .rail-notice-body strong {
    -webkit-line-clamp: 1;
}

body.chat-shell:not(.theme-light) .rail-notice-body > span {
    color: #7c8391;
    -webkit-line-clamp: 2;
}

body.chat-shell:not(.theme-light) .rail-title-icon-notice,
body.chat-shell:not(.theme-light) .rail-title-icon-pulse,
body.chat-shell:not(.theme-light) .rail-notice-arrow {
    color: #8eb2ff;
}

/* Titanium composer: neutral materials, restrained state color, no neon rings. */
body.chat-shell:not(.theme-light).workspace-mode-chat .chat-input-box,
body.chat-shell:not(.theme-light).workspace-mode-image .chat-input-box,
body.chat-shell:not(.theme-light).workspace-mode-video .chat-input-box {
    border-color: rgba(184, 194, 207, 0.14);
    border-radius: 15px;
    background: linear-gradient(180deg, #10141c 0%, #0e1219 100%);
    font-family: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
    font-size: 14px;
    font-weight: 400;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.028),
        0 24px 58px rgba(0, 0, 0, 0.5);
}

body.chat-shell:not(.theme-light).workspace-mode-chat .chat-input-box:focus-within,
body.chat-shell:not(.theme-light).workspace-mode-image .chat-input-box:focus-within,
body.chat-shell:not(.theme-light).workspace-mode-video .chat-input-box:focus-within {
    border-color: rgba(79, 140, 255, 0.32);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 26px 64px rgba(0, 0, 0, 0.56);
}

body.chat-shell:not(.theme-light).workspace-mode-chat .chat-input-box .rich-input,
body.chat-shell:not(.theme-light).workspace-mode-image .chat-input-box .rich-input,
body.chat-shell:not(.theme-light).workspace-mode-video .chat-input-box .rich-input {
    color: #e8ebef;
    font-weight: 400;
}

body.chat-shell:not(.theme-light).workspace-mode-chat .chat-input-box .rich-input.is-empty::before,
body.chat-shell:not(.theme-light).workspace-mode-image .chat-input-box .rich-input.is-empty::before,
body.chat-shell:not(.theme-light).workspace-mode-video .chat-input-box .rich-input.is-empty::before {
    color: #858d99;
    opacity: 1;
}

body.chat-shell:not(.theme-light).workspace-mode-chat .input-toolbar,
body.chat-shell:not(.theme-light).workspace-mode-image .input-toolbar,
body.chat-shell:not(.theme-light).workspace-mode-video .input-toolbar {
    color: #b8bec7;
}

body.chat-shell:not(.theme-light).workspace-mode-chat #routeStrategyBtn,
body.chat-shell:not(.theme-light).workspace-mode-image #routeStrategyBtn,
body.chat-shell:not(.theme-light).workspace-mode-video #routeStrategyBtn {
    border-color: transparent;
    color: #e1e4e8;
    background: transparent;
    box-shadow: none;
}

body.chat-shell:not(.theme-light).workspace-mode-chat #routeStrategyBtn:hover,
body.chat-shell:not(.theme-light).workspace-mode-image #routeStrategyBtn:hover,
body.chat-shell:not(.theme-light).workspace-mode-video #routeStrategyBtn:hover,
body.chat-shell:not(.theme-light).workspace-mode-chat #routeStrategyBtn.active,
body.chat-shell:not(.theme-light).workspace-mode-image #routeStrategyBtn.active,
body.chat-shell:not(.theme-light).workspace-mode-video #routeStrategyBtn.active {
    border-color: rgba(184, 194, 207, 0.12);
    color: #f3f5f7;
    background: #171d28;
    box-shadow: none;
}

body.chat-shell:not(.theme-light).workspace-mode-chat .tool-btn.active,
body.chat-shell:not(.theme-light).workspace-mode-chat .tool-btn.web-search.active,
body.chat-shell:not(.theme-light).workspace-mode-chat #thinkingBtn.active,
body.chat-shell:not(.theme-light).workspace-mode-chat #thinkingBtn.thinking-mode,
body.chat-shell:not(.theme-light).workspace-mode-image .tool-btn.active,
body.chat-shell:not(.theme-light).workspace-mode-video .tool-btn.active,
body.chat-shell:not(.theme-light).workspace-mode-video #videoBgmBtn.active,
body.chat-shell:not(.theme-light).workspace-mode-video #videoWatermarkBtn.active {
    color: #dfe8ff;
    background: #18202c;
    box-shadow: inset 0 0 0 1px rgba(79, 140, 255, 0.18);
}

body.chat-shell:not(.theme-light) .image-options-popup,
body.chat-shell:not(.theme-light) .image-options-popup[data-option-type="videoSpecs"],
body.chat-shell:not(.theme-light) .image-options-popup[data-option-type="videoDuration"] {
    border-color: rgba(184, 194, 207, 0.14);
    border-radius: 13px;
    background: #10141c;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.035),
        0 24px 70px rgba(0, 0, 0, 0.64);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

body.chat-shell:not(.theme-light) .image-option-item {
    color: #b6bcc5;
    font-size: 12px;
    font-weight: 600;
}

body.chat-shell:not(.theme-light) .image-option-item:hover {
    color: #eef1f4;
    background: #161c26;
}

body.chat-shell:not(.theme-light) .image-option-item.active,
body.chat-shell:not(.theme-light) .image-options-popup[data-compact-mode="true"] .image-option-item.active {
    color: #f1f4f6;
    background: linear-gradient(90deg, #1c2638, #171e2b);
    box-shadow: inset 2px 0 0 #4f8cff;
}

body.chat-shell:not(.theme-light) .image-option-item-icon,
body.chat-shell:not(.theme-light) .image-options-popup[data-compact-mode="true"] .image-option-item-icon,
body.chat-shell:not(.theme-light) .image-option-item.active .image-option-item-icon,
body.chat-shell:not(.theme-light) .image-options-popup[data-compact-mode="true"] .image-option-item.active .image-option-item-icon {
    color: #a8b0ba;
    background: rgba(255, 255, 255, 0.045);
}

body.chat-shell:not(.theme-light) .image-option-item.active .image-option-item-check {
    color: #8eb2ff;
}

body.chat-shell:not(.theme-light) .video-specs-body {
    gap: 15px;
    padding: 15px;
}

body.chat-shell:not(.theme-light) .video-specs-section-title,
body.chat-shell:not(.theme-light) .video-duration-title {
    color: #aeb5bf;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

body.chat-shell:not(.theme-light) .video-specs-options {
    gap: 3px;
    border: 1px solid rgba(184, 194, 207, 0.06);
    background: #181e28;
}

body.chat-shell:not(.theme-light) .video-specs-option {
    color: #b8bec7;
    font-size: 11.5px;
    font-weight: 600;
}

body.chat-shell:not(.theme-light) .video-specs-option:hover {
    color: #e7eaed;
    border-color: rgba(79, 140, 255, 0.22);
    background: #1a2230;
}

body.chat-shell:not(.theme-light) .video-specs-option.active {
    color: #f2f4f6;
    border-color: rgba(79, 140, 255, 0.38);
    background: linear-gradient(180deg, #202c40, #1a2332);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.chat-shell:not(.theme-light) .video-specs-section.is-resolution .video-specs-option,
body.chat-shell:not(.theme-light) .video-specs-section.is-count .video-specs-option,
body.chat-shell:not(.theme-light) .video-specs-options.is-compact .video-specs-option {
    font-size: 11.5px;
}

/* Each icon is a miniature of its real output frame, including portrait ratios. */
body.chat-shell:not(.theme-light) .video-ratio-icon {
    width: 18px;
    height: 10px;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    flex: 0 0 auto;
    border-width: 1.5px;
    border-radius: 2px;
    opacity: 0.9;
}

body.chat-shell:not(.theme-light) .video-specs-option[data-video-spec-key="aspectRatio"][data-video-spec-value="21:9"] .video-ratio-icon {
    width: 20px;
    height: 8px;
}

body.chat-shell:not(.theme-light) .video-specs-option[data-video-spec-key="aspectRatio"][data-video-spec-value="16:9"] .video-ratio-icon {
    width: 18px;
    height: 10px;
}

body.chat-shell:not(.theme-light) .video-specs-option[data-video-spec-key="aspectRatio"][data-video-spec-value="4:3"] .video-ratio-icon {
    width: 16px;
    height: 12px;
}

body.chat-shell:not(.theme-light) .video-specs-option[data-video-spec-key="aspectRatio"][data-video-spec-value="1:1"] .video-ratio-icon {
    width: 13px;
    height: 13px;
}

body.chat-shell:not(.theme-light) .video-specs-option[data-video-spec-key="aspectRatio"][data-video-spec-value="3:4"] .video-ratio-icon {
    width: 11px;
    height: 14px;
}

body.chat-shell:not(.theme-light) .video-specs-option[data-video-spec-key="aspectRatio"][data-video-spec-value="9:16"] .video-ratio-icon {
    width: 9px;
    height: 15px;
}

body.chat-shell:not(.theme-light) .video-specs-option.active .video-ratio-icon {
    color: #9ebdff;
}

body.chat-shell:not(.theme-light) .video-specs-toggle.active {
    background: #4f8cff;
}

body.chat-shell:not(.theme-light) .video-duration-range {
    background: linear-gradient(90deg, #5d96ff 0 var(--range-fill, 0%), #252c38 var(--range-fill, 0%) 100%);
}

body.chat-shell:not(.theme-light) .video-duration-range::-webkit-slider-thumb {
    width: 6px;
    height: 17px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: #d9e1e4;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.4);
}

body.chat-shell:not(.theme-light) .video-duration-range::-moz-range-thumb {
    width: 6px;
    height: 17px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: #d9e1e4;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.4);
}

body.chat-shell:not(.theme-light) .video-duration-scale {
    color: #8d95a0;
    font-size: 10.5px;
    font-weight: 600;
}

body.chat-shell:not(.theme-light) .video-duration-value {
    border-color: rgba(79, 140, 255, 0.22);
    color: #f2f4f6;
    background: linear-gradient(180deg, #1a2230, #151a24);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.chat-shell:not(.theme-light) .video-duration-value small {
    color: #b0b7c1;
}

/* Keep the compact specs summary icon as a plain 16:9 frame. */
body.chat-shell .video-specs-summary-icon {
    width: 16px;
    height: 14px;
    flex: 0 0 16px;
    display: block;
    align-self: center;
    margin: 0;
    transform: none !important;
}

body.chat-shell #videoSpecsBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

body.chat-shell #videoSpecsBtn #videoSpecsLabel {
    display: inline-flex;
    align-items: center;
    min-height: 16px;
    line-height: 16px;
}

/* Reference mode stays selected without gaining a pale-blue outline. */
body.chat-shell:not(.theme-light).workspace-mode-video #imageModeBtn,
body.chat-shell:not(.theme-light).workspace-mode-video #imageModeBtn:hover,
body.chat-shell:not(.theme-light).workspace-mode-video #imageModeBtn:focus,
body.chat-shell:not(.theme-light).workspace-mode-video #imageModeBtn:focus-visible,
body.chat-shell:not(.theme-light).workspace-mode-video #imageModeBtn.active,
body.chat-shell:not(.theme-light).workspace-mode-video #imageModeBtn.popup-open,
body.chat-shell:not(.theme-light).workspace-mode-video #imageModeBtn[aria-expanded="true"] {
    border: 0 !important;
    border-color: transparent !important;
    outline: 0 !important;
    color: #e2e6ed;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

body.chat-shell:not(.theme-light).workspace-mode-video #imageModeBtn:hover,
body.chat-shell:not(.theme-light).workspace-mode-video #imageModeBtn:focus-visible {
    background: rgba(255, 255, 255, 0.055) !important;
    box-shadow: none !important;
}

/* The blue dot only marked hidden advanced settings and made the compact
   summary look like it still had an active outline. Keep the summary clean. */
body.chat-shell.workspace-mode-video .video-specs-dot {
    display: none !important;
}

body.chat-shell:not(.theme-light).workspace-mode-video .chat-input-box:focus-within {
    border-color: rgba(143, 154, 172, 0.26) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.045),
        0 22px 58px rgba(0, 0, 0, 0.48) !important;
}

/* Composer controls never jump on hover: only color, border and shadow change. */
body.chat-shell .chat-input-box,
body.chat-shell .chat-input-box:hover,
body.chat-shell .chat-input-box:focus-within,
body.chat-shell .chat-input-box .tool-btn,
body.chat-shell .chat-input-box .tool-btn:hover,
body.chat-shell .chat-input-box .tool-btn:focus,
body.chat-shell .chat-input-box .tool-btn:active,
body.chat-shell .chat-input-box .image-option-btn,
body.chat-shell .chat-input-box .image-option-btn:hover,
body.chat-shell .chat-input-box .image-option-btn:focus,
body.chat-shell .chat-input-box .image-option-btn:active,
body.chat-shell .chat-input-box .image-option-btn.popup-open,
body.chat-shell .chat-input-box .asset-entry-btn,
body.chat-shell .chat-input-box .asset-entry-btn:hover,
body.chat-shell .chat-input-box .asset-entry-btn:focus,
body.chat-shell .chat-input-box .asset-entry-btn:active,
body.chat-shell .chat-input-box #sendBtn,
body.chat-shell .chat-input-box #sendBtn:hover,
body.chat-shell .chat-input-box #sendBtn:focus,
body.chat-shell .chat-input-box #sendBtn:active {
    transform: none !important;
}

body.chat-shell .chat-input-box {
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease !important;
}

body.chat-shell .chat-input-box .tool-btn,
body.chat-shell .chat-input-box .image-option-btn,
body.chat-shell .chat-input-box .asset-entry-btn,
body.chat-shell .chat-input-box #sendBtn {
    transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease !important;
}

/* Compact generation status cards replace the old full-width error bubble. */
body.chat-shell.workspace-mode-video .message.video-failure-message {
    align-items: flex-start;
    width: 100%;
    padding: 0;
    gap: 10px;
}

body.chat-shell.workspace-mode-video .video-failure-message .message-avatar {
    margin-top: 6px;
}

body.chat-shell.workspace-mode-video .video-failure-message .message-body {
    flex: 0 1 auto;
    width: auto;
    max-width: min(560px, calc(100% - 42px));
}

body.chat-shell.workspace-mode-video .video-failure-card {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 2px 11px;
    width: fit-content;
    max-width: 100%;
    padding: 11px 14px 12px;
    border: 1px solid rgba(238, 116, 126, 0.18);
    border-radius: 12px;
    color: #edf1f6;
    background: linear-gradient(180deg, rgba(36, 25, 31, 0.96), rgba(25, 20, 25, 0.98));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

body.chat-shell.workspace-mode-video .video-failure-icon {
    grid-row: 1 / span 3;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-top: 1px;
    border: 1px solid rgba(244, 124, 134, 0.22);
    border-radius: 9px;
    color: #ff9ba3;
    background: rgba(230, 77, 91, 0.1);
}

body.chat-shell.workspace-mode-video .video-failure-icon svg {
    width: 15px;
    height: 15px;
}

body.chat-shell.workspace-mode-video .video-failure-title {
    color: #f4f6f9;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.5;
}

body.chat-shell.workspace-mode-video .video-failure-detail {
    color: #a9b0bc;
    font-size: 12px;
    line-height: 1.55;
}

body.chat-shell.workspace-mode-video .video-failure-refund {
    justify-self: start;
    margin-top: 5px;
    padding: 2px 7px;
    border: 1px solid rgba(63, 190, 135, 0.18);
    border-radius: 999px;
    color: #75d5aa;
    background: rgba(45, 168, 115, 0.08);
    font-size: 10.5px;
    font-weight: 600;
}

body.chat-shell.theme-light.workspace-mode-video .video-failure-card {
    border-color: rgba(201, 69, 82, 0.15);
    color: #272332;
    background: #fffafa;
    box-shadow: 0 10px 26px rgba(92, 48, 58, 0.07), inset 0 1px 0 #fff;
}

body.chat-shell.theme-light.workspace-mode-video .video-failure-icon {
    border-color: rgba(202, 72, 84, 0.17);
    color: #c94f5b;
    background: rgba(218, 72, 86, 0.075);
}

body.chat-shell.theme-light.workspace-mode-video .video-failure-title { color: #302833; }
body.chat-shell.theme-light.workspace-mode-video .video-failure-detail { color: #746b78; }
body.chat-shell.theme-light.workspace-mode-video .video-failure-refund {
    border-color: rgba(35, 142, 96, 0.16);
    color: #23865f;
    background: rgba(41, 157, 107, 0.07);
}

/* Other video actions (remix/extend) use the legacy error-message node. Keep
   those failures compact too, so no video error can fall back to a giant pill. */
body.chat-shell.workspace-mode-video .message .error-message {
    width: fit-content;
    max-width: min(560px, 100%);
    padding: 11px 14px;
    border: 1px solid rgba(238, 116, 126, 0.18);
    border-radius: 12px;
    color: #edf1f6;
    background: linear-gradient(180deg, rgba(36, 25, 31, 0.96), rgba(25, 20, 25, 0.98));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
    font-size: 13px;
    line-height: 1.55;
}

body.chat-shell.theme-light.workspace-mode-video .message .error-message {
    border-color: rgba(201, 69, 82, 0.15);
    color: #302833;
    background: #fffafa;
    box-shadow: 0 10px 26px rgba(92, 48, 58, 0.07);
}

/* Light specs use the established violet accent instead of cyan labels. */
body.chat-shell.theme-light .video-specs-section-title,
body.chat-shell.theme-light .video-duration-title,
body.chat-shell.theme-light .video-specs-setting-label strong {
    color: #6b5ce7;
}

body.chat-shell.theme-light .video-specs-toggle.active {
    background: #6b5ce7;
    box-shadow: 0 0 0 3px rgba(107, 92, 231, 0.1);
}

/* Light and dark rails now share the same compact geometry and hierarchy. */
body.chat-shell.theme-light .workspace-rail {
    width: 232px;
    flex-basis: 232px;
    gap: 10px;
    padding: 12px 10px;
    border-left-color: rgba(44, 39, 78, 0.1);
    color: #252238;
    background: #f7f8fc;
}

body.chat-shell.theme-light .workspace-rail::before {
    display: none;
}

body.chat-shell.theme-light .workspace-rail-header {
    min-height: 48px;
    padding: 0 3px 9px;
    border-bottom-color: rgba(44, 39, 78, 0.09);
}

body.chat-shell.theme-light .workspace-rail-brand-icon {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
    border-color: rgba(107, 92, 231, 0.2);
    border-radius: 8px;
    color: #6b5ce7;
    background: rgba(107, 92, 231, 0.08);
    box-shadow: none;
}

body.chat-shell.theme-light .workspace-rail-brand-icon svg {
    width: 17px;
    height: 17px;
    filter: none;
}

body.chat-shell.theme-light .workspace-rail-brand-copy strong {
    color: #252238;
    font-size: 13px;
}

body.chat-shell.theme-light .workspace-rail-brand-copy small {
    color: #77728a;
}

body.chat-shell.theme-light .workspace-rail-card {
    border-color: rgba(52, 47, 84, 0.1);
    background: #ffffff;
    box-shadow: none;
}

body.chat-shell.theme-light .rail-account-card {
    padding: 10px;
    background: #ffffff;
}

body.chat-shell.theme-light .rail-avatar {
    border-color: rgba(107, 92, 231, 0.16);
    background: linear-gradient(135deg, #8878f1, #6757d8);
    box-shadow: none;
}

body.chat-shell.theme-light .rail-primary-btn {
    color: #ffffff;
    border-color: rgba(107, 92, 231, 0.38);
    background: linear-gradient(135deg, #7d6ded, #6657d8);
    box-shadow: none;
}

body.chat-shell.theme-light .workspace-rail-section-title small {
    display: none;
}

body.chat-shell.theme-light .rail-quick-grid {
    gap: 2px;
}

body.chat-shell.theme-light .workspace-rail .rail-quick-action {
    height: 48px;
    padding: 0 8px;
    border-color: transparent;
    border-radius: 8px;
    color: #615c72;
    background: transparent;
    box-shadow: none;
}

body.chat-shell.theme-light .workspace-rail .rail-quick-action:hover {
    color: #302a58;
    border-color: transparent;
    background: rgba(107, 92, 231, 0.065);
    box-shadow: none;
    transform: none;
}

body.chat-shell.theme-light .workspace-rail .rail-quick-icon,
body.chat-shell.theme-light .workspace-rail .rail-quick-action[data-rail-action="assets"] .rail-quick-icon,
body.chat-shell.theme-light .workspace-rail .rail-quick-action[data-rail-action="usage"] .rail-quick-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    border-color: rgba(107, 92, 231, 0.12);
    border-radius: 7px;
    color: #6b5ce7;
    background: rgba(107, 92, 231, 0.07);
    box-shadow: none;
}

body.chat-shell.theme-light .workspace-rail .rail-quick-copy strong {
    color: #393548;
}

body.chat-shell.theme-light .workspace-rail .rail-quick-copy small {
    color: #878291;
}

body.chat-shell.theme-light .rail-current-card {
    padding: 10px;
}

body.chat-shell.theme-light .rail-current-model {
    margin-top: 8px;
    padding: 8px;
    border-color: rgba(52, 47, 84, 0.08);
    background: #f7f7fb;
}

body.chat-shell.theme-light .rail-model-orb {
    background: rgba(107, 92, 231, 0.1);
    box-shadow: none;
}

body.chat-shell.theme-light .rail-model-orb i {
    background: #7668e8;
    box-shadow: none;
}

body.chat-shell.theme-light .rail-notice-card {
    min-height: 0;
    flex: 0 0 auto;
    padding: 10px;
}

body.chat-shell.theme-light .rail-notice-card:hover {
    border-color: rgba(107, 92, 231, 0.16);
    background: #fbfaff;
}

body.chat-shell.theme-light .rail-notice-body {
    margin-top: 10px;
    gap: 5px;
}

body.chat-shell.theme-light .rail-notice-body strong {
    -webkit-line-clamp: 1;
}

body.chat-shell.theme-light .rail-notice-body > span {
    color: #827d8e;
    -webkit-line-clamp: 2;
}

body.chat-shell.theme-light .rail-title-icon-notice,
body.chat-shell.theme-light .rail-title-icon-pulse,
body.chat-shell.theme-light .rail-notice-arrow {
    color: #6b5ce7;
}

@media (max-width: 1320px) and (min-width: 1181px) {
    body.chat-shell:not(.theme-light) .workspace-rail {
        width: 218px;
        flex-basis: 218px;
    }

    body.chat-shell.theme-light .workspace-rail {
        width: 218px;
        flex-basis: 218px;
    }
}
